*“You won’t get caught if you hide behind someone.”*

Sang-Woo advises Gi-Hun to hide behind someone to avoid getting shot.

Gi-Hun follows Sang-Woo's advice and hides behind Ali, who saved his life earlier. Gi-Hun and Ali both have the same height, K. Many players saw this trick and also started hiding behind Ali. 

Now, there are N players standing *between* Gi-Hun and Ali in a straight line, with the i^{\text{th}} player having height H_{i}. Gi-Hun wants to know the minimum number of players who need to get shot so that Ali is visible in his line of sight.

Note:
* Line of sight is a straight line drawn between the topmost point of two objects. Ali is visible to Gi-Hun if nobody between them crosses this line.
* Even if there are some players who have the same height as that of Gi-Hun and Ali, Ali will be visible in Gi-Hun's line of sight.
* Gi-Hun and Ali have the same height.

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

- The first line of input contains a single integer T, denoting the number of test cases. The description of T test cases follows.
- The first line of each test case contains two space-separated integers N and K, denoting the total number of players between Gi-Hun and Ali and the height of both of them respectively.
- The second line of each test case contains N space-separated integers, denoting the heights of the players between Gi-Hun and Ali.

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

For each test case, output in a single line the minimum number of players who need to get shot so that Ali is visible in Gi-Hun's line of sight.

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

$1 ≤ T ≤ 10^{5}$
$1 ≤ N ≤ 10^{5}$
$1 ≤ K ≤ 10^{6}$
$1 ≤ H_{i} ≤ 10^{6}$ for every $1 ≤ i ≤ N$.
- The sum of $N$ across all test cases does not exceed $5\cdot 10^{5}$.

----- Sample Input 1 ------ 
3
4 10
2 13 4 16
5 8
9 3 8 8 4
4 6
1 2 3 4
----- Sample Output 1 ------ 
2
1
0
----- explanation 1 ------ 
Test Case 1: Gi-Hun and Ali have height $10$. For Ali to be visible to Gi-Hun, the second person (with height $13$) and the fourth person (with height $16$) need to get shot. Hence, the minimum number of players who need to get shot is $2$.

Test Case 2: Gi-Hun and Ali have height $8$. For Ali to be visible to Gi-Hun, the first person (with height $9$) needs to get shot. Hence, the minimum number of players who need to get shot is $1$.

Test Case 3: Nobody needs to get shot because everyone is shorter than Gi-Hun and Ali.

Source: codechef | Difficulty: EASY
Tags: Constructive algorithms

Data structures

Ad-hoc


Solutions:
t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	c = 0
	for j in l:
		if j > k:
			c += 1
	print(c)


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


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


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	h = list(map(int, input().split()))
	count = 0
	l = []
	for j in h:
		if j > k:
			l.append(j)
	print(len(l))


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


t = int(input())
for i in range(0, t):
	nk = list(map(int, input().split()))
	height = list(map(int, input().split()))
	count = 0
	for j in height:
		if j > nk[1]:
			count = count + 1
	print(count)


def main(brray, k):
	count = 0
	for _ in brray:
		if _ > k:
			count += 1
	print(count)
for _ in range(int(input())):
	(N, K) = map(int, input().split())
	array = list(map(int, input().split()))[:N]
	main(array, K)


T = int(input())
for i in range(T):
	m = 0
	(N, K) = map(int, input().split())
	P = list(map(int, input().split()))
	for j in range(len(P)):
		if P[j] > K:
			m += 1
	print(m)


for i in range(int(input())):
	(pplBetween, maxHeight) = map(int, input().split())
	heights = [int(x) for x in input().split()]
	count = 0
	for h in heights:
		if h > maxHeight:
			count += 1
	print(count)


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	h = list(map(int, input().split()))
	c = 0
	for i in range(len(h)):
		if h[i] > k:
			c = c + 1
	if c > 0:
		print(c)
	else:
		print(c)


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


for i in range(int(input())):
	(n, k) = map(int, input().split())
	h = list(map(int, input().split()))
	c = sum(map(lambda x: x > k, h))
	print(c)


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


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


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


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	g = 0
	for i in a:
		if i > k:
			g = g + 1
	print(g)


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	A = list(map(int, input().split(' ')))
	count = 0
	for i in range(x):
		if A[i] > y:
			count += 1
	print(count)


t = int(input())
for i in range(t):
	(n, k) = list(map(int, input().split()))
	m = list(map(int, input().split()))
	filteri = list(filter(lambda x: x > k, m))
	print(len(filteri))


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


for i in range(int(input())):
	(N, K) = map(int, input().split())
	A = list(map(int, input().split()))
	count = 0
	for j in range(N):
		if A[j] > K:
			count += 1
	print(count)


import numpy as np
for i in range(int(input())):
	(n, k) = list(map(int, input().split()))
	arr = np.array(list(map(int, input().split())))
	l = len(arr)
	for i in arr:
		if i > k:
			arr = np.delete(arr, np.argwhere(arr == i))
	print(l - len(arr))


vp = int(input())
for i in range(vp):
	(t, a) = map(int, input().split())
	l = list(map(int, input().split()))
	count = 0
	for k in range(t):
		if l[k] > a:
			count = count + 1
		else:
			conut = 0
	print(count)


T = int(input())
for t in range(T):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split(' ')))
	count = 0
	for i in range(n):
		if l[i] > k:
			count += 1
	print(count)


test = int(input())
for i in range(test):
	(h, k) = map(int, input().split())
	n = list(map(int, input().split()))
	c = 0
	for i in n:
		if i > k:
			c = c + 1
	print(c)


for i in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	c = 0
	for i in a:
		if i > k:
			c = c + 1
	print(c)


n = int(input())
for e in range(n):
	(x, y) = map(int, input().split())
	li = list(map(int, input().split()))
	c = 0
	for f in li:
		if f > y:
			c = c + 1
	print(c)


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


T = int(input())
for i in range(T):
	(N, K) = map(int, input().split(' '))
	m = list(map(int, input().split(' ')))[:N]
	l = []
	for i in m:
		if i > K:
			l.append(i)
	print(len(l))


for _ in range(int(input())):
	(n, h) = map(int, input().split())
	lst = list(map(int, input().split()))
	count = 0
	for i in range(0, n):
		if lst[i] > h:
			count += 1
	print(count)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	c = 0
	for x in a:
		if x > k:
			c += 1
	print(c)


for _ in range(int(input())):
	(N, K) = map(int, input().split())
	list1 = input().split()
	count = 0
	for i in list1:
		if int(i) > K:
			count += 1
	print(count)


for i in range(int(input())):
	(n, h) = map(int, input().split())
	l = list(map(int, input().split()))
	count = 0
	for i in l:
		if i > h:
			count += 1
	print(count)


T = int(input())
for _ in range(T):
	(N, K) = map(int, input().split())
	t = list(map(int, input().split(' ')))
	c = 0
	for j in range(N):
		if t[j] > K:
			c = c + 1
	print(c)


for t in range(int(input())):
	(n, k) = map(int, input().split())
	hght = list(map(int, input().split()))
	to_rem = [body for body in hght if body > k]
	print(len(to_rem))


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = list((i for i in map(int, input().split()) if i > k))
	print(len(a))


T = int(input())
for _ in range(T):
	(N, K) = map(int, input().split())
	H = list(map(int, input().split()))
	count = 0
	for h in H:
		if h > K:
			count += 1
	print(count)


T = int(input())
for j in range(T):
	(N, K) = map(int, input().split())
	H = list(map(int, input().split()))
	counter = 0
	for i in range(N):
		if H[i] > K:
			counter += 1
	print(counter)


for _ in range(int(input())):
	(N, K) = map(int, input().split())
	arr = list(map(int, input().split()))
	count = 0
	for i in arr:
		if i > K:
			count += 1
	print(count)


t = int(input())
for i in range(t):
	(N, K) = map(int, input().split())
	height_list = list(map(int, input().split()))
	count = 0
	for i in range(N):
		if height_list[i] > K:
			count += 1
	print(count)


t = int(input())
for i in range(t):
	(N, K) = map(int, input().split())
	h = list(map(int, input().split()))
	c = 0
	for i in range(N):
		if h[i] > K:
			c += 1
	print(c)


T = int(input())
for i in range(T):
	(n, k) = map(int, input().split())
	m = list(map(int, input().split()))
	count = 0
	for i in range(n):
		if m[i] > k:
			count = count + 1
		else:
			count = count
	print(count)


for i in range(int(input())):
	(n, k) = map(int, input().split())
	h = list(map(int, input().split()))
	count = 0
	for i in range(n):
		if h[i] > k:
			count += 1
		else:
			continue
	print(count)


for i in range(int(input())):
	(n, k) = map(int, input().split())
	count = 0
	heights = list(map(int, input().split()))
	for j in range(n):
		if heights[j] > k:
			count += 1
		else:
			count = count
	print(count)


t = int(input())
for i in range(t):
	(N, H) = map(int, input().split())
	A = list(map(int, input().split()))
	b = []
	for j in range(N):
		if A[j] > H:
			b.append(A[j])
	print(len(b))


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


for T in range(int(input())):
	(N, K) = map(int, input().split(' '))
	arr1 = list(map(int, input().split(' ')))
	count = 0
	for element in arr1:
		if element > K:
			count += 1
		else:
			continue
	print(count)


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