Https://www.codechef.com/viewsolution/23720681

https://www.codechef.com/viewsolution/23720681

Someone can help me what was wrong with this code

Test for this:-
1
5 1
-1 -2 -3 -4 -5

correct ans= -5
your ans= 0