I am getting wrong output for more than two input

code-https://ide.codingblocks.com/s/201686

u are taking input in a wrong way
first interger denotes the no of test cases
then t lines follow
each with 2 input integers

so the code would look like
cin >> t;
for(int i = 0 ;i < t; i++){
cin >> x1 >> x2;
fn() ;
}

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.