## GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

## A Bit Easy CodeChef Solution | CodeChef Problem Solution 2022

Chef was impressed by an array $A$ of $N$ non-negative integers. But, he was asked to solve the following problem in order to get this array.

Given a non-negative integer $k$, find the number of pairs $\left(i,j\right)$ $\left(1\le i such that the following condition holds true:
$\left({A}_{i}$ $|$ ${A}_{j}\right)$ $+$ $\left({A}_{i}\oplus {A}_{j}\right)$ $+$ $\left({A}_{i}$ $\mathrm{&}$ ${A}_{j}\right)$ $=k$ $+{A}_{j}$, where

• $\left({A}_{i}|{A}_{j}\right)$ denotes Bitwise OR operation,
• $\left({A}_{i}$ $\oplus$ ${A}_{j}\right)$ denotes Bitwise XOR operation,
• $\left({A}_{i}$ $\mathrm{&}$ ${A}_{j}\right)$ denotes Bitwise AND operation.

You, being Chef's friend, help him get this array by solving the above problem.

### Input Format

• The first line contains an integer $T$, the number of test cases.
• The first line of each test case contains two space-separated integers $N$ and $k$, the number of integers in the array $A$ and the non-negative integer $k$ respectively.
• The next line contains $N$ space-separated non-negative integers ${A}_{1},{A}_{2},\dots ,{A}_{N}$, the elements of the array $A$.

### Output Format

For each test case, print a single line containing the number of pairs satisfying the mentioned condition.

### Constraints

• $1\le T\le 200$
• $1\le N\le {10}^{5}$
• $0\le k\le {10}^{18}$
• $0\le {A}_{i}\le {10}^{18}$
• Sum of $N$ over all test cases does not exceed $3\cdot {10}^{5}$.