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:
arr = list(map(int, input().rstrip().split()))
arr2 = list(map(int, input().rstrip().split()))
m = arr[1]
sum_arr2 = sum(arr2)
len_arr2 = len(arr2)
count = 0
popular = sum_arr2/(4*m)
i = 0
while i < len_arr2 and count < m:
    if arr2[i] >= popular:
        count += 1
    i += 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
for i in range(n):
    sum=sum+a[i]
    
x= (sum)/(4*m)
#print(x)
l=[]
for j in range(n):
    if(a[j] >= x):
        l.append(a[j])
#print(l)        
if(len(l)>=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()]

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

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

nn.sort(reverse = True)

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

Submission status: Accepted

Solution code:
n,m=map(int,raw_input().split())
a=sorted(map(int,raw_input().split()))
print 'No' if 4*m*a[n-m]<sum(a) else 'Yes'

Submission status: Accepted

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

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

flag = arr[m-1]*4*m >= total
print("Yes" if flag else "No")

Submission status: Accepted

Solution code:
#B
NM = input().split(' ')
N = int(NM[0]) ; M = int(NM[1])
Ai = input().split(' ')
all_A = 0
for k in Ai:
    all_A += int(k)
line = all_A / (4*M)
count = 0
for k in Ai:
    if int(k) >= line:
        count += 1
if count >= M:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
N,M=map(int, input().split())
array1=list(map(int, input().split()))
array2=sorted(array1, reverse=True)
Sum=0
for i in range(N):
        Sum += array2[i]
flg=0
for i in range(M):
    if array2[i] < Sum/(4*M):
        print('No')
        flg=1
        break
if flg == 0:
    print('Yes')

Submission status: Accepted

Solution code:
n,m=map(int,raw_input().split())
a=sorted(map(int,raw_input().split()))
print 'No' if (4*m)*a[n-m]<sum(a) else 'Yes'

Submission status: Accepted

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

if product_list[m-1] >= sum(product_list)/(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)

th = sum(a)/(4*m)
flag = True

for i in range(m):
    if a[i] >= th:
        flag = True
    else:
        flag = False

if flag == True:
    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())
ai = list(map(int,input().split()))
s = sum(ai)
count = 0
for i in ai:
  if i >= s/4/m:
    count += 1
if count >= m:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
n, m = [int(w) for w in input().strip().split()]
arr = [int(w) for w in input().strip().split()]
 
ss = sum(arr)
frac = ss/(4*m)
arr.sort(reverse=True)
if arr[m-1] >= frac:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
n,m=map(int,raw_input().split())
a=sorted(map(int,raw_input().split()),reverse=True)
print 'No' if (4*m)*a[m-1]<sum(a) else 'Yes'

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())
ai = list(map(int,input().split()))
s = sum(ai)
count = 0
for i in ai:
  if i >= s/(4*m):
    count += 1
if count >= m:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
c=list(map(int,input().split()))
required=sum(c)/(4*b)
count=0
for d in sorted(c,reverse=True):
    if d>=required:
        count+=1
    else:
        break
print("YNeos"[count<b::2])

Submission status: Accepted

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

a = sorted(A, reverse=True, key=int)

b = a[M-1]
c = sum(a)
d = 4*M

if b*d >= c:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
import bisect
import collections
import sys

sys.setrecursionlimit(100000)
input = sys.stdin.readline
ACMOD = 1000000007
INF = 1 << 62


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


def llmi(n):
    return [lmi() for _ in range(n)]


N, M = lmi()
B = lmi()

limit = sum(B)/4/M
if len(list(filter(lambda v:v>=limit,B))) >= 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]
print("Yes" if 4*m*a[m-1]>=sum(a) else "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([i*4*m>=s for i in a])>=m) else "No")

Submission status: Accepted

Solution code:
n,m=map(int,input().split())
a=list(map(int,input().split()))
sa=sum(a)
a.sort()
b=sa/(4*m)
flag=0
for i in range(m):
    if a[n-i-1]<b:
        flag=1
        break

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

Submission status: Accepted

Solution code:
from collections import defaultdict, deque
import sys
import heapq
import bisect
import itertools
import queue
import copy
import time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7

def inp(): return int(sys.stdin.readline())

def inpl(): return list(map(int, sys.stdin.readline().split()))

def inpl_str(): return list(sys.stdin.readline().split())

n, m = inpl()
a = inpl()
s = sum(a)
cnt = 0
for i in a:
    if i*(4*m) >= s:
        cnt += 1
if cnt >= m:
    print('Yes')
else: 
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

_,M = map(int, sys.stdin.readline().strip().split())
A = list(map(int, sys.stdin.readline().strip().split()))

if sum(A) <= sorted(A)[-M] * M * 4:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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


INF = float('inf')


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

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

p=0

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

    
for i in range(n):

    if l[i]>=s/(4*m):
        p+=1

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

Submission status: Accepted

Solution code:
from collections import defaultdict, deque
import sys
import heapq
import bisect
import itertools
import queue
import copy
import time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7

def inp(): return int(sys.stdin.readline())

def inpl(): return list(map(int, sys.stdin.readline().split()))

def inpl_str(): return list(sys.stdin.readline().split())

n, m = inpl()
a = inpl()
s = sum(a)
cnt = 0
for i in a:
    if i >= s/(4*m):
        cnt += 1
if cnt >= m:
    print('Yes')
else: 
    print('No')

Submission status: Accepted

Solution code:
N,M = (int(x) for x in input().split())
a = list(map(int,input().split()))
x = sum(a)*1/(4*M)

pick = 0
for (a_i) in a:
    if (a_i) >= x:
        pick += 1

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

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

Submission status: Accepted

Solution code:
b,c=map(int,input().split())
a=list(map(int,input().split()))
d=sum(a)
new_a=sorted(a)
e=-1
f=0
g=4*c

while new_a[e] >= d/g:
    e=e-1
    f=f+1
    if -e>b:
        break

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

Submission status: Accepted

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


for i in range(len(A)):
    B += A[i]
for i in range(len(A)):
    if A[i] >= B / (4 * M):
        count += 1
if count >= M :
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time


def I(): return int(input())


def S(): return input()


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


def MS(): return map(str, input().split())


def LI(): return [int(i) for i in input().split()]


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


def input(): return sys.stdin.readline().rstrip()


yn = {False: 'No', True: 'Yes'}
YN = {False: 'NO', True: 'YES'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']

show_flg = False
# show_flg = True


def main():
    N, M = MI()
    A = LI()
    s = sum(A)
    A = sorted(A, reverse=True)

    for i in range(M):
        a = s / (4 * M)
        # print(a)
        if A[i] < a:
            print('No')
            return

    print('Yes')


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n, m = (int(x) for x in input().split())
seq = sorted((int(x) for x in input().split()), reverse=True)
t = sum(seq) / (4*m)
for val in seq:
  if val >=t:
    m-=1
  else:
    break
if m < 1:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
import math
def getInput():
    return [int(i) for i in input().rstrip().split(' ')]
N, M = getInput()
A = getInput()
_4M = math.ceil(sum(A) / (4*M))
A.sort(reverse=True)
cnt = 0
for i in A:
    if i >= _4M:
        cnt += 1
print('Yes') if cnt >= M 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);
 
i = 0;
while i<n and a[i] >= sum(a)/(4*m):
    i += 1;
 
if i >= m :
    print('Yes');
else :
    print('No');

Submission status: Accepted

Solution code:
ok = 0
sum = 0
n, m= (int(x) for x in input('').split())
l = list(int(y) for y in input('').split())
for i in range(n):
  sum = sum + l[i]
for j in range(n):
  if l[j] >= sum * (1 / (4 * m)):
    ok = 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)
sumA = sum(A)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def getInput():
    return [int(i) for i in input().rstrip().split(' ')]
N, M = getInput()
A = getInput()
_4M = sum(A) / (4*M)
A.sort(reverse=True)
cnt = 0
for i in A:
    if i >= _4M:
        cnt += 1
print('Yes') if cnt >= M else print('No')

Submission status: Accepted

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

aa = sorted(a, reverse=True)

suma = sum(aa)
threshold = suma / (4 * m)

if aa[m-1] >= threshold:
    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)
print("YNeos"[sum(a[i]>=sum(a)/(4*m)for i in range(m))<m::2])

Submission status: Accepted

Solution code:
base = input().split()
re = input().split()
rev = []
n = int(base[0])
m = int(base[1])
for i in re:
  rev.append(int(i))
s = sum(rev)
rev.append(0)
rev.sort(reverse=True)
cnt = 0
while rev[0]>=(s/(4*m)):
  cnt += 1
  del rev[0]
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)
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()))
ans = 0
s = sum(a)
for i in a:
    if i >= s/(4*m):
        ans += 1
if ans >= 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)
print("YNeos"[sum([sum(a)/(4*m)<=a[i] for i in range(m)])!=m::2])

Submission status: Accepted

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

Submission status: Accepted

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

print('Yes' if sorted(A, reverse=True)[m-1] >= borderline else 'No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,m = map(int,raw_input().split())
a = map(int,raw_input().split())
a = sorted(a, reverse=True)
votes = sum(a)
yes = True
for i in xrange(m):
  if a[i]*4*m < votes:
    yes = False
if yes:
  print "Yes"
else:
  print "No"

Submission status: Accepted

Solution code:
b, c = map(int, input().split())
a = list(map(int, input().split()))
d = sum(a)
new_a = list(reversed(sorted(a)))
e = 0
f = 0
g = 4*c
while new_a[e] >= d/g:
    e = e+1
    f = f+1
    if e == b:
        break
if f >= c:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
n,m = map(int,input().split())
a = sorted(list(map(int,input().split())),reverse=1)
asum = sum(a)
if a[m-1] >= asum/(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()))
    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__':
    main()

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
A = sorted(list(map(int, input().split())))
ans = sum(x >= (sum(A) / (4 * M)) for x in A)
print('No' if ans < M else 'Yes')

Submission status: Accepted

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

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

print("Yes" if m <= ok_count else "No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7 # 998244353
input=lambda:sys.stdin.readline().rstrip()
def resolve():
    n, m = map(int,input().split())
    A = list(map(int,input().split()))
    s = sum(A)
    cnt = 0
    for a in A:
        cnt += 4 * m * a >= s
    print("Yes" if cnt >= m else "No")
resolve()

Submission status: Accepted

Solution code:
N,M = (int(x) for x in input().split())
A_list = [int(x) for x in input().split()]
A_sum = sum(A_list)
Bool_list = []
for A in A_list:
    if A >= (A_sum/(4*M)):
        Bool_list.append("True")
        
if (len(Bool_list)) >= 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)
for i in range(m):
    if a[i] < sum(a)/(4*m):
        print("No")
        exit()
print("Yes")

Submission status: Accepted

Solution code:
# coding: utf-8
import re
import math
import itertools
from copy import deepcopy
import fractions
import random
from heapq import heappop,heappush
import time
import os
import sys
import datetime
from functools import lru_cache
readline=sys.stdin.readline
sys.setrecursionlimit(2000)
#import numpy as np
alphabet="abcdefghijklmnopqrstuvwxyz"
mod=int(10**9+7)
inf=int(10**20)
def yn(b):
    if b:
        print("yes")
    else:
        print("no")
def Yn(b):
    if b:
        print("Yes")
    else:
        print("No")
def YN(b):
    if b:
        print("YES")
    else:
        print("NO")
class union_find():
    def __init__(self,n):
        self.n=n
        self.P=[a for a in range(N)]
        self.rank=[0]*n
 
    def find(self,x):
        if(x!=self.P[x]):self.P[x]=self.find(self.P[x])
        return self.P[x]
 
    def same(self,x,y):
        return self.find(x)==self.find(y)
 
    def link(self,x,y):
        if self.rank[x]<self.rank[y]:
            self.P[x]=y
        elif self.rank[y]<self.rank[x]:
            self.P[y]=x
        else:
            self.P[x]=y
            self.rank[y]+=1
 
    def unite(self,x,y):
        self.link(self.find(x),self.find(y))
 
    def size(self):
        S=set()
        for a in range(self.n):
            S.add(self.find(a))
        return len(S)
def is_power(a,b):#aはbの累乗数か
    now=b
    while now<a:
        now*=b
    if now==a:return True
    else:return False
def bin_(num,size):
    A=[0]*size
    for a in range(size):
        if (num>>(size-a-1))&1==1:
            A[a]=1
        else:
            A[a]=0
    return A
def fac_list(n,mod_=0):
    A=[1]*(n+1)
    for a in range(2,len(A)):
        A[a]=A[a-1]*a
        if(mod>0):A[a]%=mod_
    return A
def comb(n,r,mod,fac):
    if(n-r<0):return 0
    return (fac[n]*pow(fac[n-r],mod-2,mod)*pow(fac[r],mod-2,mod))%mod
def next_comb(num,size):
    x=num&(-num)
    y=num+x
    z=num&(~y)
    z//=x
    z=z>>1
    num=(y|z)
    if(num>=(1<<size)):return False
    else:
        return num
def get_primes(n,type="int"):
    A=[True]*(n+1)
    A[0]=False
    A[1]=False
    for a in range(2,n+1):
        if A[a]:
            for b in range(a*2,n+1,a):
                A[b]=False
    if(type=="bool"):return A
    B=[]
    for a in range(n+1):
        if(A[a]):B.append(a)
    return B
def is_prime(num):
    if(num<=2):return False
    i=2
    while i*i<=num:
       if(num%i==0):return False
       i+=1
    return True
def ifelse(a,b,c):
    if a:return b
    else:return  c
def join(A,c=" "):
    n=len(A)
    A=list(map(str,A))
    s=""
    for a in range(n):
        s+=A[a]
        if(a<n-1):s+=c
    return s
def factorize(n,type_="dict"):
    b = 2
    list_ = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            list_.append(b)
        b+=1
    if n > 1:list_.append(n)
    if type_=="dict":
        dic={}
        for a in list_:
            if a in dic:
                dic[a]+=1
            else:
                dic[a]=1
        return dic
    elif type_=="list":
        return list_
    else:
        return None
############################################
N,M=map(int,input().split())
A=list(map(int,input().split()))
Yn(len([a for a in A if a*4*M>=sum(A)])>=M)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

ans = N - x

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

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
ai = list(map(int, input().split()))
required = sum(ai) / (4 * m)
count = 0
for a in sorted(ai, reverse=True):
    if a >= required:
        count += 1
    else:
        break
print("YNeos"[count < m::2])

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
A = list(map(int, input().split()))
vote_sum = sum(A)
cnt = 0
y = "Yes"
n = "No"

for i in range(N):
	if (A[i]*4*M) >= vote_sum:
		cnt += 1

if cnt >= M:
	print(y)
else:
	print(n)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N,m=input().split()
M=int(m)
As_org=[]
As_org=input().split()
As=sorted([int(i) for i in As_org], reverse=True)

Amax = int(max(As))
total=sum(As)

frag=0
i=0

while i <=M-1:
    Ai=As[i]
    if Ai < total/ (4*M):
        frag +=1
        break
    i+=1
if frag>0:
    print("No")
else:
    print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import os

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N, M = il()
    A = il()
    sm = sum(A)
    A.sort(reverse=True)

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math
n, m = map(int, input().split())
a = sorted(list(map(int,input().split())))
suma = sum(a)
a = [i for i in a if i * 4 * m >= suma]
ans = (len(a) >= m)
print("Yes" if ans else "No")

Submission status: Accepted

Solution code:
import sys
import os

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N, M = il()
    A = il()
    sm = sum(A)
    mi = sm / (4*M)
    cnt = 0

    for a in A:
        if a >= mi: cnt += 1

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math
N,M = map(int,input().split())
l = [int(i) for i in input().split()]
l.sort(reverse = True)
l_sum = sum(l)
d = (1/(4*M))*l_sum
cnt = 0
 
for i in range(N):
    if l[i] >= d:
        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()))

count =0
souhyou = sum(A)
for i in range(N):
    if A[i]>=souhyou/(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()
s=0
for i in range(0,n):
  s+=a[i];
s/=(4*m)
c=0
for i in range(0,n):
  if a[i]>=s:
    c+=1;
if c>=m:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
a_lst = []
a_lst = list(map(int, input().split()))
# print()
percent = sum(a_lst) / (4 * m)
cnt = 0
for i in range(n):
    # print("a", a_lst[i])
    # 同値の場合を書いてなくて1WAあほまぬけ
    if a_lst[i] >= percent:
        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()]

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

if cnt >= M:
    print('{}'.format('Yes'))
else:
    print('{}'.format('No'))

Submission status: Accepted

Solution code:
n, m = (int(x) for x in input().split())
num_point = [int(x) for x in input().split()]
count = 0
 
for n in num_point:
    if n >= (sum(num_point) / (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(reverse=True)
sum_ = 0
for i in a:
    sum_ +=i
if(a[m-1]>=sum_/(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]"):

    sumA = sum(A)
    sortA = sorted(A, reverse=True)

    thresh = sumA / (4*M)

    for a in range(M):

        if sortA[a] < thresh:
            print(NO)
            return
    print(YES)
    return



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:
n,m = map(int,input().split())
l = list(map(int,input().split()))

s = sum(l)
    
#print('s=%d' %s)

l = sorted(l,reverse=True)

#print(l)

x = (1 / (4*m)) * s
ans = 0

#print('x = %d' %x)


for i in range(m):
    if(l[i] >= x):
        ans = ans + 1
    #print('l[%d]=%d' %(i,l[i]))

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
import numpy as np
 
YES = "Yes"  # type: str
NO = "No"  # type: str
 
 
def solve(N: int, M: int, A: "List[int]"):
    A = np.array(A)
    n_sum = np.sum(A)/4/M
    if len(set(A)) != N:
        print("??")
    if (A >= n_sum).sum() >= 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:
n,m=map(int,input().split())
a=list(map(int,input().split()))
unta=sum(a)

dsrxq=0
for i in range(n):
  if a[i]*4*m>=unta:
    dsrxq+=1
if dsrxq>=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)

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) #票数の大きい順に並べる
if A[M-1] >= S / (4*M) : print("Yes") #この条件より大きい要素が(M-1)個あれば題意を満たす
else :print("No")

Submission status: Accepted

Solution code:
import sys

stdin = sys.stdin
inf = 1 << 60
mod = 1000000007

ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

n, m = na()
a = na()

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())
list=[int(i) for i in input().split()]

vote = 0


for v in list :
    vote = vote + v

judge = vote / (4 * M)

pop = 0
for x in range(0, N) :
    if list[x] >= judge :
        pop = pop + 1

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