Getting wrong answer in ACM14KP1

problem : CodeChef: Practical coding for everyone
my solution : CodeChef: Practical coding for everyone

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!