Can anyone plese help me out what is the issue in my code, just couldnt understand why is it giving wrong answer for this, logic seems to be correct I guess
My submission https://codeforces.me/contest/2116/submission/336427692
The problem https://codeforces.me/contest/2116/problem/B








Don't compare numbers after taking modulo, compare them before taking modulo.
In this case, it's 2^i+2^j versus 2^x+2^y. Compare them lexicographically to see which number is bigger, then and only then take modulo.