# PROBLEM LINK

# PROBLEM STATEMENT

The cure for the coronavirus is finally found.

The doctor has the cure and now the only hurdle between him and his patient is a grid with infinite cells. The doctor is at position a in the grid. He has to move to a position b in the grid where his patient is. But the doctor can only move in the below manner :

- He can choose a positive odd integer x and move x distances to his right.
- He can choose a positive even integer y and move y distances to his left.

But the doctor is allowed to make as many moves as he can to finally reach his patient.

Your task is simple. You have to find whether the doctor will be able to reach his patient or not, to cure him. Also, time is a critical factor here. So if he reaches the patient, then you need to find out how many moves it will take for him to reach his patient.

In order to reach early, the doctor will move optimally to minimize the number of moves to reach his patient.

# SOLUTION

If a=b, then the answer is 0. Otherwise if a>b and a-b is even or a<b and a-b is odd then the answer is 1, else the answer is 0.# SOLUTION CODE

```
#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
int a,b;
cin>>a>>b;
if(a==b)
{
cout<<"0"<<endl;
}
else if(a>b)
{
if((a-b)%2 ==0)
cout<<"1"<<endl;
else
cout<<"2"<<endl;
}
else
{
if((b-a) %2 ==0)
cout<<"2"<<endl;
else
cout<<"1"<<endl;
}
}
}
```