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

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

Submission status: Accepted

Solution code:
## D
N,M =map(int,input().split())
A = list(map(int,input().split()))
A_sort=sorted(A)[::-1]
A_criterion=sum(A)/4/M
ans="Yes"
if A_sort[M-1]<A_criterion:
    ans="No"
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
A = list(map(int, list(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
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
b = sorted(b, reverse=True)
# b.reverse()
# list2 = sorted(list1, reverse=True)


def canSelect(a, total, M):
    return a >= total / (4 * M)


def returnWord(flag):
    if flag:
        return 'Yes'
    return 'No'


total = sum(b)
M = a[1]
count = 0
res = 'Yes'
for i in b:
    count += 1
    if not canSelect(i, total, M):
        res = returnWord(False)
    if count == M:
        print(res)
        sys.exit()

# print(-(-a[0] // a[1]))

Submission status: Accepted

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

Total = 0
for i in range(N):
    Total += A[i]

ch = 0
for j in range(M):
    if A[j] < Total/(4*M):
        ch += 1
    else:
        continue
        
if ch > 0:
    print("No")
else:
    print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,M =input().split()
A = list(map(int, input().split()))
A.sort(reverse=True)
ans="Yes"

th = sum(A)/(4*int(M))
for i in range(int(M)):
  if A[int(M)-1-i] < th:
    ans="No"
    break
print(ans)

Submission status: Accepted

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

cond = sum(Alist) * (1 / (4 * M))
count = 0

for A in Alist:
    if A >= cond:
        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()))

thresh_score = 1/(4*M) * sum(A)

over_count = sum([1 if a >= thresh_score else 0 for a in A])
print('Yes' if over_count >= M else 'No')

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
A = input().split()
list_a = [int(n) for n in A]
count = 0

waru = 4 * M
SUM = sum(list_a)
vote = SUM / waru

for i in range(0, N):
    if list_a[i] >= vote:
        count += 1
    else:
        pass

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

Submission status: Accepted

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

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

Submission status: Accepted

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

voteN = sum(A)

count = 0
for x in A:
  if x >= voteN/(4*M):
    count += 1

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

Submission status: Accepted

Solution code:
nm = [int(x) for x in input().split()]
n = nm[0]
m = nm[1]
total = 0
result = 0
votes = [int(x) for x in input().split()]
for vote in votes:
  total+=vote
total/=4*m
for vote in votes:
  if vote>=total:
    result+=1
if result>=m:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
import math


n, m = map(int, input().split())
ls = list(map(int, input().split()))
ls.sort(reverse=True)
gk = sum(ls)
hikaku = math.ceil(gk/(4*m)) 

if hikaku <= int(ls[m-1]):
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
from sys import stdin

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

# print(N, M, A)
A.sort()
if sum(A) % (4*M) == 0:
    b = sum(A)//(4*M)
else:
    b = sum(A)//(4*M)+1
# print(b,A,A[N-1-M+1])
if A[N-1-(M-1)] >= b:
    print("Yes")
else:
    print("No")
# print(A)

Submission status: Accepted

Solution code:
N, M = (int(x) for x in input().split())
A = list(map(int, input().strip().split()))
A.sort(reverse=True)

for m in range(M):
    s = sum(A)
    if A[m] >= s / (4 * M):
        a = True
    else:
        a = False

if a == True:
    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)

bool_list = []

for i in range(len(A)):
    if A[i] >= (sum_A / (4*M)):
        bool_list.append("T")

    else:
        continue


if bool_list.count("T") >= 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 range(N):
	if A[i] >= sum(A)/(4*M):
		cnt += 1
	else:
		cnt = cnt

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

Submission status: Accepted

Solution code:
n,m = map(int,input().split())
lis = input().split()
lis = [int(i) for i in lis]
s = sum(lis)
ans = 0


for i in range(n):
    if lis[i] >= s*(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.sort()
S = sum(A)
         
if 1/(4*M) <= A[N-M]/S :
	print("Yes")
else:
	print("No")

Submission status: Accepted

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

total = sum(a)
count = 0
for i in range(n):
	if 4*m*a[i] >= total:
		count += 1

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

Submission status: Accepted

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

for i in range(M):
  s = sum(num)
  if sss[i] >= s/(4*M):
    pass
  else:
    print('No')
    f = False
    break
if f:
  print('Yes')

Submission status: Accepted

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

Submission status: Accepted

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

tf=0
sum=0

for h in range(N):
    sum += A[h]

list.sort(A,reverse=True)

for i in range(M):
    if A[i]<(sum/(4*M)):
        tf = 1
        break

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

Submission status: Accepted

Solution code:
N,M=map(int,input().split())
A=[int(b) for b in input().split()]
cnt=0
ans=sum(A)/(4*M)
#print(ans)

for i in range(N):
  if A[i] >=ans:
    cnt+=1
#print(cnt)

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

Submission status: Accepted

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

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

Submission status: Accepted

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

tmp = 0
for i in a:
    if i >= sum(a) * cnt:
        tmp += 1

if tmp >= 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)

f = S / (4 * M)

A.sort(reverse=True)

flag = 0

for i in range(M):
  if A[i] >= f:
    pass
  else:
    flag = 1
    break

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

Submission status: Accepted

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

s = sum(A)

c = list(filter(lambda a: a >= s / (4 * M), A))

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

Submission status: Accepted

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

sum = 0
for a in A:
  sum += int(a)

#print(sum)
limit = sum/(4*int(M))

j = 0
for i in range(N):
  if int(A[i])>=limit:
    j += 1


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

Submission status: Accepted

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

hoge = 4*M
thr = sum(num_list) / hoge

ans = 'Yes'
if sorted_list[M-1] < thr:
    ans = 'No'


print(ans)

Submission status: Accepted

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

L = math.ceil(sum(S) / (4 * M))
SS = 0
for s in S:
        if s // L >0:
        	SS+=1

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

Submission status: Accepted

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

l = [i for i in li if i >= x]
if len(l) >= M:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

S=sorted(L,reverse=True)
a=sum(L)
if S[m-1] < 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()))
choicable = list(map(lambda x:True if x>=sum(a)/(4*m) else False,a))
print('Yes' if sum(choicable) >= m else 'No')

Submission status: Accepted

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

    thresh = sum(A) / (4*M)
    items = [a for a in A if a >= thresh]

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


##########
if __name__ == "__main__":
    b()

Submission status: Accepted

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

Submission status: Accepted

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

mm = sum(A) / (4 * M)
print('Yes' if len([i for i in A if i >= mm]) >= M else 'No')

Submission status: Accepted

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

Submission status: Accepted

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

sum = 0
i = 0
while i != N:
    sum += A[i]
    i += 1

vote = sum / (4 * M)

i = 0
while i != M:
    if A[i] < vote:
        print("No")
        break
    i += 1
    if i == M:
        print("Yes")

Submission status: Accepted

Solution code:
import math

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

cond = sum(AS) / (4 * M)
AS = sorted(AS, reverse=True)

origin = AS[0:M]
result = list(filter(lambda a: a >= cond, origin))

if origin == result:
    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)
d=s/(4*M)
count=0
i=0
while(i<N):
    if(A[i]>=d):
        count=count+1
    i=i+1

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
sum_A = sum(A)
flag = 0
A.sort(reverse=True)
for i in range(M):
    if A[i]/sum_A < 1/(4*M):
        flag = 1

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

Submission status: Accepted

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

for i in range(m):
    if a[i] >= sum(a)/(4*m):
        count = count * 1
    else:
        count = count * 0
if count == 1:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

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

As.sort(reverse=True)

al = sum(As)

ans = 'No' if al/(4*M)>As[M-1] else 'Yes'
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

t = sum / (4*m)
if sa[n-m] < t:
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:

import collections


def solve(n, m, arr):
    totalVotes = sum(arr)

    arr.sort(reverse=True)

    for i in range(m):
        if arr[i] < (totalVotes / (4 * m)):
            return False

    return True


[n, m] = list(map(int, input().strip().split()))
arr = list(map(int, input().strip().split()))

print("Yes" if solve(n, m, arr) else "No")

Submission status: Accepted

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

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

Submission status: Accepted

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

list.sort(a,reverse=True)
judge = 1

for i in range(m):
    if a[i]< a_sum*1/(m*4):
        judge = 0
        break

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

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
list_vote = list(map(int, input().split()))
list_vote_copy = list_vote[:]
total_votes = sum(list_vote)
check = (total_votes / (4 * m))
count = 0
for ele in list_vote_copy:
    if ele >= check:
        count += 1

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

total = sum(A)
border = total / (4*m)
count = 0

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

ans = "Yes"
if count < m:
    ans = "No"

print(ans)

Submission status: Accepted

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

H = sum(AList)/(4*M)

S =0

for A in AList:
  if A>= H:
    S = S + 1

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

Submission status: Accepted

Solution code:
inp = input()
v = input().split(" ")

n = int(inp.split(" ")[0])
m = int(inp.split(" ")[1])

votes = [int(v_) for v_ in v]
votes.sort(reverse=True)

total = sum(votes)
border = total / ( 4 * m )

i = 1
for vote in votes:

    if vote < border :
        print("No")
        exit()

    if i == m:
        print("Yes")
        exit()

    i+=1

Submission status: Accepted

Solution code:
import sys

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

l = [int(x) for x in input().split()]

cnt = 0
for i in l:
    if float(i) < float(sum(l)*1/(4*m)):
        cnt += 1
    if cnt > len(l)-m:
        print("No")
        sys.exit()

print("Yes")

Submission status: Accepted

Solution code:
a=list(map(int,input().split()))
n=a[0]
m=a[1]
touhyou=list(map(int,input().split()))
s=float(sum(touhyou)/4/m)
list=[]
for i in touhyou:
  if i>=s:
    list.append(i)
if len(list)>=m:
  print("Yes")
else:
  print("No" )

Submission status: Accepted

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

quat = sum(a) / (4*m)
cnt = 0
for i in a:
    if i >= quat:
        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()))
b = sum(list(map(lambda x: x >= sum(a)/(4*m), a)))
print('Yes' if m<=b else 'No')

Submission status: Accepted

Solution code:
from collections import defaultdict, deque
import sys
import heapq
import bisect
import math
import itertools
import string
import queue
import copy
import time
# import numpy as np
from fractions import gcd

sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7


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


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


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

from collections import defaultdict, deque
import sys
import heapq
import bisect
import math
import itertools
import string
import queue
import copy
import time
# import numpy as np
from fractions import gcd

sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7


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


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


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


N, M = inp_list()
A = inp_list()
A.sort(reverse=True)
total = sum(A)

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

Submission status: Accepted

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


flg = 0

a_list.sort()
a_list.reverse()

all = 0

for i in range(n):
    all += a_list[i]

all = all*(1/(4*m))


for j in range(m):
    if a_list[j] < all:
        flg = 1

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

Submission status: Accepted

Solution code:
import numpy as np

input_str = input()
N, M = list(map(lambda x: int(x), input_str.split(' ')))

input_str = input()
input_list = np.array(list(map(lambda x: int(x), input_str.split(' '))))

A_sum = np.sum(input_list)

count = np.count_nonzero(input_list >= A_sum / (4*M))

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
x = [int(i) for i in input().split(maxsplit=(n-1))]

sum = 0
count = 0
for i in x:
    sum += i

con = (1/(4*m))*sum

for i in x:
    if i >= con:
        count += 1
    if count == m:
        print('Yes')
        exit()
print('No')

Submission status: Accepted

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

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

    th = sm / (4 * m)
    cnt = 0
    for a in A:
        # print(a, th)
        if a >= th:
            cnt = cnt + 1

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



if __name__ == '__main__':
    solve()

Submission status: Accepted

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

total = sum(A)

noselect = 0
for i in range(N):
    if A[i] < total / (4*M):
        noselect += 1

if N - noselect >= M:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
alis = list(map(int, input().split()))
func = lambda x : x >= (sum(alis)/(4*m))
anslis = list(map(func, alis))
if anslis.count(True) >= m:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s = input().split(" ")
N = int(s[0])
M = int(s[1])

s = input().split(" ")
sum = 0
l = []
for i in range(N):
    sum += int(s[i])
    l.append(int(s[i]))

l = sorted(l, reverse=True)
yes = True

for i in range(M):
    if int(l[i]) < sum / (4 * M):
        yes = False
if yes:
    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)
total = 0
for i in range(len(b)):
  total += b[i]

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

Submission status: Accepted

Solution code:
i = list(map(int, input().split()))
j = list(map(int, input().split()))

j.sort(reverse=True)
k = i[1]
l = sum(j)
k_k = k*4

if j[k-1] >= l /k_k:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
N,M = map(int, input().split())
A = list(map(float, input().split()))
sum_A = sum(A)
cout = 0
flag = False
for i in range(N):
  if A[i] >= sum_A / (4 * M):
    cout += 1
    if cout >= M:
      flag = True
      break
      
if flag:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
def get_int_list(inp_str):
    return list(map(int, inp_str.split(" ")))

n, m = get_int_list(input())
objs = get_int_list(input())

threshold = sum(objs) / (4 * m)
ans = [o >= threshold for o in objs]
num = sum(ans)
if num >= m:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
n,m = map(int,input().split())
line = sorted(list(map(int,input().split())),reverse = True)
sums = sum(line)
if sums % (4*m) != 0:
  least = sums//(4*m) + 1
else:
  least = sums//(4*m)
box = []
for i in line:
  if i >= least:
    box.append(i)
if len(box) >= 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=0
for i in range (0,N):
  sum_A=sum_A+A[i]
pop=0
for i in range(0,N):
  if A[i]>=sum_A/(4*M):
    pop=pop+1
if pop>=M:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
A = list(map(int, input().split()))
b = float(sum(A)/(4*M))
num = 0
for i in range(N):
    if A[i] >= b:
        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(reverse = True)
t = sum(a)
p = 0
for i in range(n):
  if a[i] >= t/(4*m):
    p += 1
  else:
    break

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
import sys

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

vote = []
vote = list(map(int, input().split()))
sum_n = sum(vote)

i = 0
while i < M:
    max_n = max(vote)
    if max_n < math.ceil(sum_n / (4 * M)):
        print("No")
        sys.exit()
    vote.pop(vote.index(max_n))
    i += 1

print("Yes")

Submission status: Accepted

Solution code:
INPUT = input().split()
N = int(INPUT[0])
M = int(INPUT[1])
score_list = input().split()
score_list_int =  [int(n) for n in score_list]

border = sum(score_list_int)/4/M

answer = "Yes"

for i in score_list_int:
    if i < border:
        N -= 1

if N < M:
    answer = "No"
    
print(answer)

Submission status: Accepted

Solution code:
N,M = map(int,input().split())
List =list( map(int,input().split()))
S = sum(List);
count = 0;
for i in range(N):
    if List[i] >= S/(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()))
S = sum(A)
A_selected = [a for a in A if a >= (S/4/M)]
ret = len(A_selected) >= M
if ret:
    ret_str = 'Yes'
else:
    ret_str = 'No'
print(ret_str)

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)/4/M:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

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

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

s = sum(an)

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

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

Submission status: Accepted

Solution code:
N, M= list(map(int, input().split()))
A= list(map(int, input().split()))
A.sort(reverse = True)
B = A[0:M]
C = B[-1]
Sum =  sum(A)
if C >=Sum /(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 = sum(A)
ans = 0
for i in range(n):
    if float(A[i]) >= a_sum/(4*m):
        ans += 1


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

Submission status: Accepted

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

sumPolls = sum(A)
criteria = sumPolls / (4 * M)

if A[M-1] < criteria:
  print("No")
else:
  print("Yes")

Submission status: Accepted

Solution code:
import sys
N,M = map(int, input().split())
A = list(map(int, input().split()))
sorted_A = sorted(A, reverse=True) 
all_A = sum(A)

rule = (1/(4*M))

ans = 0

for i in A:
    if (i / all_A) >= rule:
        ans = ans + 1
    else:
        pass

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

Submission status: Accepted

Solution code:

N, M = [int(t) for t in input().split(" ")]
votes = [int(t) for t in input().split(" ")]
total = sum(votes)
t = total/(4*M)

popular = [v for v in votes if v >= t]
if len(popular) >= M:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
n, m = list(map(int, input().split()))
l = list(map(int, input().split()))
r = list(filter(lambda x:x >= sum(l)/(4*m),l))
if len(r) >= m:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

YES = "Yes"
NO = "No"

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

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

B = sorted(A,reverse=True)

cnt = 0
for i in range(N):
    if B[i] >= least:
        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()))
su = sum(A)
A.sort(reverse=True)

cnt = 0
for i in A:
  if (i >= su / 4 / M):
    cnt += 1
if (cnt >= M):
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, m = map(int,input().split())
a = list(map(int, input().split()))
popular = list(filter(lambda e: e>=(1/(4*m))*sum(a),a))
print("Yes" if len(popular) >= 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()]

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())
Alist = list(map(int, input().split()))
Alist.sort(reverse=True)
sumnation = sum(Alist)
bordernum = sumnation / (4*M)
for i in Alist[:M]:
    judlist = []
    temp = True if i >= bordernum else False
    judlist.append(temp)
    judged =  all(judlist)
if judged:
    print('Yes')
else :
    print('No')

Submission status: Accepted

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

sortedA = sorted(A, reverse=True)

AA = sum(A)
de = AA/(4*M)
picA = sortedA[0:M]


if (picA[-1] < de):
  print("No")
  
else:
  print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:

import sys, io, os
input = sys.stdin.readline
inputt = lambda: range(int(input()))
inputn = lambda n = 1: range(n)
inputi = lambda: map(int, input().split())
inputl = lambda: list(inputi())
from math import *
from heapq import *
from bisect import *
from functools import reduce, lru_cache
from collections import Counter, defaultdict
from builtins import *

N, M = inputi()
A = inputl()
S = sum(A)
t = ceil(S / (4 * M))
b = (sum(a >= t for a in A) >= M)
if b:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
NM = input().split();
N,M = int(NM[0]),int(NM[1]);
A = list(map(int, input().split()));
A.sort(reverse=True);

#先に総得票数を調べる
Sum = 0;
for i in range(N):
    Sum = Sum + A[i];
    
#人気商品とは呼べないボーダー
fil = Sum / (4 * M);

#全探索
count=0;
for j in range(M):
    if(A[j] >= fil):
        count+=1;

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