XOR

I am dedicating XOR its own page because it comes up a lot in Competitive Programming and is pretty different from the other bitwise operators?

XOR is really great for Parity Check.

Really cool, Negating every bit of a number is equivalent to XOR every bit with 1, i.e., with a number of equal size where all bits are 1.

a ^ 1 is NOT same thing as -a, you need like a ^ 111111…1