#include
using namespace std;
int main()
{
int a,o,k,t,i,diff;
cin>>t;
for(i=1;i<=t;i++)
{
cin>>a>>o>>k;
if(a>o)
{
diff=a-o;
if(diff>=k)
{
o+=k;
cout<<a-o<<endl;
}
else
{
o+=diff;
k=k-diff;
if(k%2==0)
cout<<0<<endl;
else
cout<<1<<endl;
}
}
else if(o>a)
{
diff=o-a;
if(diff>=k)
{
a+=k;
cout<<o-a<<endl;
}
else
{
a+=diff;
k=k-diff;
if(k%2==0)
cout<<0<<endl;
else
cout<<1<<endl;
}
}
else
{
if(k%2==0)
cout<<0<<endl;
else
cout<<1<<endl;
}
}
return 0;
}
Comments