I tried to solve the problem "Maximize the sum " from march long challenge. My solution is passing the 2 sub-tasks but it is failing to achieve third sub-task. can anyone figure out what is bug in my code.
Link to my solution: https://www.codechef.com/viewsolution/9699718