It's IPL time and as usual RCB are finding it tough to qualify for playoffs.  RCB needs a minimum of $X$ more points to qualify for playoffs in their remaining $Y$ matches. A win, tie and loss in a match will yield $2,1,0$ points respectively to a team.

You being a true RCB supporter want to find the minimum number of matches RCB needs to win to qualify for playoffs. It is guaranteed that RCB will qualify for playoffs if they win all their remaining $Y$ matches.

------ Input: ------

First line will contain $T$, number of testcases. Then the testcases follow. 
Each testcase contains of a single line of input, two space separated integers $X, Y$

------ Output: ------

For each testcase, output in a single line the minimum number of matches RCB must win to qualify for playoffs.

------ Constraints : ------

$1 ≤ T ≤ 10000$
$1 ≤ X ≤ 100$
$1 ≤ Y ≤ 100$
$1 ≤ X ≤ 2\cdot Y$

----- Sample Input 1 ------ 
2
10 5
1 5
----- Sample Output 1 ------ 
5
0
----- explanation 1 ------ 
- In first case $X=10$ and $Y=5$, so RCB needs $10$ points from remaining $5$ matches to qualify for playoffs. It is only possible if they win all their remaining $5$ matches.
- In second case $X=1$ and $Y=5$, so RCB needs $1$ points from their remaining $5$ matches to qualify for playoffs. It can be done if they tie any one of their $5$ matches and lose the remaining $4$. So they need to win $0$ matches.

Difficulty: EASY

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


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


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


try:
	for _ in range(int(input())):
		(X, Y) = map(int, input().split())
		print(0 if X <= Y else X - Y)
except:
	pass


for _ in range(int(input())):
	(X, Y) = map(int, input().split())
	if X <= Y:
		print(0)
		continue
	if X == 2 * Y:
		print(Y)
		continue
	print(X - Y)


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


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


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


a = int(input())
for i in range(a):
	(p, m) = map(int, input().split())
	print(max(p - m, 0))


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	if x == 2 * y:
		print(y)
	elif x <= y:
		print(0)
	else:
		print(x - y)


for _ in range(int(input())):
	(X, Y) = map(int, input().split())
	if X < Y:
		print(0)
	else:
		print(X - Y)


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


for i in range(int(input())):
	(xneed, yrem) = map(int, input().split())
	if xneed > yrem:
		print(xneed - yrem)
	else:
		print(0)


n = int(input())
for i in range(n):
	s = input()
	l = s.split()
	x = int(l[0])
	y = int(l[1])
	if x == y * 2:
		print(x // 2)
	elif x > y:
		z = x - y
		print(z)
	else:
		print(0)


t = int(input())
for i in range(t):
	(X, Y) = map(int, input().split())
	print(X - Y) if X >= Y else print(0)


testcases = int(input())
while testcases > 0:
	(X, Y) = map(int, input().split())
	if X <= Y:
		print(0)
	else:
		print(X - Y)
	testcases -= 1


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


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	print(max([0, a - b]))


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


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


for i in range(int(input())):
	(x, y) = map(int, input().split())
	a = 0
	s = 0
	if x <= y:
		print('0')
	else:
		while 1:
			p = 2 * a
			q = y - a
			s = p + q
			if s == x:
				print(a)
				break
			a += 1


goals = int(input())
for distractoins in range(goals):
	(life, wife) = map(int, input().split())
	if wife >= life:
		print('0')
	else:
		print(life - wife)


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


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


t = int(input())
for i in range(0, t):
	ans = input()
	ans = ans.split()
	(x, y) = (int(ans[0]), int(ans[1]))
	for win in range(0, y + int(1)):
		for draw in range(0, y + 1 - win):
			if win * 2 + draw == x:
				ans.append(win)
	print(ans[2])


test = int(input())
for i in range(test):
	(points, match) = map(int, input().split())
	if points > match:
		print(points - match)
	else:
		print('0')


for tc in range(int(input())):
	(x, y) = map(int, input().split())
	wins = 0
	draws = y
	points = wins * 2 + draws
	while points < x:
		wins = wins + 1
		draws = draws - 1
		points = wins * 2 + draws
	print(wins)


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