All test cases wrong

hello @kartik-malik
image
put this if statement inside if statement.

also print output for each test case in separate line.
for that add cout<<"\n" after printing answer