WA in "MATXOR"

please help

/*
      >>       >=>   >=>          >====>         <===>      >==>    >=>
     >>=>      >=>  >=>           >=>   >=>    <=>    <=>   >> >=>  >=>
    >> >=>     >=> >=>            >=>    >=> <=>        <=> >=> >=> >=>
   >=>  >=>    >>=>>      <====>  >=>    >=> <=>        <=> >=>  >=>>=>
  >=====>>=>   >=>  >=>           >=>    >=> <=>        <=> >=>   > >=>
 >=>      >=>  >=>   >=>          >=>   >=>    <=>     <=>  >=>    >>=>
>=>        >=> >=>     >=>        >====>         <===>      >=>     >=>

Atharva Karandikar
*/

#include <bits/stdc++.h>
#include<algorithm>
#include<vector>
using namespace std;
void solve()
{
    long long int i,j,k,cnt=0,cnt1=0,cnt2=0,num,denom,n,A,B,ind=0,sum=0,m,k1,k2,w1,w2,x1,x2,b;
    string str;

    cin>>n>>m>>k;
    if(n>m)
    {k=n;
     n=m;
     m=k;}


    {
        if((n%2)==0)
        {
            for(i=1;i<=n/2;i++)
            {
                sum=sum^(k+i+i);


            }
            cnt=n/2;
            num=m;
            denom=n;
            while(cnt--)
            {
                sum=sum^(k+num+denom);


                num--;
                denom--;
            }
        }
        else
        {
            for(i=1;i<=n/2;i++)
            {
                sum=sum^(k+i+i);

            }
            cnt=n/2;
             num=m;
             denom=n;
            while(cnt--)
            {
                sum=sum^(k+num+denom);
                num--;
                denom--;
            }
            for(i=n/2+1;i<m-n/2;i++)
            {
                sum=sum^(k+i+n/2+1);
            }



        }

    }
    cout<<sum<<endl;



}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int tc;
    cin>>tc;
    while(tc--)
    {
        solve();
    }
    return 0;
}


please help

Lets assume n=4,m=1,k=5; So first there will be swapping of n,m. So now n=1,m=4,k=5.
Now n is odd so it will go to else part then n/2=0 so it will not enter for part nor while part.
Next last for part loop will be from i=1 to i<4, now here comes the error. Your ans would be in this case 7^8^9 but the ans should be 7^8^9^10. i hope you understood your mistake. This is your second mistake.

First one is blunder. You are swapping n,m using k; if n=4,m=1,k=5 then according to your program n=1,m=4,k=4 which is wrong.

thanks