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:
"""
NTC here
"""
import sys
inp = sys.stdin.readline
def input(): return inp().strip()
# flush= sys.stdout.flush
# import threading
# sys.setrecursionlimit(10**6)
# threading.stack_size(2**26)
 
def iin(): return int(input())
 
 
def lin(): return list(map(int, input().split()))
 
 
# range = xrange
# input = raw_input
 
def main():
    T = 1
    while T:
        T-=1
        n, m = lin()
        a = lin()
        sm = sum(a)
        ch = 0
        lst = sm/(4*m)
        for i in a:
            if i>=lst:
                ch+=1
        print('Yes' if ch>=m else 'No')

 
 
 
 
 
main()
 
# threading.Thread(target=main).start()

Submission status: Accepted

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

t = sum(A)
ans = 0
for a in A:
    if a * 4 * M >= t:
        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()))

S=0

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

if S>=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)
r = 'Yes'
t = sum(a)
for i in range(m):
    if a[i] < t / (4 * m):
        r = 'No'
        break
print(r)

Submission status: Accepted

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

list.sort(A,reverse=True)

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

Submission status: Accepted

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

Submission status: Accepted

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

if O >= 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()
A.reverse()
if A[M-1] >= sum(A)/4/M:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque
from decimal import *


def lcm(x, y):
    return (x * y) // math.gcd(x, y)


if __name__ == '__main__':
    b, c = map(int, input().split())

    a = [int(i) for i in input().split()]
    t = sum(a)
    a.sort(reverse=True)
    count = 0
    for i in range(c):
        if a[i] / t >= 1 / (4 * c):
            count += 1
    if count == c:
        print("Yes")
    else:
        print("No")

Submission status: Accepted

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

for i in range(0, M):
  if M == 0:
    break
  if A[i]<(sum/(4*M)):
    print('No')
    flag = 1
    break

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

Submission status: Accepted

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

Submission status: Accepted

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

t = input().split()
n = int(t[0])
m = int(t[1])

a = sorted(map(int, input().split()))

s = sum(a)

if a[n-m] < s/(4*m):
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
N, M = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
A.sort()
A.reverse()
total = 0
Flag = True
for i in A:
    total += i
for i in range(M):
    if A[i]*4*M < total:
        Flag = False
if Flag:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

"1 2 3 4 5を配列に"
A = list(map(int, input().split()))
s = sum(A)
ok = s * (1/(4*M))
count = 0

for a in A:
  if a >= ok:
    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()))
l = []

for i in a:
    if i >= sum(a) / (4 * m):
        l.append(i)

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()))

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

Submission status: Accepted

Solution code:
in1 = input().split()
in1num = [int(x) for x in in1]
a = input().split()
anum = [int(x) for x in a]
sum_a = sum(anum)
anum.sort(reverse=True)

N = in1num[0]
M = in1num[1]

#print(sum_a)
#print((sum_a)/(4*M))
#print(anum[M-1])

if anum[M-1] >= (sum_a)/(4*M):
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

a = input().split()
for i in range(len(a)):
    a[i] = int(a[i])
tot = sum(a)
a = sorted(a, reverse=True)
count = 0
for j in range(len(a)):
    max = a[0]
    if max < tot / 4 / m:
        break
    count += 1
    a.pop(0)

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

Submission status: Accepted

Solution code:
import bisect
n,m = [int(i) for i in input().split()]
al = sorted([int(i) for i in input().split()],reverse = True)
total = sum(al)

l = al[:m]

if l[-1] >= total/(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()
A.reverse()
B = sum(A) / (4 * M)
C  = [A[j] for j in range(M) if A[j] >= B]
print('Yes' if len(C) == M else 'No')

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力

N, M = map(int, input().split())
lst = list(map(int, input().split()))

votes = sum(lst)
threshold = votes * (1/(4*M))

lst = sorted(lst,reverse=True)

index = M-1
if(lst[index] >= threshold):
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
A = list(map(int, input().split()))
sum = sum(A)
cnt = 0
for i in range(N):
    if A[i] < sum*(1/(4*M)):
        cnt += 1
if (len(A) - 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)
min = s / (4 * M)
cnt = 0
for a in A:
  if a >= min:
    cnt += 1
if M <= cnt:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
n, m = map(int,input().split())
A = sorted([i for i in map(int,input().split())])
total = sum(A)
if A[-m] >= total/4/m:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N, M = map(int, input().split())
count = 0
nums = [int(x.strip()) for x in input().split(' ')]
num_sum = sum(nums)
tmp = num_sum / (4*M)

for num in nums:
  if not num < tmp:
    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()))

su=sum(A)
i=0
while max(A)*4*M>=su:
    i+=1
    A.remove(max(A))
    if i>=M:
        print("Yes")
        break
else:
    print("No")

Submission status: Accepted

Solution code:
# coding: utf-8
 
a=list(map(int,input().split()))
#読み込み
N = a[0]
M = a[1]
 
b=list(map(int,input().split()))
#総得票数
Sum_vote = sum(b)
list.sort(b, reverse=True)

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

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
shina = list(map(int, input().split()))
shina.sort(reverse=True)
hantei = 0
sou = sum(shina)

for i in range(M):
  if shina[i] < sou / (4 * M):
    hantei += 1

if hantei == 0:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,m = map(int, input().split())		# 5 7 2

A = sorted(list( map(int, input().split()) ), reverse=True)	# 1 2 3 4 5 ...(降順(逆順)ソート付き)

ans="Yes"
if A[m-1]*4*m < sum(A): ans="No"

print(ans)

Submission status: Accepted

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

a = sorted(a, reverse = True)
if a[m-1] >= sum(a) / (4*m):
  ans = "Yes"
else:
  ans = "No"
print(ans)

Submission status: Accepted

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

count = 0
x = 4 * M
v = sum(B) / x

for i in B:
    if i >= v:
        count += 1

if count >= 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()))

t = math.ceil(sum(a)/(4*m))
ans = 0
for i in a:
  if t <= i:
    ans += 1
    
if m <= ans:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
AList=list(map(int, input().split()))
ALists=sorted(AList,reverse=True)
tot=sum(AList)
for i in range(M):
    if(ALists[i]*1.0/tot<1.0/(4.0*M)):
        print('No')
        i-=1
        break
if(i==M-1):
    print('Yes')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

votes = input().split(" ")
votes = [int(vote) for vote in votes]
votes.sort(reverse=True)

check_vote = votes[m-1]

if check_vote >= sum(votes) / (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=sum(A)
S=S/(4*M)
A.sort(reverse=True)
if A[M-1]>=S:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
n,m = map(int,input().split())
l = list(map(int,input().split()))
sl = sum(l) * (1 / (4 * m))
ok = 0

for i in range(len(l)):
  if l[i] >= sl:
    ok += 1
if ok >= 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 = sum(A)
if A[M-1]<b/(4*M):
  print('No')
else:
  print('Yes')

Submission status: Accepted

Solution code:
import sys

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

nM=0
As=sorted(A, reverse=True)
threshold=float(sum(A)/(4*M))
#print(As, sum(A), threshold)

last=A[0]

for i in range(N):
    if not(float(As[i]) < threshold):
        nM+=1
    else:
        break
    
    if nM>=M:
        break

#print(nM,M)
if nM>=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)
border = total_votes / (4 * m)

count = 0
for a in votes:
    if a < border:
        continue
    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(' ')))

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

boader = totalVote / (4*M)

countPopularItem = 0
for a in A:
    if a >= boader:
        countPopularItem += 1

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

Submission status: Accepted

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

As = list(map(int,input().split()))
vote_sum = sum(As)
least_vote_num = vote_sum / (4 * M)

if len([A for A in As if A >= least_vote_num]) >= M:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
n, m = input().split()
m = int(m)
s = 0
r = 'Yes'
v = [ int(x) for x in input().split(' ') if x != ' ']
v.sort(reverse=True)
for i in v:
  s += i
s = s / 4 / m
for i in range(m):
  if v[i] < s:
    r = 'No'
    break
    
print(r)

Submission status: Accepted

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

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

ksum= sum(k)
k.sort(reverse=True)
#print(k)
p = 'Yes'
for i in range(b):
    #print(i)
    if k[i] < ksum/4/b:
        p = 'No'
        break
print(p)

Submission status: Accepted

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

list_sum = sum(List)

count = 0
for i in List:
    if i * 4 * m >= list_sum:
        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()))
k=1/(4*M)
t=0
S=0
for i in range(N):
  S=S+A[i]
for i in range(N):
  if A[i]>=S*k:
    t=t+1
  else:
    continue
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()))
total = sum(a)
c = 0
for i in a:
  if i >= total/(4*m):
    c += 1
if c >= m:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
[N,M] = [int(x) for x in input().split()]
l = [int(x) for x in input().split()]
l.sort()
ans = 0
for i in range(N):
    ans += l[i]

if l[N-M] >= ans/(4*M):
    print('Yes')
else:
    print('No')

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

SUM = sum(A)
count = 0
for a in A:
    if a >= SUM / (4*M):
        count += 1
    
    if M == count:
        print("Yes")
        exit()

print("No")

Submission status: Accepted

Solution code:
#B
import numpy as np
n,m=map(int,input().split())
a=list(np.fromstring(input(),int,sep=' '))
a.sort(reverse=True)
if a[m-1]<sum(a)/(4*m):
    print("No")
else:
    print("Yes")

Submission status: Accepted

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

n = a[0]
m = a[1]
co = 0
for i in range(n):
  if b[i]>=sum(b)/(4*m):
    co = co+1
if co >= 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)
x = sum(A)
min_ = x / (4*M)
flag = 0

for i, a in enumerate(A):
  if a < min_:
    break
  if i+1 == M:
    flag = 1
    break
if flag == 1:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
import numpy as np

n,m = list(map(int, input().split()))
a = np.array(list(map(int, input().split())))
b=np.sum(a)
a_sort=np.sort(a)[::-1]
if a_sort[m-1]<b/(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=0
for i in range(N):
	S=S+A[i]
min=S/(4*M)
count=0
for i in range(N):
	if A[i]>=min:
		count=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()))
total = sum(A)
if len([i for i in A if i >= total/(4*M)])>= M:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

sm = sum(aL)

cnt = 0
for a in aL:
    if sm * (1 / (4 * m)) <= a:
        cnt += 1
    if m <= cnt:
        print("Yes")
        exit()

print("No")

Submission status: Accepted

Solution code:
import sys
n,m = map(int,input().split())
l = sorted(list(map(int,input().split())),reverse=True)
for i in range(m):
    if l[i] < sum(l) * 1/(4*m):
        print('No')
        sys.exit()
print('Yes')

Submission status: Accepted

Solution code:
n,m = map(int,input().split()) #n種類　M個えらぶ
a = list(map(int,input().split()))
sum_list = sum(a)

count = 0
for i in range(n):
    if a[i] >= sum_list/(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()))

x = 0

A = sorted(A, reverse=True)

for i in A:    #総投票数
    x += i

if A[M-1] >= x*float(1/(4*M)):
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

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

Submission status: Accepted

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

num = 0

for i in list:
    if i >= sum(list)/(4*M):
        num+=1

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

Submission status: Accepted

Solution code:
def main():
    mylist = []
    for i in range(2):
        mylist.append(input())
    N, M = list(map(int, mylist[0].split()))
    votes = list(map(int, mylist[1].split()))

    v_sum = sum(votes)

    votes.sort(reverse=True)

    flag = True
    for i in range(M):
        if votes[i] < v_sum / (4 * M):
            flag = False

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



if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N, M = map(int,input().split())
AA = list(map(int,input().split()))
AA.sort()
SUM = sum(AA)
TH = SUM/4/M
if AA[-M]>=TH:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

count = 0
votes = sum(A)

for a in A:
	if a/votes >= 1/(4*M):
		count += 1

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

Submission status: Accepted

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

votes= sum(arr)
lim=math.ceil(votes/(4*m))
m_arr= [i for i in arr if i>= lim]
if len(m_arr)>=m:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
def listint():
    a = input().split()
    for i in range(len(a)):
        a[i] = int(a[i])
    return a
n,m = listint()
votes = listint()
sumvo = sum(votes)
able = 0
for i in range(n):
    if votes[i] >= sumvo/(4*m):
        able = able+1
if able >= m:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
#B
N,M=map(int,input().split())
A=[int(i) for i in input().split()]
SUM=sum(A)
cnt=0
for a in A:
    if 4*M*a>=SUM:
        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()))
num=sum(a)
tmp=float(num)/float(4.0*m)
count=0
for i in range(n):
  if a[i]>=tmp:
    count+=1
if count>=m:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc161/tasks/abc161_b
N, M = map(int, input().split())
A = list(map(int, input().split()))
total = sum(A)
limit = total / (4 * M)

count = 0
for a in A:
    count += (a >= limit)

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)
print("Yes" if A[M-1] * 4 * M >= sum(A) else "No")

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
rr = range


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_tuple(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_col(H, n_cols):
    '''
    H is number of rows
    n_cols is number of cols
    A列、B列が与えられるようなとき
    '''
    ret = [[] for _ in range(n_cols)]
    for _ in range(H):
        tmp = list(map(int, read().split()))
        for col in range(n_cols):
            ret[col].append(tmp[col])
    return ret


def read_matrix(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため


def read_map(H):
    '''
    H is number of rows
    文字列で与えられた盤面を読み取る用
    '''
    return [read()[:-1] for _ in range(H)]


def read_map_as_int(H):
    '''
    #→1,.→0として読み込む
    '''
    ret = []
    for _ in range(H):
        ret.append([1 if s == '#' else 0 for s in read()[:-1]])
        # 内包表記はpypyでは若干遅いことに注意
        # #numpy使うだろうからこれを残しておくけど
    return ret


MOD = 10**9 + 7
INF = 2**31  # 2147483648 > 10**9
# default import
from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  # , insort_left, insort_right
from fractions import gcd


def lcm(a, b):
    # 最小公倍数
    g = gcd(a, b)
    return a * b // g


N, M = read_ints()
A = read_ints()

thre = sum(A) / (4 * M)
cnt = 0
for a in A:
    if a >= thre:
        cnt += 1
print('Yes' if cnt >= M else 'No')

Submission status: Accepted

Solution code:
import math

N,M=map(int,input().split(" "))
A=[int(_) for _ in input().split(" ")]

s = math.ceil(sum(A) / (4*M))

#print(s)
count = 0

for i in range(N):
  if A[i] >= s:
    count += 1

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

Submission status: Accepted

Solution code:
N,M = list(map(lambda x:int(x),input().split()))
A_list = list(map(lambda x:int(x),input().split()))
A_total = 0
can_be_choosen = 0

for n in A_list:
    A_total += n

for n in range(len(A_list)):
    if not (float(A_list[n]) < (A_total*(1.0/(4.0 * M)))):
        can_be_choosen += 1

if can_be_choosen >= 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()
l.reverse()
a = sum(l)
for i in range(m):
  if l[i]/a < 1/(4*m):
    print('No')
    exit()
print('Yes')

Submission status: Accepted

Solution code:
NM = list(map(int, input().split()))
N = NM[0]
M = NM[1]
vote = list(map(int, input().split()))
vote.sort()
voteSum = 0
for j in vote:
    voteSum += j
if vote[-M]/voteSum >= 1/(4*M):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
l = input().split()
l = [int(i) for i in l]  
l.sort(reverse=True)
val = sum(l)
deadline = val/(4*M)
if l[M-1] >= deadline:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
def main():
    N, M = map(int, input().split())
    A_list = [A for A in input().split()]
    A_list = list(map(int, A_list))
    A_list.sort(reverse = True)

    value_sum = float(sum(A_list))
    fourM = float(4 * M)
    i_cycle = 0
    for Ai in A_list :
        i_cycle = i_cycle + 1
        #print(1 / fourM)
        if Ai / value_sum >= (1 / fourM) and i_cycle <= M :
            if i_cycle == M :
                print("Yes")
                break
        #elif Ai / value_sum < (1 / fourM) and i_cycle <= M :
        #    print("No")
        #    break
        else :
            print("No")
            break

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:

n,m= map(int,input().split())
a = list(map(int,input().split()))[:n]

s = sum(a)
t = s * (1/(4*m))

r=0

for i in range(n):
    if a[i] >= t :r+=1


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

Submission status: Accepted

Solution code:
# coding : utf-8

N, M = list(map(int, input().split()))
arr = list(map(int, input().split()))

border = sum(arr) / (4*M)

count = 0
for arr_i in arr:
    if(arr_i >= border):
        count+=1

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

Submission status: Accepted

Solution code:
import sys
N,M = map(int, input().split())
a = list(map(int,input().split()))
a.sort(reverse=True)
a_sum = sum(a)
for i in range(M):
    if(a[i] < a_sum/(4*M)):
        print("No")
        sys.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):
    bool_over = a[i] >= (sum(a)/(4*M))
    if(bool_over):
        count +=1

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

Submission status: Accepted

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

max = 0
for ai in a:
  max += int(ai)

ss = max / (4 * m)

rs = 0
for ai in a:
  if float(ai) >= ss:
  	rs += 1

if rs >= 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)
a.sort(reverse=True)
ans = 'Yes'
for i in range(m):
    if a[i] < votes / (4 * m):
        ans = 'No'
        break
print(ans)

Submission status: Accepted

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

    total = sum(a)
    boarder = (1/(4*m)) * total
    chosen = 0

    for i in range(len(a)):
        if(a[i]>=boarder):
            chosen = chosen + 1

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

main()

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 a:
    if i >= total * (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.sort()
a = a[::-1]
pop = []
counter = 0
for i in range(m):
    pop.append(a[i])

all_vote = 0
for i in a:
    all_vote += i

for n in pop:
    if n*4*m < all_vote:
        print("No")
        break
    else:
        counter += 1

if counter == m:
    print("Yes")

Submission status: Accepted

Solution code:
n,m=input().split()
a = [int(e) for e in input().split()]
a.sort()
a.reverse()

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

Submission status: Accepted

Solution code:
N, M = input().split()
A_lst = input().split()
total = sum([int(i) for i in A_lst])
th = total/(4*int(M))
count = sum([int(i) >= th for i in A_lst])
if count >= int(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)
c = 0
p = 0
for el in l:
    if el >= (s/(m*4)):
        c = c + 1
    if c == m:
        p = 1
        break

if p == 1:
    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)
c = 0
for i in range(n):
  if a[i] >= x:
    c += 1
  if c >= m:
    print('Yes')
    break
if c < m:
  print('No')

Submission status: Accepted

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

a = list(filter(lambda x: x>=sum(a)/(4.0*M),a))
if len(a) >= M:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
a = input().split()
a = [int(_) for _ in a]

total_amount = sum(a)
threshold = 1/(4*m) * total_amount
clear_a = [_ for _ in a if _ >= threshold]
if len(clear_a) >= m:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8

n, m = map(int, input().split())

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

border = sum(a_list) / (4 * m)

a_choiced_list = [a for a in a_list if a >= border]

if len(a_choiced_list) < m:
    print('No')
else:
    print('Yes')

Submission status: Accepted

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

sum_a = sum(a)
jouken = sum_a / (m * 4)
#print(jouken)
c = 0
for i in range(n):
    if a[i] >= jouken:
        c += 1
if c >= m:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
n, m = list(map(int, input().split(" ")))
a_list = list(map(int, input().split(" ")))
a_sum = sum(a_list)
criteria = (1 / (4 * m)) * a_sum
a_list.sort()
a_list.reverse()
def check(a_list, m):
  for a in a_list:
    if a < criteria:
      return False
    m -= 1
    if m == 0:
      return True
result = check(a_list, m)
if result:
  print("Yes")
else:
  print("No")