~/algor $ cat problems/bit-xori-k-qism-massivlar
Subarrays with XOR equal to k
Medium
1000 ms
128 MB
55%
An array of $n$ non-negative integers and a number $k$ are given. How many contiguous subarrays have the XOR of their elements ($a_{l} \oplus a_{l+1} \oplus \ldots \oplus a_{r}$, $l \le r$) equal to $k$?
Input
The first line contains two integers: $n$ and $k$. The second line contains $n$ integers $a_{i}$.
Output
One integer — the number of subarrays.
Note
$1 \le n \le 2 \cdot 10^{5}$
$0 \le k, a_{i} \lt 2^{30}$
Examples
Input #1
5 6 4 2 2 6 4
Output #1
4
Input #2
1 0 0
Output #2
1