Source Code
#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 9;
const int mod = 1e9 + 7;

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t;
    cin >> t;
    while(t--){
        int n, k;
        cin >> n >> k;
        int ans = k / 2;
        //if(k % 2 == 0 && k != 2) ans++;
        
        cout << ans << "\n";
    }
    return 0;
}  
Copy
Ramadan Candies AbduSaber
GNU G++17
7 ms
380 KB
Accepted