#include <iostream>
#define ll long long
#include <cmath>
using namespace std;
bool check_oe(ll int a, ll int c){
if(a<0) a*=(-1);
if(c<0) c*=(-1);
if((a%2==0 and c%2==0) or (a%2==1 and c%2==1)) return false;
return true;
}
int main(){
int t;
cin>>t;
while(t--){
ll int a,b,c;
cin>>a>>b>>c;
if(check_oe(a,c)){
if(b==floor((float)(a+c)/2)) cout<<"1"<<endl;
else if(b<floor((float)(a+c)/2)) cout<<(1+floor((float)(a+c)/2)-b)<<endl;
else cout<<(b-floor((float)(a+c)/2))<<endl;
}
else cout<<abs((a+c)/2-b)<<endl;
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojZGVmaW5lIGxsIGxvbmcgbG9uZwojaW5jbHVkZSA8Y21hdGg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CmJvb2wgY2hlY2tfb2UobGwgaW50IGEsIGxsIGludCBjKXsKICAgIGlmKGE8MCkgYSo9KC0xKTsKICAgIGlmKGM8MCkgYyo9KC0xKTsKICAgIGlmKChhJTI9PTAgYW5kIGMlMj09MCkgb3IgKGElMj09MSBhbmQgYyUyPT0xKSkgcmV0dXJuIGZhbHNlOwogICAgcmV0dXJuIHRydWU7Cn0KaW50IG1haW4oKXsKICAgIGludCB0OwogICAgY2luPj50OwogICAgd2hpbGUodC0tKXsKICAgICAgICBsbCBpbnQgYSxiLGM7CiAgICAgICAgY2luPj5hPj5iPj5jOwogICAgICAgIGlmKGNoZWNrX29lKGEsYykpewogICAgICAgICAgICBpZihiPT1mbG9vcigoZmxvYXQpKGErYykvMikpIGNvdXQ8PCIxIjw8ZW5kbDsKICAgICAgICAgICAgZWxzZSBpZihiPGZsb29yKChmbG9hdCkoYStjKS8yKSkgY291dDw8KDErZmxvb3IoKGZsb2F0KShhK2MpLzIpLWIpPDxlbmRsOwogICAgICAgICAgICBlbHNlIGNvdXQ8PChiLWZsb29yKChmbG9hdCkoYStjKS8yKSk8PGVuZGw7CiAgICAgICAgICAgIAogICAgICAgIH0KICAgICAgICBlbHNlIGNvdXQ8PGFicygoYStjKS8yLWIpPDxlbmRsOwogICAgICAgIAogICAgfQogICAgcmV0dXJuIDA7Cn0K