题意:找到n ^ 1 … n ^ m中最小为出现的非负整数
int main() {
int _ = read;
while (_--) {
int n = read, m = read;
if(n > m) {
puts("0");
continue;
}
++m;
int ans = 0;
for (int i = 30; i >= 0; i--) {
if ((m & (1 << i)) && !(n & (1 << i))) ans |= 1 << i;
else if ((n & (1 << i)) && !(m & (1 << i))) break;
}
printf("%d
", ans);
}
return 0;
}