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

my code:https://www.codechef.com/viewsolution/38134888
question:https://www.codechef.com/LRNDSA04/problems/LOWSUM

tried whole day for the question ,not getting right answer ,
guys plz help,
i guess the approach is right,but i m not getting where im going wrong?

plz help