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 = list(map(int, input().split(" ")))
a = list(map(int, input().split(" ")))
low = sum(a) / (4 * m)
count = 0
for v in a:
    if v >= low:
        count+= 1
if count >= m:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

if l % 1 == 0:
  l -= 1
  
a = len(list( i for i in A if i > l ))
if a >= M:
  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()))
A = sorted(A, reverse=True)
if (A[M - 1] >= sum(A) / (4 * M)):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
import numpy as np

NM=np.array(input().split(" "),dtype=np.int32)
N=NM[0]
M=NM[1]

A=np.array(input().split(" "),dtype=np.int32)

total=sum(A)

th=total*(1/(4*M))

count=0

for a in A:
    if(a>=th):
        count+=1

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
n, m = map(int, input().split())
i = list(map(int, input().split()))

sumsum = sum(i) 
border = sumsum/4/m

count = 0
for num in i:
    if num >= border:
        count += 1

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

Submission status: Accepted

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

Submission status: Accepted

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

def input_multiple_number():
    return map(int, input().split())

def input_multiple_number_as_list():
    return list(map(int, input().split()))


N,M = input_multiple_number()
list_A = input_multiple_number_as_list()


sums = 0

for a in list_A:
	sums += a

thre = -(-sums//4//M)

cnt = 0
for a in list_A:
	if a >= thre:
		cnt += 1

if cnt >= 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()))
    # import numpy as np

    # A = np.array(A)
    su = sum(A)
    a = sorted(A, reverse=True)

    tmp = su/M * 0.25

    if a[M-1] < tmp:
        print('No')
    else:
        print('Yes')


if __name__ == '__main__':
    main()

Submission status: Accepted

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

thres = sum(a) / 4 / m
select = 0
for ai in a:
    if ai >= thres:
        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()))
kijun = sum(a)/(4*M)
ans = 0
for i in a:
    if i >= kijun:
        ans += 1
if ans >= M:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
#B
nm = [int(x) for x in input().split()]
line = [int(x) for x in input().split()]

m = nm[1]
yeet = sum(line)
line.sort(reverse = True)

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

Submission status: Accepted

Solution code:
inp = list(map(lambda x: int(x), input().split(" ")))
N = inp[0]
M = inp[1]
inp = list(map(lambda x: int(x), input().split(" ")))

count_all = sum(inp)
check = count_all/(4*M)

inp.sort()
inp.reverse()

flag = True
for i in range(M):
    if(inp[i]<check):
        print("No")
        flag = False
        break
if (flag):
    print("Yes")

Submission status: Accepted

Solution code:
import sys

n, m, *a = map(int, sys.stdin.read().split())

def main():
    a.sort(reverse=True)
    s = sum(a)
    ans = 'Yes' if  a[m-1] * 4 * m >= s else 'No'
    print(ans)

if __name__ ==  '__main__':
    main()

Submission status: Accepted

Solution code:
import collections, math

local = False
if local:
    file = open("inputt.txt", "r")

def inp():
    if local:
        return file.readline().rstrip()
    else:
        return input().rstrip()

def ints():
    return [int(_) for _ in inp().split()]


N, M = ints()

A = ints()

totalvotes = sum(A)
popitems = 0
ratio = 1/(4*M)
border = ratio*totalvotes

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

if popitems>=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)
Flag = True
goukei = sum(A)
for a in range(M):
    if A[a]*4*M < goukei:
        Flag = False
print('Yes' if Flag else 'No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np

def main():
    n, m = map(int, input().split(" "))
    As = np.array(list(map(int, input().split(" "))))
    #print(np.sum(As) /(4 * m))
    #print(As >= (np.sum(As) /(4 * m)))
    if np.count_nonzero(As >= (np.sum(As) /(4 * m))) >= m:
        ans = "Yes"
    else:
        ans = "No"
    print(ans)
if __name__ == '__main__':
    main()

Submission status: Accepted

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

total=sum(a)
import math
border=math.ceil(total/(4*m))
cnt=0
for i in a:
    if i>=border:
        cnt+=1
print('Yes' if cnt>=m else 'No')

Submission status: Accepted

Solution code:
R = lambda: map(int, input().split())
n, m = R()
a = sorted(R())
print('YNeos'[4 * m * a[-m] < sum(a)::2])

Submission status: Accepted

Solution code:
from sys import stdin
from sys import setrecursionlimit
from math import ceil
from collections import Counter, deque, defaultdict
setrecursionlimit(1000000)

# INF = float('inf')
INF = int(1e10)

def input():
    return stdin.readline()[:-1]

def main():
    from builtins import int, map
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    Asum = sum(A)
    A = [4 * M * a for a in A]

    count = 0
    for a in A:
        if a >= Asum:
            count += 1
    
    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()

S=sum(A)

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

Submission status: Accepted

Solution code:
n,m = input().split(' ')
l = [int(x) for x in input().split(' ')]
l.sort()
if sum(l) > l[-int(m)]*4*int(m):
  print("No")
else:
  print("Yes")

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
A = list(map(int, input().split()))
cnt = 0
total = sum(A)
for i in range(len(A)):
    if A[i] >= (total * (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()))
s= sum(A)
l = s / (4*M)

cnt = 0

for a in A:
  if a >= l: cnt = cnt + 1
    
if cnt < M:
  print('No')
else:
  print('Yes')

Submission status: Accepted

Solution code:
def main():
    N,M = map(int,input().split(' '))
    ori_data = input().split(' ')
    data = [int(ori_data[i]) for i in range(N)]
    all = 0
    for per in data:
        all += per

    judge = all / (4 * M)
    count = 0
    for per in data:
        if(per >= judge):
            count += 1
    if(count >= M):
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def resolve():
    N, M = map(int,input().split())
    S = tuple(map(int, input().split()))
    g = sum(S) * (1/(4*M))

    count = 0
    ans = 'No'
    for s in S:
        if s >= g:
            count += 1

        if count == M:
            ans = 'Yes'
            break

    print(ans)

if __name__ == '__main__':
    resolve()

Submission status: Accepted

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

a = list(reversed(sorted(a)))

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

Submission status: Accepted

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

sou = sum(As)
th = sou/4/m
count = 0
for e in As:
  if e >= th:
    count += 1
    if count == m:
      print('Yes')
      break
if count < m:
  print('No')

Submission status: Accepted

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

Submission status: Accepted

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

A = sorted(A, reverse=True)

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse=True)
print('YNeos'[A[M-1]<sum(A)/4/M::2])

Submission status: Accepted

Solution code:
from math import ceil
n,m = [int(x) for x in input().split(' ')]
arr = [int(x) for x in input().split(' ')]
t = ceil(sum(arr)/(4*m))
cnt = 0
for i in arr:
    if i>=t:
        cnt=cnt+1
if(cnt>=m):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
a_list = list(map(int, input().split()))
a_list.sort(reverse=True)
total = sum(a_list)
if a_list[m-1] / total >= 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()))
num = sum(a)
cnt = 0
for i in a:
    if i < num /(4 * m):
        continue
    else:
        cnt += 1

# print(n, m, a, num, cnt)
if cnt < m:
    print('No')
else:
    print('Yes')

Submission status: Accepted

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

a.sort()
if a[-m] < sum(a) / (4*m):
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
A = list(map(int, input().split()))
cnt = 0
b = sum(A)/(4*M)
for i in range(N):
    if A[i] >= b:
        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()))
l = sorted(l,reverse = True)
high = sum(l)

if l[m-1] >= high/4/m:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

t = sum(A) / (4 * M)
l = len(tuple(filter(lambda x: x >= t, A)))

print('Yes' if M <= l else 'No')

Submission status: Accepted

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

S = sum(A)

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

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 ai in a:
    if ai >= s:
        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()))

sa = sorted(a, reverse=True)
sum = sum(a)
flg = 0
for index in range(m):
    if sa[index] < sum / (4 * m):
        print("No")
        flg = 1
        break
if flg == 0:
    print("Yes")

Submission status: Accepted

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

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

s = sum(a)

bdr = s / (4 * m)

cnt = 0
for v in a:
    if v >= bdr:
        cnt += 1

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

Submission status: Accepted

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

x = sum(A_list)/(4*M)

ok_list = [i for i in A_list if i >= x ]
if len(ok_list) >= M:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,M=map(int,input().split())
A=list(map(int,input().split()))
B=sorted(A)
C=sum(B)
if C<=B[-M]*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()))
total_a = 0

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

a.sort(reverse=True)
choice_flag = True

for i in range(m):
    aa = a[i]

    if aa < total_a / (4 * m):
        choice_flag = False
        break

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

Submission status: Accepted

Solution code:
import math

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

a2 = sorted(a, reverse=True)
limit = math.ceil(sum(a)/(4*m))

if a2[m-1] >= limit:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

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

sum_vote = sum(a)
cond = (1 / (4 * m)) * sum_vote

a = sorted(a, reverse=True)

# print(a)
flag = True
for i in range(m):
    if a[i] < cond:
        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()))
a.sort(reverse=True)
if a[m-1] >= sum(a) / (4 * m):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
import sys
import re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, M = MAP()
A = LIST()

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

S=sum(A)
J=S*1/(4*M)

cnt=0
for value in A:
    if value >= J:
        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()))
sumA = sum(A)
A.sort(reverse=True)

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# B - Popular Vote
# 標準入力の取得
N,M = list(map(int, input().split()))
A = list(map(int, input().split()))

# 商品を降順にソートし、M番目の商品の得票数と1/4Mを比較
total_votes = sum(A)
sorted_A = sorted(A, reverse=True)
if sorted_A[M-1] >= total_votes/(4*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)
cnt = 0
for i in range(n):
    if sum_a / (4*m) <= a[i]:
        cnt += 1
if m <= cnt:
    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()]
s = sum(a)
a = sorted(a,reverse=True)
if a[m-1] >= s/(4*m):
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
import numpy as np
n,m = map(int, input().split())
l = np.array(list(map(int, input().split())))
l.sort()
al = l.sum()
if l[-m] < al/(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 = sum(a)
chk =s * 1/(4*m)
x = sorted(a, reverse=True)
if x[m-1] < chk:
    print('No')
    exit()

print('Yes')

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
A = list(map(int, input().split()))
S = 0
count = 0
for i in A:
  S += i
  
vote = S / (4 * M)

for i in A:
  if i >= vote:
    count += 1
    
if count >= M:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

Submission status: Accepted

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

total = sum(a)

for i in range(n):
  if a[i] >= total / (4 * m):
    a[i] = "OK"

if a.count("OK") >= 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)

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import numpy as np

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

if (np.count_nonzero(a >= np.sum(a)/(4*m)) >= m):
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

A.sort(reverse=True)

b=sum(A)

c=b/(4*M)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,M = map(int,input().split())
A = sorted(map(int,input().split()),reverse = True)
goukei = sum(A)
judge = goukei/4/M
if A[M-1]>=judge:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
n,m = map(int,input().split())
nlist = list(map(int,input().split()))
ans = 0
for i in range(n):
  if nlist[i] >= sum(nlist)/(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())) # list()でリスト化、それを変数に代入。

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()
if A[-m] < sum(A) / 4 / m:
  print('No')
else:
  print('Yes')

Submission status: Accepted

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

for i in range(M):
  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())
li = list(map(int, input().split()))
li_a = list(sorted(li))
s = sum(li_a)
if li_a[-m] >= s/(4*m):
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
import sys
from pprint import pprint

N, M = map(int, sys.stdin.readline().strip().split())
A = list(map(int, sys.stdin.readline().strip().split()))

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

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

Submission status: Accepted

Solution code:
N,M = list(map(int,input().split()))
A = list(map(int,input().split()))
ans = []
r = sum(A) / (4 * M)

for i in A:
    if i < r:
        pass
    else:
        ans.append(i)
if len(ans) < M:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
a=input()
a,b=a.split(" ")
a=int(a)
b=int(b)
pro=[]
temp=input().split(" ")
for i in range(a):
    pro.append(int(temp[i]))
pro.sort(reverse=True)
sumvote=sum(pro)
for i in range(b):
    if pro[i]<1/(4*b)*sumvote:
        print("No")
        quit()
print("Yes")

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

x = sum(a)/(4*m)
a = sorted(a, reverse=True)
b = 0

for i in range(m):
  if a[i] < x:
    b += 1
    print('No')
    break

if b == 0:
  print('Yes')

Submission status: Accepted

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

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

count=0
for i in range(N):
  if A[i] >= m:
    count+=1

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

Submission status: Accepted

Solution code:
n,m = list(map(int, input().split()))
a = list(map(int, input().split()))
counta = 0
min_ = sum(a)/(4*m)
for i in a:
    if i >= min_:
        counta+=1
if counta >= 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)
r = s/(4*m)
a = sorted(a, reverse=True)
can = True
for x in a[:m]:
    if x < r:
        can = False
        break
if can: print("Yes")
else: print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,m=map(int,input().split())
a=list(map(int,input().split()))
price=sum(a)*(1/4/m)
ans=[]

for i in range(n):
  if a[i]>=price:
    ans.append(a[i])
    
if len(ans)>=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()]
_sum = sum(A)
th = _sum / (4*m)
cnt = 0

for a in A:
    if a >= th:
        cnt += 1
if cnt >= m:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

count = sum(x>=sum(vote_list)/(4*M) for x in vote_list)

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

Submission status: Accepted

Solution code:
def b161(n , m , al):

    ans = "Yes"
    al.sort(reverse=True)
    gou = sum(al)

    for i in range(m):
        if al[i] < gou / (4 * m):
            ans = "No"

    return ans

def main():
    n , m = map(int , input().split())
    al = list(map(int , input().split()))
    print(b161(n , m , al))

if __name__ == '__main__':
    main()

Submission status: Accepted

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

vote_sum = sum(A)
min_needed = (vote_sum + 4 * M - 1) // (4 * M)

A.sort(reverse=True)

print("Yes" if A[M - 1] >= min_needed else "No")

Submission status: Accepted

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

A.sort(reverse=True)
tot=sum(A)
totm=sum(A[:M])

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#create date: 2020-04-04 21:06

import sys
stdin = sys.stdin

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

def main():
    n, m = na()
    a = na()
    k = 1/(4*m) * sum(a)
    a.sort(reverse=True)
    if a[m-1] >= k:
        print("Yes")
    else:
        print("No")

if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

if A[-m] < 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()))
A = sorted(A, reverse=True)
for i in range(M):
    if A[i] < sum(A) * (1/ (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 = sorted(A, reverse=True)
ALL = sum(A_sort)
cnt = 0
for c in A_sort:
    if c < ALL / (4 * M):
        break

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

Submission status: Accepted

Solution code:
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n,m=LI()
  l=LI()

  sm=sum(l)
  a=sm/(4*m)

  l.sort(reverse=True)
  for x in l:
    if m<=0:
      return 'Yes'
    m-=1
    if x<a:
      return 'No'
  if m<=0:
    return 'Yes'
  return 'No'

# main()
print(main())

Submission status: Accepted

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

sum_a = sum(a)
count = 0
for val in a:
    if val >= sum_a / (4 * m):
        count += 1
if count >= m:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

minimum = sum(A) / (4 * M)
A = [a for a in A if a >= minimum]
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()))

A_sum = sum(A)
A.sort(reverse=True)

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
n,m = map(int,input().split())
a = list(map(int,input().split()))
lim = sum(a)/(4*m)
a.sort()
for i in range(m):
    if a[-1-i] >= lim:
        continue
    else:
        print("No")
        exit()
print("Yes")

Submission status: Accepted

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

p = [ai for ai in a if ai >= sum(a)/(4 * m)]

if len(p) >= 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()
total = sum(A)

if A[N - M] >= total / (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()]
s=0
for i in range(n):
  s+=A[i]
c=0
for i in range(n):
  if A[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())
L = list(map(int,input().split()))
li = []
for i in range(len(L)):
    li.append(L[i] >=sum(L)/(4*m) )
cnt = 0
for i in range(len(li)):
     if sum(li)>=m:
         cnt +=1
if cnt >= 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()))
# print(A)
A.sort(reverse=True)
# print(A)

for i in range(M):
    if A[i] < sum(A) / (4 * M):
        print('No')
        exit()
else:
    print('Yes')

Submission status: Accepted

Solution code:
str1 = str(input())
l1 = str1.split(' ')
n = int(l1[0])
m = int(l1[1])
str2 = str(input())
l2 = str2.split(' ')
l = [int(x) for x in l2]
total = sum(l)
testNum = total/(4*m)
x = []
for i in l:
	if i>=testNum:
		x.append(i)

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

Submission status: Accepted

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

sm = sum(A)
ans = 'Yes'
for i in range(M):
    if A[i] < sm / (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_ls = list(map(int, input().split()))
a_ls.sort(reverse = True)
#print(a_ls)
all_sum = sum(a_ls)
#print(all_sum)
#print(all_sum/(4*m))
if a_ls[m-1] >= (all_sum/(4*m)):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

count = 0
sum = sum(data)

for _ in range(N):
    if 1/(4*M) * sum <= data[_]:
        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()))

sum = sum(A)
ans = 0

for i in A:
    if i * 4 * M >= sum:
        ans += 1

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