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

vote = sum(a)

a.sort()
b = a[::-1]

for i in range(m):
    if b[i] * 4 * m < vote:
        print('No')
        exit()
        
print('Yes')

Submission status: Accepted

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

N,M = list(map(int,input().split()))
A = sorted(list(map(int,input().split())),reverse = 1)
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()))

a.sort(reverse=True)

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

Submission status: Accepted

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

#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()

def main():
	n,m=MI()
	A=LI()
	A.sort(reverse=True)
	S=sum(A)


	ans="Yes"

	for i in range(m):
		if A[i]*4*m<S:
			ans="No"
			break

	print(ans)
















if __name__ == "__main__":
	main()

Submission status: Accepted

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

d = sum(c)
e = sorted(c,reverse=True)

for i in range(b):
  if(e[i]<d/(4*b)):
    print("No")
    exit()
print("Yes")

Submission status: Accepted

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

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

for i in range(M):
    if sum(a)%(M*4)== 0:
        if a[i] >= int(sum(a)/(M*4)):
            b += 1 
    if sum(a)%(M*4)!= 0:
        if a[i] > int(sum(a)//(M*4)):
            b += 1 
if b == M:
    print('Yes')
elif b < M:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
n,m = readInts()
A = readInts()
sumA = sum(A)
div = sumA * (1/(4*m))
A = sorted(A,reverse=True)
for i in range(m):
    if A[i] < div:
        print('No')
        exit()
print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
# hello worldと表示する
# coding: utf-8
# hello worldと表示する
#float型を許すな
#numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7
n,m=MI()
lis=LI()
u=sum(lis)
count=0
lis.sort(reverse=True)
for i in range(n):
    if (4*m)*lis[i]>=u:
        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()))

vote = sum(a)
a.sort(key=lambda x: -x)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, m = input().split()
a = list(map(int, input().split()))
b = []
s = 0

for i in a:
    s += i

for i in a:
    if float(i) >= float(int(s)/(4*int(m))):
        b.append(i)
        if len(b) == int(m):
            break

if len(b) == int(m):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

check = sum(an)/(4*m)
count = 0

for a in an :
  if a >= check:
    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)
for i in range(N):
  if i < M and A[i] < sum(A) / (4 * M):
    print("No")
    exit()
print("Yes")

Submission status: Accepted

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

(n, m), s = map(int, input().split()), sorted(list(map(int, input().split())), reverse = True)
print('Yes' if s[m-1] >= sum(s) / (m * 4) else 'No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
A = input().split()
A = [int(i) for i in A]
A.sort(reverse=True)
total = sum(A)
flag = True

for i in range(M):
    if A[i] < total/(4*M):
        print('No')
        flag = False
        break

if(flag):
    print('Yes')

Submission status: Accepted

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

dl = sum(A)/(4*M)

a_desc = sorted(A, reverse=True)

for i in range(M):
    if a_desc[i] < dl:
        print("No")
        break
else:
    print("Yes")

Submission status: Accepted

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

total = sum(A)
A.sort(reverse=True)
if A[M-1] < total / (4*M):
    print('No')
else:
    print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# Nこの商品の中からM個選ぶ
N, M = list(map(int, input().split()))
# 商品iの得票数はA_i
A = list(map(int, input().split()))

A = sorted(A, reverse=True)

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

Submission status: Accepted

Solution code:
# Nこの商品の中からM個選ぶ
N, M = list(map(int, input().split()))
# 商品iの得票数はA_i
A = list(map(int, input().split()))

A = sorted(A, 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())
num=[int(i) for i in input().split()]
num=sorted(num,reverse=True)
sum_num=sum(num)
if num[m-1]<sum_num/(4*m):
    print("No")
else:
    print("Yes")

Submission status: Accepted

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

for i in range(len(A)):
  C += A[i]
  
for i in range(len(A)):
  if A[i] >= C/(4*M):
    B += 1

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

Submission status: Accepted

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

total=0
a.sort(reverse=True)
for i in range(n):
    total+=a[i]


ans=1
for i in range(m):
    if a[i]<1/4/m*total:
        ans=0
        break
if ans==1:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

x = sorted(lstA)[-M] #大きいほうから数えてM番目(選んだ中では最も小さい)

if(x >= (sum(lstA) * 1) / (4 * M)):
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

sum_a=sum(a)
cnt=0

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

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

Submission status: Accepted

Solution code:
import math  # noqa: F401
from typing import Dict, List, Optional, Tuple, Union  # noqa: F401


def main(N: int, M: int, A: List[int]):
    x = sum(A) * 1 / (4 * M)
    chooseables: List[bool] = [a >= x for a in A]
    print(["No", "Yes"][sum(chooseables) >= M])


if __name__ == "__main__":
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    main(N, M, A)

Submission status: Accepted

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

count = 0
for i in a:
    if i/sum(a) >= 0.25/m:
        count += 1

print('Yes' if count >= m else '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) * (1 / (4 * M)):
    print("No")
else:
    print("Yes")

Submission status: Accepted

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

sum_a = sum(A)
ans = 0
for i,a in enumerate(A):
    if a >= sum_a / (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()))
count = 0
for i in a:
  if (sum(a)/(4*m)) <= i:
    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()))
b = sum(a)
d = b/(4*m)
e = 0
for i in range(len(a)):
  if a[i] >= d:
    e += 1
if e >= m:
  print("Yes")
else :
  print("No")

Submission status: Accepted

Solution code:
from sys import exit

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

vote = sum(A)

count = 0
for a in A:
    if a * 4 * M >= vote:
        count += 1
        if count == M:
            print('Yes')
            exit()

print('No')

Submission status: Accepted

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

B = [1 for a in A if a >= (sum(A)-1)//(4*M)+1]

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

Submission status: Accepted

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

Submission status: Accepted

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

sum_a=sum(a)

if sum_a/(M*4) > float(sorted(a)[::-1][M-1]):
  print("No")
else:
  print("Yes")

Submission status: Accepted

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

for i in range(1,m+1):
    if A[-i]<0.25*sum(A)/m:
        print('No')
        exit()
print('Yes')

Submission status: Accepted

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

A_sum = sum(A)

this_or_more = A_sum/(4*M)

print("Yes" if sum(a>=this_or_more for a in A) >= M else "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("No")
else:
  print("Yes")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,M = map(int,input().split())
A = list(map(int,input().split()))
A.sort(reverse =True)
minimum = sum(A)/(4*M)
count = 0
for i in range(M):
    a = A.pop(0)
    if a < minimum:
        count = 1
if count == 0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
import math
N,M = map(int,input().split())
A = list(map(int,input().split()))
SUM = sum(A)
ans = 0
for i in range(N):
	if A[i] >= math.ceil(SUM/4/M):
		ans +=1
if ans >= M:
	print("Yes")
else:
	print("No")

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


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


def sum_of_arithmetic_progression(s, d, n):
    return n * (2 * s + (n - 1) * d) // 2


def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


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


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

    total = sum(A)
    c = 0
    for a in A:
        c += a * 4 * M >= total

    if c >= M:
        print(Yes)
    else:
        print(No)


def main():
    solve()


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
n, m, *a = map(int, open(0).read().split())
s = sum(a)
print("YNeos"[sum(i * 4 * m >= s for i in a) < m::2])

Submission status: Accepted

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

if sum(A)%(4*m)!=0:
    if s>t:
        ans='Yes'
    else:
        ans='No'
else:
    if s>=t:
        ans='Yes'
    else:
        ans='No'
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

threshold = sum(A) / (4*m)

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

newlist = sorted(a,reverse=True)

for i in range(m):
    if newlist[i] >= sum(a)*(1/(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()))
a = sorted(a, reverse=True)
s = sum(a)
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()))
b = sorted(a, reverse = True)
if b[m-1] >= sum(b) * (1 / (4 * 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()]
k=sum(a)
a.sort(reverse=True)
cont=0
ans=''
for i in a:
    if i>=k*(1/(4*m)):
        cont+=1
if cont>=m: print("Yes")
else: print("No")

Submission status: Accepted

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

Submission status: Accepted

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


border = total_voting / (4 * m)

ll = []
for i in l:
  if i >= border:
    ll.append(i)

if m <= len(ll):
  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()
    A.reverse()
    total = sum(A)
    for i in range(M):
        if total / (4 * M) <= A[i]:
            continue
        print('No')
        return
    print('Yes')

main()

Submission status: Accepted

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

A = [a for a in A if a >= line]

print('Yes') if len(A) >= m else print('No')

Submission status: Accepted

Solution code:
N,M = (int(a) for a in input().split())
A = list(map(int,input().split()))
A = list(reversed(sorted(A)))
v = sum(A)
d = v / (4*M)
if A[M-1]  < d :
    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)

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

c = 0
for i in range(n):
    if a[i] < v:
        break
    else:
        c += 1

    if c == m:
        break

if c < 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()
sum = 0
for i in range(N):
    sum += A[i]

for i in range(N):
    if N - i > N - M:
        if sum / (4 * M) > A[N-1-i]:
            print('No')
            exit()

print('Yes')

Submission status: Accepted

Solution code:
import math
N, M = map(int, input().split())
ans = 0
Nlist = list(map(int, input().split()))
total = sum(Nlist)
Mmin = math.ceil(total*1/(4*M))
ans = len([1 for x in Nlist if x >= Mmin])
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.sort(reverse=True)
total = sum(A)
print('Yes' if A[M-1] >= total / (4 * M) else 'No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,m=map(int,input().split())
a=list(map(int,input().split()))
print('NYoe s'[len([i for i in a if i>=sum(a)/4/m])>=m::2])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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()))
total=sum(a)/4/m
count=0
for i in a:
    if i>=total:
        count+=1
if count>=m:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np

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

vote_arr = np.array(vote_lists)
total_vote = vote_arr.sum()
is_popular = total_vote / (4 * m)

answer_lists = []

for i in vote_lists:
  if i >= is_popular:
    answer_lists.append(i)

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

for i in range(N):
    if i == M - 1:
        if (s / (4 * M)) > A[i]:
            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)
A.sort(reverse=True)

for i in range(N):
    if i == M-1:
        if (s/(4*M))>A[i]:
            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)
A = sorted(A,reverse=True)

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

Submission status: Accepted

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

sum_a = sum(a)
a = sorted(a)

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

Submission status: Accepted

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

Submission status: Accepted

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

atot = sum(a)
ans = 'Yes'
for i in range(m):
   if a[i] < atot/(4.0*m):
      ans = 'No'
      break
print(ans)

Submission status: Accepted

Solution code:
n = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
tot = sum(a)
count = 0
for i in a:
	if((i * 4 * n[1]) >= tot):
		count += 1
if(count >= n[1]):
	print('Yes')
else:
	print('No')

Submission status: Accepted

Solution code:
import sys
import itertools
# import numpy as np
import time
import math
 
sys.setrecursionlimit(10 ** 7)
 
from collections import defaultdict
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())
# list(map(int, input().split()))

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

limit = sum(A) / (4 * M)

ans = [a for a in A if a >= limit]
if len(ans) >= M:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
inp1, inp2 = map(int,input().split())
list = list(map(int,input().split()))
list.sort(reverse = True)
if list[inp2-1] >= (sum(list))/ (inp2 * 4):
    print("Yes")
elif list[inp2-1] < (sum(list))/ (inp2 * 4):
    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()))

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,M = map(int,input().split())
A = list(map(int,input().split()))
A.sort(reverse=-1)
sum_A = sum(A)
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()))

def vote(a,m):
  a.sort(reverse=True)
  if a[m-1] >= sum(a)/(4*m):
      return True
  else:
      return False
    
ans = "Yes" if vote(A,M) else "No"
print(ans)

Submission status: Accepted

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

a.sort(reverse = True)

count = 0

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

k = count/(4*m)

if a[m-1] < k:
  print("No")
else:
  print("Yes")

Submission status: Accepted

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

sum=sum(A_list)
#print(sum)

for i in range(0,N):
    if A_list[int(i)] < sum / (4*M):
        A_list[int(i)]="Noooo"
    else:
        A_list[int(i)]="Yeeees"
#print(A_list)

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

Submission status: Accepted

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

total = sum(A)
count = sum(1 for x in A if 4 * M * x >= total)
if count >= M:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
arr = input().split()

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

n,m,count,sum = int(arr[0]),int(arr[1]),0,0

for i in arr2:
  sum += i
  

for i in arr2:
  if i >= sum/(4*m): count+= 1
    
if count >= m: print("Yes")
else: print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# 161 B

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

for j in range(len(a)):
    sum += a[j]

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


if num >= 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 = sorted(a_list)

cnt = 0

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

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