Today Chef wants to evaluate the dishes of his $N$ students. He asks each one to cook a dish and present it to him.
Chef loves his secret ingredient, and only likes dishes with at least $X$ grams of it.
Given $N$, $X$ and the amount of secret ingredient used by each student $A_i$, find out whether Chef will like at least one dish. 

-----Input:-----
- First line will contain $T$, number of testcases. Then the testcases follow. 
- The first line of each testcase contains two integers $N$ 
(number of students) and $X$ (minimum amount of secret ingredient that a dish must contain for Chef to like it).
- The next line contains $N$ space separated integers, $A_i$ denoting the amount of secret ingredient used by the students in their dishes.

-----Output:-----
For each testcase, print a single string "YES" if Chef likes at least one dish. Otherwise, print "NO". (Without quotes).

-----Constraints:-----
- $1 \leq T \leq 100$
- $1 \leq N \leq 1000$
- $1 \leq X \leq 1000000$
- $1 \leq A_i \leq 1000000$

-----Sample Input:-----
3
5 100
11 22 33 44 55
5 50
10 20 30 40 50
5 45
12 24 36 48 60

-----Sample Output:-----
NO
YES
YES

Source: codechef | Difficulty: EASY
Tags: Implementation

Complete search


Solutions:
t = int(input())
for k in range(t):
	(a, b) = map(int, input().split())
	c = list(map(int, input().split()))
	c.sort()
	if c[a - 1] >= b:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	l = [int(i) for i in input().split()]
	if max(l) >= x:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(N, X) = map(int, input().split())
	A = list(map(int, input().split()))
	print('YES' if X <= max(A) else 'NO')


t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	ans = 'NO'
	for j in range(len(a)):
		if x <= a[j]:
			ans = 'YES'
			break
	print(ans)


a = int(input(''))
for i in range(a):
	(N, X) = [int(x) for x in input('').split()]
	v = [int(x) for x in input('').split()]
	k = list(v)
	c = 0
	for i in range(0, len(k)):
		if k[i] >= X:
			c = c + 1
	if c != 0:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	arr = list(map(int, input().split()))
	for i in arr:
		if i >= x:
			print('YES')
			break
	else:
		print('NO')


T = int(input())
for i in range(0, T):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	flag = True
	for w in range(0, len(a)):
		if a[w] >= x:
			flag = False
	if flag:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	k = 0
	for j in a:
		if j >= x:
			k = 1
	if k == 1:
		print('YES')
	else:
		print('NO')


a = int(input())
for i in range(a):
	(n, x) = map(int, input().split(' '))
	a = list(map(int, input().split(' ')))
	flag = 0
	for j in a:
		if j >= x:
			flag = 1
			break
	if flag == 1:
		print('YES')
	else:
		print('NO')


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


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	if max(l) >= k:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(0, t):
	lst = [int(x) for x in input().split(' ')]
	n = lst[0]
	x = lst[1]
	l = [int(x) for x in input().split(' ')]
	c = 0
	for ele in l:
		if ele >= x:
			c = c + 1
			break
	if c == 0:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	f = 0
	for i in a:
		if i >= x:
			f = 1
			break
	print('YES' if f else 'NO')


T = int(input())
for i in range(T):
	(N, K) = map(int, input().split())
	A = list(map(int, input().split()))[:N]
	for j in range(len(A)):
		if A[j] >= K:
			print('YES')
			break
	else:
		print('NO')


t = int(input())
for _ in range(t):
	line = input().split()
	n = int(line[0])
	x = int(line[1])
	students = list(map(int, input().split()))
	n_valid = len(list(filter(lambda s: s >= x, students)))
	if n_valid == 0:
		print('NO')
	else:
		print('YES')


t = int(input())
i = 0
while i < t:
	y = input().split()
	n = int(y[0])
	x = int(y[1])
	a = input().split()
	m = 0
	while m < n:
		a[m] = int(a[m])
		m += 1
	j = 0
	while j < n:
		if a[j] >= x:
			print('YES')
			break
		elif j == n - 1 and a[j] < x:
			print('NO')
			break
		else:
			j = j + 1
	i = i + 1


n = int(input())
for i in range(n):
	(n, x) = map(int, input().split())
	l = [int(j) for j in input().split()]
	c = 0
	for k in l:
		if k >= x:
			c = 1
	if c == 1:
		print('YES')
	else:
		print('NO')


def func(x, a):
	for amount in a:
		if amount >= x:
			return 'YES'
	return 'NO'
for _ in range(int(input())):
	a = input().split()
	n = int(a[0])
	x = int(a[1])
	print(func(x, map(int, input().split())))


t = int(input())
for i in range(t):
	(n, k) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	search = 0
	for i in range(len(a)):
		if a[i] >= k:
			search = 1
			break
	if search == 1:
		print('YES')
	else:
		print('NO')


for t in range(int(input())):
	(n, x) = map(int, input().split(' '))
	l = list(map(int, input().split(' ')))
	m = max(l)
	if m >= x:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(n, a) = map(int, input().split())
	if sum([int(x) >= a for x in input().split()]):
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(n, m) = map(int, input().split())
	l = list(map(int, input().split()))
	for i in range(n):
		if l[i] >= m:
			print('YES')
			break
	else:
		print('NO')


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	l = list(map(int, input().split()))
	c = 0
	for val in l:
		if val >= x:
			c = 1
	print('YES' if c == 1 else 'NO')


testCases = int(input())
for testCase in range(testCases):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	if x <= max(a):
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	l = [int(x) for x in input().split()]
	f = 0
	for i in l:
		if i >= k:
			print('YES')
			f = 1
			break
	if f == 0:
		print('NO')


try:
	for _ in range(int(input())):
		(a, b) = map(int, input().split())
		s = list(map(int, input().split()))
		d = max(s)
		if d >= b:
			print('YES')
		else:
			print('NO')
except:
	pass


for t in range(int(input())):
	(n, m) = map(int, input().split())
	l = list(map(int, input().split()))
	f = 0
	for i in l:
		if i >= m:
			print('YES')
			f = 1
			break
	if f == 0:
		print('NO')


t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	flag = False
	for i in a:
		if i >= x:
			print('YES')
			flag = True
			break
	if flag == False:
		print('NO')


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	arr = sorted(list(map(int, input().split())))
	if arr[-1] < x:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	if max(a) >= x:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	a.sort(reverse=True)
	if a[0] >= x:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(n, x) = [int(x) for x in input('').split()]
	l = list(map(int, input('').split()))
	l1 = []
	for j in range(len(l)):
		if l[j] >= x:
			l1.append(1)
		else:
			l1.append(0)
	if l1.count(1) >= 1:
		print('YES')
	else:
		print('NO')


for T in range(int(input())):
	(n, k) = map(int, input().split())
	ls = list(map(int, input().split()))
	maxi = max(ls)
	if maxi >= k:
		print('YES')
	else:
		print('NO')


t = int(input())
while t > 0:
	(n, k) = map(int, input().split())
	array = list(map(int, input().split()))
	count = 0
	for i in array:
		if i >= k:
			count += 1
		else:
			pass
	if count >= 1:
		print('YES')
	else:
		print('NO')
	t -= 1


def main():
	for _ in range(int(input())):
		(n, x) = map(int, input().split(' '))
		A = list(map(int, input().split(' ')))[:n]
		flag = True
		for i in A:
			if i >= x:
				flag = False
				break
		print('NO' if flag else 'YES')
main()


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	xa = [v for v in a if v >= x]
	if len(xa) > 0:
		print('YES')
	else:
		print('NO')


tst = int(input())
for i in range(tst):
	(n, x) = map(int, input().split())
	arr = list(map(int, input().split()))
	c = 0
	for j in range(n):
		if arr[j] >= x:
			c = c + 1
	if c > 0:
		print('YES')
	else:
		print('NO')


n = int(input())
xs = []
numbers = []
for i in range(n):
	xs.append(int(input().split()[1]))
	numbers.append(list(map(int, input().split())))

def answer(l, x1):
	happy = list(filter(lambda x: x >= x1, l))
	if len(happy) > 0:
		return 'YES'
	else:
		return 'NO'
for (l, x1) in zip(numbers, xs):
	print(answer(l, x1))


for _ in range(int(input())):
	(n, x) = list(map(int, input().strip().split()))
	a = list(map(int, input().strip().split()))
	a.sort()
	if a[-1] >= x:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	ans = True
	lis = list(map(int, input().split()))
	for i in range(n):
		if lis[i] >= x:
			print('YES')
			ans = False
			break
	if ans == True:
		print('NO')


t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	ans = 0
	for i in range(n):
		if a[i] >= x:
			ans = 1
			break
	if ans == 1:
		print('YES')
	else:
		print('NO')


import os, sys, io, math
from re import *
from math import *
from array import *
from heapq import *
from bisect import *
from functools import *
from itertools import *
from statistics import *
from collections import *
I = lambda : [*map(int, sys.stdin.readline().split())]
IP = lambda : map(int, input().split())
IS = lambda : input()
IN = lambda : int(input())
IF = lambda : float(input())

def f():
	(n, x) = IP()
	l = I()
	return 'YES' if max(l) >= x else 'NO'
for _ in range(IN()):
	print(f())


t = int(input())
for i in range(t):
	(n, m) = map(int, input().split())
	l = list(map(int, input().split()))
	l.sort(reverse=True)
	if l[0] >= m:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	l = [int(x) for x in input().split()]
	flag = 0
	for i in l:
		if i >= x:
			flag = 1
			break
	if flag:
		print('YES')
	else:
		print('NO')


t = int(input())
while t > 0:
	(n, x) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	f = 0
	for i in a:
		if i >= x:
			f = 1
			break
	if f == 1:
		print('YES')
	else:
		print('NO')
	t = t - 1


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	l = list(map(int, input().split()))
	h = 0
	for i in l:
		if i >= x:
			print('YES')
			h = 1
			break
	if h == 0:
		print('NO')


for i in range(int(input())):
	(a, b) = list(map(int, input().split()))
	ar = list(map(int, input().split()))
	for j in ar:
		if j >= b:
			print('YES')
			break
	else:
		print('NO')


for i in range(int(input())):
	(num, x) = map(int, input().split())
	li = list(map(int, input().split()))
	cou = 0
	for j in li:
		if j >= x:
			cou += 1
	if cou == 0:
		print('NO')
	else:
		print('YES')


t = int(input())
while t:
	c = 0
	(n, x) = map(int, input().split())
	l = sorted(list(map(int, input().split())))[::-1]
	for i in l:
		if i >= x:
			c += 1
			break
		else:
			break
	print('YES') if c == 1 else print('NO')
	t -= 1


for t in range(int(input())):
	(n, x) = map(int, input().split())
	a = sorted(list(map(int, input().split())))
	if x <= a[-1]:
		print('YES')
	else:
		print('NO')


for tc in range(int(input())):
	(n, x) = map(int, input().split())
	arr = list(map(int, input().split()))
	poss = False
	for ele in arr:
		if ele >= x:
			poss = True
			break
	print('YES' if poss else 'NO')


for i in range(int(input())):
	(n, x) = map(int, input().split(' '))
	l = list(map(int, input().split(' ')))
	for j in range(len(l)):
		if l[j] >= x:
			print('YES')
			break
	else:
		print('NO')


t = int(input())
while t != 0:
	(n, x) = map(int, input().split())
	l = list(map(int, input().split()))
	f = 0
	for j in l:
		if j >= x:
			f = 1
			break
	if f == 1:
		print('YES')
	else:
		print('NO')
	t -= 1


for i in range(int(input())):
	n = list(map(int, input().split()))
	N = n[0]
	X = n[1]
	COunt = 0
	A = list(map(int, input().split()))
	for j in range(N):
		if A[j] >= X:
			COunt = 1
			print('YES')
			break
	if COunt == 0:
		print('NO')


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	c = 'NO'
	for i in a:
		if i >= x:
			c = 'YES'
			break
	print(c)


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	l = list(map(int, input().split()))
	if max(l) >= y:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(n, X) = map(int, input().split(' '))
	l = list(map(int, input().split(' ')))
	count = 0
	flag = 0
	for x in l:
		if x >= X:
			flag = 1
			print('YES')
			break
	if flag == 0:
		print('NO')


try:
	for i in range(int(input())):
		(n, x) = map(int, input().split())
		l = list(map(int, input().strip().split()))
		l.sort()
		for i in l:
			if i >= x:
				print('YES')
				break
		else:
			print('NO')
except:
	pass


t = int(input())
for tc in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = []
	for j in a:
		if j >= x:
			b.append(j)
	if len(b) == 0:
		print('NO')
	else:
		print('YES')


for t in range(int(input())):
	(n, x) = list(map(int, input().split()))
	numberlist = list(map(int, input().split()))
	numberlist.sort()
	count = 0
	for f in numberlist:
		if f >= x:
			count = count + 1
	if count > 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n_x = input().split(' ')
	(n, x) = (int(n_x[0]), int(n_x[1]))
	dishes = input().split(' ')
	for j in range(n):
		if int(dishes[j]) >= x:
			print('YES')
			break
	else:
		print('NO')


for a in range(int(input())):
	(N, X) = map(int, input().split())
	l = list(map(int, input().split()))
	count = 0
	for element in l:
		if element >= X:
			count += 1
	if count >= 1:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	lst = [int(x) for x in input().split()]
	for j in range(len(lst)):
		if lst[j] >= x:
			print('YES')
			break
	else:
		print('NO')


for i in range(int(input())):
	(n, m) = map(int, input().split())
	k = list(map(int, input().split()))
	c = 0
	for i in k:
		if i >= m:
			c = 1
			break
	if c == 1:
		print('YES')
	else:
		print('NO')


(n, i) = (int(input()), 1)
while i <= n:
	stusecret = list(map(int, input().split()))
	secamt = list(map(int, input().split()))
	for j in range(stusecret[0]):
		if secamt[j] >= stusecret[1]:
			print('YES')
			break
	else:
		print('NO')
	i += 1