human
A straightforward question. Given an array of positive integers you have to
  print the number of subarrays whose XOR is less than K.
  Subarrays are defined as a sequence of continuous elements Ai, Ai+1, ..., Aj .
  XOR of a subarray is defined as Ai^Ai+1^ ... ^Aj.
  Symbol ^ is Exclusive Or. You can read more about it here:
 http://en.wikipedia.org/wiki/Exclusive_or

Input Format:

  First line contains T, the number of test cases. Each of the test case
  consists of N and K in one line, followed by N space separated integers in
  next line.
  

Output Format:

  For each test case, print the required answer.
  

Constraints:

  1 ≤ T ≤ 10
  1 ≤ N ≤ 10^5
  1 ≤ A[i] ≤ 10^5
  1 ≤ K ≤ 10^6
  Sum of N over all testcases will not exceed 10^5.

Sample Input:

1
5 2
4 1 3 2 7	
Sample Output:

3
Explanation:

  Only subarrays satisfying the conditions are [1],[1,3,2] and [3,2].
  

Problem Setter: Lalit Kundu
The above is tricky. Write me a correct solution in PYTHON.
assistant
#Here is Python code to print the number of subarrays whose XOR is less than K.

class Trie:
        def __init__(self):
                self.nextL = [-1] * 300000
                self.nextR = [-1] * 300000
                self.sizeL = [0] * 300000
                self.sizeR = [0] * 300000
                self.hash = 1
        
        def insert(self, no):
                node = 0
                for bit in xrange(17, -1, -1):
                        i = no & 1 << bit != 0
                        nexT = self.nextL if i == 0 else self.nextR
                        size = self.sizeL if i == 0 else self.sizeR
                        if nexT[node] == -1:
                                nexT[node] = self.hash
                                self.hash += 1
                        size[node] += 1
                        node = nexT[node]
        
        def query(self, no, k):
                if k >= 1 << 17:
                        return self.sizeL[0] + self.sizeR[0]
                node, count = 0, 0
                for bit in xrange(17, -1, -1):
                        i = no & 1 << bit != 0
                        j = k  & 1 << bit != 0
                        if node == -1:
                                return count
                        if j == 1:
                                count += self.sizeL[node] if i == 0 else self.sizeR[node]
                        node = self.nextL[node] if (i ^ j) == 0 else self.nextR[node]
                return count
        
for tc in xrange(input()):
        N, K = map(int, raw_input().split())
        A = list(map(int, raw_input().split()))
        trie = Trie()
        trie.insert(0)
        xorPrefix = 0
        ans = 0
        for a in A:
                xorPrefix ^= a
                ans += trie.query(xorPrefix, K)
                trie.insert(xorPrefix)
        print ans