Can anyone please help me with this problem?

Here is the problem statement: SUMTRIAN Problem - CodeChef
Here is my code: CodeChef: Practical coding for everyone

Any help would be appreciated :smile: