Help in Special Sums (https://www.codechef.com/INOIPRAC/problems/INOI1501)

I got AC in every test case except for test 0 in sub-task 1. Could anybody help me find the mistake in my code? Link of submission: CodeChef: Practical coding for everyone