HELP IN PRMQ PROBLEM OF JUNE CHALLENGE!

Link of my solution: https://www.codechef.com/viewsolution/14364516
I don’t know where my implementation is going wrong. I tried many test cases, but no luck :frowning:
Can someone provide me some test cases or point out the mistake in my code.

Take this test case-

Input
10
1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000
1
1 9 1 100
Your Output
0
Correct Output
108

Thanks. It worked :slight_smile: