#include #include #include #include #include #include #include #include using namespace std; vector make_is_prime(int N) { vector prime(N + 1, true); if (N >= 0) prime[0] = false; if (N >= 1) prime[1] = false; for (int i = 2; i * i <= N; i++) { if (!prime[i]) continue; for (int j = i * i; j <= N; j += i) { prime[j] = false; } } return prime; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int T; cin >> T; for (int i=0; i> A >> B; bitset<64> bs1(A); int point = 64 - (B+1); if (bs1.test(point)){ cout << 0 << endl; } else{ for (int j=0; j<100; j++){ int score = pow(2, j); if (score > A){ cout << score-1 << endl; break; } } } } }