I have in this q

// C++ program to find count of subarrays with
// sum divisible by k.
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int subCount(ll arr[], ll n,ll k)
{
int mod[k];
memset(mod, 0, sizeof(mod));
int cumSum = 0;
for (int i = 0; i < n; i++) {
cumSum += arr[i];
mod[((cumSum % k) + k) % k]++;
}

int result = 0; 
for (int i = 0; i < k; i++) 
	if (mod[i] > 1) 
		result += (mod[i] * (mod[i] - 1)) / 2; 

result += mod[0]; 

return result; 

}

int main()
{
ll t;
cin>> t;
while(t–)
{
ll n;
cin>> n;
if(n==1)
{
cout<<1<<endl;
}
else{

	    ll arr1[n];
   for(int i=0;i<n;i++)
   {
	   cin>> arr1[i];
   }

cout << subCount(arr1, n,n) << endl; 
   }

}
return 0; 

}

Coding Blocks IDE
this is my code

Have debugged your code here, now it’s passing all test cases. You can submit this.

still it is not passsing a test case

It’s getting accepted see


Try submitting it here: https://hack.codingblocks.com/app/practice/1/1065/problem

Screenshot 2020-12-22 225130

it is showing an error.

Have you submitted this code on the link i have provided?

yes i submitted there . but it showing an error while submitting in dashboard section.

ok after re login i am able to submit it .
Thnkx

glitch glitch glitch …
You can mark this doubt as resolve now.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.