Alice has recently started playing Chess. Her current rating is X. She noticed that when she wins a game, her rating increases by 8 points.

Can you help Alice in finding out the minimum number of games she needs to win in order to make her rating greater than or equal to Y?

------ 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 line of each test case contains two integers X and Y, as described in the problem statement. 

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

For each test case, output the minimum number of games that Alice needs to win in order to make her rating greater than or equal to Y.

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

$1 ≤ T ≤ 10^{4}$
$1 ≤ X ≤ Y ≤ 10^{4}$

----- Sample Input 1 ------ 
4
10 10
10 17
10 18
10 19

----- Sample Output 1 ------ 
0
1
1
2
----- explanation 1 ------ 
Test case $1$: Since Alice's current rating $X$ is already equal to her desired rating $Y$, she doesn't need to win any game. 

Test case $2$: Alice's current rating is $10$. After winning $1$ game, her rating will become $10+8=18$, which is greater than her desired rating of $17$. Thus, she has to win at least $1$ game.

Test case $3$: Alice's current rating is $10$. After winning $1$ game, her rating will become $10+8=18$, which is equal to her desired rating of $18$. Thus, she has to win at least $1$ game. 

Test case $4$: Alice's current rating is $10$. After winning $1$ game, her rating will become $18$, which is less than her desired rating of $19$. She will need to win one more game in order to make her rating $26$, which is greater than $19$. Thus, she has to win at least $2$ games.

Difficulty: EASY
Tags: Mathematics

Starter code:

Solutions:
import math
t = int(input())
i = 1
while i <= t:
	(x, y) = map(int, input().split())
	i = i + 1
	n = float((y - x) / 8)
	n1 = int(math.ceil(n))
	print(n1)


import math
T = int(input())
for i in range(T):
	(X, Y) = map(int, input().split())
	ReqRating = Y - X
	print(math.ceil(ReqRating / 8))


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


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


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


import math
for t in range(int(input())):
	(a, b) = map(int, input().split())
	c = b - a
	print(math.ceil(c / 8))


from math import ceil
for i in range(int(input())):
	(a, b) = map(int, input().split())
	c = abs(a - b)
	if c == 0:
		print('0')
	elif c <= 8:
		print('1')
	elif c > 8:
		c /= 8
		print(ceil(c))


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


t = int(input())
c = 0
for i in range(t):
	c = 0
	(x, y) = map(int, input().split())
	if x >= y:
		print(0)
	elif x < y:
		while x < y:
			x += 8
			c += 1
		print(c)


for _ in range(int(input())):
	(X, Y) = map(int, input().split())
	games = 0
	while X < Y:
		X += 8
		games += 1
	print(games)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	c = 0
	while a < b and a != b:
		a += 8
		c += 1
	print(c)


for i in range(int(input())):
	(X, Y) = map(int, input().split())
	match = 0
	while True:
		if X >= Y:
			break
		X += 8
		match += 1
	print(match)


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	count = 0
	while True:
		if x < y:
			count += 1
			x += 8
		else:
			break
	print(count)


n = int(input())
for i in range(n):
	a = 0
	m = input().split()
	k = int(m[0])
	k1 = int(m[1])
	while k < k1:
		k = k + 8
		a = a + 1
	print(a)


for i in range(int(input())):
	(x, y) = map(int, input().split())
	z = 0
	while x < y:
		x += 8
		z += 1
	print(z)


for t in range(int(input())):
	(x, y) = map(int, input().split())
	count = 0
	while x < y:
		x += 8
		count += 1
	print(count)


T = int(input())
for i in range(T):
	count = 0
	(X, Y) = map(int, input().split())
	if X >= Y:
		print(0)
	else:
		for j in range(Y):
			if X < Y:
				X = X + 8
				count += 1
		print(count)


t = int(input())
for i in range(t):
	(n, m) = map(int, input().split())
	r = m - n
	if r % 8 == 0:
		print(r // 8)
	else:
		print(r // 8 + 1)


t = int(input())
for i in range(t):
	(x, y) = map(int, input().split())
	d = y - x
	print((d + 8 - 1) // 8)


t = int(input())
for i in range(t):
	(X, Y) = map(int, input().split())
	GameRating = Y - X
	count = 0
	if Y - X < 8 and Y - X > 0:
		count += 1
	elif (Y - X) % 8 == 0:
		count = (Y - X) // 8
	elif Y - X > 8:
		count = (Y - X) // 8 + 1
	else:
		pass
	print(count)


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


s = int(input())
for a in range(s):
	(x, y) = map(int, input().split())
	p = y - x
	if p % 8 == 0:
		print(int(p / 8))
	else:
		print(int(p / 8) + 1)


for i in range(int(input())):
	(x, y) = map(int, input().split())
	a = 0
	while True:
		if x >= y:
			break
		x += 8
		a += 1
	print(a)


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


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


def main():
	t = int(input())
	for i in range(t):
		(cur, aim) = map(int, input().split())
		icnt = 0
		while True:
			if cur >= aim:
				break
			else:
				cur += 8
				icnt += 1
		print(icnt)
main()


from math import ceil
for testcase in range(int(input())):
	(x, y) = map(int, input().split(' '))
	print(ceil((y - x) / 8))


testcase = int(input())
while testcase > 0:
	(x, y) = map(int, input().split())
	rating_needed = y - x
	if rating_needed % 8 == 0:
		print(rating_needed // 8)
	else:
		print(rating_needed // 8 + 1)
	testcase -= 1


for i in range(int(input())):
	(Xchess, Yrating) = map(int, input().split())
	match_rating = 0
	while True:
		if Xchess >= Yrating:
			break
		Xchess += 8
		match_rating += 1
	print(match_rating)


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


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	p = b - a
	if p % 8 == 0:
		print(p // 8)
	else:
		print(p // 8 + 1)


n = int(input())
for i in range(n):
	(x, y) = list(map(int, input().split()))
	c = 0
	k = 8
	for i in range(x, y + 1):
		if i >= y:
			if c == 0:
				print('0')
			elif c % 8 == 0:
				print(c // 8)
			else:
				print(c // 8 + 1)
		else:
			c += 1


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


t = int(input())
for i in range(t):
	(x, y) = map(int, input().split())
	games = (y - x) // 8
	if x + games * 8 == y:
		print(games)
	else:
		print(games + 1)


from math import *
for _ in range(int(input())):
	(a, b) = map(int, input().split(' '))
	r = abs(b - a)
	print(ceil(r / 8))


t = int(input())
for _ in range(t):
	(x, y) = map(int, input().split(' '))
	chess = lambda x, y: int((y - x) // 8) + 1 if (y - x) % 8 else int((y - x) // 8)
	print(chess(x, y))


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


t = int(input())
while t > 0:
	(x, y) = map(int, input().split())
	if y < x:
		print(0)
	else:
		d = y - x
		if d % 8 == 0:
			print(d // 8)
		else:
			print(d // 8 + 1)
	t -= 1


import math
t = int(input())
for _ in range(t):
	(x, y) = map(int, input().split())
	k = y - x
	print(math.ceil(k / 8))


t = int(input())
for _ in range(t):
	(curr, goal) = map(int, input().split())
	diff = goal - curr
	if diff % 8 == 0:
		print(diff // 8)
	else:
		print(diff // 8 + 1)