Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Let's note that we can count all pairs with XOR ≤ K, so the answer would be to subtract the number of pairs withs XOR < low from the number of pairs with XOR ≤ high.
For each value, find out the number of values when you XOR it with the result is ≤ K using a trie.