Can anyone one help me why i am getting wrong ans despite getting correct output

https://www.codechef.com/viewsolution/25427209

I read your solution, you did not gave newline after each output. But that was just one part of mistake, still WA. Then i logically read your code. As far as i can see your your approach is wrong
!

You should try again :smile: