[Practice ] The Great Escape Plan! | CodeChef

**Setter:** virtual_worm

**Tester:** rounak_rocco

**Editorialist:** codechef_ciem

### DIFFICULTY:

EASY

### PREREQUISITES:

None

### PROBLEM:

"I am not in danger, Rio. I am the danger. Denver opens his door and gets shot, and you think that of me? No! I am the one who makes you bleed!”

Rio fears Tokyo and Moscow escaping to Professor. Tokyo wants to clean her lab as soon as possible and then go back home to her husband.

In order clean his lab, he has to achieve cleaning level of lab as M. The current cleaning level of the lab is W.

He must choose one positive odd integer q and one positive even integer v. Note that, he cannot change q or v once he starts cleaning.

He can replace W with W+q OR W with W−v for one round of cleaning:

You have to find minimum number of rounds (possibly zero) to make lab clean.

### QUICK EXPLANATION:

- When X>Y, it will take 1 operation if the difference is even, else 2.
- When X<Y, it will take 1 operation when difference is odd, 2 when difference is even but not divisible by 4 else 3.
- When X=Y, it will take 0 operation.

### TIME COMPLEXITY:

O(1) for each testcase.

### SOLUTION(PYTHON)

T=int(input())

for _ in range(T):

X,Y=map(int,input().split())

diff=abs(X-Y)

if(X>Y):

if (diff%2==0):

ans=1

else:

ans=2`elif (X<Y): if (diff%2!=0): ans=1 elif (diff%4==0): ans=3 else: ans=2 else: ans=0 print(ans)`