Discussion About Divisible Subarrays

This is Discussion thread about Divisible Subarrays

#include
using namespace std;
int main()
{
int i,j,k,m,n,currentsum;
cin>>m;
for(j=0;j<m;j++)
{
cin>>n;
int a[n];
cin>>a[0];
int cumsum[n];
cumsum[0]=a[0];
for(i=1;i<n;i++)
{
cin>>a[i];
cumsum[i] = a[i] + cumsum[i-1];

	}
	k=0;
	for(i=0;i<n;i++)
	{
		for(j=i;j<n;j++)
		{
			currentsum=0;
			if(i==0)
			currentsum = cumsum[j];
			else
			currentsum = cumsum[j] - cumsum[i-1];
			if( currentsum % n == 0 )
			k++;
		}
	}
	cout<<k<<endl;

}
return 0;
}

its is not printing answer for more than one value of m.

public static void main(String args[]) {
FastReader sn = new FastReader();
int T = sn.nextInt();
while(T-- > 0) {
int n =sn.nextInt();
long sum=0;
long []holder = new long[n+1];
holder[0]=1;
for(int i=0;i<n;i++) {
long n1 = sn.nextLong() + sum;
sum = n1;
long m = (n1+n)%n;
holder[(int) m]++;
}
long ans=0;
for(long a : holder) {
// if(a >= 2) {
ans += (a*(a-1))/2;
//}
}
System.out.println(ans);
}
}

I don’t know. But some reason Test case 3 is not passing.