Source Code
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;cin>>n;
    while(n--){
        int a,b;cin>>a>>b;
        a=a+1;
        if(a>=b){
            cout<<b/2<<endl;
        }
        else{
            cout<<a/2<<endl;
        }
        
    }
}
Copy
Ramadan Candies sharlok not active_74
GNU G++17
53 ms
376 KB
Accepted