Divisible Subarrays: Please help me with this

#include
using namespace std;
#define ll long long
int main(){

int t;
ll n;
ll arr[10000005];
cin>>t;
for(int k=0;k<t;k++){
	
	ll prefix_sum[10000005] = {0};
	int sum=0;
	cin>>n;
    prefix_sum[0] = 1;
	for(ll i=0;i<n;i++){
		cin>>arr[i];
		sum+=arr[i];
		
        if(sum<0){
            sum = (sum+n)%n;
        }
        else{
            sum%=n;
        }
        
		prefix_sum[sum]++;
	}

	ll ans=0;
	for(ll i=0;i<n;i++){
		long long int number = prefix_sum[i];
		ans+= (number*(number-1))/2;
	}
	cout<<ans<<endl;
}


return 0;

}

hello @Aditikumari

use modulo property here to avoid overflow.
sum=(sum+arr[i])%n;

#include
using namespace std;
#define ll long long
int main(){

int t;
ll n;
ll arr[10000005];
cin>>t;
for(int k=0;k<t;k++){
	
	ll prefix_sum[10000005] = {0};
	int sum=0;
	cin>>n;
    prefix_sum[0] = 1;
	for(ll i=0;i<n;i++){
		cin>>arr[i];

sum=(sum+arr[i])%n;

        if(sum<0){
            sum = (sum+n)%n;
        }
        else{
            sum%=n;
        }
        
		prefix_sum[sum]++;
	}

	ll ans=0;
	for(ll i=0;i<n;i++){
		long long int number = prefix_sum[i];
		ans+= (number*(number-1))/2;
	}
	cout<<ans<<endl;
}


return 0;

} Sir still showing error

Sir can u provide me the correct code… so that i may know my mistake

ok pls save ur code here-> https://ide.codingblocks.com/
and share the link with me

https://ide.codingblocks.com/s/240972 saved sir, please check

@Aditikumari

checker is showing runerror even for correct solutions. may be there is some issue is with server.
pls try again after sometime,

sure sir, sir my solution is correct??

yeah . . . . . . . .

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.