What's wrong with this code as its showing testcases fail
Hello @Ashu1318, this is your code segment
for(ll i=0;i<n;i++)
{
cin>>a[i];
sum+=a[i];
sum= (sum+n)%n;
prefix[sum]++;
}
here (sum+n)%n doesn’t guarantee that value will be positive, suppose sum is -23 and n is 5 then -18%5 will be 3 so still the negative value will be there
for(ll i=0;i<n;i++)
{
cin>>a[i];
sum+=a[i];
sum= (n + (sum)%n)%n; # so the one thing we can do here in order to avoid neg values
prefix[sum]++;
}
Make this slight change it will get AC.
I hope it is clear to you. In case it is clear to you pls mark it as resolve and provide the rating as well as feedback so that we can improve ourselves.
In case there is still some confusion pls let me know, I will surely try to help you out.
Thanks 
Happy Coding !!