#include #include using namespace std; #define rep(i, n) for(int i=0; i #include int main() { int T; cin >> T; vector bin(62); bin[0] = 1; rep(i, 61) { bin[i + 1] = bin[i] * 2; } rep(test, T) { ll x, y; cin >> x >> y; bitset<61> b = x; while (b[y]) { y++; } cout << bin[y] - 1 << endl; } }