Chef discovered that his secret recipe has been stolen. He immediately informs the police of the theft.

It is known that the policeman and thief move on the number line. You are given that:
The initial location of the policeman on the number line is X and his speed is 2 units per second.
The initial location of the thief on the number line is Y and his speed is 1 unit per second.

Find the minimum time (in seconds) in which the policeman can catch the thief. Note that, the policeman catches the thief as soon as their locations become equal and the thief will try to evade the policeman for as long as possible.

------ Input Format ------ 

- The first line of input will contain an integer T — the number of test cases. The description of T test cases follows.
- The first and only line of each test case contains two integers X and Y, as described in the problem statement. 

------ Output Format ------ 

For each test case, output in a single line the minimum time taken by the policeman to catch the thief. 

------ Constraints ------ 

$1 ≤ T ≤ 1000$
$-10^{5} ≤ X, Y ≤ 10^{5}$

----- Sample Input 1 ------ 
3
1 3
2 1
1 1
----- Sample Output 1 ------ 
2
1
0
----- explanation 1 ------ 
Test case $1$: The initial locations of the policeman and thief are $1$ and $3$ respectively. The minimum time taken by the policeman to catch the thief is $2$ seconds, and this happens when both the policeman and the thief move towards the right.  

Test case $2$: The initial location of the policeman and thief are $2$ and $1$ respectively. The minimum time taken by the policeman to catch the thief is $1$ second, and this happens when both the policeman and the thief move towards the left.  

Test case $3$: The initial locations of the policeman and thief are $1$ and $1$ respectively. Because the police is already present at the location of thief, the time taken by police to catch the thief is $0$ seconds.

Source: codechef | Difficulty: EASY
Tags: Mathematics


Solutions:
t = int(input())
for tc in range(t):
	(x, y) = map(int, input().split())
	print(abs(x - y))


t = int(input())
for i in range(t):
	(x, y) = map(int, input().split())
	x1 = max(x, y)
	print(x1 - x or x1 - y)


tst = int(input())
for i in range(tst):
	(x, y) = map(int, input().split())
	if x > y:
		print(x - y)
	else:
		print(y - x)


for i in range(int(input())):
	(x, y) = map(int, input().split())
	print(abs(x - y))


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	count = 0
	if x == y:
		print(0)
	else:
		print(x - y if x > y else y - x)


T = int(input())
for i in range(0, T):
	(x, y) = map(int, input().split())
	print(max(x, y) - min(x, y))


t = int(input())
for i in range(t):
	(X, Y) = map(int, input().split())
	vr = 1
	print(abs(X - Y))


for i in range(int(input())):
	(a, b) = map(int, input().split())
	print(max(a, b) - min(a, b))


t = int(input())
while t > 0:
	(a, b) = map(int, input().split())
	print(abs(a - b))
	t -= 1


c = 0
for i in range(int(input())):
	(a, b) = map(int, input().split())
	print(abs(a - b))


k = int(input())
for i in range(k):
	(a, b) = map(int, input().split())
	print(abs(b - a))


T = int(input())
for i in range(T):
	(A, B) = map(int, input().split())
	if A > B:
		print(A - B)
	elif B > A:
		print(B - A)
	else:
		print(0)


T = int(input())
for t in range(T):
	(X, Y) = map(int, input().split())
	print(abs(X - Y))


for _ in range(int(input())):
	(X, Y) = map(int, input().split())
	print(abs(X - Y))


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	if a < b:
		print(b - a)
	elif a > b:
		print(a - b)
	elif a == b:
		print(0)


def Ploice(x, y):
	print(abs(y - x) // (2 - 1))
for i in range(int(input())):
	(x, y) = map(int, input().split())
	Ploice(x, y)


a = int(input())
for i in range(a):
	(b, c) = map(int, input().split())
	d = b - c
	if d < 0:
		print(d * -1)
	else:
		print(d)


import math
t = int(input())
for i in range(t):
	(x, y) = map(int, input().split(' '))
	if x < y:
		print(y - x)
	else:
		print(x - y)


t = int(input())
for i in range(t):
	(x, y) = map(int, input().split())
	m = max(x, y)
	n = min(x, y)
	print(m - n)


for i in range(int(input())):
	(X, Y) = map(int, input().split())
	print(abs(X - Y))


t = int(input())
for i in range(t):
	(m, n) = map(int, input().split())
	a = m - n
	b = n - m
	print(max(a, b))


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	print(max(x, y) - min(x, y))


t = int(input())
for i in range(t):
	(x, y) = map(int, input().split())
	if x > y:
		print(x - y)
	elif y > x:
		print(y - x)
	elif x == y:
		print(0)


T = int(input())
for i in range(0, T):
	(x, y) = map(int, input().split())
	count = 0
	if x - y > 0:
		print(x - y)
	elif y - x > 0:
		print(y - x)
	else:
		print(0)


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	if a < b:
		print(b - a)
	else:
		print(a - b)


tc = int(input())
for i in range(tc):
	(pols, chor) = map(int, input().split())
	d = abs(pols - chor)
	print(d)


t = int(input())
while t > 0:
	(x, y) = map(int, input().split())
	print(abs(x - y))
	t -= 1


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a != b:
		print(abs(a - b))
	else:
		print(0)


test_case = int(input())
while test_case > 0:
	(police, thief) = map(int, input().split())
	print(abs(police - thief))
	test_case -= 1


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	print(abs(x - y))


t = int(input())
while t > 0:
	(x, y) = map(int, input().split())
	if x > y:
		print(x - y)
	elif y > x:
		print(y - x)
	else:
		print('0')
	t -= 1


t = int(input())
while t > 0:
	(x, y) = map(int, input().split())
	a = x * 2
	b = y * 1
	if x == y:
		print('0')
	elif x > y:
		print(x - y)
	elif y > x:
		print(y - x)
	else:
		print(0)
	t -= 1


t = int(input())
for _ in range(t):
	(police_location, thief_location) = map(int, input().split())
	print(abs(police_location - thief_location))


T = int(input())
while T > 0:
	(X, Y) = map(int, input().split())
	print(abs(X - Y))
	T = T - 1


for t in range(int(input())):
	(a, b) = map(int, input().split())
	print(abs(a - b))


t = int(input(''))
for a in range(t):
	(x, y) = map(int, input().split())
	z = abs(x - y)
	print(z)


t = int(input())
for i in range(t):
	(x, y) = list(map(int, input().split()))
	if x < y:
		print(y - x)
	else:
		print(x - y)


t = int(input())
for i in range(t):
	(x, y) = map(int, input().split())
	a = max(x, y)
	b = min(x, y)
	print(a - b)