题目链接:https://codeforces.com/problemset/problem/1217/A
题记:注意d和ans要防止负数的出现即可。
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
int main(){
int t;
cin>>t;
while(t--){
int a,b,c;
cin>>a>>b>>c;
int d=max(0,(b+c-a+2)/2);
int ans=max(0,c-d+1);
cout<<ans<<endl;
}
return 0;
}