| JPC 4.0 |
|---|
| Finished |
Iyad has a cat called Thlooj, and many of the cats in his neighborhood look like him, so on his birthday we decided we want to DNA a bunch of cats and see how many are related to him.
Thlooj and his brother M3m3 They tested $$$n$$$ cats, and each cat's DNA was represented by an integer $$$a_i$$$. We say a cat is related to Thlooj if they have any mutual ones in their binary representation, more specifically if $$$a_i$$$ $$$\&$$$ $$$D \gt 0$$$ where $$$D$$$ is Thlooj's DNA.
How many cats are related to Thlooj?
Note that $$$\&$$$ is the bitwise AND operator.
The first line of the input contains an integer $$$t$$$ $$$(1 \leq t \leq 10^3)$$$ – the number of testcases.
The first line of each case contains two integers $$$n$$$ and $$$D$$$ $$$(1 \leq n \leq 2\cdot10^5; 1 \leq D \leq 10^9)$$$ – the number of cats they tested and Thlooj's DNA.
The second line of each case contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ $$$(0 \leq a_i \leq 10^9)$$$.
It's guaranteed that the sum of $$$n$$$ over all test cases doesn't exceed $$$10^6$$$.
For each test case, print one integer, the number of cats related to Thlooj.
24 121 6 8 53 111 24 66
3 3
| Name |
|---|


