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: Wrong Answer

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 sumvote>=m:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


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

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

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


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()

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

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
n, m = map(int, input().split())
a = list(map(int, input().split()))
b = 0
c = 0
d = "Yes"
l = 1 / (4 * m)
for i in a:
  b += i
b = b * l
while c < m:
  if a[c] < b:
    d = "No"

print(d)

Submission status: Time Limit Exceeded

Solution code:
N, M = map(int, input().split())
blist=list(map(int,input().split()))
cset = set(blist)
while 1:
    if len(cset)!=N:
        break
    count = 0
    for i in blist:
        count += i
    M = count/(4*M)
    flag = 0
    for i in blist:
        if i>M:
            flag += 1
    if flag>1:
        print('Yes')
    else:
        print('No')

Submission status: Time Limit Exceeded

Solution code:
from itertools import combinations
n, m = map(int, input().split())
a = list(map(int, input().split()))
total = sum(a)
must = total / (4 * m)
cnt = 0
for c in combinations(a, m):
    flag = True
    for i in c:
        if i < must:
            flag = False
            break
    if flag:
        print("Yes")
        exit()
    else:
        continue
print("No")

Submission status: Accepted

Solution code:
from numpy import cumsum
n,m=map(int,input().split())
a=list(map(int,input().split()))
result=cumsum(a)[-1]
mi=result/(4*m)
ans=0
for i in range(n):
    if a[i]>=mi:
        ans+=1
if ans>=m:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

for i in range(n):
  if lis[i] >= sum(lis) * (1/(4*m)):
    con += 1
    if con == m:
      print("Yes")
      exit()

print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,M=map(int,input().split())
A=input()
def ans161(N:int, M:int, A:str):
    A=sorted(list(map(int,A.split())))
    if A[-M]< sum(A)/(4*M):
        return "No"
    else:
        return "Yes"
print(ans161(N,M,A))

Submission status: Accepted

Solution code:
N, M =  map(int, input().split())
A = list(map(int, input().split()))
assert len(A) == N
# 商品iは得票Ai
# 総得票数の1/4M以上の商品をM個選ぶ
total = sum(A)
import math
thres = math.ceil(total / (4 * M))
count = len([i for i in range(N) if A[i] >= thres])
if count >= M:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

check_num = A_list[M - 1]
if check_num / sum(A_list)  >= 1 / (4 * 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()]
a.sort(reverse=True)
border=sum(a)/(4*m)
ans='Yes'
for i in range(m):
  if a[i]<border:
    ans='No'
    break
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,m=map(int,input().split())
li=list(map(int,input().split()))
ans=0
q=sorted(li,reverse=True)
for i in range(m):
    if q[i]*4*m>=sum(li):
        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()))
B = sorted(A,reverse=True)
judge = sum(A) / (4*M)
if B[M-1] < judge:
    print('No')
else:
    print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def sep():
    return map(int,input().strip().split(" "))
def lis():
    return list(sep())
import sys
sys.setrecursionlimit(10**6)

n,m=sep()
ar=lis()
ar.sort(reverse=True)
k=ar[m-1]
if k>=((sum(ar)/(4*m))):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
n,m=map(int,input().split())
a=list(map(int,input().split()))
s = sum(a)
ans =0
for i in a:
  if i>=s/4/m:
    ans+=1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,M = map(int,input().split())
array = list(map(int,input().split()))
total = sum(array)
count = 0
for i in range(N):
  if array[i] < total / (4*M) :
    continue
  else:
    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()))
get = 0
count = 0

for i in a:
    get += i

for i in a:
    if i*4*m >= get:
        count += 1

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

Submission status: Accepted

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

nums.sort(reverse=True)
ss = sum(nums)
if nums[m-1] * (4 * m) < ss:
    print('No')
else:
    print('Yes')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N,M=[int(s) for s in input().split()]
ls=[int(s) for s in input().split()]
ls=sorted(ls,reverse=True)
border=sum(ls)/(4*M)
if ls[M-1]>=border:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N,M=map(int,input().split())
A=list(map(int,input().split()))
A.sort(reverse=True)
x=sum(A)
for i in range(M):
    if 4*M*A[i]<x:
        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)
AM=A[0:M]
asum=sum(A)
rate=asum/4/M

for idx in AM:
    if idx<rate:
        print('No')
        break
else:
    print('Yes')

Submission status: Accepted

Solution code:
import decimal

N, M = map(int, input().split())
A = list(map(int, input().split()))
cnt = 0
base = sum(A) / (4 * M)
for Ai in A:
  if Ai >= base:
    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()))

sum = 0
for score in A:
    sum += score

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import bisect
N,M=map(int,input().split())
A=sorted(list(map(int,input().split())))
#print(A,sum(A)/4/M,A[N-M])
if sum(A)/4/M<=A[N-M]:
  print('Yes')
else:print('No')

Submission status: Accepted

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

votes = sum(A)
tot = 0

for i in range(n) :
    std = votes * (1 / (4*m))
    if(A[i] < std) :
        continue
    tot += 1
if(tot >= m) :
    print("Yes")
else :
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
A = list(map(int, input().split()))
sorted_A = list(reversed(sorted(A)))
print("No" if sorted_A[m-1] < sum(A)/(4*m) else "Yes")

Submission status: Accepted

Solution code:
n,m = map(int,input().split())
A = list(map(int,input().split()))
s = sum(A)
d = s * (1/(4*m))
t = sum(a >= d for a in A)
print('Yes' if t >= m else 'No')

Submission status: Accepted

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

A = sorted(A, reverse=True)
S = sum(A)
ans = "No"
for i in range(M):
    if A[i] >= S / (4 * M):
        ans = "Yes"
    else:
        ans = "No"
        break
print(ans)

Submission status: Accepted

Solution code:
from collections import Counter
N,M=map(int,input().split())
A=sorted(map(int,input().split()),reverse=True)
s=sum(A)/(4*M)
for i in range(M):
    if A[i]<s:
        print('No')
        exit()
print('Yes')

Submission status: Accepted

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

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

Submission status: Accepted

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

for i in range(M):
    if A[i] < sum_A / (4.0 * M):
        print('No')
        exit()

print('Yes')

Submission status: Accepted

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

A.sort()
A.reverse()
s = 0
cnt = 0

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

s = sum(a)
a.sort(reverse=True)

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

Submission status: Accepted

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

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

if(M <= sum(A)):
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

std = sum(a)*(1/(4*m))

cnt = 0
for i in range(n):
    if a[i] >= std:
        cnt += 1

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

Submission status: Accepted

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

ans = 0
for ai in vote_list:
    if ai >= 1/(4*m)*sum(vote_list):
        ans += 1

if ans < m :
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

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

a.sort(reverse=True)
total = sum(a)
if all([x >= total / (4 * m) for x in a[:m]]):
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

total = sum(a)
cnt = 0

for _a in a:
    if _a * 4 * m >= total:
        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()))
k = sum(a)*(1/(4*m))
b = [i for i in a if i >= k]

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding=utf-8

if __name__ == '__main__':
    N, M = map(int, input().split())
    li = list(map(int, input().split()))
    lisum = sum(li)

    cnt = 0
    for i in range(N):
        if lisum / (M * 4) <= li[i]:
            cnt += 1

    if M <= cnt:
        print('Yes')

    else:
        print('No')

Submission status: Accepted

Solution code:
def main():
    N, M = tuple([int(_x) for _x in input().split()])
    A = [int(_x) for _x in input().split()]
    total = sum(A)
    if total % (4*M) == 0:
        min_vote = total // (4 * M)
    else:
        min_vote = 1 + total // (4 * M)

    cnt = 0
    for vot in A:
        if vot >= min_vote:
            cnt += 1
    if (cnt >= 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 = sum(A)
th = s / (4*M)
cnt = 0

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

if cnt < M:
    print("No")
else:
    print("Yes")

Submission status: Accepted

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

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

Alist = sorted(Alist,reverse=True)
#print (sum(Alist))
Ans = "No"
for i in range(M):
  #print (Alist[i])
  #print((sum(Alist)/4*M))
  if Alist[i]>=(sum(Alist)/(4*M)):
    Ans ="Yes"
  else:
    Ans = "No"
    
print (Ans)

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
c=list(map(int,input().split()))
d=sum(c)
e=(4*b)
f=0
for i in c:
    if(i*e>=d):
        f+=1

if(f>=b):
    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()]
a.sort(reverse = True)
s = sum(a)
res = "Yes"
for i in range(m):
  if a[i] * 4 * m < s:
    res = "No"
print(res)

Submission status: Accepted

Solution code:
mn = input().split()
ob = input().split()

n = int(mn[0])
m = int(mn[1])

votes = 0

for i in range(n):
    ob[i] = int(ob[i])
    votes += ob[i]

ob.sort(reverse = True)

line = votes/4/m

ans = 0

for i in range(m):
    if ob[i] < line:
        ans += 1

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

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 * 4* m >= sum_a:
            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())
hyo = list(map(int,input().split()))
all_hyo = sum(hyo)

hyo.sort(reverse=True)

a = True

for x in range(m):
  if hyo[x] < all_hyo / 4 / m:
    a = False
    break

if a :
  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)
cnt = 0
for a in A:
    if a >= line:
        cnt += 1
if cnt >= M:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

    for i in A:
        if i/sum(A) >= 1/(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()))

cn = 0
SUM = 0

for i in range(len(A)):
    SUM = SUM + A[i]
    
for i in range(len(A)):
    if A[i] >= (SUM / 4 / M):
        cn = cn + 1
    else:
        continue

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

t = sum(a) / (4*m)
print('Yes' if sum([1 for i in a if i >= t]) >= m else 'No')

Submission status: Accepted

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

Submission status: Accepted

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

c=0

for i in a:
  if i>=sum(a)*(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 = list(map(int,input().split()))
judge = sum(A) / (4 * m)
ans = []
for i in range(n):
  if A[i] < judge :
    continue
  else:
    ans.append(A[i])
print("Yes") if len(ans) >= m else print("No")

Submission status: Accepted

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

A=list(map(int,input().split()))
ans=0
A.sort(reverse=True)
S=sum(A)

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())
alist = list(map(int,input().split()))

alist.sort(reverse=True)
allvote = sum(alist)

count = 0
for i in range(n):
    if alist[i] >= allvote/(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()))
b = sum(a)/(4*m)
cnt = 0
for i in a:
    if b <= i:
        cnt += 1
        if cnt >= m:
            print("Yes")
            exit()
print("No")

Submission status: Accepted

Solution code:
ri = lambda S: [int(v) for v in S.split()]
N, M = ri(input())
A = ri(input())
T = sum(A)
thresh = (1/(4*M)) * T
c = len([v for v in A if v >= thresh])
print("Yes" if c >= 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()]
cnt = 0
sum_ = sum(a)
for ai in a:
  if ai >= 1 / (4 * m) * sum_:
    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()))
rank = sum(A) / (4*m)
cnt =0

for a in A:
    cnt += rank <= a

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)
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()))
l = sorted(a, reverse=True)
sum = sum(l) / 4 / m
count = 0

for i in range(len(l)):
    if l[i] >= sum:
        count += 1
    else:
        break


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())),reverse=True)
total = sum(a) / (4 * m)
if min(a[:m]) >= total:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
a = list(map(int, input().split()))
border = sum(a) / (4 * m)
a.sort(reverse=True)

for i in range(m):
    if border <= a[i]:
        pass
    else:
        print('No')
        exit(0)

print('Yes')

Submission status: Accepted

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

cnt = 0
vote = sum(A_ls) / (4 * M)
for i in range(N):
  if A_ls[i] >= vote:
    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()))

A.sort(reverse=True)

all_ = sum(A)
th = all_/(4*M)

ans='Yes'
if A[M-1] < th:
    ans='No'
    
print(ans)

Submission status: Accepted

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

S = sum(A)
th = math.ceil(S / (4*M))

ans = 0
for a in A:
  if a >= th:
    ans += 1
    
print("Yes" if ans >= M else "No")

Submission status: Accepted

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

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)
# Yesのためには、M個の商品全てが、s/(4M)以上の票を獲得することが必要
# つまり、M位の商品がs/(4M)以上の票を獲得していればYes、未満ならNo 
if A[M-1]*(4*M) >= s: 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 = sorted(A, reverse=True)
ans = 'Yes'
for i in range(M):
  if A[i]*(4*M) < s: 
    ans = 'No'
    break

print(ans)

Submission status: Accepted

Solution code:
n,m=map(int,input().split())
A=list(map(int,input().split()))
ans=0
for i in range(n):
  if 4*m*A[i]<sum(A):
    continue
  else:
    ans+=1

if ans<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)

popular = [x for x in a if x*4*m >= total]

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# 整数の入力
# a = int(input())
# スペース区切りの整数の入力
# b, c = map(int, input().split())
# 文字列の入力
# s = input()
# 出力
# print("{} {}".format(a+b+c, s))
n,m = map(int,input().split())
a = list(map(int,input().split()))
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())
A = list(map(int, input().split()))

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = input()
n = n.split()
m = int(n[1])
n = int(n[0])
a = input()
a = a.split()
c = int(a[0])
for b in range(n-1):
    c = c + int(a[b+1])
c = c / (4 * m)
e = 0
for d in range(n):
    if int(a[d]) >= c :
        e = e + 1
if e >= 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 = sorted(a, reverse=True)
a_sum = sum(a)

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

Submission status: Accepted

Solution code:
# coding: utf-8

kind, choose = map(int, input().split())
count = 0
total = 0

num = input().split(" ")
for i in num:
    total += int(i)

ok = total / (4 * choose)

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, m = (int(x) for x in input().split())
list_a = sorted([int(x) for x in input().split()], reverse=True)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,M=map(int,input().split())
A=[int(x) for x in input().split()]
s=sum(A)
l=len(A)
m=0
for i in range(l):
    if A[i]>=s/(4*M):
        m+=1
if M<=m:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
def main():
    n, m = map(int, input().split())
    a_lst = list(map(int, input().split()))
    total = sum(a_lst)
    cnt = 0

    for a in a_lst:
        if a * 4 * m >= total:
            cnt += 1

    if cnt >= m:
        ans = "Yes"
    else:
        ans = "No"

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def main():
    n, m = map(int, input().split())
    a_lst = list(map(int, input().split()))
    total = sum(a_lst)
    cnt = 0

    for a in a_lst:
        if a >= total / (4 * m):
            cnt += 1

    if cnt >= m:
        ans = "Yes"
    else:
        ans = "No"

    print(ans)


if __name__ == "__main__":
    main()