#include <bits/stdc++.h>
using namespace std;
#define int long long int
void solve()
{
int k,rows,cols;
cin>>rows>>cols>>k;
int res=0;
for(int x=2;x<=(rows+cols);x++)
{
int end=rows+cols;
int ans=0;
if(x>(rows+1))
{
// ans=min(rows,(end-x+1));
if(rows<=(end-x+1))
ans=rows;
else
{
ans=end-x+1;
}
// cout<<ans<<"\n";
}
else
{
// ans=min(x-1,cols);
if((x-1)<=cols)
{
ans=x-1;
}
else
{
ans=cols;
}
// cout<<ans<<"\n";
}
if(ans%2==1)
{
int z=x+k;
res=res^z;
}
// cout<<res<<" \n";
}
cout<<res<<"\n";
}
int32_t main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr), cout.tie(nullptr);
int t=1;
cin>>t;
while(t--){
solve();
}
return 0;
}
Can anyone tell me why this code is giving tle Matrix Xor Ploblem Codechef Cook OFF PLEASE HELP