Source Code
#include<bits/stdc++.h>
using namespace std;

void solve(){
    int n,k;
    cin>>n>>k;
    
    cout<<(int)ceil((k-1)/2.0)<<endl;
}
// 1000000000
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int t;  
    cin>>t;
    while(t--){
        solve();
    }
}
Copy
Ramadan Candies hashemtb
GNU G++17
35 ms
380 KB
Accepted