Divisible Subarrays

my code shows TLE in one test case. I haven’t studied dynamic programmic or anyother concepts only arrays, how do I optimize it. Current execution time is O(n^2).

I have used cummulative sum approach.

https://codeshare.io/G8dVxj