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

Approaching XOR Problems

When you see XOR problems, you generally approach it from a bit by bit basis. For example, this 1700 problem https://codeforces.com/problemset/problem/1879/D