Given a number N, The problem asks you to find all such pairs u,v such that there exists another set of pairs a,b such that 1. a ^ b = u
- a + b = v
where u , v <= N.
I finally concluded that basically we have to find a+b<=N, but how to proceed from here. Many other submissions used dp approach to solve this problem. Can anyone tell me the approach and intutition to solve it. Editorial is in japanese.