Wrong Answer for Correct Code

Problem Code- EOOPR

CODE :
#include
#include
using namespace std;

int check(int a){
if (a%2==0){
return 1;
}
else
return 0;
}

int main() {
int t;
cin >> t;

while(t!=0){

int x, y, k;
cin >> x >> y;
k=y-x;
if(k>0){
    if (check(k)==1){
       cout << "2";
    }
    else
    cout << "1";
}
if (k<0){
    k=abs(k);
    if(check(k)==1){
        cout << "1";
    }
    else {
    cout << "2";
    
    }
}
if (k==0){
    cout << "0";
}

printf("\n");
--t;
}

return 0;
}

given input is satisfying then why wrong answer

Consider the case X=2 and Y=10. You can’t do it in 2 steps. You require 3 steps (+5+5-2). So do consider the cases where X>Y and (Y-X)/2 is even.