Divisible subaarays runtime error

here is the link https://ide.codingblocks.com/s/104068

hey @ayush1213, add a statement sum=sum%n after sum+=arr[i];

but why can u explain i didnt get it @Gaurav13998

hey @ayush1213, you have to take the mod the check divisibility of that sub array. For more information, go through this video, prateek sir has expalined it very well https://www.youtube.com/watch?v=QQQpOa3aXew.

@Gaurav13998 sir i did sum=(sum+n)%n than why i again have to do sum%=n;

hey @ayush1213, sum=(sum+n)%n, this will ensure that negative of mod number will right answer too.
while this sum%=n; is must here.

@Gaurav13998 sir i added thestateMENT BUT IT IS NOW GIVING WRONG NASWER

hey @ayush1213, share me the updated code saved in coding blocks ide.

https://ide.codingblocks.com/s/104068 @Gaurav13998 sir this is the code

hey @ayush1213, constraints are high in question, except t make everthing of type long long int.

Here is your updated code

@Gaurav13998 thank you sir

hey @ayush1213 , if your query is resolved. Please mark this doubt as resolved and rate me on the basis of your experience.
rating option will appear when to mark this doubt as resolved