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()))
ans = 0

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

Submission status: Accepted

Solution code:
def main():
  n, m = map(int, input().split())
  A = list(map(int, input().split()))
  
  voteSum = sum(A)
  
  B = sorted(A, reverse = True)
  
  #for i in range(0, m):
  if B[m-1] >= voteSum / (4*m):
    print('Yes')
  else:
    print('No')
      
  
main()

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
A = [j for j in map(int, input().split())]
s = sum(A)
count = 0
m = s/4/M
for i in A:
    if i >= m:
        count += 1
print("Yes" if count >= M else "No")

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
import math

N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse=True)
total = sum(A)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#-*-coding:utf-8-*-

def main():
    vote_list=[]
    n,m = map(int,input().split())
    vote_list=list(map(int,input().split()))
    ans=0

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

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(100000)


def main():
    N, M = [int(i) for i in input().strip().split()]
    A_list = [int(i) for i in input().strip().split()]
    num = 0

    for i in range(N):
        if A_list[i] >= sum(A_list) / (4 * M):
            num += 1
        else:
            continue

    if num >= M:
        return "Yes"
    else:
        return "No"


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

Submission status: Accepted

Solution code:
import numpy as np
def cumsum(x):
    return list(np.cumsum(x))

def cumsum_number(N,K,x):
    ans=[0]*(N-K+1)
    number_cumsum = cumsum(x)
    number_cumsum.insert(0,0)
    for i in range(N-K+1):
        ans[i]=number_cumsum[i+K]-number_cumsum[i]
    return ans
"""
int #整数
float #小数

#for
for name in fruits: #fruitの頭から操作
    print(name)

#リスト
list0 = [] #リスト生成
list0 = [1,2,3,4] #初期化
list0 = [0]*10 #[0,0,0,0,0,0,0,0,0,0]
list1= [i for i in range(10)] #>>> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
list1 = list(map(int, input().split()))　# 複数の入力をリストに入れる
number=[int(input()) for i in range(int(input()))] #複数行の入力をリストに
list1 = list1 + [6, 7, 8] #リストの追加
list2.append(34) #リストの追加　最後に（）内が足される
list.insert(3,10) #リストの追加　任意の位置（追加したい位置,追加したい値）
len(list4) #リストの要素数
max(sa) #list saの最小値
list5.count(2) #リスト(文字列も可）内の2の数
list1.sort() #並び替え小さい順
list1.sort(reverse=True)  #並び替え大きい順
set(list1) #list1内の重複している要素を削除し、小さい順に並べる
sum([2,3,   ,3]) #リストの合計

abs(a) #aの絶対値
max(a,b) min(a,b) #最大値　最小値
text1 = text1.replace("34","test") #text1内の"34"を"test"に書き換える(文字列内の文字を入れ替える)

exit(0) #強制終了

cumsum(リスト) #累積和をリストで返す
cumsum_number(N,K,x) #N個の数が含まれるリストx内のK個からなる部分和をリストで返す
"""
N,M=map(int,input().split())
number=list(map(int,input().split()))
ans = 0
for i in number:
    if i>=sum(number)/(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()))
cnt = 0

for val in a:
  if val >= 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()))

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(reverse = True)
K = sum(A)/(4*M)
print('Yes' if A[M-1] >= K else 'No')

Submission status: Accepted

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

t = sum(a)/(4*m)
a = sorted(a, reverse=True)
for i in range(n):
    if a[i] >= t:
        m -= 1

if m <= 0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
n,m = map(int,input().split())
L=list(map(int,input().split()))
mx = sum(L)
mn = mx/(4*m)
L.sort(reverse = True)
count = 0
for i in range(n):
    if L[i]>=mn:
        count+=1
    if count ==m:
        print('Yes')
        sys.exit()
print('No')
sys.exit()

Submission status: Accepted

Solution code:
n,m = map(int,input().split())
hyou = list(map(int,input().split()))
sum = 0
flg = 0

list.sort(hyou, reverse=True)

for i in range(n):
  sum += hyou[i]

sum = sum / (4 * m)
  
for i in range(m):
  if hyou[i] >= sum:
    continue
  else:
    flg = 1
    break
    
if flg == 0:
  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=list(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()))

pick = 0

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

Submission status: Accepted

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

V = sum(A)
L = V/4/M

cnt = 0
for i in A:
  if i >= L:
    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()))
goukei=sum(A)
A.sort(reverse=True)
flag=True
for i in range(M):
  if A[i]<goukei/(4*M):
    flag=False
print("Yes" if flag==True else "No")

Submission status: Accepted

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

for i in range(n):
    if a[i]>=x:
        c+=1
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()))

s = sum(A) / (4 * m)
cnt = 0
for a in reversed(sorted(A)):
    if a < s:
        break
    cnt += 1
    if cnt >= m:
        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()))
a.sort(reverse=True)
b=sum(a)
flg=True
for i in range(m):
    if a[i]<b/(4*m):
        flg=False
if flg:
    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)
c = 0
for i in a:
  if i >= asum*(1/(4*m)):
    c+=1
    if c >= m:
      print('Yes')
      quit()
print('No')

Submission status: Accepted

Solution code:
N,M = map(int,input().split())
votes = list(map(int,input().split()))
votes.sort(reverse=True) #降順
ans ="Yes"
for i in range(M):
  if(votes[i]/sum(votes) < 1/(4*M)):
    ans = "No"
    break;
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

num = 0

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

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

Submission status: Accepted

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

s = 0
for i in range(n):
  if A[i] >= sum(A)/(4*m):
    s += 1
  else:
    pass
  
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()))
count = 0
A_sum =sum(A)
vote_min = A_sum/(4*M)
for i in range(len(A)):
  if A[i] >= vote_min:
    count += 1
print("Yes" if count >= M else "No")

Submission status: Accepted

Solution code:
n, m = list(map(int, input().split()))
goods = list(map(int, input().split()))
flag = 1
limit = float(sum(goods)) / (4 * m)
for i in range(n - 1):
  for j in range(n - i - 1):
    if goods[j] <= goods[j+1]:
      tmp = goods[j]
      goods[j] = goods[j+1]
      goods[j+1] = tmp
for i in range(1, m):
  if goods[i] < limit:
    flag = 0
    break
if flag:
  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:
#inport
import sys
import numpy as np
from collections import deque


#input
N,M = [int(x) for x in sys.stdin.readline().split()]
g = [int(x) for x in sys.stdin.readline().split()]

g = np.array(g)
#print(g)
#print(1/4/M*np.sum(g))
#print(g >= 1/4/M*np.sum(g))

if np.count_nonzero(g >= 1/4/M*np.sum(g)) >= M:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
from sys import exit
N,M = map(int,input().split())

itemlist = [int(x) for x in input().split()]
itemlist.sort(reverse=True)

point = sum(itemlist)/(4*M)

for i in range(M):
    if itemlist[i] < point:
        print('No')
        exit(0)

print('Yes')

Submission status: Accepted

Solution code:
n,m=map(int,input().split())
A=sorted(list(map(int,input().split())))[::-1]
vote_min=sum(A)*(1/(4*m))
prod_popular=0
ans="No"
for a in A:
    if a>=vote_min:
        prod_popular+=1
    if prod_popular==m:
        ans="Yes"
print(ans)

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
a = list(map(int, input().split()))
select = 0
a.sort(reverse=True)
for i in range(m):
    if a[i]/sum(a) >= 1/(4*m):
        select = 1
    else:
        select = 0

if select == 1:
    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 range(n):
    if 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_sum=sum(a)
a_sort=sorted(a,reverse=True)
for i in range(m):
  if a_sort[i]<(a_sum)/4/m:
    print("No")
    break
else:
  print("Yes")

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
a = list(map(int, input().split()))
s = sum(a)
ans = 0
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 = list(map(int,input().split()))

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

As = sorted(A,reverse=True)

flag = 0
for x in range(M):
    if As[x] < sum(A)/4/M:
        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()))
b = sum(A)/(4*m)
a = 0
#print(b)
for i in range(n):
  if A[i] >= b:
    a += 1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    N, M = map(int, input().split())
    A = list(map(int,input().split()))
    L = 1/(4*M)*sum(A)
    # print(L)
    sum_ = 0
    for a in A:
        # print(a)
        if a >= L:
            sum_ += 1
    if sum_ >= 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()))
threshold = 0
for ai in a:
  threshold += ai
threshold /= (4 * m)
a.sort(reverse=True)
for i in range(m):
  if a[i] < threshold:
    print('No')
    break
  if i == m - 1:
    print('Yes')
    break

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
a = list(map(int, input().split()))
threshold = 0
for ai in a:
  threshold += ai
threshold /= (4 * m)
a.sort(reverse=True)
tot = 0
for i in range(m):
  if a[i] < threshold:
    print('No')
    break
  if i == m - 1:
    print('Yes')
    break

Submission status: Accepted

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

Submission status: Accepted

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

f()

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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


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

a_sum = sum(a)
judge = a_sum/(4*m)

count = 0
for i2 in [i for i  in a if i >= judge]:
  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)
if a[m-1] < sum(a)/4/m:
  print("No")

else:
  print("Yes")

Submission status: Accepted

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

l = list(map(int,input().split()))
s = sum(l)
ans = 0
t = s/(4*m)

for i in l:
  if i>=math.ceil(t):
    ans+=1
  
if ans>=m:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
N,M = (int(X) for X in input().split())
A   = sorted([int(X) for X in 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()))

all_A = sum(A)
border = all_A / (M*4)

select = 0

for a in A:
    if a >= border:
        select += 1

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
n, m, *a = map(int, open(0).read().split())
c = sum(a)*0.25/m
for i in a:
    if i >= c:
        m -= 1
if m <= 0:
    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:
#

import sys
input=sys.stdin.readline

def main():
    n,m=map(int,input().split())
    A=list(map(int,input().split()))
    cnt=0
    suma=sum(A)
    for i in range(n):
        if A[i]>=suma/(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())
l=list(map(int,input().split()))
l.sort(reverse=True)
sum=sum(l)
for i in range(M):
    if l[i]<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.sort(reverse=True)
if 4 * M * A[M - 1] >= sum(A):
    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 4 * M * i >= sum(A):
        c = c + 1

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

Submission status: Accepted

Solution code:
#B
N,M = map(int,input().split())
A = list(map(int,input().split()))
total = sum(A)
ans = []
for n in A:
    if 4*M*n < total:
        pass
    else:
        ans.append(n)
if len(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)
ans = 0
for i in range(len(A)):
  if A[i] >= S/(4*m):
    ans += 1
  else:
    pass
  
if ans >= m:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
N,M=map(int,input().split())
a=input().split()
A=[]
for _ in a:
    A.append(int(_))
# print(N,M)
# print(A)

# N,M=4, 1
# A=[5, 4, 2, 1]

items=0
votes=sum(A)

for i in range(len(A)):
    if 4*M*A[i]>=votes:
        items+=1
    else:
        pass
if items>=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
sm=sum(a)
for l in a:
  if l >= sm/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()))
total = sum(A)
A.sort(reverse=True)

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

Submission status: Accepted

Solution code:
import sys

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

p = sum(A) / ( 4 * M )
A = sorted(A, reverse=True)

for i in range(M):
    if p > A[i]:
        print("No")
        sys.exit()
    
print("Yes")

Submission status: Accepted

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

A.sort()
#print(A)
boundary=sum(A)/(4*M)

ans='Yes'

for i in range(M):
  if A[N-i-1]<boundary:
    ans='No'
    break
print(ans)

Submission status: Accepted

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

p = 0

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

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

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
Ai = list(map(int, input().split()))
border = 1/(4*M) * sum(Ai)
Bi = [i for i in Ai if i >= border]

if M <= len(Bi):
    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 = sum(A)
    count = 0
    ans = "No"
    for a in A:
        if a >= Sum / (4 * M):
            count += 1
    if(count >= M):
        ans = "Yes"
    print(ans)
main()

Submission status: Accepted

Solution code:
N,M = list(map(int,input().split(" ")))
A = list(map(int,input().split(" ")))
total = 0
Triger = 0
A.sort(reverse=True)
for i in A:
  total += i
Triger = total / 4 / M
a = 0
for j in range(M):
  if Triger > A[j]:
    a += 1
    break
if a == 0:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
import sys
n,m=map(int,input().split())
data=list(map(int,input().split()))
data=sorted(data)[::-1]
s=sum(data)
for i in range(m):
    if data[i]*4*m<s:
        print("No")
        sys.exit()
print("Yes")

Submission status: Accepted

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


if len(list(filter(lambda x: x >=eligible, A)))>=M :
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
import sys
N, M = [int(x) for x in input().split()]
a = [float(x) for x in input().split()]
total = sum(a)
OK, NG = 0, 0
for j, i in enumerate(a):
    if i >= 1.0*total/(4*M):
        OK += 1
        if OK >= M:
            print('Yes')
            sys.exit()
    else:
        NG += 1
        if OK + (len(a) - j - 1) < M:
            print('No')
            sys.exit()

Submission status: Accepted

Solution code:
N,M=map(int,input().split())
A=list(map(int,input().split()))
total=sum(A)
select=0
for i in range(N):
  if A[i]>=total/(4*M):
    select+=1
if select>=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 4 * m * a[i] >= S:
    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()))
c=sum(L)
L=sorted(L,reverse=True)
if c/(4*M)>L[M-1]:
  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)
A = sorted(A, reverse=True)[:M]

answer = "Yes"

for i in range(M):
    if A[i] < total / (4 * M):
        answer = "No"

print(answer)

Submission status: Accepted

Solution code:
m,n=map(int,input().split())
products=list(map(int,input().split()))
products.sort()
products.reverse()
s=0
y=0
maru=0
batu=0
for x in products:
    y=y+x
for i in range(n):
    if y<=products[i]*4*n:
        maru=maru+1
    else:
        batu=batu+1
if batu==0:
    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()
a.reverse()

ans = "Yes"
if a[m - 1] * 1.0 < sum(a) / (4 * m):
    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 = [int(x) for x in input().split()]

total = sum(a)
a.sort()
a = a[::-1]
count=0
for i in range(m):
    if a[i] < total * 1/(4*m):
        break
    count+=1

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

Submission status: Accepted

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


def main():
    n, m = map(int, readline().rstrip().split())
    aList = sorted(list(map(int, readline().rstrip().split())), reverse=True)
    aSum = sum(aList)
    mLine = aSum / (4 * m)
    print("Yes" if aList[m - 1] >= mLine else "No")


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def actual(n, m, a_list):
    popular_threshold = sum(a_list) / (4 * m)

    count_can_be_popular = 0

    for vote in a_list:
        if vote >= popular_threshold:
            count_can_be_popular += 1

    if count_can_be_popular >= m:
        return 'Yes'

    return 'No'

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

print(actual(n, m, a_list))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, M = map(int, input().split(' '))
A_n = list(map(int, input().split(' ')))
count = 0
total = sum(A_n)
A_sort = sorted(A_n, reverse=True)
for a in A_sort:
    # print(a/total)
    if a/total >= 1/4/M:
        count += 1
    else:
        break
if count >= M:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

tokuhyo=0
for i in range(N):
    tokuhyo+=S[i]

S.sort()
S.reverse()
for i in range(M):
    if S[i]<tokuhyo/(4*M):
        print("No")
        exit()

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)
counter_0 = 0

for i in range(M):
  if A[i] < total/(4*M):
    counter_0 += 1
    
if counter_0 == 0:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# Template 1.0
import sys, re
from collections import deque, defaultdict, Counter, OrderedDict
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log
from heapq import heappush, heappop, heapify, nlargest, nsmallest
def STR(): return list(input())
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def list2d(a, b, c): return [[c] * b for i in range(a)]
def sortListWithIndex(listOfTuples, idx):   return (sorted(listOfTuples, key=lambda x: x[idx]))
def sortDictWithVal(passedDic):
    temp = sorted(passedDic.items(), key=lambda kv: (kv[1], kv[0]))
    toret = {}
    for tup in temp:
        toret[tup[0]] = tup[1]
    return toret
def sortDictWithKey(passedDic):
    return dict(OrderedDict(sorted(passedDic.items())))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

n,m =MAP()

a = LIST()

tot = sum(a)

temp = (0.25/m)*tot

a = sorted(a)[::-1]

abc = a[m-1]

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

Submission status: Accepted

Solution code:
import itertools
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush,heapify
import math
from copy import deepcopy
import queue
import numpy as np
# sympy as syp(素因数分解とか)
Mod = 1000000007
def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))+1):
        if prime[i] == 1:
            for j in range(2*i,n+1):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n+1):
        if prime[i] == 1:
            res.append(i)
    return res

 
class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[y] = px
        else:
            self.parent[px] = py
 
    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)

def main():  #startline-------------------------------------------
    n, m = map(int, input().split())
    a = list(map(int, input().split()))
    a.sort(reverse = True)
    ans = 0
    for i in range(n):
        if a[i] >= sum(a) / (4 * m):
            ans += 1
    print("Yes" if ans >= m else "No")
if __name__ == "__main__":
    main() #endline===============================================

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
a = input().split()
a_int = list(map((lambda x: int(x)), a))
num = 0

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

for i in range(n):
  if a_int[i] >= con:
    num += 1

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