https://www.codechef.com/submit/FLOW015

here is my ans. where it is wrong?https://www.codechef.com/viewsolution/26620229