Could u check why my my output is giving wrong ans:

i just observed the patters that after three operations the array retains the same confiquration.

import java.util.*;*

import java.io.;

import java.lang.*;

class cd207

{

public static void main(String args[])throws IOException

{

try

{

//takign input through IO

InputReader in = new InputReader(System.in);

OutputWriter out = new OutputWriter(System.out);

int t = in.readInt(),n,rep,rem;

long k;

while(t–>0)

{

n = in.readInt();

k = in.readLong();

int arr[] = IOUtils.readIntArray(in,n);

rem = (int)k%n;

rep = (int)k/n;

if(rep!=0)

{

op(arr,rem,rep%3);

}

else

{

for(int i=0;i<k;i++)

arr[i] = arr[i]^arr[arr.length-i-1];

}

for(int i=0;i<arr.length;i++)

{

out.print(arr[i]+" ");

out.flush();

}

out.printLine();

out.flush();

}

out.close();

}

catch(Exception e){

e.printStackTrace();

}

}

```
static void op(int arr[],int rem,int cat)
{
int n = (arr.length-1)/2;
switch(cat)
{
case 0 :
for(int i=0;i<=n;i++)
arr[i] = arr[i]^arr[arr.length-i-1];
for(int i=n+1;i<arr.length;i++)
arr[i] = 0;
break;
case 1 :
for(int i=0;i<arr.length;i++)
arr[i] = arr[i]^arr[arr.length-i-1];
break;
case 2:
for(int i=0;i<=n;i++)
arr[i] = 0;
for(int i=n+1;i<arr.length;i++)
arr[i] = arr[i]^arr[arr.length-i-1];
break;
default:
}
for(int i=0;i<rem;i++)
arr[i] = arr[i]^arr[arr.length-i-1];
}
```

}