Source Code
#include<iostream>

#include<bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int mod=1e9+7;
const ll INF=1e18;
const double pi=3.14159265358979323846;

#define F first
#define S second
#define all(v) v.begin(),v.end()
#define pb push_back
#define Go ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);

using namespace std;



int main()
{
Go

int t; cin >> t;
while(t--)
{
    ll n,k; cin >> n >> k;
    ll ans=0;

    if(k%2==0)ans=k/2;
    else ans=floor((double)k/2.0);

    cout << ans << '\n';
}

return 0;
}
Copy
Ramadan Candies yumna08
GNU G++17
6 ms
376 KB
Accepted