Compile and test are working fine but the code is not submitting.
#include
using namespace std;
int count(int a[],int n)
{ int c=0;
for (int i=0;i<n;i++)
{
int x=0;
for(int j=i;j<n;j++)
{
x=x+a[j];
if((x%n)==0)
{
c++;
}
}
}
return c;
}
int main() {
int t;
cin>>t;
while(t>0){
int n;
cin>>n;
int a[n];
for (int i=0;i<n;i++)
{
cin>>a[i];
}
cout<<count(a,n)<<endl;
--t;
}
return 0;
}