#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
void Fast(){
ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
}
void File() {
#ifndef ONLINE_JUDGE
freopen("Input.txt", "r", stdin);
freopen("Output.txt", "w", stdout);
#endif
}
typedef long long ll;
#define watch(x) cout << (#x) << " = " << x << '\n'
#define endl '\n'
#define all(a) a.begin(), a.end()
#define fix(n) cout << fixed << setprecision(n)
#define skip continue
const long double pi = acos(-1);
int main()
{
Fast();
int t;cin >> t;
while(t--){
int n , k;cin >> n >> k;
if(k & 1){
cout << (k - 1) / 2 << endl;
}
else{
cout << (k / 2) << endl;
}
}
}
Copy