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:
list = input().split()
vote_list = input().split()
is_accepted = True

sum = 0
for i in range(int(list[0])):
  sum += int(vote_list[i])

counter = 0
ave = 1/(4*int(list[1]))
for i in range(int(list[0])):
  if( int(vote_list[i]) < sum * ave):
    continue
  else:
    counter +=1
    
if counter >= int(list[1]):
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
A = list(map(int, input().split()))
total = sum(A) / (4 * M)
A.sort(reverse = True)
if A[M-1] >= total:
  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)
s=sum(A_list)
if A_list[m-1]>=s/(4*m):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
N,M=map(int, input().split())
A=list(map(int,input().split()))
C=sum(A)/(4*M)
count=0

for i in A:
    if i>=C:
        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)
c = sum(a)/(4*M)
print("Yes" if a[M-1] >= c else "No")

Submission status: Accepted

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

        ans = False
        total = 0

        A_sum = sum(A)
        threshold = A_sum/4/M

        for i in range(N):
                if A[i]>=threshold:
                        total += 1
                if total==M:
                        ans = True
                        break

        if ans:
                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()))

total = sum(A)

def check(score):
    return (True if score >= (total/(4*M)) else False)

cnt = 0
for i in range(N):
    if check(A[i]):
        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)*1.0) / (4 * M)

count = 0
for i in A:
  count += 1 if i >= S else 0

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

Submission status: Accepted

Solution code:
import numpy as np
n, m = [int(i) for i in input().split()]
a = np.array([int(i) for i in input().split()])
aa = a/(np.sum(a))
aa -= 1/(4*m)
flag = 0
aa = np.sort(aa)[::-1]

for i in range(n):
    if aa[i] < 0:
        flag += 0
    elif aa[i] >= 0:
        flag += 1

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

Submission status: Accepted

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

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

s = sum(l)

nl=sorted(l,reverse=True)



r = s/(4*m)

count=0

for i in range(m) :
    if nl[i]>=r:
        pass
    else :
        count += 1

if count > 0:
    print("No")
else :
    print("Yes")

Submission status: Accepted

Solution code:
n,m = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
a = sum(A)/(4*m)
for i in range(m):
    if A[-(i+1)] < a:
        print('No')
        exit()
print('Yes')

Submission status: Accepted

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

count = 0
for i in range(n):
    if a[i] >= sum(a) / (4*m):
        count += 1
if count >= m:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

N, M = map(int, input().rstrip().split())

votes = list(map(int, input().rstrip().split()))
ans = []

for i in range(len(votes)):
  if votes[i] >= sum(votes) / (4*M):
    ans.append(votes[i])

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

Submission status: Accepted

Solution code:
import numpy as np
n,m = map(int,input().split())
a = list(map(int,input().split()))
s = sum(a)
x = s*(1/(4*m))
aa = np.array(a)
if np.count_nonzero(aa >=x) >= m:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
N, M = map(int,input().split())
l = list(map(int,input().split()))
 
T = sum(l)
V = 1/(4*M) * T
S = len(list(filter(lambda x: x>=V, l)) )
 
print( "Yes" if S >= M else "No" )

Submission status: Accepted

Solution code:
n,m = [int(x) for x in input().split(' ')]

items = [int(a) for a in input().split(' ')]

selected = 0

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

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

Submission status: Accepted

Solution code:
from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    n, m = map(int, input().split())
    a = list(map(int, input().split()))
    limit = sum(a) / (4 * m)
    count = 0
    for i in range(n):
        if a[i] >= limit:
            count += 1
    if count >= m:
        print('Yes')
    else:
        print('No')


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()

Submission status: Accepted

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

total = 0
for i in range(n):
  total += a[i]


cnt = 0

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

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

Submission status: Accepted

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

ans = 0
for i in range(N):
    if A[i] >= sum(A)*Fraction(1,4*M):
        ans += 1
    else:
        continue

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()))
votes = sum(A)
res = "Yes"

A.sort(reverse=True)

for i in range(1, M+1):
    if A[i-1] < (votes / (4 * M)):
        res = "No"
        break

print(res)

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] < (sum(a) * (1 / (4 * m))):
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
#B
n, m = [int(_) for _ in input().split()]
a = [int(_) for _ in input().split()]
total = sum(a)
th = 1 / (4 * m) * total
import numpy as np
A = np.array(a)
A_sorted = A.argsort()[::-1]
# 上からM個選ぶ
if A[A_sorted[m - 1]] < th:
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
N,M= map(int,input().split())
A = list(map(int,input().strip().split()))
A.sort(reverse=True)
count=0
for i in range(M):
    if A[i]<((1/(4*M))*sum(A)):
        count+=1



if count==0:
    print("Yes")

else:
    print("No")

Submission status: Accepted

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

T = sum(l)
V = 1/(4*M) * T
S = len(list(filter(lambda x: x>=V, l)) )

print( "Yes" if S >= M else "No" )

Submission status: Accepted

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

c = 0

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

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()))
A.sort(reverse=True)

judge = sum(A)*1/(4*M)
cnt = 0
for i in range(M):
  if(A[i]>=judge):
    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()))
b=[0 for i in range(n)]
s=sum(a)

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Q=0
for i in range(N):
    if A[i]>=1/4/M*sum(A):
        Q+=1
if Q>=M:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
A = list(map(int, input().split()))
cnt = sum([1 for i in range(N) if A[i]*4*M >= sum(A)])

print('Yes' if cnt >= M else 'No')

Submission status: Accepted

Solution code:
n,m=map(int, input().split())
a=[int(x) for x in list(input().split())]
ans=0
suma=sum(a)
for i in range(len(a)):
        if a[i] >=(suma/(4*m)):
                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()))
r = [1 for _ in range(n)]
s = sum(a)
for i in range(n):
    if a[i]<s/(4*m):
        r[i] = 0
if sum(r)<m:
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
# ABC161B

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)

Submission status: Accepted

Solution code:
import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N,M = map(int, readline().split())
A = np.array(list(map(int, readline().split())))

sum_A = A.sum()
select_num = sum_A * (1/(4*M))
A = A // select_num
ans = 0
for i in range(len(A)):
  if A[i] < 1:
    A[i] = 0
  else:
    A[i] = 1

print('Yes' if A.sum() >= M else 'No')

Submission status: Accepted

Solution code:
def solve(string):
    n, m, *a = map(int, string.split())
    return "No" if len([_a for _a in a if _a >= sum(a) / 4 / m]) < m else "Yes"


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))

Submission status: Accepted

Solution code:
def main():
    N, M = list(map(int, input().split()))
    A = list(map(int, input().split()))
    av = sum(A) / (4 * M)
    print("Yes" if len([x for x in A if x >= av]) >= M else "No")

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

X = sum(A) / (4 * List[1])

c = 0
for i in range(0,List[0]):
    if A[i] >= X:
        c += 1

if c >= List[1]:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
sys.setrecursionlimit(10**7)
from pprint import pprint as pp
from pprint import pformat as pf
# @pysnooper.snoop()
#import pysnooper # debug

import math
#from sortedcontainers import SortedList, SortedDict, SortedSet # no in atcoder
import bisect


if __name__ == '__main__':
    n, m = list(map(int, input().split()))
    a_s = list(map(int, input().split()))

    threshold = sum(a_s) / (4 * m)
    count = 0
    for a in a_s:
        if a < threshold:
            continue
        count += 1
    #print('count') # debug
    #print(count) # debug
    if count >= m:
        print("Yes")
    else:
        print("No")

    #print('\33[32m' + 'end' + '\033[0m') # debug

Submission status: Accepted

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

Submission status: Accepted

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

sum = 0
for i in A:
    sum += int(i)

s = sum / 4 / m
ans = 0
for i in A:
    if int(i) >= s:
        ans += 1

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

Submission status: Accepted

Solution code:
if __name__ == "__main__":
    N, M = map(int, input().split())
    As = list(map(int, input().split()))
    As.sort(reverse=True)

    yes = True
    threshold = sum(As) / (4*M)
    for idx in range(M):
        if As[idx] < threshold:
            yes = False
            break
    
    if yes:
        print("Yes")
    else:
        print("No")

Submission status: Accepted

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

l = input().split(" ")
s = 0
for  i in l:
  m = int(i)
  s = s + m
 
q = s/(4*p)

c = 0
for i in l:
  m = int(i)
  if m >= q:
    c = c + 1
if c >= p:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

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

main()

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
aList = list(map(int, input().split()))
count = 0
numVote = 0
for a in aList:
    numVote += a
for a in aList:
    if(a >=  numVote / (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())))
new_A=[i for i in A if i>=sum(A)/(4*M)]
if(len(new_A)>=M):
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
import math
import time
from collections import defaultdict, deque
from sys import stdin, stdout
from bisect import bisect_left, bisect_right
n,m=map(int,stdin.readline().split())
a=list(map(int,stdin.readline().split()))
s=sum(a)
ans=0
for i in a:
    if(i<(s/(4*m))):
        continue
    ans+=1
if(ans>=m):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
_, M = map(int, input().split())
h = sorted(list(map(int, input().split())), reverse=True)
if h[M - 1] / sum(h) < 1 / (4 * M):
    print('No')
else:
    print('Yes')

Submission status: Accepted

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

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

if cnt < m:
    print('No')
else:
    print('Yes')

Submission status: Accepted

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

ans = 0

for i in A:
    if i >= sum(A) / 4 / M:
        ans += 1
    else:
        ans += 0

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

Submission status: Accepted

Solution code:
import math
n,m=map(int,input().split())
a=list(map(int,input().split()))
s=sum(a)
t=math.ceil(s/4/m)
a.sort()

cnt=0
for i in a:
  if i>=t:
    cnt+=1

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

Submission status: Accepted

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

list_A = sorted(list_A, reverse=True)

total_vote = sum(list_A)

if M > len(list_A):
    answer = 'No'
elif (list_A[M -1] / total_vote) < 1/(4*M):
    answer = 'No'
else:
    answer = 'Yes'

print(answer)

Submission status: Accepted

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

th=sum(a)/(m*4)
ans=[val for val in a if val >= th]

if len(ans) >= 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, A))
#A = list(map(int, input().split()))

A.sort(reverse=True)
#print(A)
#print(A[M-1], sum(A), 4*M, sum(A)/(4*M))

if A[M-1] >= sum(A)/(4*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)
#print(a)
if a[m - 1] < sum(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()))
b = 0
s = sum(a)

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

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
A = list(map(int, input().split()))
hyou = [0] * N
sou = 1/(4*M)
total = sum(A)
for i, a in enumerate(A):
    if a >= total*sou:
        hyou[i] = 1
if sum(hyou) >= 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)
evo = A_sum/(4*M)

counter = 0
for vote in A:
    if vote >= evo:
        counter += 1

if counter < M:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
import numpy as np

n, m = map(int, input().split())
a = np.array(list(map(int, input().split())) )

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

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
a = list(map(int, input().split()))
total = sum(a)
border = total / (4 * m)
ans = 0
for i in a:
    if i >= border:
        ans += 1

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

Submission status: Accepted

Solution code:
N, M = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]


A = sorted(A)[::-1]
total = sum(A)

OK = True
for i in range(M):
    if (A[i] * 4 * M) < total:
        OK = False

if OK:
    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 range(N):
    if A[i]>=(sum(A)*1/4/M):
        count+=1

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

Submission status: Accepted

Solution code:
n, m = list(map(int, input().split()))
a = sorted(list(map(int, input().split())), reverse = True)
if a[m - 1] >= sum(a) / (4 * 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)
a = [i / suma for i in a]
flag = True
for i in range(m):
    if a[i] < 1/(4*m):
        flag = False
        break

print('Yes') if flag else print('No')

Submission status: Accepted

Solution code:
from functools import reduce

N, M = map(int, input().split())
A = list(map(int, input().split()))
all_A = sum(A)
valid_A = list(filter(lambda x: x >= all_A/4/M, A))
if len(valid_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)
S = sum(A)
if A[M-1] >= S/(4*M):
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

s = []
for i in a:
    if i >= (sum(a)/(4*m)):
        s.append(1)
    else:
        s.append(0)

if s.count(1) >= m:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

kei = sum(a)
ans = 0
line = kei / 4 / m
for i in a:
    if i >= math.ceil(line):
        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()))

lim = 1/(4*m)

ans = 0
for a in A:
  a /= sum(A)
  if a>=lim:
    ans += 1
    
if ans >= m:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
import itertools
import math
import fractions
import functools
n, m = map(int, input().split())
a = list(map(int, input().split()))
count = 0
for i in range(n):
    if a[i] >= sum(a)/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()))

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

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

Submission status: Accepted

Solution code:
import sys
import math
import bisect

def main():
    n, m = map(int, input().split())
    A = list(map(int, input().split()))
    A.sort(reverse=True)
    total = sum(A)
    #print('A: %s' % str(A))
    ans = True
    for i in range(m):
        if A[i] * 4 * m < total:
            ans = False
            break
    if ans:
        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)
sum=0
for a in A:
    sum+=a

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

Submission status: Accepted

Solution code:
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
gross_vote = sum(A)
A_pop = [i for i in A if i>=gross_vote/4/M]
if len(A_pop)>=M:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

total = sum(A)
border = total / (4 * M)

for i in range(M):
    if A[i] < border:
        print('No')
        break
else:
    print('Yes')

Submission status: Accepted

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

print('Yes' if count>=m else 'No')

Submission status: Accepted

Solution code:
n, m = list(map(int,input().split()))
a = sorted(list(map(int, input().split())))
s, c = sum(a), 0
for i in a[::-1]:
    if i < s/(4*m):
        break
    else:
        c+=1
print('Yes' if c>=m else 'No')

Submission status: Accepted

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

    count = 0
    sum = 0

    for i in range(N):
        sum += A[i]

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

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

    ABC_161_B()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#入力をN Mで受ける
N,M = map(int,input().split())

#A1...ANを大きい順に並べ替えてAlistとして受ける
Alist = sorted(list(map(int,input().split())),reverse=True)

#M番目の商品の得票率(A[M番目]/sum(A1...AN))が1/4M以上はYes、未満はNo
if Alist[M-1] / sum(Alist) >= 1 / 4 / M:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
V = sum(A)
C = 0
for i in A:
    if i >= V / (4 * M):
        C += 1
    if C == M:
        break
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()))
total = sum(A)
count = 0
for i in range(N):
    if A[i] >= total / 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()))
limit = sum(a) * (1/(4*m))
ans=0
for i in range(n):
    if(a[i]<limit):
        continue
    ans += 1
if(ans >=m):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
import heapq

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

for i in heapq.nlargest(M,a):
    if(1 / (4 * M) <= i / sum(a)):
        count += 1

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

Submission status: Accepted

Solution code:
import heapq

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

for i in heapq.nlargest(M,a):
    if(1 / (4 * M) <= i / 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(map(int, input().split()))
judge = sum(A) / (4 * M)

L = [i for i in A if i >= judge]

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

Submission status: Accepted

Solution code:
n,m=map(int,input().split())
a=list(map(int,input().split()))
s=[]
M=sum(a)*(1/4/m)
for i in a:
    if i>=M:
        s.append(i)

if len(s)>=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 = 0
for i in range(n):
    t += a[i]

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

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]
 
sys.setrecursionlimit(1000000)
mod = 1000000007
 
def solve():
  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")
  return
 
#Solve
if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
N,M = map(int, input().split())
A = list(map(int, input().split()))
A = sorted(A)[::-1]

if all(a>=(sum(A)/(4*M)) for a in A[0:M]):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
n,m=map(int,input().split())
l=list(map(int,input().split()))
l.sort()
judge=sum(l)/(4*m)
if l[-m]>=judge:
    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)

print('Yes' if sum([x>=s/(4*m) for x in a])>=m else 'No')

Submission status: Accepted

Solution code:
N,M=map(int,input().split())
A=[int(x) for x in input().split()]
A=sorted(A)
add=0
for i in range(N):
    add+=A[i]
if 4*M*A[-M]<add:
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
import sys
import os
import bisect, collections, copy, itertools, math, string
def I(): return int(input())
def S(): return input()
def LI(): return list(map(int, input().split()))
def LS(): return list(input().split())

def solve():
	NM= LI()
	N = NM[0]
	M = NM[1]

	A = LI()

	_sum = 0
	for a in A:
		_sum += a

	x = _sum/(4* M)
	for a in A:
		if a >= x:
			M -= 1

	if M <= 0:
		print('Yes')
	else:
		print('No')

if __name__ == '__main__':
	solve()

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**7)
input = lambda: sys.stdin.readline().strip()

def main():
    N,M = map(int,input().split())
    A_list = sorted(list(map(int,input().split())),reverse=True)
    print("Yes" if A_list[M-1]>=sum(A_list)*(1/(4*M)) else "No")

main()

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
list = [int(x) for x in input().split()]
w = 0
for i in range(n):
  w +=  list[i]
list.sort()
if list[n-m] < (w / (4 * m)):
  print("No")
else:
  print("Yes")

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
import functools
N, M = list(map(int,input().split()))
A = list(map(int,input().split()))
ASUM = functools.reduce(lambda x, y: x + y, A)
if len([1 for i in range(N) if A[i]/ASUM*4*M >= 1]) >= 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()]
s = sum(a)
a.sort(reverse=True)
ans = 'Yes'
for i in range(m):
  if a[i] < s/(4*m):
    ans = 'No'
print(ans)

Submission status: Accepted

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

a_list = list(map(int, input().split())) 
a_sum = sum(a_list)

cnt = 0
for a in a_list:
    if a >= a_sum / (4*m): cnt += 1

if cnt >= 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()]
t = len([i for i in a if i * 4 * m >= sum(a)])
if t >= 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)
c=0
for a in A:
    if a >= s/(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 = list(map(int, input().split()))
A.sort(reverse = True)
if A[M - 1] >=sum(A)/(4*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)
reg = sum(a)
if a[m-1] >= reg/(4*m):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
   
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


n,m,*A=map(int,read().split())

A=sorted(A,reverse=True)

sum=sum(A)

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

Submission status: Accepted

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