Alice and Bob recently got into running, and decided to compare how much they ran on different days.

They each ran for N days — on the i^{th} day, Alice ran A_{i} meters and Bob ran B_{i} meters.  

On each day,
Alice is *unhappy* if Bob ran strictly more than twice her distance, and *happy* otherwise.
Similarly, Bob is *unhappy* if Alice ran strictly more than twice his distance, and *happy* otherwise.

For example, on a given day
If Alice ran 200 meters and Bob ran 500, Alice would be unhappy but Bob would be happy.
If Alice ran 500 meters and Bob ran 240, Alice would be happy and Bob would be unhappy.
If Alice ran 300 meters and Bob ran 500, both Alice and Bob would be happy.

On how many of the N days were both Alice and Bob happy?

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

- The first line of input will contain a single integer T, denoting the number of test cases.
- Each test case consists of three lines of input.
- The first line of each test case contains a single integer N — the number of days.
- The second line of each test case contains N space-separated integers A_{1}, A_{2}, \ldots, A_{N} — the distances run by Alice on the N days.
- The third line of each test case contains N space-separated integers B_{1}, B_{2}, \ldots, B_{N} — the distances run by Bob on the N days.

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

For each test case, output on a new line the number of days when both Alice and Bob were happy.

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

$1 ≤ T ≤ 1000$
$1 ≤ N ≤ 100$
$1 ≤ A_{i}, B_{i} ≤ 10^{5}$

----- Sample Input 1 ------ 
4
3
100 200 300
300 200 100
4
1000 1000 1000 1000
400 500 600 1200
4
800 399 1400 532
2053 2300 3400 23
5
800 850 900 950 1000
600 800 1000 1200 1400

----- Sample Output 1 ------ 
1
3
0
5

----- explanation 1 ------ 
Test case $1$: Alice is unhappy on the first day, since she ran $100$ meters but Bob ran $300$; and $300$ is more than twice of $100$.  
Similarly, Bob is unhappy on the third day.  
Both Alice and Bob are happy on the second day, so the answer is $1$.

Test case $2$: Bob is unhappy on day $1$ and happy on every other day, while Alice is happy on every day. So, they're both happy on three days — the second, third, and fourth.

Test case $3$: Alice is unhappy on days $1, 2, 3$ and Bob is unhappy on day $4$.

Test case $4$: Alice and Bob are both happy on all five days.

Difficulty: EASY

Starter code:

Solutions:
for i in range(int(input())):
	N = int(input())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	c = 0
	for i in range(N):
		if a[i] <= 2 * b[i] and b[i] <= 2 * a[i]:
			c += 1
	print(c)


for i in range(int(input())):
	n = int(input())
	m = list(map(int, input().split()))
	k = list(map(int, input().split()))
	a = 0
	for j in range(n):
		if k[j] <= 2 * m[j] and m[j] <= 2 * k[j]:
			a = a + 1
	print(a)


for i in range(int(input())):
	n = int(input())
	r = 0
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	for i in range(n):
		if b[i] > 2 * a[i] or a[i] > 2 * b[i]:
			pass
		else:
			r = r + 1
	print(r)


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	h = 0
	for i in range(n):
		if a[i] <= b[i] * 2 and b[i] <= a[i] * 2:
			h += 1
	print(h)


t = int(input())
for _ in range(t):
	N = int(input())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	count = 0
	for i in range(N):
		if max(a[i], b[i]) <= 2 * min(a[i], b[i]):
			count += 1
	print(count)


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


t = int(input())
for i in range(t):
	n = int(input())
	lst1 = list(map(int, input().split()))
	lst2 = list(map(int, input().split()))
	count = 0
	for k in range(n):
		if lst1[k] <= 2 * lst2[k] and lst2[k] <= 2 * lst1[k]:
			count += 1
	print(count)


t = int(input())
while t > 0:
	a = int(input())
	a1 = list(map(int, input().split()))
	b1 = list(map(int, input().split()))
	count = 0
	for i in range(0, a):
		if a1[i] * 2 >= b1[i] and b1[i] * 2 >= a1[i]:
			count += 1
	print(count)
	t -= 1


t = int(input())
for i in range(t):
	n = int(input())
	A = list(map(int, input().split()))
	B = list(map(int, input().split()))
	c = 0
	for i in range(n):
		if A[i] > 2 * B[i] or B[i] > 2 * A[i]:
			c = c + 1
	print(n - c)


for i in range(int(input())):
	s = int(input())
	count = 0
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	for i in range(s):
		if a[i] <= 2 * b[i] and b[i] <= 2 * a[i]:
			count += 1
	print(count)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	c = 0
	for i in range(n):
		if a[i] > b[i]:
			if a[i] > 2 * b[i]:
				pass
			else:
				c += 1
		elif b[i] > a[i]:
			if b[i] > 2 * a[i]:
				pass
			else:
				c += 1
		else:
			c += 1
	print(c)


for _ in range(int(input())):
	N = int(input())
	A = list(map(int, input().split()))[:N]
	B = list(map(int, input().split()))[:N]
	c = 0
	for i in range(N):
		if A[i] > B[i]:
			if A[i] <= 2 * B[i]:
				c += 1
		elif A[i] < B[i]:
			if B[i] <= 2 * A[i]:
				c += 1
		else:
			c += 1
	print(c)


t = int(input())
for i in range(t):
	count = 0
	n = int(input())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	for i in range(len(a)):
		if a[i] != b[i] and a[i] * 2 >= b[i] and (b[i] > a[i]):
			count = count + 1
		if a[i] != b[i] and b[i] * 2 >= a[i] and (a[i] > b[i]):
			count = count + 1
		if a[i] == b[i]:
			count = count + 1
	print(count)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	c = 0
	d = 0
	for i in range(n):
		if a[i] <= 2 * b[i] and b[i] <= 2 * a[i]:
			c += 1
	print(c)


t = int(input())
for _ in range(t):
	n = int(input())
	arr1 = list(map(int, input().split()))
	arr2 = list(map(int, input().split()))
	c = 0
	for i in range(0, len(arr1)):
		if 2 * arr1[i] >= arr2[i] and 2 * arr2[i] >= arr1[i]:
			c += 1
	print(c)


T = int(input())
for i in range(T):
	N = int(input())
	S1 = input()
	S2 = input()
	L1 = list(map(int, S1.split()))
	L2 = list(map(int, S2.split()))
	count = 0
	for j in range(N):
		if L1[j] * 2 >= L2[j] and L1[j] <= L2[j] * 2:
			count += 1
	print(count)


for i in range(int(input())):
	n = int(input())
	alice = list(map(int, input().split()))
	bob = list(map(int, input().split()))
	d = 0
	for i in range(n):
		diff = abs(alice[i] - bob[i])
		if diff <= alice[i] and diff <= bob[i]:
			d += 1
	print(d)


T = int(input())
for i in range(T):
	c = 0
	n = int(input())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	for j in range(n):
		if a[j] <= 2 * b[j] and b[j] <= 2 * a[j]:
			c += 1
	print(c)


for i in range(int(input())):
	x = int(input())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	c = 0
	for i in range(x):
		if a[i] > 2 * b[i] or b[i] > 2 * a[i]:
			c += 1
	print(x - c)


for _ in range(int(input())):
	n = int(input())
	x = [int(x) for x in input().split()]
	y = [int(x) for x in input().split()]
	s = 0
	for i in range(n):
		a = max(x[i], y[i])
		b = min(x[i], y[i])
		s += 1 if a // 2 <= b else 0
	print(s)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	for i in range(n):
		if a[i] > 2 * b[i] or b[i] > 2 * a[i]:
			n = n - 1
	print(n)


for testcase in range(int(input())):
	n = int(input())
	a_runList = list(map(int, input().split(' ')))
	b_runList = list(map(int, input().split(' ')))
	day_counter = 0
	for number in range(len(a_runList)):
		dist_a = a_runList[number]
		dist_b = b_runList[number]
		if not dist_a > 2 * dist_b and (not dist_b > 2 * dist_a):
			day_counter += 1
	print(day_counter)


for _ in range(int(input())):
	a = int(input())
	ans = 0
	x = list(map(int, input().split()))
	d = list(map(int, input().split()))
	for i in range(a):
		if x[i] <= 2 * d[i] and d[i] <= 2 * x[i]:
			ans += 1
		else:
			ans += 0
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	happ = 0
	for j in range(n):
		if a[j] <= 2 * b[j] and 2 * a[j] >= b[j]:
			happ += 1
	print(happ)


for i in range(int(input())):
	ans = 0
	n = int(input())
	InputA = list(map(int, input().strip().split()))[:n]
	InputB = list(map(int, input().strip().split()))[:n]
	for p in range(n):
		if 2 * InputA[p] >= InputB[p] and InputA[p] <= 2 * InputB[p]:
			ans = ans + 1
	print(ans)


t = int(input())
i = 0
while i < t:
	n = int(input())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	j = 0
	c = 0
	while j < n:
		if a[j] < b[j]:
			if a[j] * 2 >= b[j]:
				c += 1
		elif a[j] > b[j]:
			if b[j] * 2 >= a[j]:
				c += 1
		else:
			c += 1
		j += 1
	print(c)
	i += 1


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	for j in range(len(a)):
		if b[j] * 2 < a[j]:
			n -= 1
		elif a[j] * 2 < b[j]:
			n -= 1
	print(n)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	count = 0
	for j in range(n):
		x = 2 * a[j]
		y = 2 * b[j]
		if b[j] <= x and a[j] <= y:
			count += 1
	print(count)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	h = 0
	l = len(a)
	for j in range(l):
		if a[j] * 2 >= b[j] and b[j] * 2 >= a[j]:
			h += 1
	print(h)


n = int(input())
for _ in range(n):
	days = int(input())
	run_alice = list(map(int, input().split()))
	run_bob = list(map(int, input().split()))
	happy = 0
	for i in range(days):
		if run_bob[i] > 2 * run_alice[i] or run_alice[i] > 2 * run_bob[i]:
			pass
		else:
			happy += 1
	print(happy)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	count = 0
	for i in range(n):
		if b[i] > 2 * a[i] or a[i] > 2 * b[i]:
			continue
		else:
			count += 1
	print(count)


for i in range(int(input())):
	h = int(input())
	b = list(map(int, input().split()))
	m = list(map(int, input().split()))
	c = 0
	for j in range(h):
		if b[j] <= 2 * m[j] and m[j] <= 2 * b[j]:
			c += 1
	print(c)


for i in range(int(input())):
	a = int(input())
	l = list(map(int, input().split()))
	l1 = list(map(int, input().split()))
	c = 0
	for j in range(a):
		if l[j] <= l1[j] * 2 and l1[j] <= l[j] * 2:
			c += 1
	print(c)


t = int(input())
for i in range(t):
	n = int(input())
	l1 = list(map(int, input().split()))
	l2 = list(map(int, input().split()))
	c = 0
	for i in range(n):
		if l1[i] * 2 >= l2[i] and l2[i] * 2 >= l1[i]:
			c = c + 1
	print(c)


for i in range(int(input())):
	a = int(input())
	y = list(map(int, input().split()))
	z = list(map(int, input().split()))
	count = 0
	for j in range(len(y)):
		if y[j] * 2 >= z[j] and z[j] * 2 >= y[j]:
			count += 1
	print(count)


for _ in range(int(input())):
	n = int(input())
	ans = n
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	for i in range(n):
		if 2 * a[i] < b[i]:
			ans -= 1
		elif 2 * b[i] < a[i]:
			ans -= 1
	print(ans)


a = int(input(''))
for t in range(0, a):
	m = int(input())
	n = list(map(int, input().split()))
	o = list(map(int, input().split()))
	count = 0
	for i in range(m):
		if o[i] <= 2 * n[i] and n[i] <= 2 * o[i]:
			count += 1
	print(count)


n = int(input())
for i in range(n):
	m = int(input())
	l = list(map(int, input().split()))
	p = list(map(int, input().split()))
	k = []
	for (i, j) in zip(l, p):
		if j > i * 2 or i > j * 2:
			k.append(i)
	print(len(l) - len(k))


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	ans = 0
	for i in range(n):
		if a[i] <= 2 * b[i] and b[i] <= 2 * a[i]:
			ans += 1
	print(ans)


for i in range(int(input())):
	n = int(input())
	c = list(map(int, input().split()))
	d = list(map(int, input().split()))
	e = 0
	for i in range(n):
		if c[i] * 2 >= d[i] and d[i] * 2 >= c[i]:
			e = e + 1
	print(e)


test = int(input())
for i in range(test):
	n = int(input())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	cnt = 0
	for i in range(n):
		if a[i] < b[i]:
			if a[i] * 2 < b[i]:
				cnt += 1
		elif b[i] * 2 < a[i]:
			cnt += 1
	print(n - cnt)


for i in range(int(input())):
	n = int(input())
	count = 0
	l1 = list(map(int, input().split(' ')))
	l2 = list(map(int, input().split(' ')))
	for (x, y) in zip(l1, l2):
		if x > 2 * y:
			count = count + 0
		elif y > 2 * x:
			count = count + 0
		else:
			count = count + 1
	print(count)


for tc in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	c = 0
	for i in range(n):
		mi = min(a[i], b[i])
		ma = max(a[i], b[i])
		if ma <= 2 * mi:
			c += 1
	print(c)


for testcase in range(int(input())):
	n = int(input())
	alice = list(map(int, input().split()))
	bob = list(map(int, input().split()))
	for i in range(len(alice)):
		if alice[i] > 2 * bob[i]:
			n -= 1
		elif bob[i] > 2 * alice[i]:
			n -= 1
	print(n)


T = int(input())
for _ in range(T):
	N = int(input())
	A = [int(i) for i in input().split()][0:N]
	B = [int(j) for j in input().split()][0:N]
	count = 0
	for i in range(N):
		dist_Alice = A[i]
		dist_Bob = B[i]
		if dist_Alice > dist_Bob:
			if dist_Bob >= dist_Alice / 2:
				count += 1
		elif dist_Alice < dist_Bob:
			if dist_Alice >= dist_Bob / 2:
				count += 1
		elif dist_Alice == dist_Bob:
			count += 1
	print(count)


for i in range(int(input())):
	n = int(input())
	al = list(map(int, input().split()))
	bo = list(map(int, input().split()))
	c = 0
	for i in range(n):
		if al[i] <= bo[i] * 2 and bo[i] <= al[i] * 2:
			c = c + 1
	print(c)


goals = int(input())
for distractions in range(goals):
	wife = int(input())
	life = list(map(int, input().split()))
	aim = list(map(int, input().split()))
	stress = 0
	for death in range(wife):
		if life[death] <= aim[death] * 2 and aim[death] <= life[death] * 2:
			stress += 1
	print(stress)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	c = 0
	for i in range(n):
		res1 = b[i] <= 2 * a[i]
		res2 = a[i] <= 2 * b[i]
		c += res1 and res2
	print(c)


tc = int(input())
for i in range(tc):
	n = int(input())
	Al = list(map(int, input().split()))
	Bo = list(map(int, input().split()))
	counter = 0
	for i in range(n):
		if Al[i] <= Bo[i] * 2 and Bo[i] <= Al[i] * 2:
			counter += 1
	print(counter)


import sys
sys.setrecursionlimit(10 ** 7)
mod = 10 ** 9 + 7

def readInt():
	return int(input())

def readIntList():
	return list(map(int, input().split()))

def readStringList():
	return list(input())

def readStringListWithSpace():
	return list(input().split())

def readString():
	return input()
import math

def execute():
	for _ in range(readInt()):
		n = readInt()
		a = readIntList()
		b = readIntList()
		count = 0
		for (i, c) in enumerate(a):
			if b[i] * 2 >= c and c * 2 >= b[i]:
				count += 1
		print(count)
execute()


testcases = int(input())
for eachcase in range(testcases):
	days = int(input())
	alice = list(map(int, input().split()))
	bob = list(map(int, input().split()))
	count = 0
	for dist in range(days):
		if alice[dist] > bob[dist] and alice[dist] <= bob[dist] * 2:
			count += 1
		elif bob[dist] >= alice[dist] and bob[dist] <= alice[dist] * 2:
			count += 1
	print(count)


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	c = 0
	for i in range(len(a)):
		if a[i] < b[i]:
			if a[i] * 2 >= b[i]:
				c = c + 1
			else:
				continue
		elif b[i] * 2 >= a[i]:
			c = c + 1
		else:
			continue
	print(c)


q = int(input())
for i in range(q):
	n = int(input())
	l = list(map(int, input().split()))
	l1 = list(map(int, input().split()))
	count = 0
	for j in range(n):
		if l[j] > 2 * l1[j] or l1[j] > 2 * l[j]:
			count += 0
		else:
			count += 1
	print(count)