What is wrong with my code for problem code POGOSTCK. Please check and revert as I am a beginner

import java.util.;
import java.lang.
;
import java.io.*;

/* Name of the class has to be “Main” only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
int n,k,a[],i,c,j,max;
while(t–>0)
{
n=sc.nextInt();
a=new int[n+1];
k=sc.nextInt();
for(i=1;i<=n;i++)
{
a[i]=sc.nextInt();
}
max=a[1];
for(i=1;i<=n;i++)
{
c=0;
for(j=i;j<=n;j=j+k)
{
c=c+a[j];
}
if(c>max)
max=c;
}
System.out.println(max);
}

}

}