Ultra fast mathematician

hey i am getting wrong answer in 2nd testcase. i had passed the first testcase of the problem. i had also passed all the testcases for the same problem on codeforces.
i am unable to get where i am going wrong and why its showing wrong answer in 2nd testcase.

here is the link for my code->

Hi Ankit
Your code is working fine with all our test cases.
It’s just that your code should give the exact same output as available in the system. Every space, comma, or next line is considered on our platform.

In your case, please add an “endl” for each output i.e. line no. 29 to give exact same representation for each output in case of multiple outputs.

If your doubt is resolved, mark your doubt as resolved & if you have any other doubts, Please feel free to ask.