Problem:


Score : 200 points

Problem Statement

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.

Constraints

1 \leq M \leq N \leq 100

1 \leq A_i \leq 1000

A_i are distinct.

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N M
A_1 ... A_N

Output

If M popular items can be selected, print Yes; otherwise, print No.

Sample Input 1

4 1
5 4 2 1

Sample Output 1

Yes

There were 12 votes in total. The most popular item received 5 votes, and we can select it.

Sample Input 2

3 2
380 19 1

Sample Output 2

No

There were 400 votes in total. The second and third most popular items received less than \dfrac{1}{4\times 2} of the total number of votes, so we cannot select them. Thus, we cannot select two popular items.

Sample Input 3

12 3
4 56 78 901 2 345 67 890 123 45 6 789

Sample Output 3

Yes



Sample input:
4 1
5 4 2 1


Sample output:
Yes

Submission status: Accepted

Solution code:
#N, M
l = list(map(int, input().split()))
#A[i]
A = list(map(int, input().split()))

if len([a for a in A if a >= sum(A) / (4 * l[1])]) >= l[1]:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
N,M = map(int, input().split())
A = list(map(int, input().split()))
a = 0
for i in range(N):
    if A[i] >= sum(A)/(4*M):
        a+=1
print('No' if a<M else 'Yes')

Submission status: Accepted

Solution code:
n,m=map(int,input().split())
a=list(map(int,input().split()))
count=0
x=sum(a)
for i in range(n):
  if(a[i]>=x/(4*m)):
    count+=1
    
if(count>=m):
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
NM_list = input().split(" ")
N = int(NM_list[0])
M = int(NM_list[1])
a_list = [int(num) for num in input().split(" ")]
a_list.sort(reverse = True)
sum_vote = 0
for i in a_list:
    sum_vote += i

for i in range(M):
    if a_list[i]*4*M<sum_vote:
        print("No")
        exit()
print("Yes")

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
A = list(map(int, input().split()))

count = 0
sum_total = sum(A)

for i in range(N):
    if (A[i] >= (sum_total /(4*M))):
        count=count+1


if count >= M:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
n,m = map(int,input().split())
a = [int(i) for i in input().split()]
a.sort(reverse=True)
k = sum(a)/(4*m)
if k > a[m-1]:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
N, M = list(map(int, input().split()))
scores = list(map(int, input().split()))
at_least = sum(scores) / (4*M)

if len([ s for s in scores if s >= at_least]) >= M:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
n,m = input().split()
N = int(n)
M = int(m)
a = [int(i) for i in input().split()]
a.sort(reverse=True)
k = sum(a)/(4*M)
if k > a[M-1]:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
N,M=map(int,input().split())
A=sorted(list(map(int,input().split())))[::-1]
print("Yes" if A[M-1]*4*M>=sum(A) else "No")

Submission status: Accepted

Solution code:
N,M=map(int,input().split())
A=list(map(int,input().split()))
cnt=0
for i in range(N):
    if A[i]>=(sum(A)/(4*M)):
        cnt+=1
print("Yes" if cnt>=M else "No")

Submission status: Accepted

Solution code:
# B - Popular Vote

n, m = map(int, input().split())
a = list(int(x) for x in input().split())

s = sum(a)
cnt = 0

for i in range(n):
    if a[i] * 4 * m >= s:
        cnt += 1

if cnt >= m: 
    print('Yes')
else: 
    print('No')

Submission status: Accepted

Solution code:
n,m = map(int, input().split())
a = list(map(int, input().split()))

l = sorted(a, reverse=True)

b = sum(a) / (4*m)

if b > l[m-1]:
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse=True)
s = sum(A)
print("Yes" if A[M-1]/s >= 1/4/M else "No")

Submission status: Accepted

Solution code:

n,m = map(int, input().split())
List = list(map(int, input().split()))
listmx = sum(List)
cnt=0
for val in List:
    if val >=  listmx*1/m/4:
        cnt = cnt+1;

if cnt >= m:
    print("Yes")
else :
    print("No")

Submission status: Accepted

Solution code:
N,M = map(int,input().split())
A = sorted(list(map(int,input().split())),reverse=True)

if sum(A)/(4*M)<=A[M-1]:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
#ABC161B
import sys
N, M = map(int, sys.stdin.readline().split())
A = list(map(int, sys.stdin.readline().split()))
A.sort(reverse=True)
S = sum(A)
for a in A[:M]:
    if a/S - 1/(4*M) <0:
        print('No')
        break
else:
    print('Yes')

Submission status: Accepted

Solution code:
n,m = map(int,input().split())
*l, = map(int,input().split())
s=sum(l)
ans = 'Yes'
count=0
for i in l:
  if i >=(s/(4*m)):
    count+=1
if count<m:
  ans='No'
print(ans)

Submission status: Accepted

Solution code:
#input
N, M = map(int, input().split())
A = list(map(int, input().split()))

#output
import numpy as np
A = np.array(A)
B = np.sum(A)
C = A[A >= B/(4*M)]

if len(C) >= M:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
A = list(map(int, input().split()))
X = sum(A)
cnt = 0
for i in range(N):
    if A[i] >= (X + 4 * M - 1) // (4 * M):
        cnt += 1
if cnt >= M:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
a = sorted(list(map(int, input().split())), reverse=True)
t = sum(a) / (4 * m)
for i in range(m):
  if a[i] < t:
    print('No')
    break
else:
  print('Yes')

Submission status: Accepted

Solution code:
N, M = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
new_A = []
for i in range(N):
  if A[i] >= sum(A)/(4*M):
    new_A.append(A[i])
if len(new_A) >= M:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys

def main():
    
    n,m = map(int,input().split())
    a = list(map(int,input().split()))
    t=sum(a)
    a.sort()
    a.reverse()
    
    if a[m-1]>=t/(4*m):
        print("Yes")
    else:
        print("No")

main()

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
A = list(map(int, input().split()))

thr =  sum(A) / (4 * M)
A = [a for a in A if a >= thr]
if len(A) >= M:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
a = list(map(int, input().split()))

a.sort(reverse=True)
suma = sum(a)
if a[m - 1] >= suma / (4 * m):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
n,m = map(int,input().split())
A = list(map(int, input().split()))
x = sum(A) / (4*m)
cnt = 0
for a in A:
  if a < x:
    continue
  cnt += 1
ans = 'Yes' if cnt >= m else 'No'
print(ans)

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
a = list(map(int, input().split()))

a.sort(reverse=True)

if a[m-1] * 4 * m >= sum(a):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
#
# Written by NoKnowledgeGG @YlePhan
# ('ω')
#
#import math
#mod = 10**9+7
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""

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

def main():
  n,m = readInts()
  a = readInts()
  s = sum(a)
  cnt = 0
  for i in range(n):
    if a[i]*4*m >= s:
      cnt+=1
  if cnt >= m:print("Yes")
  else:print("No")
if __name__ == '__main__':
  main()

Submission status: Accepted

Solution code:
#
# Written by NoKnowledgeGG @YlePhan
# ('ω')
#
#import math
#mod = 10**9+7
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""
def main():
  # 総和 S <= Ai * 4M のほうがやりやすいよ！
  n,m = map(int,input().split())
  a = list(map(int,input().split()))
  
  cnt = 0
  SUM = 0
  for i in range(n):
    SUM += a[i]
  for i in range(n):
    if a[i] * (4*m) >= SUM:
      cnt+=1
  if cnt >= m:
    print('Yes')
  else:
    print('No')
  
if __name__ == '__main__':
  main()

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
a = list(map(int, input().split()))
cnt = 0 
ans = 'No'
total = sum(a)
for i in a:
  if i - total*1/(4*m) >= 0:
    cnt += 1
  if cnt == m:
    ans = 'Yes'
    break
print(ans)

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
li_a = list(map(int, input().split()))
s = sum(li_a)

counter = 0
for a in li_a:
    if a >= (s / (4 * m)):
        counter += 1
if m <= counter:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
# -*- coding:utf-8 -*-
n, m = map(int, input().split())
a = list(map(int, input().split()))
cnt=0

for i in range(n):
    if a[i] >= sum(a)/(4*m):
        cnt+=1

print("Yes") if cnt >= m else print("No")

Submission status: Accepted

Solution code:
N,M = map(int,input().split())
A_list = list(map(int,input().split()))

num = sum(A_list)/(4*M)

A2_list = [s for s in A_list if s >= num]

if len(A2_list)>=M:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
from sys import setrecursionlimit, exit
setrecursionlimit(1000000000)

from heapq import heapify, heappush, heappop, heappushpop, heapreplace
from bisect import bisect_left, bisect_right

n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=True)
if a[m-1] >= sum(a) / (m * 4):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
n, m = map(int, input().split())

a_list = list(map(int, input().split()))
a_list.sort(reverse=True)

total_votes = sum(a_list)

if a_list[m-1] < total_votes / (4 * m):
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
def can_vote(A, m):
    if m == 1:
        return True
    A.sort()
    total = sum(A)
    tt = total * (1/(4*m))
    
    counter = 0

    for i in range(len(A)-1, -1, -1):
        if A[i] >= tt:
            counter += 1
        else:
            break
    if counter >= m:
        return True
    else:
        return False

n, m = list(map(int, input().split()))
A = list(map(int, input().split()))
if can_vote(A, m):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
n, m = (int(i) for i in input().split());

v = [int(i) for i in input().split()];

cnt = 0;

s = sum(v);
for i in v:
    cnt += (4 * m * i >= s);

if cnt >= m:
    print('Yes');
else:
    print('No');

Submission status: Accepted

Solution code:
N,M = map(int,input().split())
li = list(map(int,input().split()))
li.sort(reverse=True)
if li[M-1] < sum(li)/(4*M):
  print("No")
else:
  print("Yes")

Submission status: Accepted

Solution code:
n,m = map(int,input().split())
a = list(map(int,input().split()))

lim = sum(a) / (4*m)

cnt = 0
ans = "No"
for ele in a:
	if ele >= lim : cnt += 1
	if cnt == m : ans = "Yes"; break

print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python

from sys import stdin, stderr

def check(M, A):
   A.sort()
   A = A[::-1]
   total = sum(A)
   for i in xrange(M):
      x = A[i]
      if x * 4*M < total:
         return False
   return True

def main():
   N, M = map(int, stdin.readline().split())
   A = map(int, stdin.readline().split())

   print('Yes' if check(M, A) else 'No')

   return 0

if __name__ == '__main__': main()

Submission status: Accepted

Solution code:
N, M = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
# 降順ソート
A.sort(reverse=True)
# 対象ピックアップ
pickup = A[:M]
# 足きり算出
if min(pickup) < sum(A) * (1/(4*M)):
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
a = [int(i) for i in input().split()]
s = sum(a)
c = 0

for i in range(len(a)):
    if a[i] >= s / (4*m):
        c += 1

print("Yes" if c >= m else "No")

Submission status: Accepted

Solution code:
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    n,m=INTM()
    a=LIST()
    suma=sum(a)
    ct=0
    for i in a:
        if 4*i*m>=suma:
            ct+=1
    if ct>=m:
        print('Yes')
    else:
        print('No')
if __name__ == '__main__':
    do()

Submission status: Accepted

Solution code:
n,m,*a=map(int,open(0).read().split())
print('YNeos'[len([i for i in a if sum(a)<=4*i*m])<m::2])

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
A = list(map(int, input().split()))

check = ((1 / (4 * M)) * sum(A))
x = 0
for item in A:
    if item < check:
        x += 1

ans = N - x

if ans >= M :
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
if __name__ == "__main__":
    n, m = map(int, input().split())
    a = list(map(int, input().split()))
    a.sort()
    a.reverse()
    s = sum(a)
    if a[m-1] >= s/(4*m):
        print("Yes")
    else:
        print("No")

Submission status: Accepted

Solution code:
n, m = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
print('No' if len([i for i in a if sum(a)/(4*m) <= i]) < m else 'Yes')

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse=True)
sum_A = sum(A)
is_ok = True
for i in range(M):
    check = 1 / (4 * M)
    if A[i] / sum_A < check:
        is_ok = False
        break
print("Yes" if is_ok else "No")

Submission status: Accepted

Solution code:
n,m = list(map(int,input().split()))
a = list(map(int,input().split()))

cnt=0
s = sum(a)
for i in a:
    if i>=s/(4*m):
        cnt+=1

if cnt>=m:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
n,m=map(int,input().split())
a=list(map(int,input().split()))
s=sum(a)
cnt=0
for x in a:
    if(x*4*m>=s):
        cnt+=1

if(cnt>=m):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
item_num, item_select = map(int, input().split())

item = list(map(int, input().split()))

item.sort(reverse=True)
if item[item_select - 1] >= sum(item)*1/(4*item_select):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
# n, m = map(int, '12 3'.split())
# a = list(map(int, '4 56 78 901 2 345 67 890 123 45 6 789'.split()))
n, m = map(int, (input()).split())
a = list(map(int, input().split()))

a = sorted(a, reverse=True)
thresh = float(sum(a))/(4*m)

filtered = len(list(filter(lambda x: x >= thresh, a)))

if filtered >= m:
  print('Yes')  
else:
  print('No')

Submission status: Accepted

Solution code:
n,m=map(int,input().split())
a=list(map(int,input().split()))
a=sorted(a,reverse=True)
A=[]
s=sum(a)
c=s/(4*m)
for i in range(m):
  if a[i]>=c:
    A.append(a[i])
print("Yes" if len(A)==m else "No")

Submission status: Accepted

Solution code:
n,m = map(int, input().split())
a = list(map(int, input().split()))
#print(n,m,a)
aa = sum(a)

cnt = 0
for i in a:
  if i >= aa/(4*m):
    cnt+=1
if cnt >= m:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
N,M = map(int,input().split())
A = list(map(int,input().split()))
V = sum(A)
# print("V:",V)
c = 0
for a in A:
    # print("a:",a)
    if 4*M*a >= V:
        c += 1
# print("c=",c)
if c >= M:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
A = list(map(int, input().split()))
lim = sum(A) / (4*M)
count = 0
for a in A:
    if lim <= a:
        count += 1

if count >= M:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
n,m = map(int,input().split())
a = list(map(int,input().split()))
a.sort(reverse=True)
sum_a = sum(a)
# print(a)
ans = 0
for i in range(n):
    if a[i] >= sum_a/(4*m): 
        ans = i+1
# print(ans)
# print(sum_a/(4*m))
if ans >=m:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
a = list(map(int, input().split()))
s = sum(a)
a.sort(reverse = True)
k = s/(4*m)
if a[m-1] < k:
  print("No")
else:
  print("Yes")

Submission status: Accepted

Solution code:
V=0;
o=input().rstrip().split(' ')
p=input().rstrip().split(' ')
S=0;
for i in range(0,len(p)):
    S+=int(p[i])
D=(1/(4*int(o[1])))*100;
p.sort(key=int,reverse=True)
for i in range(0,int(o[1])):
    G = (int(p[i])/S)*100;
    if G >= D:
        continue;
    else:
        V=1;
        break;
#print(D,G)
if V==0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
n,m = map(int,input().split())
a = list(map(int,input().split()))
if n < m:
  print("No")
  quit()
a.sort(reverse = True)
l = sum(a)/4/m
for i in range(m):
  if a[i] < l:
    print("No")
    quit()
print("Yes")

Submission status: Accepted

Solution code:
a = list(map(int, input().split()))
A = list(map(int, input().split()))

N, M = a[0], a[1]

sum = sum(A)

c = 0

for i in range(N):
  if A[i] >= sum/4/M:
    c = c+1

if c >= M:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
A = sorted(map(int, input().split()), reverse=True)
for i in range(M):
  if A[i] < sum(A)/(4*M):
    print("No")
    break
  elif i == M-1:
    print("Yes")

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
a = list(map(int, input().split()))
total = sum(a)
ans = 0
for i in range(n):
    if a[i] >= total / (4*m):
        ans += 1
if ans >= m:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
url = "https://atcoder.jp/contests/abc161/tasks/abc161_b"


def main():
    n, m = list(map(int, input().split()))
    n_li = list(map(int, input().split()))
    n_li = sorted(n_li, reverse=True)
    all_num = sum(n_li)
    for i in range(1, m + 1):
        if all_num / (4 * m) > n_li[i - 1]:
            print('No')
            exit()
    print('Yes')


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))

A = sum(a)
a.sort(reverse=True)

if a[m-1] >= A/(4*m):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
n, m = map(int,input().split())
l = sorted(list(map(int,input().split())), reverse=True)

l_sum = sum(l)/(m*4)

if l[m-1] >= l_sum:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
N,M=map(int,input().split())
A=list(map(int,input().split()))
A=sorted(A,reverse=True)
B=sum(A)
for i in range(M):
    if A[i]<B/(4*M):
        print("No")
        break
else:
    print("Yes")

Submission status: Accepted

Solution code:
n, m = map(int,input().split())
l = sorted(list(map(int,input().split())), reverse=True)


l_sum = sum(l)/(m*4)

ans = 0
for i in range(m):
    if l[i] >= l_sum:
        ans += 1

if ans == m:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=True)
s = sum(a)
flag = True
for i in range(m):
    if a[i] < 1/(4*m)*s:
        flag = False
        break
if flag:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
A = list(map(int, input().split()))

line = sum(A)/(4*m)
count = 0
for i in range(n):
    if A[i] >= line:
        count += 1

if count >= m:
    ans = 'Yes'
else:
    ans = 'No'

print(ans)

Submission status: Accepted

Solution code:
N,M=map(int,input().split())
A=list(map(int,input().split()))
x=sum(A)
if sum([1 if a>=x/4/M else 0 for a in A])>=M:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
n,m=map(int,input().split())
A=[int(i) for i in input().split()]
s=sum(A)
A.sort(reverse=1)
if A[m-1]*4*m>=s:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
List = list(map(int, input().split()))

tokuhyo_sum = sum(List)

count = 0
for i in List:
    if i * 4 * m >= tokuhyo_sum:
        count += 1

if count >= m:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
str1 = input()
A = input()

list1 = str1.split()
list2 = A.split()
N = list1[0]
M = list1[1]

M_count = 0

all = 0
for i in range(len(list2)):
    all = all + int(list2[i])
#print("all" + str(all))

judge =  1/(4*int(M)) * all
#print("judge" + str(judge))

for i in list2:
    #print("list2 = "+ i )
    if int(i) >= judge:
        M_count = M_count + 1
        #print("M_count" + str(M_count))
    
if M_count >= int(M):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
num = list(map(int, input().split()))
total = sum(num)
ans = []

for i in num:
    if total/(4*M) <= i:
        ans.append(i)

if len(ans) >= M:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
n,m=map(int,input().split())
a=list(map(int,input().split()))
a_sum=sum(a)
#print(a_sum)
a.sort(reverse=True)
#print(a)
if a[m-1]/a_sum>=1/(4*m):
            print('Yes')
else:
            print('No')

Submission status: Accepted

Solution code:
n,  m = map(int, input().split())
a=[int(x) for x in input().split()]
a=sorted(a, reverse=True)
c=0
anch=sum(a)/(4*m)
for i in a:
  if i>=anch:
    c+=1
  else:
    break
if c>=m:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

def main():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    b = sum(A) / (4 * M)
    ans = 0
    for a in A:
        if a >= b:
            ans += 1
    if ans >= M:
        print("Yes")
    else:
        print("No")

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n,m = map(int,input().split(" "))
a = list(map(int,input().split(" ")))
a.sort(reverse=True)
t = sum(a) / (4 * m )
print('Yes' if a[m-1] >= t else 'No')

Submission status: Accepted

Solution code:
k,m = map(int, input().split())
a = list(map(int, input().split()))

# リストaの総投票数をsに格納する
s = sum(a)

# リストaを降順にソートする
a.sort(reverse=True)

if a[m-1] >= s*(1/4/m):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
str = input().split()
n = int(str[0])
m = int(str[1])

str = input().split()
array = [int(i) for i in str]

sum = 0
for i in array:
    sum += i

cnt = 0
for i in range(n):
    if array[i]*4*m >= sum:
        cnt += 1

if cnt >= m:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
N, M = map(int, input().split())

votes = list(map(int, input().split()))

total_votes = sum(votes)
threshold = total_votes / (4*M)
temp = 0
for v in votes:
    if v >= threshold:
        temp += 1

if temp >= M:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
n,m = map(int,input().split())
a_L = list(map(int,input().split()))
s = sum(a_L)

counter = 0
for i in range(n):
    if float(a_L[i]) >= s/(4*m):
        counter += 1
if counter >= m:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
A = sorted(list(map(int, input().split())), reverse = True)
B = sum(A)

if A[M - 1] < (B / (4 * M)):
  print("No")
else:
  print("Yes")

Submission status: Accepted

Solution code:
n,m=input().split()
n,m=[int(n),int(m)]
a=list(map(int, input().strip().split()))
sum=0
for i in range(len(a)):
    sum=sum+a[i]

b=sorted(a)

if b[n-m]>=sum/4/m:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
N,M=map(int,input().split())
A=list(map(int,input().split()))
x=sum(A)/(4*M)
A.sort(reverse=True)
for a in A[:M]:
    if a<x:
        print("No")
        exit()
print("Yes")

Submission status: Accepted

Solution code:
n,m = map(int, input().split())
a = list(map(int,input().split()))
sum = sum(a) / (4*m)

for i in range(len(a)):
    if a[i] < sum:
        n -= 1

if n >= m:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
N,M = map(int,input().split())
A = list(map(int,input().split()))
flag = 0

total = sum(A)
A.sort(reverse = True)

for i in range(M):
    if A[i] >= total/(4*M) :
        pass
    else :
        flag = 1

if flag == 0:
    print("Yes")
else :
    print("No")

Submission status: Accepted

Solution code:
def submit():
    n, m = map(int, input().split())
    a = list(map(int, input().split()))
    s = sum(a)
    if sum([1 for e in a if e >= s / (4 * m)]) >= m:
        print('Yes')
    else:
        print('No')


submit()

Submission status: Accepted

Solution code:
from sys import stdin, stdout
rl = lambda: stdin.readline()
rll = lambda: stdin.readline().split()

def main():
	N, M = (int(x) for x in rll())
	A = [int(x) for x in rll()]
	tot = sum(A)
	cutoff = tot/(4*M)
	A.sort(reverse = True)
	count = 0
	for i, num in enumerate(A):
		if num >= cutoff:
			count += 1
		else:
			break
	if count >= M:
		stdout.write("Yes");stdout.write("\n")
	else:
		stdout.write("No");stdout.write("\n")
	stdout.close()

if __name__ == "__main__":
	main()

Submission status: Accepted

Solution code:
N,M = map(int, input().split())
A = list(map(int,input().split()))

NUM = 1/(4*M)
count = 0
A_s = sum(A)
NUM = NUM * A_s
for i in range(0,N):
  if(A[i] >= NUM):
    count+= 1
if(count >= M):
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
n,m=map(int,input().split())
a=list(map(int,input().split()))
p=sum(a)
ans=0
for i in range(n):
	if a[i]>=p/(4*m):
		ans+=1
print("Yes" if ans>=m else "No")

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
array=list(map(int, input().split()))
all = sum(array)
flag = 0
border = all/(4*m)
for i in range(n):
  if array[i-1] >= border:
    flag += 1
    
if flag >= m:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
A = list(map(int, input().split()))

sumA = sum(A)

filteredA = list(filter(lambda x: x >= (sumA / (4*M)), A))

if M <= len(filteredA):
    print('Yes')
else:
    print("No")

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
A = list(map(int, input().split()))

request_votes = sum(A) / (4*M)
count = 0

for vote in A:
    if vote >= request_votes:
        count += 1

if count < M:
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
l = list(map(int, input().split()))
a = sum(l)
s = a / (4*m)
l.sort(reverse = True)
if l[m-1] < s:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
n,m=map(int,input().split())
a=list(map(int,input().split()))
cnt=sum(a)/(4*m)
tmp=0
for i in range(len(a)):
    if a[i]>=cnt:
        tmp+=1

if tmp>=m:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
l = list(map(int, input().split()))
count = 0
for i in range(n):
    if l[i] >= sum(l) * (1 / (4 * m)):
        count += 1
if count >= m:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
N,M=map(int,input().split())
A=list(map(int,input().split()))
a=sum(A)
A.sort()
if A[N-M]<a/(4*M):
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
n,m = map(int, input().split())
a = list(map(int, input().split()))

s = sum(a)
min_num = float(s)/(4*m)

res = "No"
count = 0
for x in a:
    if x >= min_num:
        count += 1
    if count >= m:
        res = "Yes"
        break
print(res)

Submission status: Accepted

Solution code:
def main():
    _, m = map(int, input().split())
    ary = sorted(list(map(int, input().split())), reverse=True)
    if ary[m-1]*4*m >= sum(ary):
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
a = list(map(int, input().split()))

su = sum(a)
if m <= (len(list(filter(lambda x: (su / (4 * m)) <= x, a)))):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
N,M = map(int,input().split())	
a = list(map(int , input().split()))
count=0

for i in a:
  if i*4*M >= sum(a):
    count+=1

    
if count>=M:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
line = sum(A) / (4 * M)
count = 0
for i in A:
  if (i >= line):
    count += 1
if (count >= M):
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse = True)
b = 0
c = 0
d = ""
l = 1 / (4 * m)
for i in a:
    b += i
b = b * l
while c < m:
  if a[c] < b:
    d = "No"
  else:
    d = "Yes"
  c += 1
print(d)

Submission status: Accepted

Solution code:
n,m=map(int,input().split())
a=list(map(int,input().split()))
s=sum(a)
ans=0
for i in a:
    if i>=s/(4*m):
        ans+=1
if ans>=m:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
import unittest


class TestB(unittest.TestCase):
    def test_1(self):
        self.assertEqual(think([5, 4, 2, 1], 1), 'Yes')

    def test_2(self):
        self.assertEqual(think([380, 19, 1], 2), 'No')

    def test_3(self):
        self.assertEqual(think([4, 56, 78, 901, 2, 345, 67, 890, 123, 45, 6, 789], 3), 'Yes')


def solve():
    a, m = read()
    result = think(a, m)
    write(result)


def read():
    n, m = read_int(2)
    return read_int(n), m


def read_int(n):
    return read_type(int, n, sep=' ')


def read_float(n):
    return read_type(float, n, sep=' ')


def read_type(t, n, sep):
    return list(map(lambda x: t(x), read_line().split(sep)))[:n]


def read_line(n=0):
    if n == 0:
        return input().rstrip()
    else:
        return input().rstrip()[:n]


def think(a, m):
    total = sum(a)
    threshold = total // (4 * m) if total % (4 * m) == 0 else total // (4 * m) + 1
    return 'Yes' if len(list(filter(lambda x: x >= threshold, a))) >= m else 'No'


def write(result):
    print(result)


if __name__ == '__main__':
    # unittest.main()
    solve()

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
A = list(map(int, input().split()))

A.sort(reverse=True)
S = sum(A)

ans = True
for i in range(M):
    if A[i]*4*M < S:
        ans = False
        break

if ans:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
N,M = map(int,input().split())	
a = list(map(int , input().split()))
count=0

for i in a:
  if i*4*M >= sum(a):
    count+=1

    
if count>=M:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
N,M = map(int,input().split())

#A = list(input().split())
A =list(map(int, input().split()))

B = sorted(A)[::-1]

T=0
for i in range(N):
  T=T+B[i]
  
#print(B)
#print(B[M-1])
#print('total',T)
#print(B[M-1])

if B[M-1]>=T/4/M:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
def f(m, a):
    poll = sum(a)
    result = [i for i in a if i >= poll/4/m]
    print('Yes' if len(result) >= m else 'No')
 
n, m = map(int, input().split())
a = list(map(int, input().split()))
f(m, a)