Source Code
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<iomanip>
using namespace std;
typedef long long ll;
#define pb push_back
int main() {
    ios_base::sync_with_stdio(0); cin.tie(NULL);
    int t;
    cin >> t;
    while(t--) {
        ll n,k,total=0;
        cin >> n >> k;
        total = round((k-1)/2.0);
        cout << total << endl;
    }
    return 0;
}
Copy
Ramadan Candies osama_o
GNU G++17
78 ms
440 KB
Accepted