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())
list_A = input().split()
list_A_int = [int(s) for s in list_A]
list_A_int_sort = sorted(list_A_int, reverse=True)

compare_num = sum(list_A_int)/(4*M)

if list_A_int_sort[M-1] < compare_num:
  print("No")
else:
  print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
# n, m = map(int, "12 3".split())
# inputText2 = "4 56 78 901 2 345 67 890 123 45 6 789"
inputText2 = input()
input2List = list(map(int,inputText2.split()))
sortList = sorted(input2List, reverse=True)
# print(sortList) #380 19 1000
total = sum(sortList)
# print(total)
h = (1/(4*m)) * total
flg = False
for i in range(m):
    if sortList[i] < h:
        flg = True
        break


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

Submission status: Accepted

Solution code:
n,m = map(int,input().split())
li = list(map(int,input().split()))
soutouhyou = sum(li)
tokuhyou = soutouhyou/(4*m)
num = sum(x >= tokuhyou for x in li)
if num >= m:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline

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

A.sort(reverse=True)
ans = []
n = sum(A)
for value in A:
    if value * 4 * M < n:
        break
    else:
        ans.append(value)

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

Submission status: Accepted

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

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

FLAG=1/(4*M)*all
flag=0

for i in range(N):
    if FLAG<=int(A[0][i]):
        flag+=1

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

Submission status: Accepted

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

b = [i >= sum(a)/(4*m) for i in a]
ans = b.count(True)
if ans >= m:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
import sys
# sys.stdin = open('input.txt')

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

tot = sum(a)
th = tot / (4 * m)
cnt = 0

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

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

Submission status: Accepted

Solution code:

def resolve():
    N, M = map(int, input().split())
    A = sorted(map(int, input().split()), reverse=True)
    ok_line = sum(A)/(4*M)
    cnt = 0
    for a in A:
        if not (a < ok_line):
            cnt += 1
    ans = True if M <= cnt else False
    return print("Yes" if ans else "No")

if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
N,M=map(int, input().split())
A=list(map(int, input().split()))
A.sort()
A.reverse()
K=sum(A)
answer=0
breakflag=0
for i in range(0,N):
  if  A[i]*M*4>=K:
    if i==N-1:
      breakflag=1
    continue
  else:
    answer=i
    break
if breakflag==1:
  answer=N
if answer>=M:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
N,M=input().split()
N=int(N)
M=int(M)
a=list(map(int, input().split()))
a=list(set(a))
a=sorted(a)
b=sum(a)
c=b/(4*M)
if len(a)==N:
    if (1<=M<=N<=100)and(a[0]>=1)and(a[N-1]<=1000):
        if a[N-M]<c:
            print("No")
        if a[N-M]>=c:
            print("Yes")

Submission status: Accepted

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

if (maxn / (4*b)) > n[b-1]:
  print("No")
else:
  print("Yes")

Submission status: Accepted

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

total = sum(A)

p = 0
threshold = total / (4 * M)

for i in A:
  if i >= threshold:
    p += 1

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

Submission status: Accepted

Solution code:
import numpy as np
N,M=map(int,input().split())
A = np.array([int(i) for i in input().split()])

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,M = map(int,input().split())
A = list(map(int,input().split()))
K = 0
L = 0
for i in range(N):
  K = K + int(A[i])
j = 0

while L < M and j < N:
  if int(A[j]) >= (K/(4*M)):
    L = L + 1
  j = j + 1
if L < M:
  print('No')
elif L == M:
  print('Yes')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

def main():
    N,M = map(int, input().split())
    votes = [int(s) for s in input().split()]
    votes_sum = sum(votes)
    border_line = votes_sum / (4*M)

    result = 'Yes'
    votes.sort(reverse=True)
    for i in range(M):
        if votes[i] < border_line:
            result = 'No'
            break

    print(result)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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 = input().split(" ")
n=int(n)
m=int(m)
arr = list(map(int,input().split(" ")))

x = sum(arr)

frac = x/(m*4)

ans=0
for i in range(len(arr)):
    if(arr[i]>=frac):
        ans+=1
if(ans>=m):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

N = a[0]
M = a[1]

count = 0
b_sum = sum(b)

c = sorted(b,reverse = True)

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

Submission status: Accepted

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

c = sum(li) / (4*M)
res = 0
for l in li:
    if l >= c:
        res += 1
if res >= M:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
A = list(map(int, input().split()))  # [1, 2, 3, 4] になる

vote = sum(A)/(4*M)
judge = 0

def check(M,A,N,judge,vote):
    while 1:
        num = A.pop(A.index(max(A)))
        if num >= vote:
            judge+=1
        else:
            return 'No'
        if judge == M:
            return 'Yes'

print(check(M,A,N,judge,vote))

Submission status: Accepted

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

ans = "Yes"
sum_M = sum(A)
an = 0
for i in range(len(A)):
    if A[i] >= sum_M/(4*M):
        an += 1
        
if an<M:
    ans = "No"

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

rate = sum(a) * (1 / (4 * M))

count = 0

for num in list(range(M)):
    if a[num] >= rate:
        count += 1

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
cl1 = input().split()
cl2 = input().split()
n = int(cl1[0])
m = int(cl1[1])
cl1 = [int(s) for s in cl1]
cl2 = [int(s) for s in cl2]
sum= 0.0
for i in range(n):
    sum = cl2[i]+ sum
cl2 = sorted(cl2,reverse=True)
if(cl2[m-1] < sum/(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()
B=A[::-1]
if B[m-1]>=sum(A)/(4*m):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

list = input().split()

m = int(m)
list = [int(i) for i in list]
list.sort(reverse=True)

M = m
i = 0
while 1:
    if m == 0:
        break
    
    if list[i] >= sum(list)/(4*M):
        ans = "Yes"
    else:
        ans = "No"
        
    m-=1
    i+=1

print(ans)

Submission status: Accepted

Solution code:
def f(M,A):
  c=0
  s=sum(A)
  for a in A:
    if a>=s/4/M:c+=1
    if c>=M:return("Yes")
  return("No")
N,M=map(int,input().split())
A=[int(x) for x in input().split()]
s=sum(A)
print(f(M,A))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,M=list(map(int,input().split()))
lst=list(map(int,input().split()))
lst.sort()
if lst[0-M]*4*M>=sum(lst):
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
n,m = input().split(" ")
a = list(map(int,input().split()))
n = int(n)
m = int(m)
#print(m)
max = sum(a)

#print(a)
a = sorted(a, reverse=True)
count = 0
for i in range(m):
    if a[i] < max/(4*m):
        #print(a[i])
        print("No")
        break
    else:
        count += 1
if count == m:
        print("Yes")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
n, m = map(int, input().split())
# スペース区切りの整数をリスト化する
li = list(map(int, input().split()))
# 得票数の合計の1/4m
s = sum(li)/(4*m)
# 条件に合う商品の数
x = 0
for i in li:
    if i >= s:
        x = x+1
# 出力
if x >= m:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
import numpy as np
N, M = map(int, input().split())
al = list(map(int, input().split()))
sums = sum(al)
al.sort(reverse=True)
al = np.array(al)[:M]
al = np.sum(al>=(sums/(4*M)))
if al == 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)

y=s/(4*m)

c=0

for x in a:
    if x >= y:
        c+=1

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

Submission status: Accepted

Solution code:
i1 = input()
i2 = input()

# i1 = "4 1"
# i2 = "5 4 2 1"
list1 = [int(s) for s in i1.split()]
list2 = [int(s) for s in i2.split()]

n = list1[0]
m = list1[1]


total = sum(list2)

# 選べる
count = 0

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

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

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
listA = list(map(int, input().split()))
i = len(listA)
tokuhyousuu = sum(listA)
a = -(-tokuhyousuu // (4 * M))
ninnkiList = [i for i in listA if not i < a]
ninnkisyouhinn = len(ninnkiList)
if ninnkisyouhinn < M:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:

NM = input("").split()
A = list(map(int, input().strip().split()))

N = int(NM[0])
M = int(NM[1])
ALL = sum(A)
k = 0
c = ALL/(4*M)

for Ai in A:
    if Ai>=c:
        k += 1

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

Submission status: Accepted

Solution code:
N, M = map(int, input().split(" "))
vote = list(map(int, input().split(" ")))
vote.sort()
total = sum(vote)
count = 0
thres = total/(4*M)
for i in range(N)[::-1] :
    if vote[i] >= thres :
        count += 1
    else :
        break 

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()))
check = ((1/(4*M))*sum(A))
x = 0
for item in A:
    if item < check:
        x += 1
ans = N - x
if ans >= M:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

all_num = sum(a_list) // (4 * m)
if sum(a_list) / (4 * m) % 1 == 0:
    all_num =  sum(a_list) // (4 * m)
else:
    all_num =  (sum(a_list) // (4 * m)) + 1


count = 0
flag = False
for i in range(n):
    a = a_list[i]
    if a >= all_num:
        count += 1
    if count == m:
        flag = True
        break

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

Submission status: Accepted

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

Submission status: Accepted

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



popular = 0
sumVote = sum(a)
q,mod = divmod(sumVote,4*m)

if(mod == 0):
	line = q - 1
else:
	line = q

if(q < 1):
	print("Yes")
	exit()

for x in range(n):
	if(a[x] > line):
		popular += 1 
	if(popular == m):
		print("Yes")
		exit()

print("No")

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
A = list(map(int, input().split()))
t = 0
S = 0
for Ai in A:
    S=S+Ai

for Ai in A:
    if Ai >= S/(4*M):
        t = t+1

if t >= 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()]
total_votes = sum(A)
threshold = total_votes / (4 * M)
uppers = [int(i >= threshold) for i in A]
if sum(uppers) >= M:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
N,M = map(int,input().split())
table = [int(i) for i in input().split()]
tsum = sum(table)       ##相得票の和
a = tsum/4/M            ##得票数の1/4M
b = [i for i, x in enumerate(table) if x>=a]
c = len(b)      ##a以上の要素の数
if c >= M:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
N, M, *A = map(int, open(0).read().split())

A.sort(reverse=True)

th = sum(A) / (4 * M)
for a in A[:M]:
    if a < th:
        print("No")
        quit()

print("Yes")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import numpy as np

# スペース区切りの整数の入力
N,M = map(int, input().split())


# スペース区切りの整数の入力
list = list(map(int, input().split()))


A=sum(list)

Z=A/4/M



index=0


for num in range(N):
    if list[num]>=Z:
        index=index+1


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

Submission status: Accepted

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

X = 0
for i in range(N):
    X += A[i]
Y = X / (4 * M)

cnt = 0
for j in range(N):
    if A[j] >= Y:
        cnt += 1

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

Submission status: Accepted

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

cnt = 0

yukohyo = sum(listA)/(4*M)

for i in listA:
    if i >= yukohyo:
        cnt += 1

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

Submission status: Accepted

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

cnt = 0
for a in A:
    if S <= a * 4 * M:
        cnt += 1

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

Submission status: Accepted

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

y = 0
for i in range(n):
    x = total /(4*m)
    if total //(4*m) == total /(4*m):
        if l[i] >= total //(4*m):
            y += 1
    else:
        if l[i] > total //(4*m):
            y += 1

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

Submission status: Accepted

Solution code:
Sum = 0
inc = 0

N,M = map(int,input().split(" "))
A_l = list(map(int,input().split(" ")))
A_l.sort(reverse=True)
for i in range(N):
    Sum += A_l[i]
    
for j in range(M):
    
    if A_l[j] < Sum / (4 * M):
        inc += 1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,M=map(int,input().split())
A=list(map(int,input().split()))
pop = 1/(4*M)*sum(A)
lis = []
for i in A:
    if i>=pop:
        lis.append(i)
if len(lis)>=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)
tou = (1/(4*M))*s
count = 0
for i in A:
    if i < tou:
        continue
    else:
        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())) 


def votenum(A):
  m = 0
  for i in range(0, len(A)):
    m = m + A[i]
  return m

#上位番目
Mlast = sorted(A)[-M]


S = Mlast / votenum(A) 


if S < 0.25 / M:
  print('No')
else:
  print('Yes')

Submission status: Accepted

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

for num in A:
    if num >= p:
        popu += 1

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

Submission status: Accepted

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

N = int(N)
M = int(M)

vote_of_item = [int(x) for x in input().split(' ')]
total_votes = sum(vote_of_item)
frac_of_item = [vote/total_votes for vote in vote_of_item]
threshold = 1 / (4 * M)

selectable = 0
for i in range(len(frac_of_item)):
    if frac_of_item[i] >= threshold:
        selectable += 1


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

Submission status: Accepted

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

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

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

count = 0

ans = 'No'
k = 0
sum = 0


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




for j in range(N):
    k = A[j]

    if  k * 4 * M >= sum:
        count += 1

if count  >= M:
    ans = 'Yes'

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('No')
else:
    print('Yes')

Submission status: Accepted

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

def cumsum(xs):
  result = [xs[0]]
  for x in xs[1:]:
    result.append(result[-1] + x)
  return result
C = A

C.sort()
C = C[-M:]

B = cumsum(A)

if C[0]>=(1/(4*M))*(B[len(A)-1]):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
import math
import numpy as np

n,m=(int(x) for x in input().split())
a=list(map(int,input().split()))
a_sort=np.sort(a)[::-1]
sum=np.sum(a)
if a_sort[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())) 
ta = sum(a)
sl = sorted(a,reverse=True)
lim = ta/4/m
if sl[m-1] < lim:
    print("No")
else:
    print("Yes")

Submission status: Accepted

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

top_vote_ls = []
selectable = (1/(4*m))*sum(vote_ls)

for i in range(0, m):  
  max = 0
  for j in range(len(vote_ls)):      
    if vote_ls[j] > max: 
      max = vote_ls[j]; 
  vote_ls.remove(max); 
  if max >= selectable:
    top_vote_ls.append(max) 

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

Submission status: Accepted

Solution code:
line = list(map(int, input().split()))
p_array = list(map(int, input().split()))

n,m = line[0],line[1]

sum_array = sum(p_array)
# j_sum = int(sum_array / (4 * m))
j_sum = sum_array / (4 * m)

tmp = []

for i in p_array:
    if i < j_sum:
        continue
    tmp.append(i)

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

Submission status: Accepted

Solution code:
n,m=map(int,input().split())
a=list(map(int,input().split()))
count=0
for i in range(int(n)):
    if a[i]<sum(a)/(4*int(m)):
        count=count
    else:
        count=count+1
if count>=int(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)
if a_sum % (4 * m) != 0:
    a_border = (a_sum // (4 * m)) + 1
else:
    a_border = a_sum // (4 * m)

count = 0
for a_one in a:
    if a_one >= a_border:
        count += 1

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

Submission status: Accepted

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

Submission status: Accepted

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

l.sort(reverse=True)

temp=4*m
temp=suml/temp

if l[m-1]>=temp:
    print("Yes ")
else:
    print("No ")
    
##
##flag=False
##
##for i in range(n):
##    if m==0:
##        flag=True
##        break
##    else:
##        if l[i]>temp:
####            print(l[i],temp)
##            m-=1
##
##if flag:
##    print("Yes ")
##else:
##    print("No ")
##

Submission status: Accepted

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

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

list.sort(a, reverse=True)

ans = "No"


if a[m-1] >= sum(a)/(4*m) :
  ans = "Yes"
print (ans)

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
li = [int(p) for p in list(input().split())]
total=sum(li)
count=0
for l in li:
    if l >= total*0.25/M:
        count+=1
    else:
        pass
if count >= M:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
n,m = map(int,input().split())
num_list = list(map(int,input().split()))
cnt = 0
for i in num_list:
    if i >= sum(num_list) * (1/(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()))

sum_A = sum(A)
cnt = sum(x >= sum(A)/(4*m) for x in A)

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

Submission status: Accepted

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

total = sum(A)

ans = 0

for i in range(N):
    if A[i] >= total/(4.0*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( reverse=True )

T = sum( A )

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

Submission status: Accepted

Solution code:
a = input().split(' ')
b = input().split(' ')
a = [int(a) for a in a]
b = [int(b) for b in b]

b.sort(reverse=True)

ans = 'Yes'

if b[a[1]-1] / sum(b) < 1 / (4 * a[1]):
    ans = 'No'
            
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

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

border = sum(A) / (4*M)
flag = 'Yes'

for i in range(M):
    if border > A[i]:
        flag = 'No'

print(flag)

Submission status: Accepted

Solution code:
#https://atcoder.jp/contests/abc161/tasks/abc161_bttps://atcoder.jp/contests/abc161/tasks/abc161_a
# -*- coding: utf-8 -*-
N,M = map(int,input().split())
A = input().split()
A = [int(i) for i in A]
goukei = sum(A)
ikiti = 1/(4*M)
A.sort(reverse=True)
for i in range(len(A)):
  if A[i] < goukei*ikiti:
    A[i] = "nasi"
A = [i for i in A if i != "nasi"]
if len(A) >= M:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
import sys
from io import StringIO
import unittest


def resolve():
    n, m = map(int, input().split())
    item = []*n
    item = input().split()

    all = 0
    for i in range(len(item)):
        all += int(item[i])

    # リストの作成
    dicta = {}
    for i, a in enumerate(item):
        dicta[i] = int(a)
    dicta_sorted = sorted(dicta.items(), key=lambda x: x[1], reverse=True)

    # えらべるか判定
    choice_count = 0
    i = 0
    for i in range(m):
        aaa = 4 * m
        if dicta_sorted[i][1] < all/aaa:
            continue
        choice_count += 1

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


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)
    def test_入力例_1(self):
        input = """4 1
5 4 2 1"""
        output = """Yes"""
        self.assertIO(input, output)
    def test_入力例_2(self):
        input = """3 2
380 19 1"""
        output = """No"""
        self.assertIO(input, output)
    def test_入力例_3(self):
        input = """12 3
4 56 78 901 2 345 67 890 123 45 6 789"""
        output = """Yes"""
        self.assertIO(input, output)

if __name__ == "__main__":
    # unittest.main()
    resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

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

A = sorted(list(map(int, input().split())),reverse = True)

sum_A = sum(A) 

pop = math.ceil(sum_A / (4 * M))

count_pop = len([i for i in A if i >= pop])
#https://note.nkmk.me/python-collections-counter/

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

Submission status: Accepted

Solution code:
from fractions import Fraction

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

ans = 0
sums = 0

for _ in range(N):
  sums += A[_]


for i in range(N):
  a = Fraction(A[i],sums)
  b = Fraction(1,4*M)
  if a >= b:
    ans += 1
  else:
    pass
  
  
  

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

Submission status: Accepted

Solution code:
N,M=map(int,input().split())
List=list(map(int,input().split()))
Lists=list()
for i in List:
    if i/sum(List)>=1/(4*M):
        Lists.append(i)

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

Submission status: Accepted

Solution code:
nm = input('')
n = int(nm.split(' ')[0])
m = int(nm.split(' ')[1])
alist = input('').split(' ')

t = 0
for i in range(n):
  t += int(alist[i])

  s = 0
for i in range(n):
  a = int(alist[i])
  if a*4*m >= t:
    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()))
S=sum(A)/(4*M)

a=0
for i in range(N):
  if A[i]>=S:
    a+=1
    
if a>=M:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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


th=sum(A)/(4*M)
#print('th='+ str(th))

A_th=[A_t for A_t in A if A_t>=th]

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

Submission status: Accepted

Solution code:
# B - Popular Vote
n, m = map((int),(input().split()))

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

a.sort(reverse=True)

flg = True

for i in range(1, m):
    if a[i] < sum(a) / (4 * m):
        flg = False

if flg == 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)
j = 0
for i in range(m):
    maxA = max(A)
    if maxA >= sum_A/(4*m):
        j += 1
    A.remove(maxA)
if j == m:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

for i, a in enumerate(A_list):
    if a >= sum(A_list)*(1/(4 * M)):
        c += 1
    else:
        break

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

Submission status: Accepted

Solution code:
n, m = [int(i) for i in input().strip().split()]
items = sorted([int(i) for i in input().strip().split()], reverse = True)
th = sum(items) / (4. * m)
print("Yes" if items[m - 1] >= th else "No")