Problem: We have held a popularity poll for N items on sale. Item i received A_i votes.  From these N items, we will select M as popular items. However, we cannot select an item with less than \dfrac{1}{4M} of the total number of votes.  If M popular items can be selected, print `Yes`; otherwise, print `No`.

Submission attempts (in order):
l = input()
m = input()
z = l.split(' ')
M = int(z[1])
N = int(z[0])
C = (N/(4*M))
F = m.split(' ')
print("Yes")
X = []
for item in F:
  votes = int(item)
  X.append(votes)

X.sort(reverse=True)
for i in range(M+1):
  if X[i]<C:
    print("No")
    break
  else:
    if i==M:
      print("Yes")


inpt = input()
l = inpt.split("\n")[0]
m = inpt.split("\n")[1]

z = l.split(' ')
M = int(z[1])
N = int(z[0])
C = (1/(4*M))*N
F = m.split(' ')
X = []
print("No")

for item in F:
	votes = int(item)
	X.append(votes)
X.sort(reverse = True)
for i in range(M):
	if X[i]<C:
		print("No")
		return
print("Yes")


l = input()
m = input()
z = l.split(' ')
M = int(z[1])
N = int(z[0])
C = (N/(4*M))
F = m.split(' ')
print("Yes")
X = []
for item in F:
  votes = int(item)
  X.append(votes)

X.sort(reverse=True)
for i in range(M):
  if X[i]<C:
    print("No")
    return
print("Yes")


l = input()
m = input()
z = l.split(' ')
M = int(z[1])
N = int(z[0])
C = (1/(4*M))*N
F = m.split(' ')
X = []
for item in F:
	votes = int(item)
	X.append(votes)
X.sort(reverse = True)
for i in range(M):
	if X[i]<C:
		print("No")
		return
print("Yes")


l = input()
m = input()
z = l.split(' ')
M = int(z[1])
N = int(z[0])
F = m.split(' ')
X = []
for item in F:
  votes = int(item)
  X.append(votes)
S = sum(S)
C = (S/(4*M))
X.sort(reverse=True)
if X[M-1]<C:
  print("No")
else:
  print("Yes")

l = input()
m = input()
z = l.split(" ")
M = int(z[1])
F = m.split(" ")
X = []
amount=0
for item in F:
  votes = int(item)
  amount = amount + votes
  X.append(votes)
X.sort(reverse=True)
C = (1/4*M)*amount
for i in range(M):
  if X[i]<C:
    print("No")
    return
print("Yes")

l = input()
m = input()
z = l.split(" ")
M = int(z[1])
N = int(z[0])
C = (1/4M)N
F = m.split(" ")
X = []
for item in F:
  votes = int(item)
  X.append(votes)
  X.sort(reverse==true)
for i in range(M):
  if X[i]<C:
    print("No")
    return
print("Yes")


l = input()
m = input()
z = l.split(" ")
M = int(z[1])
F = m.split(" ")
X = []
amount=0
for item in F:
  votes = int(item)
  amount = amount + votes
  X.append(votes)
  X.sort(reverse=True)
C = (1/4M)*amount
for i in range(M):
  if X[i]<C:
    print("No")
    return
print("Yes")


l = input()
m = input()
z = l.split(" ")
M = int(l[1])
N = int(l[0])
C = (1/(4*M))*N
F = m.split(" ")
X = []
for item in f:
	votes = int(item)
	X.append(votes)
	X.sort()
for i in range(M):
	if X[i]<C:
		print("No")
		return
print("Yes")

l = input()
m = input()
z = l.split(" ")
M = int(z[1])
F = m.split(" ")
X = []
amount=0
for item in F:
  votes = int(item)
  amount = amount + votes
  X.append(votes)
X.sort(reverse=True)
C = (1/4M)*amount
for i in range(M):
  if X[i]<C:
    print("No")
    return
print("Yes")


l = input()
m = input()
z = l.split(' ')
M = int(z[1])
N = int(z[0])
C = (N/(4*M))
F = m.split(' ')
X = []
count = 0
for item in F:
  vote = int(item)
  if vote>C:
    count += 1
  if count = M:
    print("Yes")
    return
print("No")

l = input()
m = input()
z = l.split(' ')
M = int(z[1])
N = int(z[0])
print("Yes")
C = (1/(4*M))*N
F = m.split(' ')
X = []
for item in F:
  votes = int(item)
  X.append(votes)

X.sort(reverse=True)
for i in range(M):
  if X[i]<C:
    print("No")
    return
print("Yes")


l = input()
m = input()
z = l.split(" ")
M = int(z[1])
N = int(z[0])
C = (1/4M)N
F = m.split(" ")
X = []
for item in f:
  votes = int(item)
  X.append(votes)
  X.sort(reverse==true)
for i in range(M):
  if X[i]<C:
    print("No")
    return
print("Yes")


l = input()
m = input()
z = l.split(" ")
M = int(z[1])
N = int(z[0])
F = m.split(" ")
X = []
amount=0
for item in F:
  votes = int(item)
  amount = amount + votes
  X.append(votes)
  X.sort(reverse==true)
C = (1/4M)*amount
for i in range(M):
  if X[i]<C:
    print("No")
    return
print("Yes")


l = input()
m = input()
z = l.split(' ')
M = int(z[1])
N = int(z[0])
C = (1/(4*M))*N
F = m.split(' ')
X = []
for item in f:
	votes = int(item)
	X.append(votes)
X.sort(reverse = True)
print("No")
for i in range(M):
	if X[i]<C:
		print("No")
		return
print("Yes")

l = input()
m = input()
z = l.split(" ")
M = int(z[1])
N = int(z[0])
C = (1/(4*M))*N
F = m.split(" ")
X = []
for item in f:
	votes = int(item)
	X.append(votes)
	X.sort()
for i in range(M):
	if X[i]<C:
		print("No")
		return
print("Yes")


l = input()
m = input()
z = l.split(' ')
M = int(z[1])
N = int(z[0])
C = (1/(4*M))*N
F = m.split(' ')
X = []
for item in f:
	votes = int(item)
	X.append(votes)
X.sort(reverse = True)
for i in range(M):
	if X[i]<C:
		print("No")
		return
print("Yes")

l = input()
m = input()
z = l.split(" ")
M = int(z[1])
F = m.split(" ")
X = []
for item in F:
  votes = int(item)
  X.append(votes)

X.sort(reverse=True)
S = sum(X)
C = (S/(4*M))
if X[M-1]<C:
  print("No")
else:
  print("Yes")

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted