SEGSUM2 related doubt

greedy
jump
pointers

#1

Can anyone help in finding the bug in my code.I have coded my solution as given in the editorial but not getting where it is going wrong.
https://www.codechef.com/viewplaintext/11379661
question link :https://www.codechef.com/problems/SUBSEG2