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 = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse=True)

total = sum(A)
limit = total/(4*m)

cannot = 0
for i in range(m):
  if A[i]<limit:
    cannot=1
    break
    
if cannot:
  print('No')
else:
  print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

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

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

for i in range(M):
    if A[i] < check:
        print('No')
        sys.exit()
print('Yes')

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:
n,m = map(int, input().split())
a = list(map(int, input().split()))
sum = sum(a)
count = 0
for i in range(n):
    if(a[i]>=sum/(4*m)):
        count=count+1

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

Submission status: Accepted

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

    A.sort()
    if A[N - M] >= sum(A) * (1 / (4 * 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)
#print(a)
k=sum(a)/(m*4)
#print(k,a[m-1])
if a[m-1]<k:
  print("No")
else:
  print("Yes")

Submission status: Accepted

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

    if M > len(A):
        print('No')
        return

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

    for i in range(M):
        if (A[i] < total * (1 / (4 * M))):
            print('No')
            return

    print('Yes')


resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
nm=list(map(int, input().split(" ")))
n=nm[0]
m=nm[1]
votes=list(map(int, input().split(" ")))
can=sorted(votes,reverse=True)
#print(can)
stan=0
for vote in votes:
    stan+=vote
#print(stan)
if can[m-1]<stan/4/m:
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
ITEMS = list(map(int, input().split())) 
MAX = sum(ITEMS)
def solve():
    count = 0
    for item in reversed(list(sorted(ITEMS))):
        if item >= MAX * (1 / (4 * M)):
            count += 1
        if count >= M:
            print("Yes")
            return 
    
    print("No")
    
solve()

Submission status: Accepted

Solution code:
x=0;p=0
N,M=map(int,input().split())
A=list(map(int,input().split()))
x=sum(A)
for i in range(N):
  if 1/(4*M)<=A[i]/x:
    p=p+1
print("Yes" if p>=M else "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 range(n):
    if a[i] * 4 * m >= total:
        c = c + 1

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

Submission status: Accepted

Solution code:
import sys

N, M = map(int,input().split())
vote_list = list(map(int, input().split()))
mysum = sum(vote_list)
#print(mysum)
mycnt = 0
for v in vote_list:
    #print(v, 1/(4*M))
    if v >= mysum * (1/(4*M)):
        mycnt += 1
        if mycnt >= M:
            print('Yes')
            sys.exit()
print('No')

Submission status: Accepted

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

for i in a:
    su += i

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

if m <= num:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

for i in range(m):
    if a[n-i-1]*4*m<asum:
        #print(a[n-i-1]*4*m,a[n-i-1],asum)
        print("No")
        exit()
print("Yes")

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
a = list(map(int, input().split()))
b = sum(a) / (4 * m)
c = 0
for i in a:
    if i >= b:
        c += 1
if c >= m:
    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)
check = a_list[:m]
frag = True
for a in check:
  if a < sum(a_list)/(4*m):
    frag = False
if frag:
  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)
jogen=(s-1)//(4*m)

erabi=0

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

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

Submission status: Accepted

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

sum_a = sum(a_list)
# print(sum_a)
border = (1 / (4 * m)) * sum_a
# print(border)

count = 0
for a in a_list:
  if a >= border:
    count += 1
# print(count)

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

Submission status: Accepted

Solution code:
first = [int(i) for i in str(input()).split()]
n = first[0]
m = first[1]
a = [int(i) for i in str(input()).split()]

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

c= 0
for coso in a:
    if coso >= v:
        c += 1

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
from collections import Counter, deque


INF = float('inf')

""" Input
S = input()
N = int(input())
D = [int(input()) for _ in range(N)]
"""

def main():
    N, M = map(int, input().split())
    A = sorted(list(map(int, input().split())), reverse=True)
    total_score = sum(A)
    threshold = total_score * (1 / (4 * M))

    counter = 0
    for a in A:
        if threshold <= a:
            counter += 1

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


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)
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()))  #リスト

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

if cou >= 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)
A.sort(reverse=True)
if A[M-1] < V/(4*M):
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
A = list(map(int, input().split()))
to = sum(A)
cnt = 0
for a in A:
    if a>=(to * (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 = list(map(int, input().split()))

total = sum(A)
po = total*(1/(4*m))

cnt = 0
for a in A:
    if po <= a:
        cnt += 1


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

Submission status: Accepted

Solution code:
N, M, *A = map(int, open(0).read().split())

bound_product = sorted( A, reverse=True )[M-1]
total_votes = sum( A )

if ( bound_product / total_votes ) < 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()))

A.sort()

if A[-M] >= 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()))

count = 0
vote = sum(a)
for i in range(n):
    if a[i] >= vote/(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 = list(map(int, input().split()))
a.sort(reverse=True)

for i in range(m):
  if a[i] < sum(a)/(4*m):
    print('No')
    exit()
print('Yes')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, M = map(int, input().rstrip().split())
As = [int(x) for x in input().rstrip().split()]
# print(N, M)
# print(As)
total = sum(As)
count = len([True for x in As if x >= total / (4*M) ])
if count >= M:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
nm = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]

n = nm[0]
m = nm[1]

a_s = sorted(a)[::-1]
if a_s[m-1] < sum(a)/(4*m):
  print('No')
else:
  print('Yes')

Submission status: Accepted

Solution code:
import numpy as np
n, m = map(int, input().split())
A = list(map(int, input().split()))
s = sum(A)
A.sort()
index = n
for i in range(n):
    if A[i] >= s / (4 * m):
        index = i
        break

if (n - index) >= m:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
import sys
import math
import fractions
from collections import deque
from collections import defaultdict
sys.setrecursionlimit(10**7)

N, M = map(int, input().split())
A = list(map(int, input().split()))
border = sum(A) / (4 * M)
cnt = 0
for a in A:
    if a >= border:
        cnt += 1

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

Submission status: Accepted

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

cnt = 0
for item in lst:
  if item >= 1/(4*m) * sumn:
    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()))
A.sort(reverse=True)
s = sum(A)
cnt=0
for a in A:
    if a >=s/(4*m):
        cnt+=1
    else:
        break
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()))
m = 0
S = sum(A)
for i in range(N):
    if A[i] >= S / (4 * M):
        m += 1
if m >= 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()))
    A.sort(reverse=True)
    sumA = sum(A)
    
    ans = True
    for i in range(M):
        if (A[i] < sumA /(4*M)):
            ans = False

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#!usr/bin/env python3
import sys
import math
import string
import collections
import fractions
import random
from operator import itemgetter
import itertools
from collections import deque
import copy
import heapq
import bisect

MOD = 10 ** 9 + 7
INF = float('inf')
input = lambda: sys.stdin.readline().strip()

sys.setrecursionlimit(10 ** 8)

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

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

A.sort(reverse=True)
S = sum(A)
if S <= A[M - 1] * 4 * 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)
for i in range(m):
    if a[i] < (sum(a)*(1/(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()))
a.sort()
total=0
ans=0
for i in range(n):
    total+=a[i]
a.reverse()
for i in range(m):
    if a[i]>=total/(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()))
total = sum(A)
if sorted(A, reverse=True)[M-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(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()))
S=sum(A)
c=0
for i in A:
    if S<=i*4*M:
        c+=1
print("Yes" if c>=M else "No")

Submission status: Accepted

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

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

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

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

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

for a in A[:m]:
    if a < sumA / (4 * m):
        print('No')
        exit()
print('Yes')

Submission status: Accepted

Solution code:
def main():
    n, m = map(int, input().split())
    a = list(map(int, input().split()))
    sum_a = sum(a)
    si = sum_a / (4*m)
    aa = [ea for ea in a if ea >= si]
    if len(aa) >= 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()))
count = 0
judge = 0
for i in range(n):
  judge = judge + a[i]

judge = judge/(4*m)

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

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

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)

i_i = lambda: int(i_s())
i_l = lambda: list(map(int, stdin.readline().split()))
i_s = lambda: stdin.readline().rstrip()

N, M = i_l()
a = i_l()


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

Submission status: Accepted

Solution code:
N,M = map(int,input().split())
li = list(map(int,input().split()))
goukei=sum(li)
MM=goukei/(4*M)
count=0
for i in li:
  if i>=MM:
    count+=1
  else:
    pass
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)
suma=sum(a)
cnt=0
for i in a:
    #print(i)
    if i*4*m>=suma:
        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()))

ans = 'No'
c = 0
for i in a:
    if (1 / (4 * m)) <= i / sum(a):
        c += 1
if c >= m:
    ans = 'Yes'

print(ans)

Submission status: Accepted

Solution code:
import sys
N,M=map(int, sys.stdin.readline().split())
A=map(int, sys.stdin.readline().split())
b=float(sum(A))/M/4
cnt=0

for a in A:
    if b<=a:
        cnt+=1

if M<=cnt:
    print "Yes"
else:
    print "No"

Submission status: Accepted

Solution code:
import sys
from collections import defaultdict
n,m=map(int,sys.stdin.readline().split())
l=list(map(int,sys.stdin.readline().split()))
l.sort()
l.reverse()
limit=(sum(l)/(4*m))
i=0
#print(l,'l')
while i<n and l[i]>=limit:
    i+=1
if i>=m:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
alist = list(map(int, input().split()))
alist.sort(reverse=True)
tot = sum(alist)
if alist[m-1] < tot/(4*m):
  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)/(4*m)
if a[m-1]>=s:
    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)
cnt = 0
for i in range(N):
    if A[i]*4*M >= sumA:
        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())))[::-1]
b= sum(A)
c=True
for i in range(M):
  if A[i]<(b/(4*M)):
    c=False
if c==True:
  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()]
t=sum(a)/(4*m)
c=0
for i in range(n):
    if a[i]>=t:
        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()))

sum = 0
for i in A:
    sum += i
sum = sum/(4*M)

count = 0
for i in A:
    if i >= 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()))

sum=0
count=0

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

for i in range(n):
    if a[i]>=(sum/(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 = list(map(int, input().split()))
sa=sum(a)
a.sort(reverse=True)
flag="Yes"
for i in range(m):
    item = a[i]
    if sa/(4*m)>item:
        flag="No"
print(flag)

Submission status: Accepted

Solution code:
# /usr/bin/python3
# -*- coding: utf-8 -*-
from queue import Queue
from queue import LifoQueue as Stack
from math import sqrt, floor, ceil, log2
from fractions import gcd
from itertools import permutations, combinations
from operator import itemgetter
from functools import cmp_to_key


INF=1001001001
__MOD__=(10**9)+7
yn = 'YNeos'
judge = False
cnt = 0
ans = None


def lcm(a, b):
    return (a*b) // gcd(a,b)

def intinput():
    return int(input())

def mulinputs():
    return map(int,input().split())

def lineinputs(func=intinput):
    datas = []
    while True:
        try:
            datas.append(func())
        except EOFError:
            break
    return datas

class ModInt():
    def __init__(self, x):
        self.__x = (x % __MOD__)
    def __add__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x + other.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x + other.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __sub__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x - other.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x - other.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __mul__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x * other.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x * other.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __truediv__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x * other.__modinv())%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x * other.__modinv())%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __pow__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__(pow(self.__x, other.__x, __MOD__)))
        elif type(other) == ModInt:
            return self.__class__(pow(self.__x, other.__x, __MOD__))
        else:
            raise Exception("Not Int or Not ModInt")
    def __modinv(self, m=__MOD__):
        a = self.__x
        if a == 0:
            raise ZeroDivisionError()
        if gcd(a, m) != 1:
            raise Exception("%sの逆数は求まりません。" % a)
        b, u, v = m, 1, 0
        while b != 0:
            t = a//b;
            a -= t*b
            a, b = b, a
            u -= t * v
            u, v = v, u
        u %= m
        if u < 0:
            u += m
        return u
    def __int__(self):
        return self.__x



if __name__ == '__main__':
    N, M = mulinputs()
    datas = list(mulinputs())

    total = sum(datas)
    k = 1/(4*M) * total

    # 出力
    cnt = 0
    for d in datas:
        if d >= k:
            cnt += 1
            continue
    if cnt >= M:
        judge = True
    else:
        judge = False
    print(yn[not judge::2])

Submission status: Accepted

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

sum=0
for a in A:
    sum+=a
judge=sum/(4*M)
count=0
#print(judge)
for a in A:
    if a>=judge:
        count+=1

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

Submission status: Accepted

Solution code:
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

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

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

Submission status: Accepted

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

ans = filter(lambda a:a>=(sum(As)*(1/(M*4))), As)

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

def main():
    n, m = map(int, input().split())
    a = list(map(int, input().split()))
    sa = sum(a)
    f = [x for x in a if x * 4 * m >= sa]
    print("Yes" if len(f) >= m else "No")

if __name__ == "__main__":
    main()

Submission status: Accepted

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

a_sum = sum(a)
cnt = 0

def check(ai, m, a_sum):
    return ai*4*m >= a_sum

for ai in a:
    if check(ai, m, a_sum):
        cnt += 1

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

Submission status: Accepted

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

S = sum(A)

if B < S/(4*M):
    print('No')
else:
    print('Yes')

Submission status: Accepted

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

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

s = sum(A) // (4 * M) if not sum(A) % (4 * M) else sum(A) // (4 * M) + 1
c = sum([1 for a in A if a >= s])
print("Yes") if c >= M 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()]
thres = sum(A) / (4*m)
if len([i for i in range(n) if A[i]>= thres]) >= 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-1)//(4*m) + 1
count = 0
for i in range(n):
    if a[i] >= s:
        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()))
hyo = sum(A)

ans = 0
sait = hyo / (4*M)
for i in A:
    if i >= sait:
        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 = sorted(A,reverse=True)

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

Submission status: Accepted

Solution code:
N,M= list(map(int , input().split()))
A = sorted(map(int,input().split()),reverse=True)
sou = sum(A)
saitei = sou /(4*M)
B = A[0:M]
C = min(B)
if C >= saitei:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
a,b=[int(i) for i in input().split()]
arr=[int(i) for i in input().split()]
tot=sum(arr)
p=(tot/(4*b))
arr.sort()
if arr[-b]>=p:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
A = list(map(int, input().split()))
S = 0
counter = 0
for i in A:
    S = S + i
border = S / (4 * M)
for i in A:
    if i >= border:
        counter = counter + 1
result = "No"
if counter >= M:
    result = "Yes"
print(result)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,M= map(int, input().split())
A= sorted(list(map(int, input().split())))
f=0
for i in range(N):
    if A[i]>=sum(A)/(4*M):
        f+=1
if f>=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)
s=sum(a)
p=s/(4*m)

for i in range(m):
    if(p>a[i]):
        print("No")
        break
else:print("Yes")

Submission status: Accepted

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

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

Submission status: Accepted

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

cnt=0
for i in range(n):
    if A[i]<(asum/(4*m)):
        continue
    else:
        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()))
a.sort(reverse=True)
sum_a = sum(a)
if any([a[i] * 4 * m < sum_a for i in range(m)]):
  print('No')
else:
  print('Yes')

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
A=list(map(int,input().split()))
count=0
count2=0
flag=False
for i in range(N):
    count+=A[i]
for i in range(N):
    if A[i]>=count*1/(4*M) and flag==False:
        count2+=1
    if count2>=M:
        flag=True
        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()))
A.sort(reverse = True)
if A[M-1] >= sum(A) / (4 * M):
  print('Yes')
else: print('No')

Submission status: Accepted

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

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(N: int, M: int, A: "List[int]"):
    A.sort()
    filt = list(filter(lambda x: x >= sum(A)/(4*M), A))
    if len(filt) >= M:
        print(YES)
    else:
        print(NO)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, M, A)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# coding:utf-8

N,M=map(int, input().split())
A=[int(a) for a in input().split()]
s=sum(A)

A.sort(reverse=True)
if A[M-1]*4*M<s:
    print("No")
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()]
sumA = sum(A)
pop_cnt = 0
for a in A:
    if a >= (sumA/(4*M)):
        pop_cnt += 1
if pop_cnt >= M:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
# coding: utf-8


def main():
    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):
        return "Yes"
    else:
        return "No"


print(main())

Submission status: Accepted

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