#include using namespace std; typedef signed long long ll; #undef _P #define _P(...) (void)printf(__VA_ARGS__) #define FOR(x,to) for(x=0;x<(to);x++) #define FORR(x,arr) for(auto& x:arr) #define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++) #define ALL(a) (a.begin()),(a.end()) #define ZERO(a) memset(a,0,sizeof(a)) #define MINUS(a) memset(a,0xff,sizeof(a)) //------------------------------------------------------- int T; ll num2[2020202]; int A[101010],B[101010],C[101010]; int combi(int N_, int C_) { return num2[N_]==num2[C_]+num2[N_-C_]; } int hcomb(int P_,int Q_) { return (P_==0&&Q_==0)?1:combi(P_+Q_-1,Q_);} void solve() { int i,j,k,l,r,x,y; string s; FOR(i,2020000) { j=i; while(j) num2[i]+=j/2, j/=2; } cin>>T; FOR(i,T) { cin>>A[i]>>B[i]>>C[i]; if(C[i]%2==0) { _P("0\n"); continue; } if(hcomb(C[i],B[i])==0) { _P("0\n"); continue; } _P("%d\n",hcomb(C[i],A[i])); } } int main(int argc,char** argv){ string s;int i; if(argc==1) ios::sync_with_stdio(false); FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin); solve(); return 0; }