Chef visited a grocery store for fresh supplies. There are N items in the store where the i^{th} item has a freshness value A_{i} and cost B_{i}.

Chef has decided to purchase all the items having a freshness value greater than equal to X. Find the total cost of the groceries Chef buys.

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

- The first line of input will contain a single integer T, denoting the number of test cases.
- Each test case consists of multiple lines of input.
- The first line of each test case contains two space-separated integers N and X — the number of items and the minimum freshness value an item should have.
- The second line contains N space-separated integers, the array A, denoting the freshness value of each item.
- The third line contains N space-separated integers, the array B, denoting the cost of each item.

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

For each test case, output on a new line, the total cost of the groceries Chef buys.

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

$1 ≤ T ≤ 100$
$1 ≤ N, X ≤ 100$
$1 ≤ A_{i}, B_{i} ≤ 100$

----- Sample Input 1 ------ 
4
2 20
15 67
10 90
3 1
1 2 3
1 2 3
3 100
10 90 50
30 7 93
4 50
12 78 50 40
40 30 20 10

----- Sample Output 1 ------ 
90
6
0
50

----- explanation 1 ------ 
Test case $1$: Item $2$ has freshness value greater than equal to $X = 20$. Thus, Chef buys item $2$. The total cost is $90$.

Test case $2$: Items $1, 2,$ and $3$ have freshness value greater than equal to $X = 1$. Thus, Chef buys all $3$ items. The total cost is $1+2+3 = 6$.

Test case $3$: No item has freshness value greater than equal to $X = 100$. Thus, Chef buys no items.

Test case $4$: Items $2$ and $3$ have freshness value greater than equal to $X = 50$. Thus, Chef buys items $2$ and $3$. The total cost is $30+20 = 50$.

Difficulty: EASY

Starter code:

Solutions:
t = int(input())
for _ in range(t):
	(num_items, min_fresh) = map(int, input().split())
	fresh_arr = list(map(int, input().split()))
	cost_arr = list(map(int, input().split()))
	total_cost = 0
	for i in range(len(cost_arr)):
		if fresh_arr[i] >= min_fresh:
			total_cost += cost_arr[i]
	print(total_cost)


t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	cost = 0
	for i in range(len(a)):
		if a[i] >= x:
			cost = cost + b[i]
	print(cost)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	c = list(map(int, input().split()))
	d = list(map(int, input().split()))
	e = 0
	for j in range(a):
		if c[j] >= b:
			e += d[j]
		else:
			e += 0
	print(e)


z = int(input())
for i in range(1, z + 1):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	t = 0
	for j in range(n):
		if a[j] >= x:
			t = t + b[j]
		else:
			t = t + 0
	print(t)


for k in range(int(input())):
	(a, b) = map(int, input().split())
	c = list(map(int, input().split()))
	d = list(map(int, input().split()))
	count = 0
	for i in range(a):
		if c[i] >= b:
			count += d[i]
	print(count)


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


t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	c = 0
	for j in range(n):
		if a[j] >= x:
			c = c + b[j]
	print(c)


t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	l = list(map(int, input().split()))
	k = list(map(int, input().split()))
	s = 0
	for i in range(len(l)):
		if l[i] >= m:
			s = s + k[i]
	print(s)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	x = list(map(int, input().split()))
	y = list(map(int, input().split()))
	s = 0
	for i in range(a):
		if x[i] >= b:
			s += y[i]
	print(s)


t = int(input())
for i in range(t):
	count = 0
	(n, x) = map(int, input().split())
	fres = list(map(int, input().split()))
	cost = list(map(int, input().split()))
	for j in range(n):
		if fres[j] >= x:
			count += cost[j]
	print(count)


t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	arr_fresh = list(map(int, input().split()))
	arr_c = list(map(int, input().split()))
	tot = 0
	for i in range(0, len(arr_fresh)):
		if arr_fresh[i] >= x:
			tot += arr_c[i]
	print(tot)


n = int(input())
for _ in range(n):
	(N, X) = list(map(int, input().split()))
	A = list(map(int, input().split()))
	B = list(map(int, input().split()))
	cost = 0
	for i in range(N):
		if A[i] >= X:
			cost += B[i]
	print(cost)


for _ in range(int(input())):
	(n, x) = list(map(int, input().split()))
	fresh_l = list(map(int, input().split()))
	cost_l = list(map(int, input().split()))
	s = 0
	for i in range(n):
		if fresh_l[i] >= x:
			s += cost_l[i]
	print(s)


n = int(input())
for i in range(n):
	(N, x) = list(map(int, input().split()))
	fresh = list(map(int, input().split()))
	cost = list(map(int, input().split()))
	cost1 = 0
	for j in range(N):
		if fresh[j] >= x:
			cost1 = cost1 + cost[j]
	print(cost1)


for i in range(int(input())):
	(n, x) = map(int, input().split())
	la = list(map(int, input().split()))
	lb = list(map(int, input().split()))
	cost = 0
	for i in range(n):
		if la[i] >= x:
			cost = cost + lb[i]
	print(cost)


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	t = 0
	for j in range(n):
		if a[j] >= x:
			t = t + b[j]
		else:
			t = t + 0
	print(t)


T = int(input())
for i in range(T):
	A = []
	B = []
	r = 0
	(N, X) = map(int, input().split())
	A = list(map(int, input().split()))
	B = list(map(int, input().split()))
	for j in range(len(A)):
		if A[j] >= X:
			r = r + B[j]
		else:
			r = r + 0
	print(r)
	A.clear()
	B.clear()


t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	fresh = list(map(int, input().split()))
	cost = list(map(int, input().split()))
	tot = 0
	for a in range(n):
		if fresh[a] >= x:
			tot += cost[a]
	print(tot)


t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	l1 = list(map(int, input().split()))
	l2 = list(map(int, input().split()))
	s = 0
	for i in range(n):
		if l1[i] >= x:
			s += l2[i]
	print(s)


t = int(input())
for i in range(t):
	c = 0
	(a, b) = map(int, input().split())
	l1 = list(map(int, input().split()))
	l2 = list(map(int, input().split()))
	for i in range(a):
		if l1[i] >= b:
			c += l2[i]
	print(c)


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	s = 0
	for j in range(n):
		if a[j] >= k:
			s = s + b[j]
		else:
			s = s + 0
	print(s)


for i in range(int(input())):
	(n, x) = map(int, input().split())
	arr = [int(X) for X in input().split()]
	brr = [int(x) for x in input().split()]
	crr = []
	for i in range(n):
		if arr[i] >= x:
			crr.append(brr[i])
	print(sum(crr))


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	l = []
	for i in range(n):
		if a[i] >= x:
			l.append(b[i])
		else:
			pass
	print(sum(l))


t = int(input())
for i in range(t):
	(n, f) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	c = 0
	for i in range(len(a)):
		if a[i] >= f:
			c = c + b[i]
	print(c)


for _ in range(int(input())):
	(N, X) = map(int, input().split())
	A = list(map(int, input().split()))
	B = list(map(int, input().split()))
	s = 0
	for i in range(len(A)):
		if A[i] >= X:
			s += B[i]
	print(s)


for t in range(int(input())):
	(items, freshness) = map(int, input().split())
	A = list(map(int, input().split()))
	B = list(map(int, input().split()))
	cost = 0
	for i in range(items):
		if A[i] >= freshness:
			cost += B[i]
	print(cost)


t = int(input())
for i in range(t):
	(items, freshness) = map(int, input().split())
	fresh = list(map(int, input().split()))[:items]
	cost = list(map(int, input().split()))[:items]
	l = []
	for j in range(len(fresh)):
		if fresh[j] >= freshness:
			l.append(j)
	total = 0
	for k in range(len(l)):
		total += cost[l[k]]
	print(total)


for i in range(int(input())):
	(n, x) = map(int, input().split())
	l = list(map(int, input().split()))
	c = list(map(int, input().split()))
	t = 0
	for i in range(0, n):
		if l[i] >= x:
			t += c[i]
	print(t)


T = int(input())
for _ in range(T):
	(N, X) = map(int, input().split())
	A = [int(i) for i in input().strip().split()][0:N]
	B = [int(j) for j in input().strip().split()][0:N]
	cost = 0
	i = 0
	while i < N:
		if A[i] >= X:
			cost += B[i]
			i += 1
		else:
			i += 1
	print(cost)


for t in range(int(input())):
	(n, x) = [int(x) for x in input().split()]
	l1 = [int(n) for n in input().split()]
	l2 = [int(n) for n in input().split()]
	l3 = []
	for i in range(len(l1)):
		if l1[i] >= x:
			l3.append(i)
	sum = 0
	for i in range(len(l3)):
		sum += l2[l3[i]]
	print(sum)


for _ in range(int(input())):
	su = 0
	(a, b) = map(int, input().split())
	l = list(map(int, input().split()))
	l1 = list(map(int, input().split()))
	for i in range(len(l)):
		if l[i] >= b:
			su += l1[i]
	print(su)


for i in range(int(input())):
	(n, x) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	s = 0
	for i in range(n):
		if a[i] >= x:
			s = s + b[i]
		else:
			s = s + 0
	print(s)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	l = list(map(int, input().split()))
	m = list(map(int, input().split()))
	c = 0
	for i in range(len(l)):
		if l[i] >= b:
			c += m[i]
	print(c)


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	fresh = list(map(int, input().split()))
	price = list(map(int, input().split()))
	total = 0
	for i in range(n):
		if fresh[i] >= x:
			total = total + price[i]
	print(total)


for _ in range(int(input())):
	count = 0
	(num, x) = map(int, input().split())
	amm = list(map(int, input().split()))
	bmm = list(map(int, input().split()))
	for i in range(num):
		if amm[i] >= x:
			count += bmm[i]
	print(count)


for i in range(int(input())):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	index = [i for i in range(len(a)) if a[i] >= x]
	print(sum([b[i] for i in index]))


t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	fresh = list(map(int, input().split()))
	cost = list(map(int, input().split()))
	total = 0
	for i in range(0, len(fresh)):
		if fresh[i] >= x:
			for j in range(0, len(cost)):
				if i == j:
					total = total + cost[j]
		else:
			pass
	print(total)


t = int(input())
for i in range(t):
	(n, mf) = map(int, input().split())
	k = 0
	f = list(map(int, input().split()))
	c = list(map(int, input().split()))
	for j in range(n):
		if f[j] >= mf:
			k += c[j]
	if k == 0:
		print('0')
	else:
		print(k)


def main():
	t = int(input())
	while t > 0:
		(n, x) = map(int, input().split())
		a = list(map(int, input().split()))
		b = list(map(int, input().split()))
		l = len(a)
		s = 0
		for i in range(l):
			if a[i] >= x:
				s += b[i]
		print(s)
		t -= 1
main()


t = int(input())
while t > 0:
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	sum = 0
	for y in range(len(a)):
		if a[y] >= x:
			sum = sum + b[y]
	print(sum)
	t -= 1


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	lst_a = list(map(int, input().split()))
	lst_b = list(map(int, input().split()))
	ans = 0
	for i in range(n):
		if lst_a[i] >= x:
			ans += lst_b[i]
	print(ans)


t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	l = []
	for i in range(n):
		if a[i] >= x:
			l.append(b[i])
	print(sum(l))


T = int(input())
for i in range(T):
	(N, X) = map(int, input().split())
	z = input().split()
	A = [int(i) for i in z]
	y = input().split()
	B = [int(i) for i in y]
	c = 0
	for i in range(len(A)):
		if A[i] >= X:
			c = c + B[i]
	print(c)


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	li = []
	for i in range(n):
		if a[i] >= x:
			li.append(b[i])
	print(sum(li))


def code():
	cases = int(input())
	for _ in range(cases):
		(N, X) = map(int, input().split(' '))
		freshness = list(map(int, input().split(' ')))
		costs = list(map(int, input().split(' ')))
		total_cost = 0
		for (i, itemF) in enumerate(freshness):
			if itemF >= X:
				total_cost += costs[i]
		print(total_cost)
code()


T = int(input())
for _ in range(T):
	(N, X) = map(int, input().split())
	A = list(map(int, input().split()))
	B = list(map(int, input().split()))
	K = []
	for i in range(N):
		if A[i] >= X:
			K.append(B[i])
	print(sum(K))


t = int(input())
for i in range(t):
	(x, y) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	lst = []
	for j in range(x):
		if a[j] < y:
			pass
		else:
			lst.append(b[j])
	print(sum(lst))


T = int(input())
for i in range(T):
	(n, x) = map(int, input().split(' '))
	a = list(map(int, input().strip().split()))[:n]
	b = list(map(int, input().strip().split()))[:n]
	total_cost = 0
	for j in range(n):
		if a[j] >= x:
			total_cost += b[j]
	print(total_cost)