Why is this not working

while i am doing as it was in the lecture t fails on some testcases please help:
#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
int tc;
cin>>tc;
while(tc–){
int n,sum=0;
cin>>n;
int arr[n];
for(int i=0;i<n;i++)cin>>arr[i];
for(int i=1;i<n;i++){
arr[i]+=arr[i-1];
}
map<int,int> mp;
mp[0]++;
for(int i=0;i<n;i++){
mp[arr[i]%n]++;
}
for(auto c:mp){
sum=sum+((c.second)*(c.second-1)/2);
}
cout<<sum<<endl;
}
return 0;
}

Share your code via ide.codingblocks.com with proper indentation.

Please help me with this problem I have been stuck here for so long

Just now you have shared the link.
I’ll get back to you asap

i have made some changes. Check 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.

explain the changes to me

I don’t remember after so many days, kindly compare the two codes yourself now :slight_smile: