Divisible Subarrays

code Link : https://pastebin.com/FGSqN7nD

I am able to clear one test case and in one I am getting runtime error , please see my code explain me why I am getting runtime error

Hi @Divya_321
Run error is because in line 14 you are only considering that sum will always be positive. But when sum is -ve then run error occur. You must use :

aux[((sum % n)+n)%n]++;

reason : as the sum can be negative, taking modulo twice it will make that positive and wont cause run error.

but here inputs are non negative so how will I get negative sum please elaborate with an example @Aayush

see the constraints of question it is given that | ai | < 10^9 which means each element of array lies in range of ( -(10^9) to 10^9 )

Constraints
1<=T<=10 1<=N<=10^5 |ai|<=10^9