Chef and Chefina are at positions X and Y on a number line.

They both love badminton.

It is known that badminton courts are located at every integer point.

They want to find a court such that the *maximum* distance travelled by either of them is minimized.

Formally, suppose they choose the badminton court at position Z. You need to find the minimum value of \max(|X-Z|, |Y-Z|) across all possible choices of Z. Here, |X| denotes absolute value of X.

Report this minimum value.

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

- The first line of input will contain a single integer T, denoting the number of test cases.
- Each test case consists of two space-separated integers X and Y.

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

For each test case, output the minimum possible value of \max(|X-Z|, |Y-Z|).

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

$1 ≤ T ≤ 1000$
$1 ≤ X, Y ≤ 1000$
$X \neq Y$

----- Sample Input 1 ------ 
4
3 5
7 6
1 10
63 31

----- Sample Output 1 ------ 
1
1
5
16

----- explanation 1 ------ 
Test case $1$: They will choose the court at position $4$ in the optimal case where both have to travel a distance of $1$ unit.

Test case $2$: They can either choose the court at position $6$ or position $7$. In both the cases one person has to travel a distance of $1$ unit.

Difficulty: EASY

Starter code:

Solutions:
import math
for i in range(int(input())):
	(a, b) = map(int, input().split())
	d = max(a, b)
	e = min(a, b)
	c = math.ceil((d - e) / 2)
	print(c)


import math
for j in range(int(input())):
	(x, y) = map(int, input().split())
	z = abs(x - y)
	print(math.ceil(z / 2))


t = int(input())
for _ in range(t):
	(x, y) = map(int, input().split())
	min_dist = max(abs(x - y), abs(y - x))
	for z in range(min(x, y), max(x, y) + 1):
		dist = max(abs(x - z), abs(y - z))
		if dist < min_dist:
			min_dist = dist
	print(min_dist)


import math
t = int(input())
for i in range(t):
	(x, y) = map(int, input().split())
	c = x - y
	a = math.fabs(c) // 2
	if math.fabs(c) % 2 == 0:
		print(int(a))
	else:
		print(int(a + 1))


T = int(input())
for _ in range(T):
	(x, y) = map(int, input().split())
	a = x - y
	b = abs(a) // 2
	if abs(a) % 2 == 0:
		print(int(b))
	else:
		print(int(b + 1))


for i in range(int(input())):
	(x, y) = map(int, input().split())
	z = (x + y) // 2
	print(max(abs(x - z), abs(y - z)))


import math
for _ in range(int(input())):
	(x, y) = map(int, input().split())
	a = x - y
	b = math.fabs(a) // 2
	if math.fabs(a) % 2 == 0:
		print(int(b))
	else:
		print(int(b + 1))


for i in range(int(input())):
	(x, y) = map(int, input().split())
	if abs(x - y) % 2 == 0:
		print(abs(x - y) // 2)
	else:
		print(abs(x - y) // 2 + 1)


t = int(input())
for i in range(t):
	(x, y) = map(int, input().split())
	a = max(x, y)
	b = min(x, y)
	c = a - b
	if c % 2 == 0:
		print(c // 2)
	else:
		print(c // 2 + 1)


for i in range(int(input())):
	(a, b) = map(int, input().split())
	c = max(a, b)
	e = a + b
	f = e // 2
	g = c - f
	print(g)


n = int(input())
for _ in range(n):
	(X, Y) = list(map(int, input().split()))
	avg = (X + Y) // 2
	print(max(X - avg, Y - avg))


n = int(input())
for i in range(n):
	l = list(map(int, input().split()))
	l = sorted(l)
	x = l[1]
	y = l[0]
	if (x - y) % 2 == 0:
		print((x - y) // 2)
	else:
		print((x - y) // 2 + 1)


for i in range(int(input())):
	(a, b) = map(int, input().split())
	mean = (a + b) // 2
	if abs(a - b) == 1:
		print('1')
	else:
		print(max(abs(a - mean), abs(b - mean)))


for i in range(int(input())):
	(x, y) = map(int, input().split(' '))
	distance = abs(y - x)
	result = max(distance // 2, distance - distance // 2)
	print(result)


n = int(input())
for i in range(n):
	l = list(map(int, input().split()))
	z = (l[0] + l[1]) // 2
	print(max(l[0] - z, l[1] - z))


for i in range(int(input())):
	(a, b) = map(int, input().split())
	t = abs(a - b)
	if t % 2 != 0:
		print(abs(a - b) // 2 + 1)
	else:
		print(abs(a - b) // 2)


for i in range(int(input())):
	(x, y) = map(int, input().split())
	s = x + y
	p = max(x, y)
	k = int(s / 2)
	print(p - k)


t = int(input())
for i in range(t):
	(x, y) = map(int, input().split())
	lb = min(x, y)
	ub = max(x, y)
	q = abs(x - y)
	for j in range(lb, ub + 1):
		k = max(abs(x - j), abs(y - j))
		if q > k:
			q = k
	print(q)


t = int(input())
for i in range(t):
	(x, y) = map(int, input().split())
	if (x + y) % 2 == 0:
		z = (x + y) // 2
		print(abs(z - x))
	elif (x + y) % 2 != 0:
		z = (x + y) // 2
		c = max(abs(x - z), y - z)
		if c != 0:
			print(c)
		else:
			print(1)


n = int(input())
for i in range(n):
	(a, b) = list(map(int, input().split()))
	res = (a + b) // 2
	res1 = max(a, b)
	res2 = res1 - res
	print(res2)


import math
for t in range(int(input())):
	(chef_position, chefina_position) = map(int, input().split())
	difference = chef_position - chefina_position
	temp = math.fabs(difference) // 2
	if math.fabs(difference) % 2 == 0:
		print(int(temp))
		pass
	else:
		print(int(temp + 1))
		pass


import math
T = int(input())
for i in range(T):
	(X, Y) = map(int, input().split())
	result = math.floor((X + Y) / 2)
	ans = max(X, Y)
	print(int(abs(ans - result)))


import math
T = int(input())
for _ in range(T):
	(X, Y) = map(int, input().split())
	midpoint = (X + Y) / 2
	result_floordiv = (X + Y) // 2
	if midpoint == result_floordiv:
		Z = result_floordiv
	elif midpoint != result_floordiv:
		Z = int(math.ceil(midpoint))
	distX = abs(X - Z)
	distY = abs(Y - Z)
	print(max(distX, distY))


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	z = (x + y) // 2
	if (x + y) % 2 == 0:
		print(min(abs(z - x), abs(z - y)))
	else:
		print(min(abs(z - x), abs(z - y)) + 1)


t = int(input())
for i in range(t):
	(x, y) = map(int, input().split())
	b = -(x - y)
	if (x + y) % 2 == 0:
		if x - y <= 0:
			print(b // 2)
		else:
			print((x - y) // 2)
	elif x - y < 0:
		print(b // 2 + 1)
	else:
		print((x - y) // 2 + 1)


import math
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	print(math.ceil(abs(a - b) / 2))


t = int(input())
while t > 0:
	t = t - 1
	(a, b) = map(int, input().split())
	c = a + b
	if c % 2 == 0:
		d = c // 2
	else:
		d = c // 2 + 1
	if a >= d:
		e = a - d
	else:
		e = d - a
	if b >= d:
		f = b - d
	else:
		f = d - b
	if e >= f:
		print(e)
	else:
		print(f)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	c = int((a + b) / 2)
	if a > b:
		print(a - c)
	else:
		print(b - c)


for i in range(int(input())):
	(X, Y) = map(int, input().split())
	if abs(X - Y) % 2 == 0:
		print(abs(X - Y) // 2)
	else:
		print(abs(X - Y) // 2 + 1)


import math

def solution():
	pass
T = int(input())
for _ in range(T):
	(X, Y) = map(int, input().split())
	if X > Y:
		(X, Y) = (Y, X)
	ans = 1001
	for Z in range(X, Y + 1):
		currMin = max(abs(X - Z), abs(Y - Z))
		ans = min(currMin, ans)
	print(ans)


import math
for i in range(int(input())):
	(x, y) = map(int, input().split())
	c = math.ceil(abs(x - y) / 2)
	print(c)


from math import ceil
T = int(input())
for _ in range(T):
	(X, Y) = map(int, input().split())
	Z = (X + Y) / 2
	print(ceil(max(abs(X - Z), abs(Y - Z))))


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split(' '))
	a = (n + k) // 2
	print(max(n - a, k - a))


import math
for i in range(int(input())):
	(x, y) = map(int, input().split())
	c = abs(x - y)
	n = c // 2
	if c % 2 == 0:
		print(n)
	else:
		print(n + 1)


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	m = 100
	d = abs(x - y)
	if d == 1:
		print(1)
	elif d % 2 == 0:
		print(d // 2)
	else:
		print(d // 2 + 1)


import math as pa
t = int(input())
for i in range(t):
	(x, y) = map(int, input().split())
	a = abs(x - y)
	p = a / 2
	print(pa.ceil(p))


import math
for i in range(int(input())):
	(x, y) = map(int, input().split())
	s = abs(x - y)
	e = s / 2
	print(math.ceil(e))


import math as ma
t = int(input())
for i in range(t):
	(x, y) = map(int, input().split())
	c = abs(x - y)
	d = c / 2
	print(ma.ceil(d))


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	diff = abs(x - y)
	if diff == 1:
		print('1')
	elif diff % 2 == 0:
		print(diff // 2)
	else:
		print(diff // 2 + 1)