You have been recently hired as a developer in CodeChef. Your first mission is to implement a feature that will determine the number of submissions that were judged late in a contest.
There are $N$ submissions, numbered $1$ through $N$. For each valid $i$, the $i$-th submission was submitted at time $S_i$ and judged at time $J_i$ (in minutes). Submitting and judging both take zero time. Please determine how many submissions received their verdicts after a delay of more than $5$ minutes.

-----Input-----
- The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.
- The first line of the input contains a single integer $N$.
- $N$ lines follow. For each valid $i$, the $i$-th of these lines contains two space-separated integers $S_i$ and $J_i$.

-----Output-----
For each test case, print a single line containing one integer — the number of submissions for which the judging was delayed by more than 5 minutes.

-----Constraints-----
- $1 \le T \le 100$
- $1 \le N \le 100$
- $1 \le S_i \le J_i \le 300$ for each valid $i$

-----Subtasks-----
Subtask #1 (100 points): original constraints

-----Example Input-----
1
5
1 3
4 4
4 10
1 11
2 7

-----Example Output-----
2

-----Explanation-----
Example case 1: The delays of the respective submissions are $2$ minutes, $0$ minutes, $6$ minutes, $10$ minutes and $5$ minutes. Only submissions $3$ and $4$ are delayed by more than $5$ minutes, hence the answer is $2$.

Difficulty: EASY
Tags: Implementation

Starter code:

Solutions:
t = int(input())
for i in range(t):
	n = int(input())
	count = 0
	for i in range(n):
		(a, b) = map(int, input().split())
		p = max(a, b)
		q = min(a, b)
		r = p - q
		if r > 5:
			count = count + 1
	print(count)


t = int(input())
for i in range(t):
	n = int(input())
	c = 0
	for j in range(n):
		(a, b) = map(int, input().split())
		if b - a > 5:
			c = c + 1
		else:
			continue
	print(c)


for _ in range(int(input())):
	c = 0
	for i in range(int(input())):
		(a, b) = map(int, input().split())
		if abs(a - b) > 5:
			c += 1
	print(c)


for _ in range(int(input())):
	c = 0
	for i in range(int(input())):
		(s, j) = [int(x) for x in input().split()]
		if j - s > 5:
			c += 1
	print(c)


for _ in range(int(input())):
	a = int(input())
	c = 0
	while a:
		(d, b) = map(int, input().split())
		if b - d > 5:
			c += 1
		a -= 1
	print(c)


t = int(input())
for _ in range(t):
	n = int(input())
	c = 0
	for i in range(n):
		(s, j) = map(int, input().split())
		if abs(j - s) > 5:
			c += 1
	print(c)


for i in range(int(input())):
	c = 0
	for j in range(int(input())):
		(a, b) = map(int, input().split())
		if b - a > 5:
			c += 1
	print(c)


for _ in range(int(input())):
	count = 0
	for i in range(int(input())):
		(a, b) = map(int, input().split())
		if b - a > 5:
			count += 1
	print(count)


T = int(input())
for i in range(T):
	N = int(input())
	count = 0
	for i in range(N):
		(j, k) = map(int, input().split())
		if k - j > 5:
			count += 1
	print(count)


t = int(input())
for _ in range(t):
	n = int(input())
	res = 0
	for _ in range(n):
		(s, j) = map(int, input().split())
		diff = abs(s - j)
		if diff > 5:
			res += 1
	print(res)


for j in range(int(input())):
	count = 0
	for i in range(int(input())):
		(a, b) = map(int, input().split())
		if abs(a - b) > 5:
			count += 1
	print(count)


t = int(input())
for i in range(t):
	n = int(input())
	count = 0
	for j in range(n):
		(s, j) = map(int, input().split())
		if j - s > 5:
			count += 1
	print(count)


try:
	t = int(input())
	for r in range(t):
		n = int(input())
		s = 0
		for i in range(n):
			(a, b) = map(int, input().split())
			c = b - a
			if c > 5:
				s += 1
				cou = s
		print(cou)
except:
	pass


t = int(input())
for i in range(t):
	x = int(input())
	count = 0
	for j in range(x):
		(z, y) = map(int, input().split())
		if abs(z - y) > 5:
			count = count + 1
	print(count)


for i in range(int(input())):
	n = int(input())
	l = []
	countnum = 0
	for j in range(n):
		(t, s) = map(int, input().split())
		l.append(s - t)
	for item in l:
		if item > 5:
			countnum += 1
	print(countnum)


for _ in range(int(input())):
	n = int(input())
	l = []
	c = 0
	for _ in range(n):
		(a, b) = map(int, input().split())
		l.append(b - a)
	for i in l:
		if i > 5:
			c = c + 1
	print(c)


t = int(input())
while t > 0:
	n = int(input())
	count = 0
	while n > 0:
		while True:
			a = list(map(int, input().split()))
			if 1 <= a[0] <= a[1] <= 300:
				break
		if a[1] - a[0] > 5:
			count += 1
		n -= 1
	print(count)
	t -= 1


def main():
	t = int(input().strip())
	for i in range(t):
		n = int(input().strip())
		count = 0
		for j in range(n):
			(s, j) = [int(x) for x in input().strip().split()]
			if j - s > 5:
				count += 1
		print(count)
main()


for t in range(int(input())):
	c = 0
	for i in range(int(input())):
		(s, j) = list(map(int, input().split()))
		if j - s > 5:
			c += 1
	print(c)


t = int(input())
while t != 0:
	a = int(input())
	count = 0
	for i in range(a):
		(c, b) = list(map(int, input().split()))
		d = b - c
		if d > 5:
			count += 1
	print(count)
	t = t - 1


for _ in range(int(input())):
	s = 0
	for _ in range(int(input())):
		(a, b) = map(int, input().split())
		if abs(a - b) > 5:
			s += 1
	print(s)


for i in range(int(input())):
	n = int(input())
	res = 0
	for i in range(n):
		(s, j) = map(int, input().split())
		if j - s > 5:
			res += 1
	print(res)


for test in range(int(input())):
	num = int(input())
	delayed = 0
	for i in range(num):
		(submi, judged) = map(int, input().split())
		if abs(submi - judged) > 5:
			delayed += 1
	print(delayed)


T = int(input())
for i in range(T):
	N = int(input())
	S = []
	J = []
	c = 0
	for j in range(N):
		(a, b) = list(map(int, input().split()))
		S.append(a)
		J.append(b)
		if abs(J[j] - S[j] > 5):
			c += 1
	print(c)


Test = int(input())
for Cases in range(Test):
	NumberofSubmission = int(input())
	MoreThanFiveMinutes = 0
	for Values in range(NumberofSubmission):
		(Submission, Judged) = map(int, input().split())
		Duration = abs(Submission - Judged)
		if Duration > 5:
			MoreThanFiveMinutes += 1
	print(MoreThanFiveMinutes)


for i in range(int(input())):
	count = 0
	for j in range(int(input())):
		XY = input().split()
		X = int(XY[0])
		Y = int(XY[1])
		if Y - X > 5 or X - Y > 5:
			count += 1
	print(count)


for t in range(int(input())):
	n = int(input())
	count = 0
	for _ in range(n):
		(a, b) = map(int, input().split())
		if b - a > 5:
			count += 1
	print(count)


a = int(input())
for i in range(a):
	k = int(input())
	l = []
	for j in range(k):
		(b, c) = map(int, input().split())
		v = abs(b - c)
		l.append(v)
	c = 0
	l1 = []
	for t in range(0, len(l)):
		if l[t] > 5:
			l1.append(l[t])
	print(len(l1))


goals = int(input())
for distractions in range(goals):
	aim = 0
	life = int(input())
	for stress in range(life):
		(wife, death) = map(int, input().split())
		if abs(wife - death) > 5:
			aim += 1
	print(aim)


T = int(input())
for i in range(T):
	N = int(input())
	co = 0
	for j in range(N):
		(a, b) = map(int, input().split())
		if b - a > 5:
			co += 1
	print(co)


for _ in range(int(input())):
	n = int(input())
	c = 0
	for i in range(n):
		(S, J) = map(int, input().split())
		if J - S > 5:
			c += 1
	print(c)


for i in range(int(input())):
	num = 0
	for j in range(int(input())):
		x = input().split(' ')
		a = int(x[0])
		b = int(x[1])
		if b - a > 5:
			num += 1
	print(num)


t = int(input())
for i in range(t):
	n = int(input())
	new = []
	d = 0
	for i in range(n):
		(s, j) = list(map(int, input().split()))
		c = j - s
		new.append(c)
	for i in new:
		if i > 5:
			d = d + 1
	print(d)


for _ in range(int(input())):
	c = 0
	for __ in range(int(input())):
		(a, b) = map(int, input().split())
		if b - a > 5:
			c += 1
	print(c)


t = int(input())
for i in range(t):
	n = int(input())
	a = 0
	for i in range(n):
		(s, j) = [int(x) for x in input().split()]
		if j - s > 5:
			a += 1
	print(a)


for _ in range(int(input())):
	l = int(input())
	count = 0
	for i in range(l):
		(s, j) = map(int, input().split())
		if j - s > 5:
			count += 1
		else:
			pass
	print(count)


for _ in range(int(input())):
	n = int(input())
	cnt = 0
	for i in range(n):
		(s, j) = map(int, input().split())
		if j - s > 5:
			cnt += 1
	print(cnt)


for i in range(int(input())):
	N = int(input())
	count = 0
	for j in range(N):
		(S, J) = map(int, input().split())
		if J - S > 5:
			count += 1
	print(count)


t = int(input())
for tc in range(t):
	n = int(input())
	b = []
	for j in range(n):
		(n, k) = map(int, input().split())
		d = 0
		for l in range(n):
			c = k - n
			if c > 5:
				b.append(c)
				break
	print(len(b))


for i in range(int(input())):
	c = 0
	N = int(input())
	for i in range(N):
		(s, j) = map(int, input().split())
		d = j - s
		if d > 5:
			c += 1
	print(c)


t = int(input())
for i in range(t):
	n = int(input())
	m = 0
	for j in range(n):
		(S, J) = map(int, input().split())
		if J - S > 5:
			m = m + 1
	print(m)


for i in range(int(input())):
	s = 0
	for i in range(int(input())):
		(a, b) = map(int, input().split())
		if b - a > 5:
			s += 1
	print(s)


n = int(input())
for i in range(n):
	count = 0
	x = int(input())
	for i in range(x):
		(a, b) = map(int, input().split())
		if b - a > 5:
			count = count + 1
	print(count)


T = int(input())
for i in range(T):
	res = 0
	n = int(input())
	for k in range(n):
		(s, j) = map(int, input().split())
		r = abs(s - j)
		if r > 5:
			res += 1
	print(res)


for _ in range(int(input())):
	b = []
	for x in range(int(input())):
		a = list(map(int, input().split()))
		b.append(abs(a[0] - a[1]))
	c = 0
	for x in b:
		if x > 5:
			c += 1
	print(c)


for i in range(int(input())):
	n = int(input())
	c = 0
	for i in range(n):
		(x, y) = list(map(int, input().split()))
		d = y - x
		if d > 5:
			c = c + 1
	print(c)


n = int(input())
for i in range(n):
	m = int(input())
	c = 0
	for j in range(m):
		(p, q) = map(int, input().split())
		z = q - p
		if z > 5:
			c += 1
		else:
			pass
	print(c)


T = int(input())
for t in range(0, T):
	N = int(input())
	S = []
	J = []
	count = 0
	for i in range(0, N):
		(s, j) = map(int, input().split())
		S.append(s)
		J.append(j)
		if j - s > 5:
			count += 1
	print(count)


for _ in range(int(input())):
	n = int(input())
	count = 0
	for i in range(n):
		(x, y) = list(map(int, input().split()))
		if y - x > 5:
			count += 1
	print(count)


n = int(input())
for i in range(0, n):
	a = int(input())
	count = 0
	for i in range(a):
		(c, d) = map(int, input().split())
		e = abs(c - d)
		if e > 5:
			count += 1
	print(count)


T = int(input())
for _ in range(T):
	N = int(input())
	lst = list()
	for _ in range(N):
		(Si, Ji) = map(int, input().split())
		diff = abs(Si - Ji)
		if diff > 5:
			lst.append(diff)
	print(len(lst))


for i in range(int(input())):
	count = 0
	for i in range(int(input())):
		(x, y) = map(int, input().split())
		if y - x > 5:
			count += 1
	print(count)


for case in range(int(input())):
	count = 0
	for i in range(int(input())):
		(s, j) = map(int, input().split())
		if j - s > 5:
			count += 1
	print(count)


n = int(input())
for i in range(n):
	a = int(input())
	c = 0
	for j in range(a):
		(mm, nn) = list(map(int, input().split()))
		if abs(mm - nn) > 5:
			c += 1
	print(c)


t = int(input())
while t > 0:
	s = int(0)
	n = int(input())
	while n > 0:
		(a, b) = list(map(int, input().split()))
		if b - a > 5:
			s = s + 1
		n = n - 1
	t = t - 1
	print(s)


cases = int(input())
for case in range(cases):
	N = int(input())
	count = 0
	for _ in range(N):
		(S, J) = list(map(int, input().split()))
		if abs(J - S) > 5:
			count += 1
	print(count)


for i in range(int(input())):
	n = int(input())
	count = 0
	for i in range(n):
		(o, p) = map(int, input().split())
		if p - o > 5:
			count += 1
	print(count)


for i in range(int(input())):
	n = int(input())
	k = []
	v = 0
	for j in range(n):
		(s, r) = map(int, input().split())
		k.append(abs(s - r))
	for u in range(n):
		if k[u] > 5:
			v += 1
	print(v)


for i in range(int(input())):
	count = 0
	for j in range(int(input())):
		(A, B) = map(int, input().split(' '))
		if abs(A - B) > 5:
			count += 1
	print(count)


for t in range(int(input())):
	c = 0
	for i in range(int(input())):
		(s, j) = [int(x) for x in input().rstrip().split()]
		if j - s > 5:
			c += 1
	print(c)


for i in range(int(input())):
	n = int(input())
	count = 0
	for i in range(0, n):
		(a, b) = map(int, input().split())
		c = abs(a - b)
		if c > 5:
			count = count + 1
		else:
			pass
	print(count)


for t in range(int(input())):
	numberlist = 0
	for n in range(int(input())):
		(n, k) = list(map(int, input().split()))
		if abs(n - k) > 5:
			numberlist += 1
	print(numberlist)


for _ in range(int(input())):
	n = int(input())
	res = []
	for i in range(n):
		(a, b) = map(int, input().split())
		res.append(abs(a - b))
	count = 0
	for j in res:
		if j > 5:
			count += 1
	print(count)


for _ in range(int(input())):
	x = int(input())
	count = []
	ans = 0
	for i in range(x):
		(a, b) = map(int, input().split())
		sub = abs(a - b)
		count.append(sub)
	for j in range(len(count)):
		if count[j] > 5:
			ans += 1
		else:
			ans += 0
	print(ans)