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

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

ok = 0
for i in range(N):
    if A[i] >=  T / 4 / M:
        ok = ok + 1

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

Submission status: Accepted

Solution code:
n,m=map(int, input().split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
a=list(map(int, input().split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき

a.sort(reverse=True)

s=sum(a)

if a[m-1]*m*4>=s:
    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)/(4*m)
if a[m-1]>=x:
    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 a in A:
    total += a

word = "Yes"
for m in range(M):
    if (A[m] * 4 * M < total):
        word = "No"
 
print(word)

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 = list(map(int,input().split()))
A = list(map(int,input().split()))
thresh = sum(A) / (4*M)
print("Yes" if M <= len([i for i in A if i >= thresh]) else "No")

Submission status: Accepted

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

c=0
s=sum(l)

for i in range (n):
  if l[i]>=s/(4*m):
    c+=1
    
if c>=m:
  print ('Yes')
else:
  print ('No')

Submission status: Accepted

Solution code:
n,m = map(int,input().split())
a = sorted(list(map(int,input().split())),reverse=True)
def main():
    s = sum(a)
    thresh = s/4/m
    if a[m-1]>=thresh:
        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(reverse=True)

box = []
_sum = sum(A)
for a in A:
    if a >= 1/(4*M) * _sum:
      box.append(a)

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

Submission status: Accepted

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

import sys


def input():
    return sys.stdin.readline()


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

    sum_a = sum(a_list)

    limit = 1 / (4*m)

    sorted_a = sorted(a_list, reverse=True)
    count = 0
    for ai in sorted_a:
        ratio_ai = ai / sum_a

        if ratio_ai >= limit:
            count += 1
            if count >= m:
                print("Yes")
                exit()
            continue
        else:
            print("No")
            exit()



if __name__ == "__main__":
    resolve()

Submission status: Accepted

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

a = input().split()
a = [int(a) for a in a]

sum_a = sum(a)

a_can_choose = [True if a >= sum_a / (4 * m) else False for a in a]

print("Yes" if m <= sum(a_can_choose) else "No")

Submission status: Accepted

Solution code:
#


def main():
    n, m = map(int, input().split(" "))
    a = [int(s) for s in input().split(" ")]
    total = sum(a)
    lim = total / (4 * m)
    a = sorted(a, reverse=True)
    count = 0
    for i in a:
        if i >= lim:
            count += 1
        else:
            break
    if count >= 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(reverse=True)
cnt =0
goukei = sum(a)
for i in range(m):
    if a[i] < (1/(4*m) * goukei):
        continue
    else:
        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)
s = sum(a)

limit = s / (4*m)

for i in range(m):
    if a[i] < limit:
        print("No")
        exit()

print("Yes")

Submission status: Accepted

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

Submission status: Accepted

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

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

a.sort(reverse = True)
s = sum(a)
b = s / (4*M)

if a[M-1] >= b:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N,M = list(map(int,input().split()))
A = list(map(int,input().split()))

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

cor = []
for a in A:
    if a > sre or a == sre:
        cor.append(a)

#print(len(cor))
if len(cor) > M or len(cor) == M:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

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

a.sort(reverse=True)

sum = 0
for i in a:
    sum += i

#print(str(a[m-1]),str(sum),str(1 / (4 * m)))

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

Submission status: Accepted

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

line = input().rstrip().split(' ')
a = [0] * n
total = 0
for i in range(n):
    a[i] = int(line[i])
    total += a[i]

list.sort(a, reverse=True)
b = total / (4 * m)

ans = 'Yes'
for i in range(m):
    if a[i] < b:
        ans = 'No'

print(ans)

Submission status: Accepted

Solution code:
import numpy as np
N,M = map(int,input().split())
A = np.array(list(map(int,input().split())))

all_sum_a = np.sum(A)

if M<=np.sum(A>=all_sum_a/(4*M)):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

n,m=nm()
a=nl()
j=0
count=sum(a)/(4*m)
for i in a:
    if i>=count:
        j+=1
if j<m:
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
A = sorted(map(int, input().split()))
sum_a = sum(A)
border = sum_a / (4*M)

if A[-M] >= border:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
n,m=map(int,input('').split(' '))
a=input('').split(' ')
s=0
for b in range(n):
    a[b]=int(a[b])
    s=s+a[b]

ko=0
if s%(4*m)==0:
    ok=int(s/(4*m))
else:
    ok=int((s/(4*m)))+1

for b in range(n):
    if a[b]>=ok:
        ko=ko+1

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

Submission status: Accepted

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

A = sorted(A, reverse=True)

X = A[M-1]
Y = sum(A)
th = Y / (4*M)

if X >= th:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
N_all, M_part = map(int, input().split())
Hyou = list(map(int, input().split()))

Hyou.sort(reverse=True)
summ = sum(Hyou)

thres = summ / (4 * M_part)

if (Hyou[M_part - 1] >= thres):
    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)
F = True
for i in range(M):
  if sum(A)/(4*M) > A[i]:
    F = False
print("Yes" if F else "No")

Submission status: Accepted

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

if len(data) < m:
  print('No')
  exit()

total = sum(data)

data.sort(reverse=True)

for d in data[:m]:
  if d < total / (4 * m):
    print('No')
    exit()
print('Yes')

Submission status: Accepted

Solution code:
"""
import random
import functools
import copy
import bisect
import array
import re
import collections
import heapq
import fractions
import itertools
import string
import math
from operator import itemgetter as ig
from bisect import bisect_left, bisect_right, insort_left, insort_right
from itertools import permutations, combinations, product, accumulate, groupby
from heapq import heappush, heappop
from collections import deque, defaultdict, Counter
import sys
sys.setrecursionlimit(10 ** 7)
#import numpy as np

inf = 10 ** 20
INF = float("INF")
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = dd + [(-1, 1), (1, 1), (1, -1), (-1, -1)]
ddn9 = ddn + [(0, 0)]
'''for dx, dy in dd:
        nx = j + dx; ny = i + dy
            if 0 <= nx < w and 0 <= ny < h:'''
"""


def main():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    A.sort()
    A.reverse()
    sum_A = sum(A)
    M_1 = 4*M
    b = sum_A / M_1
    #b = (sum_A + (M_1) - 1) / M_1
    flag = True
    for i in range(M):
        if A[i] < b:
            print('No')
            flag = False
            break
    if flag:
        print('Yes')


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:

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

A_list = list(map(int, input().split()))
A_list.sort(reverse=True)

total = sum(A_list)

if total / (4 * M) > A_list[M - 1]:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
txt = 'No'
suma = sum(a)


def fil(n):
    if suma / (4 * m) <= n:
        return True
    else:
        return False


a = list(filter(fil, a))

if len(a) >= m:
    txt = 'Yes'

print(txt)

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
l = list(map(int, input().split()))
total = sum(l)
limit = total * (1 / (4 * M))
n = sum(x >= limit for x in l)
ans = 'No'
if n >= M:
    ans = 'Yes'
print(ans)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
lis = list(map(int, input().split()))
mot = sum(lis)
liss = sorted(lis, reverse=True)

flag = True
for a in range(m):
    if liss[a] * 4 * m < mot:
        flag = False

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

Submission status: Accepted

Solution code:
N,M=map(int,input().split())
A=list(map(int,input().split()))
All=sum(A)
hantei = All/4/M
ninki=0
for cnt in A:
    if cnt >=hantei:
        ninki+=1
if ninki>=M:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
import math
import sys

stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))
mod = 10**9 + 7 
sys.setrecursionlimit(1000010)


M,M = nm()
A  = nl()
As = sorted(A,reverse=True)
# rint(As)
s = sum(A)
# print(s)
limit=(s + 4*M -1) // (4 *M )
if As[M-1] >= limit:
    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:
import numpy as np
n,m,*a = map(int,open(0).read().split())
if np.count_nonzero(np.array(a)>=sum(a)/4/m)>=m:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

total = sum(boat_list)

threshold = total / (4 * M)

judge_list = []

for i in range(len(boat_list)):
    if boat_list[i] >= threshold:
        judge_list.append(1)
    else:
        pass

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

Submission status: Accepted

Solution code:
#coding : utf-8

N, M = map(lambda x: int(x), input().split(" "))
A = list(map(lambda x: int(x), input().split(" ")))

total = 0

for a in A:
	total += a

m = 0

for a in A:
	if a * 4 * M >= total:
		m += 1

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

Submission status: Accepted

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

Submission status: Accepted

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

a.sort(reverse=True)
s = sum(a)
thresh = s/(4*m)
flag=True
for i in range(m):
    if a[i]< thresh:
        flag=False
        break

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

Submission status: Accepted

Solution code:
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
all_A = sum(A)
comp = (1/(4*M))*all_A
A.sort(reverse=True)
i = 0
ans = 0
#print(A)
while (i <= M-1):
    if A[i] >= comp:
        ans += 1
    i += 1
#print(M)
#print(ans)
if ans == M:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
import numpy as np

def main():
    N,M = map(int,input().split())
    A = np.array(list(map(int,input().split())))
    ans = 'No'

    if sum( A >= sum(A)/4/M ) >= M: ans = 'Yes'
    
    print(ans)
    return

if __name__ == "__main__":
    main()

Submission status: Accepted

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

def main():
    n, m = map(int, input().split())
    li = list(map(int, input().split()))

    sorted_li = sorted(li, reverse=True)

    if sorted_li[m-1] < sum(li)/(4*m):
        print('No')
    else:
        print('Yes')

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
str = input().split()
n = int(str[0])
m = int(str[1])
arr = input().split()
cnt = 0
sum = 0
for i in range(n):
    sum+=int(arr[i])

for i in range(n):
    if int(arr[i]) >= (sum)/(4*m):
        cnt+=1
if cnt >= m:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

An = sorted(An, reverse=True)

goukei = sum(An)
keisan = goukei * (1 / (4 * M))

flag = True

for i in range(M):
  if An[i] < keisan:
    flag = False
    print('No')
    break
  
if flag is True:
  print('Yes')

Submission status: Accepted

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

ng = sum(a) / (4 * m)
a.sort(reverse=True)
ans = 'Yes'
for i in a[:m]:
    if i < ng:
        ans = 'No'
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np

N, M = np.array(list(map(int, input().split())))
A = np.array(list(map(int, input().split())))
A_sum = A.sum()
if((A[A >= A_sum/(4*M)].size) >= M):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
a = list(map(int, input().split()))
requiredValue = float(sum(a)) / 4 / m
count = 0

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

Submission status: Accepted

Solution code:
n, m = map(int,input().split())
A = [int(a) for a in input().split()]
A.sort()
if 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()))
cnt = 0

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

a = sorted(a, reverse=True)

chflg = True

for i in range(m):
    if a[i] < cnt * 1 / (4 * m):
        chflg = False

if chflg == True:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
n, m = input().strip().split(' ')
n, m = [int(n), int(m)]


array = list(map(int, input().strip().split(' ')))
sum = 0
for i in range(n):
    sum = sum + array[i]

bd = sum / (4*m)

cnt = 0
for i in range(n):
    if array[i] >=  bd:
            cnt = cnt + 1
ans = 'No'
if cnt >= m:
    ans = 'Yes'
print(ans)

Submission status: Accepted

Solution code:
NM = list(map(int, input().split()))
score = list(map(int, input().split()))

cutter = 0
all = 0
for i in range(len(score)):
    all += score[i]

candidate = 0
criteria = 4 * NM[1]
for i in range(len(score)):
    if (all <= (score[i] * criteria)):
        candidate += 1

if (candidate >= NM[1]):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

arr = list(map(int, input().split()))
arr = sorted(arr, reverse=True)
ans = 0
s = sum(arr)/m/4

for i in range(n):
  if arr[i] >= s:
    ans += 1
  
if ans >= m:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

b.sort(reverse=True)
#print(b)

s = 0
for i in range(len(b)):
  s += b[i]
  
flag = True
for i in range(a[1]):
  if b[i] < (s / (4*a[1])):
    flag = False

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

Submission status: Accepted

Solution code:
N,M=map(int,input().split())
Z=[int(_) for _ in input().split()]
V=sum(Z)
rat=float(1/(4*M))
cnt=0
for i in range(N):
  if float(Z[i]/V)>=rat:
    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()
A.reverse()
A_sum = sum(A)
bound = 0
if A_sum % (4 * M) == 0:
    bound = A_sum // (4 * M)
else:
    bound = A_sum // (4 * M) + 1
if A[M - 1] >= bound:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

A.sort(reverse = True)
real = A[M-1] / sum(A)
ideal = 1 / (4 * M)

if real >= ideal:
    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)
cnt = 0
for i in range(N):
  if sum(A)*(1/(4*M))<=A[i]:
    cnt+=1
if M <= cnt:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
from sys import stdin


def main():
    input = lambda: stdin.readline()[:-1]
    N, M = map(int, input().split())
    A = list(map(int, input().split()))

    num = (sum(A) + (4 * M) - 1) // (4 * M)
    A.sort(reverse=1)
    if A[M-1] >= num:
        print('Yes')
    else:
        print('No')


main()

Submission status: Accepted

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

Submission status: Accepted

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

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

cnt = 0

for j in range(N):
  if sumA * (1/4/M) <= A[j]:
    cnt = cnt + 1

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

Submission status: Accepted

Solution code:
[N,M]=[int(item)for item in input().split()]
items=[int(item)for item in input().split()]
items_sum=sum(items)

cnt=0
for item in items:
    if item >= items_sum /(4*M):
        cnt += 1
        if cnt==M:
            print("Yes")
            exit()
        
print("No")

Submission status: Accepted

Solution code:
n,m = list(map(int,input().split()))
A = list(map(int,input().split()))
sum = sum(A)
MM = 4*m
A.sort(reverse=True)
for i in range(m):
    if A[i] < sum / MM:
        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)
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)

#print(a,(sum(a)/(4*m)))

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()))
a = sorted(a, reverse = True)
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=sorted(list(map(int,input().split())),reverse=True)
print("Yes" if a[m-1]>=(sum(a)/(4*m)) else "No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import defaultdict
import math
N, M = map(int, input().split(' '))
A = list(map(int, input().split(' ')))
kijun = sum(A)/M/4

a = list(filter(lambda x: x >= kijun, A))
if len(a) >= 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)
for i in range(m):
    if sum_a/4/m > max(a):
        print("No")
        break
    else:
        a.remove(max(a))
else:
    print("Yes")

Submission status: Accepted

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

Submission status: Accepted

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

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

# 大きい順に並べ替え
sorted_A = sorted(A, reverse=True)

# 先頭からM個の要素を抜き出す
m_ele = sorted_A[:M]

# 総得票数を求める
total_toku = sum(sorted_A)

# M回ループ
for m in m_ele:
    # 得票数 < 1 / 4 / M * 総得票数かチェック
    if m < 1 / 4 / M * total_toku:
        # そうならNoしてbreak
        print('No')
        break
# ループを全部抜けたらYes
else:
    print('Yes')

Submission status: Accepted

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

if len(list(filter(lambda x: x>=total/(4*m), votes))) >= m:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
if __name__ == '__main__':
	N, M = map(int, input().split())
	A = [int(a) for a in input().split()]

	th = sum(A)/4/M

	A.sort(reverse=True)



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

Submission status: Accepted

Solution code:
n,m=map(int,input().split())
l=sorted(map(int,input().split()),reverse=True)
sum_1=sum(l)
miman=1/(4*m)
#print(m,n,l,sum_1,miman)
bl=True
for i in range(m):
    if l[i]/sum_1<miman:
        bl=False
        print("No")
        break
if bl :print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
init = [int(s) for s in input().rstrip().split(' ')]
data = [int(s) for s in input().rstrip().split(' ')]

sorData = sorted(data,reverse=True)

if sorData[init[1]-1] < sum(data)/(4*init[1]):
    print("No")
else:
    print("Yes")

Submission status: Accepted

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

print('Yes'if sums>=m else '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/(4*m):
        c+=1

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

Submission status: Accepted

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

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

a_s = sorted(A, reverse=True)
a_i = [int(x) for x in a_s ]
total = sum(a_i)
m_4 = total / (4 * M)

count = 0
for i in a_i:
  if i >= m_4:
    count += 1
  
if M <= count:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

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

else :
    print("No")

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)
ans = True

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

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

Submission status: Accepted

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

threshold = sum(A) / (4*M)
count=0
for i in range(len(A)):
    if A[i] >= threshold:
        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] * 4 * m >= sum(a):
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
  #n = int(input())
  #s = input()
  #s = input().split()
  n,m = list(map(int,input().split()))
  a = list(map(int,input().split()))
  #a = [input() for i in range(n)]
  #a = [int(input()) for i in range(n)]
  #a = [input().split() for i in range(n)]
  #a = [list(map(int,input().split())) for i in range(n)]
  ans = 0
  count = 0
  su = 0
  lis = []
  
  for i in range(n):
    su += a[i] 
  a.sort(reverse = True)
  
  for i in range(m):
    if a[i] < su/(4*m):
      print("No")
      exit()
  print("Yes")

if __name__ == '__main__':
  main()

Submission status: Accepted

Solution code:
n,m=map(int,input().split())
s=list(map(int,input().split()))
s.sort(reverse=True)
total_vote=0
for i in range(n):
    total_vote += s[i]

count = 0
while count != m:
    if total_vote * (1/(4*m)) > s[count]:
        print("No")
        exit()
    else:
        count+=1
print("Yes")

Submission status: Accepted

Solution code:
def main():
  n,m = map(int, input().split())
  
  point = sorted(list(map(int, input().split())), reverse=True)
  border = sum(point) / (4*m)
  
  result = 'Yes'
  for i in range(m):
    if point[i] < border:
      result = 'No'
      break
 
  return result

print(main())

Submission status: Accepted

Solution code:
from sys import *
N,M = map(int,stdin.readline().split())
items = list(map(int, stdin.readline().split()))
total = sum(items)
items.sort(reverse = True)
count = 0
for item in items[0:M]:
    if item < total * (1/(4*M)):
        print("No")
        exit()
print("Yes")

Submission status: Accepted

Solution code:
N, M = list(map(int,input().split()))
A_list = list(map(int,input().split()))
A_list.sort(reverse=True)
ans = A_list[:M]
if min(ans) >= sum(A_list)/(4*M):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
nm = list(map(int,input().rstrip().split()))
n = nm[0]
m = nm[1]
arr = list(map(int,input().rstrip().split()))
vote = sum(arr)
cou = 0
com = (1/(4*m))*vote
for i in range(len(arr)):
    if arr[i] >= com:
        cou += 1
if cou >= m :
    print('Yes')
else:
    print("No")

Submission status: Accepted

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

hyousu = sum(item_list)
threshold = hyousu * (1 / (4 * M))

item_list.sort(reverse=True)
if item_list[M-1] < threshold:
  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)

amount = sum(A)

selectable = 0
for a in A:
    if(not (a*4*M < amount)):
        selectable += 1

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

Submission status: Accepted

Solution code:
import bisect as bs

n,m = map(int, input().split())
a = sorted(list(map(int, input().split())), reverse=True)
s = sum(a)

count = 0

for i in range(len(a)):
  if a[i]*m*4 >= s:
    count += 1
  else:
    break

if count >= 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()))

sorted_a = sorted(a, reverse=True)

for i in range(m):
    if sorted_a[i] < sum(a) / 4 / m:
        print('No')
        sys.exit()
print('Yes')

Submission status: Accepted

Solution code:
def f(A,M):
    N=len(A)
    c=0
    for i in range(N):
        if A[i]>=1/(4*M)*(sum(A)):
            c+=1
    if c>=M:
        return "Yes"
    else:
        return "No"
N,M=map(int,input().split())
A=list(map(int,input().split()))
print(f(A,M))

Submission status: Accepted

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

A=list(map(int,input().split()))
L=sum(A)
flag=0
for i in range(N):
    if A[i]>=L/(4*M):
        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()))
th=sum(a)/(4*m)
a=sorted(a)[::-1]
c=0
f=False
for i in a:
  if i>=th:
    c+=1
  if c>=m:
    f=True
    break
if f:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
# -*- coding utf-8 -*-
n,m = map(int, input().split())
a = [int(x) for x in input().split()]
a.sort(reverse=True)

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