You are given n integers and a target k. A subset is any selection of positions (the empty selection counts, and equal values at different positions are different choices). Count the subsets whose XOR equals k. The XOR of the empty subset is 0.
The first line has n and k. The second line has the n integers.
Print one integer: the number of subsets whose XOR is k.
1 <= n <= 20 0 <= a_i < 2^30 0 <= k < 2^30 The answer is at most 2^20.
1000 ms256 MB
3 0 1 1 1
4
The empty subset and the three pairs {1, 1} have XOR 0.
4 7 1 2 4 8
1
Only {1, 2, 4} has XOR 7.