Bounded XOR Count — Solution & Editorial
Binary digit DP over ~40 bits carrying two tight flags: one for the upper bound N on i, one for the constraint (i XOR X) ≤ Y compared bit by bit from the top.
Complexity: O(bits)
Binary digit DP over ~40 bits carrying two tight flags: one for the upper bound N on i, one for the constraint (i XOR X) ≤ Y compared bit by bit from the top.
Complexity: O(bits)