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 = list(map(int, input().split()))
alst = list(map(int, input().split()))
cnt = 0
sum = 0
for x in alst:
  sum += x
min = sum / (4 * m)
for a in alst:
  if a >= min:
    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()))
sumA = sum(A)
cnt = sum(a >= (sumA - 1) // (4 * m) + 1 for a in A)
if cnt >= m:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

flag = [0]*N
sumAn = sum(An)
threshold = sumAn/(4*M)
for i, A in enumerate(An):
  if A >= threshold: flag[i] = 1

print("Yes" if sum(flag) >= M else "No")

Submission status: Accepted

Solution code:
def solve(n, m, a_list):
    cnt = 0
    if sum(a_list) % (4 * m) == 0:
        bar = sum(a_list) // (4 * m)
    else:
        bar = sum(a_list) // (4 * m) + 1
    for a in a_list:
        if a >= bar:
            cnt += 1
    if cnt >= m:
        return "Yes"
    else:
        return "No"


def main():
    n, m = map(int, input().split())
    a_list = list(map(int, input().split()))
    res = solve(n, m, a_list)
    print(res)


def test():
    assert solve(4, 1, [5, 4, 2, 1]) == "Yes"
    assert solve(3, 2, [300, 19, 1]) == "No"
    assert solve(12, 3, [4, 56, 78, 901, 2, 345, 67, 890, 123, 45, 6, 789]) == "Yes"


if __name__ == "__main__":
    test()
    main()

Submission status: Accepted

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

s = sum(a)
counta = 0

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

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

Submission status: Accepted

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

num = 0
tot = sum(a)
for ai in a:
    if ai * 4 * m >= tot:
        num += 1

if num >= 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()
kei=0

for i in a:
  kei+=i

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

Submission status: Accepted

Solution code:
input = raw_input

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

suma = sum(a_list)
th = float(suma) / (4*m)

count = 0
for a in a_list:
    if a * 4* m >= suma:
        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()))
s = sum(A)
t = 0
for x in A:
    if 4*M*x >= s:
        t += 1
print("Yes" if t >= M else "No")

Submission status: Accepted

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

Submission status: Accepted

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

import sys

DEBUG = False

def read(t):
    return t(sys.stdin.readline().rstrip())


def read_list(t, sep = " "):
    return [t(s) for s in sys.stdin.readline().rstrip().split(sep)]


def dprint(*args, **kwargs):
    if DEBUG:
        print(*args, **kwargs)
    return


def main():
    n, m = read_list(int)
    as_ = read_list(int)
    all_voting = sum(as_)
    if len(list(filter(lambda v: v >= all_voting / (4 * m), as_))) >= m:
        print("Yes")
        return
    print("No")


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
n,m = [int(j) for j in sys.stdin.readline().split()]
l = [int(j) for j in sys.stdin.readline().split()]
l.sort(reverse=True)
for i in range(m):
    if l[i]<sum(l)/(4*m):
        # print(l[i])
        print("No")
        break
else:
    print("Yes")
    # else:

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# coding: utf-8
"""
about module
"""


def main():
    _, m = map(int, input().split())
    a = list(map(int, input().split()))
    counter = 0
    border = sum(a)/(4*m)
    for v in a:
        if v >= border:
            counter += 1
    if counter >= 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()))
import numpy as np
A = np.array(A)
A = A/ np.sum(A)
thre = 1/(4*m)
count = 0
for i in A:
  if i >= thre:
    count += 1
if count >= m:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

s = sum(a)

count = 0
for n in a:
  if n >= s / 4 / M:
    count += 1

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

Submission status: Accepted

Solution code:
list_in=list(map(int,input().split()))
N=list_in[0]
M=list_in[1]

list_item= list(map(int,input().split()))
count = 0
threshold = sum(list_item) / (4 * M)
for item in list_item:
    if item >= threshold:
        count = count + 1

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

Submission status: Accepted

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

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

a.reverse()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)


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

    tot = sum(A)
    test = tot / (4 * M)

    count = 0

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

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



main()

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

Submission status: Accepted

Solution code:
# coding: utf-8
n, m = [int(x) for x in input().split()]
As = [int(x) for x in input().split()]
s = 0
t = 0
flag = "No"
for a in As:
    t += a
for a in As:
    if not (4*m*a < t):
        s += 1
    if s >= m:
        flag = "Yes"
        break
print(flag)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？


n,m=mii()
arr=limii()

sumvote=sum(arr)
cnt=0
for i in range(n):
    if arr[i] >= sumvote/(4*m):
        cnt+=1
if cnt>=m:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
import sys
import math

from collections import defaultdict
from collections import deque
def load(vtype=int):
    return vtype(input().strip())
def load_list(seplator=" ", vtype=int):
    return [vtype(v) for v in input().strip().split(seplator)]
def exit():
    import sys
    sys.exit(0)
def perm_sub(li, used):
    if len(li) == len(used):
        return [deque()]
    k = []
    for i in range(len(li)):
        if i in used:
            continue
        used.add(i)
        sub_list = perm_sub(li, used)
        for sub in sub_list:
            sub.appendleft(li[i])
        k.extend(sub_list)
        used.discard(i)
    return k
def perm_li(li):
    return perm_sub(li, set())
def perm_n(n):
    return perm_sub(list(range(n)), set())
def join_i(li, sep=""):
    return sep.join([str(e) for e in li])
def li2n(li):
    n, base = 0, 1
    for i in range(len(li)-1, -1, -1):
        n += li[i] * base
        base *= 10
    return n
def sli2ili(li):
    return [int(s) for s in li] 
def prime_list(n):
    li = [i for i in range(2, n+1)]
    for i in range(len(li)):
        if li[i] >= int(math.sqrt(n)):
            break
        if li[i] == -1:
            continue
        for j in range(i+1, len(li)):
            if li[j] % li[i] == 0:
                li[j] = -1
    return [n for n in li if n != -1]
def gcd(a, b):
    a, b = max(a, b), min(a, b)
    while True:
        r = a % b
        if r == 0: return b
        a, b = b, r
def lcm(a, b):
    return int(a * b / gcd(a,b))
def all_subset(li):
    s = []
    n = len(li)
    for bit in range(0, (1<<(n+1))):
        ss = set()
        for i in range(0, n):
            if (bit & (1 << i)):
                ss.add(li[i])
        s.append(ss)
    return s
def factorial(n):
    if n == 1:
        return 1
    return n * factorial(n-1)
def mCn(m, n):
    def factorial_ntimes(m, n):
        r = 1
        while n:
            r *= m
            m -= 1
            n -= 1
        return r
    return int(factorial_ntimes(m, n) / factorial(n))

n, m = load_list()

A = load_list()

s = sum(A)

c = 0
for a in A:
    if a >= s * (1 / (4 * m)):
        c += 1

if 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()]
b=[i for i in a if i>=sum(a)/4/m]
print('Yes' if len(b)>=m else 'No')

Submission status: Accepted

Solution code:
import sys
I=input().split()
N=int(I[0])
M=int(I[1])
HYO=[0]*N

I=input().split()
SO=0
for _ in range(N):
    HYO[_]=int(I[_])
    SO+=int(I[_])

HYO.sort()
if (HYO[N-M]<SO/(4*M)):
    print("No")
else:
    print("Yes")

Submission status: Accepted

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

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

s=sum(A)
u=s/4/M
A.sort(reverse=True)
if A[M-1]>=u:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

    total = sum(A)

    count = 0
    for a in A:
        if a >= total / (4.0 * M):
            count += 1

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#b
N, M = [int(n) for n in input().split(" ")]
A = [int(n) for n in input().split(" ")]

mini = sum(A)/4/M

if sum([0 if a<mini else 1 for a 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()))
cnt = 0
for i in A:
    j = sum(A)/(4*M)
    if i >=j:
        cnt += 1

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

Submission status: Accepted

Solution code:
n,m=map(int,input().split())
a=[int(x) for x in input().split()]
b=sum(a)
c=sorted(a)
d=(b/4)/m
if c[-m]>=d:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, m = list(map(int, input().split()))
al = list(map(int, input().split()))
ans = 0
sum_a = sum(al)
for a in al:
    if a*4*m >= sum_a:
        ans += 1
if m <= ans:
    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)
all_vote = sum(A)

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

Submission status: Accepted

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

ans = 1 / (4 * M)
A = sorted(A, reverse=True)
ans1 = 0
for i in range(M):
    if A[i]/sum(A) >= ans:
        ans1 += 1
if ans1 == M:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

th = sum(Alist)/(4*M)
if len([a for a in Alist if a >= th]) >= 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)
su = sum(a)

for i in range(m):
    if a[i]<su*(1/(4*m)):
        print("No")
        exit(0)

print("Yes")

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
a = list(map(int, input().split()))
total = sum(a)
cnt = 0
# print(1 / (4 * m))

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

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

Submission status: Accepted

Solution code:
def get_ints():
    return map(int, input().split())

n, m = get_ints()
As = list(get_ints())

total = sum(As)

count = 0
for a in As:
    if a * 4 * m >= total:
        count += 1

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

Submission status: Accepted

Solution code:
n,m = map(int,input().split())
ai = list(map(int,input().split()))
line = sum(ai)/(4*m)
count = 0
for i in ai:
    if i >= line:
        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()
ans = "Yes"
suma = sum(a)
for i in a[-m:]:
    if i < suma*(1/(4*m)):
        ans = "No"
        break
print(ans)

Submission status: Accepted

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

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

list_2 = list(filter(lambda x: minValue <= x, A))

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

Submission status: Accepted

Solution code:
# ABC161_B
n,m=map(int,input().split())
a=list(map(int,input().split()))
s=sum(a)
c=0
for aa in a:
    if 4*aa*m>=s:
        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(" ")))

count = 0
sum_A = sum(A_list)
for i in A_list:
    if i >= sum_A/(4*M):
        count += 1

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

items = sorted(A)[::-1][:M]
border = sum(A) * (1 / (4 * M))
is_selectable = True
for item in items:
    if item < border:
        is_selectable = False
        break

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

Submission status: Accepted

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

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

ans = 'Yes'
sep = point / (4 * m)
a.sort()
a.reverse()
for i in range(m):
    if a[i] < sep:
        ans = 'No'

print(ans)

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
A = list(map(int, input().split()))
total = sum(A)
limit = total / 4 / m
#print(limit)
counter = 0
for a in A:
  if a >= limit:
    counter += 1
    #print(counter)
    
if counter >= m:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
a = [int(i) for i in input().split()]
s = sum(a)
c = 0
for i in a:
    if i >= s / (4 * m):
        c += 1
print("YNeos"[c < m::2])

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sat Apr  4 21:05:12 2020

@author: Kanaru Sato
"""

n,m = list(map(int, input().split()))
a = list(map(int, input().split()))
sum = 0

for i in range(len(a)):
    sum += a[i]
    
a.sort(reverse=True)

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

Submission status: Accepted

Solution code:
# coding: utf-8


def solve(*args: str) -> str:
    n, m = map(int, args[0].split())
    A = list(map(int, args[1].split()))
    total = sum(A)
    ret = [a for a in A if total/(4*m) <= a]

    return 'Yes' if m <= len(ret) else 'No'


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

sAA = sorted(AA, reverse=True)
th = sum(AA) / (4*M)

if sAA[M-1] >= th:
    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)
ans = 0
for i in A:
  if 4 * M * i >= s:
    ans += 1

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

Submission status: Accepted

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

a.sort()
a.reverse()

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


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

count=0

for i in a:
    if(i>=num):
        count+=1

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

Submission status: Accepted

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

sumu=0
for i in range(N):
    sumu+=As[i]

sles=sumu*0.25/M
count=0
flag="No"
for i in range(N):
    if As[i]>=sles:
        count+=1
    if count==M:
        flag="Yes"
        break



print(flag)

Submission status: Accepted

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

p=0

for i in range(n):
    if a[i]>=c:
        p+=1
if p>=m:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import numpy as np

#n=int(sys.stdin.readline())
n,m=map(int,sys.stdin.readline().split())
a=np.array(sys.stdin.readline().split(),dtype='int64')
#a=np.array([sys.stdin.readline().split() for i in range(n)],dtype='int64')

a=np.sort(a)[::-1]
to=np.sum(a)

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

Submission status: Accepted

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


def ceil(a, b):
    return (a + b - 1) // b


S = ceil(sum(A), 4 * M)
print('Yes' if sum(1 if a >= S else 0 for a in A) >= M else 'No')

Submission status: Accepted

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

Submission status: Accepted

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

lis = sorted(vote, reverse=True)

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

Submission status: Accepted

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

total = sum(A)
cnt = 0

for a in A:
    if a >= total/(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()))
import numpy as np
asun = np.array(a)
suma = asun.sum()
a.sort(reverse=True)
cnt = 0
ans = 'Yes'
for aa in a:
  cnt += 1
  if aa < suma/(4*m):
    ans = 'No'
    break
  if cnt == m:
    break
print(ans)

Submission status: Accepted

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

average = sum(A) / M

count = 0
for a in A:
    if a >= (average / 4):
        count += 1

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

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
p = [int(_) for _ in input().split()]
sum_p = sum(p)
count = 0

for i in p:
    if i >= sum_p / (4 * m):
        count += 1

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

Submission status: Accepted

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

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

ans = 0

s = 0

for j in range(n):
    s += a[j]

for i in range(n):
    if a[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=list(map(int,input().split()))

import sys

limit=sum(A)/(4*M)
A.sort()
A=A[::-1]
for i in range(M):
    if A[i] < limit:
        print('No')
        sys.exit()
else:
    print('Yes')

Submission status: Accepted

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

ans = 0
for num in A:
  if (amount / (4 * M)) <= num:
    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()))

cnt = 0
thr=1/(4*M)*sum(A)
for i in A:
  if i>=thr:
    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()))

thresh = sum(a) / (4 * m)
selected = list(filter(lambda x: x >= thresh, a))

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

Submission status: Accepted

Solution code:
# coding:utf-8

N, M = map(int, input().split(' '))
A = list(map(int, input().split(' ')))
threshold = sum(A) / (4 * M)
A.sort(reverse=True)

for i in range(M):
    if A[i] < threshold:
        print('No')
        exit(0)
print('Yes')

Submission status: Accepted

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

J = sum(A)/(4*M)
cnt = 0

for i in range(N):
    if A[i]>=J:
        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)
su = sum(A)
flag = True
for i in range(M):
  if A[i] < su/(4*M):
    flag = False
if flag == False:
  print("No")
else:
  print("Yes")

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)


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

    min = total / (4*m)

    c = 0
    for i in range(n):
        if a[i] >= min:
            c += 1
    if c >= m:
        print('Yes')
    else:
        print('No')


main()

Submission status: Accepted

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

total = sum(A)
kosuu = 0
for i in A:
  if i >= total / (4*M):
    kosuu += 1

if kosuu >= 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)/(4*M)
tmp = N
ans = 'Yes'
for a in A:
    if a < r: tmp -= 1
    if tmp < M:
        ans ='No'
        break
print(ans)

Submission status: Accepted

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

A = [x for x in A if x >= (sum(A)/4/M)]
if len(A) >= 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()))
    #
    t = sum(int(i) for i in A) / (4 * M)
    ans = 0
    for a in A:
        if a >= t:
            ans += 1
        if ans == M:
            print("Yes")
            return 0
    print("No")
    return 0


if __name__ == '__main__':
    main()

Submission status: Accepted

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

A.sort()
s = sum(A)

if A[-M] < s/4/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
sm = sum(a)
for i in a:
    if( i >= sm/(4*m)):
        count += 1
if(count >= 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()]
t = sum(l) / 4 / M
num = 0
ans = 0
for i in range(len(l)):
  if l[i] >= t:
    num += 1
  if num >= M:
    ans += 1
    break
if ans == 1:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

n,m = inm()
a = inl()
t = sum(a)
a.sort(reverse=True)
cnd = (a[m-1]*4*m >= t)
print('Yes' if cnd else 'No')

Submission status: Accepted

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

def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
# 入力全てを整数に変換したものの配列を受け取る
def LI(): return list(map(int, sys.stdin.readline().split()))
# 入力全てを整数に変換して1引いたものの配列を受け取る
def LLI(rows_number): return [LI() for _ in range(rows_number)]

n,m = MI()
a = sorted(LI())[::-1]
asum = sum(a)
if a[:m][-1]>=asum*(1/(4*m)):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
I=lambda:list(map(int,input().split()))
n,m=I()
l=I()
s=sum(l)
te=1/(4*m)
c=0
for i in l:
    if (i/s)>=te:
        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()))
p = 0
q = 0
for i in range(n):
    p += a[i]
for i in range(n):
    if(a[i] >= p/(4*m)):
        q += 1
if(q >= 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)
#print(A)
sum_ = sum(A)
if A[m - 1] < sum_ / (4 * m):
  print("No")
else:
  print("Yes")

Submission status: Accepted

Solution code:
n,m = map(int,input().split())
a = sorted(list(map(int,input().split())),reverse=True)
s = 0
for i in range(n):
  s += a[i]

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

Submission status: Accepted

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip()

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

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

limit = 1 / (4*M)

A.sort(reverse=True)
ans = 0
sum_A = sum(A)
for i in range(len(A)):
    if (A[i] / sum_A) >= limit:
        ans += 1
    if ans == M:
        print("Yes")
        exit()

print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

# print('input >>')
N, M = map(int,(input().split()))
As = list(map(int,(input().split())))

border = sum(As)*1/(4*M)
As_best = sorted(As, reverse=True)[:M]

for A in As_best:
    if A < border:
        print('No')
        sys.exit()
print('Yes')

# print('-----output-----')