Getting wrong answer in ACM14KP1

problem : https://www.codechef.com/LRNDSA04/problems/ACM14KP1/
my solution : https://www.codechef.com/viewsolution/36124961

I am getting wrong answer. I involved in this question for 3-4 days but still not able to what the problem is. Please help. It becomes a serious problem for me.
Thanks!