Count the number of integer pairs (x,y) such that 0<=x<=1 billion, 0<=y<=1 billion and 0<=XOR(x,y)<=500 million. XOR(x,y) denotes the bitwise XOR of the bits of x with those of y in binary (base 2) representation. You are free to use a computer. What's an efficient algorithm?
- via Topcoder SRM-595