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:
import math
from collections import defaultdict
ml=lambda:map(int,input().split())
ll=lambda:list(map(int,input().split()))
ii=lambda:int(input())
ip=lambda:input()

"""========main code==============="""

x,y=ml()
a=ll()
b=sum(a)
c=b/(4*y)
ans=0
f=0
for i in a:
    if(i>=c):
        ans+=1
    if(ans>=y):
        f=1
        break
if f:
    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)
t = s/(4*m)
ans = "Yes"
for num,i in enumerate(a):
  if num == m:
    break
  elif i<t:
    ans = "No"
    break
print(ans)

Submission status: Accepted

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

c = 0
s = sum(a)
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 = (int(x) for x in input().split())
array = list(map(int, input().strip().split()))
array.sort(reverse=True)
if(array[M-1]>=sum(array)/(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()
A.reverse()

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

Submission status: Accepted

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

sum_ai = sum(ai)

ai.sort(reverse=True)

for i in range(m):
    if ai[i] < sum_ai * 1/(4*m):
        print('No')
        exit()
        
print('Yes')

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
l = list(map(int, input().split()))
k = sorted(l)
souhyou = sum(l)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,M=map(int,input().split())
A=sorted([int(_) for  _ in input().split()])[::-1]
_sum=sum(A)

for m in range(M):
    if A[m]/_sum < 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()))

border = sorted(a)[-M]
print("Yes" if border >= sum(a) / (4 * M) else "No")

Submission status: Accepted

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

Submission status: Accepted

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

win,total=0,sum(A)
for a in A:
  if a>=total*(1/(4*m)):
    win+=1
if win>=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)

count = 0
for i in range(n):
    if total <= a[i] * 4 * m:
        count += 1

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

Submission status: Accepted

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

count=0
for i in ls:
    if i<total/(4*m):
        continue
    else:
        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()))
total = sum(A)
maxi = total / (4*M)
item = 0
for a in A:
    if a >= maxi:
        item+=1
print('Yes' if item >= M else 'No')

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
a.reverse()
flag = "Yes"
num = sum(a)
for i in range(0, m):
    if a[i] * 4 * m < sum(a):
        flag = "No"
print(flag)

Submission status: Accepted

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

total = sum(a)

selectable = 0
for aa in a:
    if aa >= total / (4 * m):
        selectable += 1

if m <= selectable:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

if cnt >= 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()))
tmp = 0
for i in range(N):
    if A[i] >= (sum(A)/(4*M)):
        tmp += 1
    else:
        pass

if tmp >= 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)
sub = sum(a)
ans = 0
touhyou = sub * (1 / (4 * m))
for i in range(n):
    if a[i] >= touhyou:
        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()))
select = 0
vote = sum(A)
for i in A:
    if 4 * M * i >= vote: select += 1
if select >= 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()]
a.sort()
b = 0
for i in range(n):
	b+=a[i]
if a[n-m]>=b/(4*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()]
A.sort()
A.reverse()
if A[M-1]>=0.25/M*sum(A):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

N, M = list(map(int, input().split()))
a_list = list(map(int, input().split()))
total = sum(a_list)
b_list = [a for a in a_list if a >= total * (1 / (4 * M))]
ans = "Yes" if len(b_list) >= M else "No"

print(ans)

Submission status: Accepted

Solution code:
N, M = (int(x) for x in input().split())
votes = [int(x) for x in input().split()]
ans = 'Yes'
votes.sort(reverse=True)
if votes[M-1] < sum(votes)/(4*M):
    ans = 'No'
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

a.sort(reverse = True)

sm = sum(a)
if a[m-1]<sm/(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)
# print(A[M-1],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()))
total = sum(a)
thred = total/(4*m)
if len([i for i in a if i>=thred]) >= m:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

A = sorted(A, reverse=True)
sum_vote = sum(A)
if A[M-1] < sum_vote/(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)
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=sorted([int(i) for i in input().split()])[::-1]
total = sum(a)
if a[m-1] >= total/(4*m): print("Yes")
else: print("No")

Submission status: Accepted

Solution code:
N,M = map(int,input().split())
A_li = list(map(int,input().split()))
cnt = 0
lim = (1 / (4*M)) * sum(A_li)
for i in A_li:
    if i >= lim:
        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=sorted(A, reverse=True)
for i in range(m):
    if A[i]<sum(A)/(4*m):
        print('No')
        exit()
print('Yes')

Submission status: Accepted

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

count = 0
sousu = sum(Ai)
for A in Ai:
    if A >= sousu / (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)
cnt = 0
for a in A:
    if a*4*M >= S:
        cnt += 1
print("Yes" if cnt >= M else "No")

Submission status: Accepted

Solution code:
def A():
    X, Y, Z= map(int, input().split())
    print(Z, X, Y)

def B():
    N, M = map(int, input().split())
    A = [int(n) for n in input().split()]
    threshold = sum(A)/(4*M)
    ans = 0
    for n in A:
        if n >= threshold:
            ans += 1
    if ans >= M:
        print('Yes')
    else:
        print('No')
B()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np

N, M = map(int, input().split())
A_l = np.array(list(map(int, input().split())))


A_l = np.sort(A_l)

thr = np.sum(A_l) / 4 / M

num = np.sum(A_l >= thr)

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

Submission status: Accepted

Solution code:
N, M = list(map(int, input().split(' ')))
A_list = list(map(int, input().split(' ')))
sum_A = sum(A_list)

count = 0
for A in A_list:
  if A >= 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()))
cnt = 0
all_vote = sum(A)
for a in A:
    if a >= (all_vote/(4*M)):
        cnt += 1

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

def main():
    N, M = map(int,input().split())
    A = list(map(int, input().split()))
    A.sort(reverse=True)

    vote = sum(A)

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

    print('Yes')


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

N, M = MAP()
A = LIST()
s = sum(A)
d = 1 / (4 *  M) * s

A.sort(reverse = True)
count = 0
for i in range(N):
    if A[i] >= d:
        count += 1
    else:
        break
if count >= M:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
N, M = map(int, raw_input().split())
A = map(int, raw_input().split())
print "Yes" if len([a for a in A if a*4*M>=sum(A)])>=M else "No"

Submission status: Accepted

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

nec = sum(A)/4/M;

count = 0;

for i in range(N):
    if A[i]>=nec:
        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()))
sums=sum(a)
hh=1/(4*m)
a.sort(reverse=True)
ans=0
for i in a:
  if hh<=i/sums:
    ans+=1
  else:
    break
if ans>=m:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
def YesNo(T):
    if T:
        print('Yes')
    else:
        print('No')

N, M = map(int, input().split())
A = list(map(int, input().split()))
cnt = 0
A.sort()
tmp = sum(A) / (4*M)
for i in reversed(range(N)):
    if A[i] >= tmp:
        cnt += 1
    else:
        break
YesNo(cnt >= M)

Submission status: Accepted

Solution code:
n,m = map(int,input().split())
l = list(map(int,input().split()))
a = sum(l)
b = a/4/m
ans = 0
for i in l:
    if i >= b:
        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()))

count = 0
_sum = sum(a)
for _a in a:
    if _a*4*m >= _sum:
        count += 1
print("Yes" if count >= m else "No")

Submission status: Accepted

Solution code:
def main():
    n, m, *a = map(int, open(0).read().split())
    k = sum(a)/(4*m)
    l = sum([i>=k for i in a])
    print('Yes' if l>=m else 'No')

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

count = 0

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

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

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
A_array = list(map(int, input().split()))
item = 0
vote_sum = sum(A_array)
boarder = vote_sum / (4 * M)

for a in A_array:
    if a >= boarder:
        item += 1
if item >= M:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(700000)

def s_in():
    return input()

def n_in():
    return int(input())

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

def print_l(l):
    print(' '.join(map(str, l)))

class Interval():
    def __init__(self, li):
        self.li = li
        self.n = len(li)
        self.sum_li = [li[0]]
        for i in range(1, self.n):
            self.sum_li.append(self.sum_li[i-1] + li[i])

    def sum(self, a, b=None):
        if b is None:
            return self.sum(0, a)

        res = self.sum_li[min(self.n-1, b-1)]
        if a > 0:
            res -= self.sum_li[a-1]
        return res

n,m = l_in()
A = l_in()
s = sum(A)

if len(list(filter(lambda a: 4*m*a >= s, A))) >= m:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, M, *A = map(int, open(0).read().split())
A.sort()
if all(a >= sum(A) / (4 * M) for a in A[-M:]):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

b = sum(A) / (4 * M)
cnt = 0
for i in A:
	if i >= b:
		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()))
limit = 1+(-1+sum(a))//(4*m)

cnt=0
for i in a:
    if(i>=limit):
        cnt+=1

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

Submission status: Accepted

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

t = sum(aa) / (4 * m)
c = 0
for a in aa:
    if a >= t:
        c += 1
if c >= m:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline
N, M = [int(x) for x in input().strip().split()]
A = [int(x) for x in input().strip().split()]
S = sum(A)
C = len([a for a in A if a >= S / (4*M)])
if C >= M:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

c = 0
m = sum(A) *  1 / (4 * M)
for i in range(N):
  if A[i] >= m:
    c += 1
print("Yes" if c >= M else "No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, M = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
s = sum(A)
c = 0
for a in A: 
    c += ( a >= s/(4*M))
print('Yes' if c >= M else 'No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = input().split()
N = int(x[0])
M = int(x[1])

A = input().split()
A = [int(l) for l in A]

S = sum(A)

c = 0
for x in A:
    if 4*M*x >= S:
        c +=1
if c >= M:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

sm=sum(a)
cnt=0
for i in range(n):
    if a[i]*4*m >= sm:
        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()))

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

a = sum([i >= t for i in A])
if a >= M:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

a = list(map(int, input().split()))
a.sort()
a = a[::-1]
summ = sum(a)
asikiri = summ / (4 * m)

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

print('Yes')

Submission status: Accepted

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

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

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

Submission status: Accepted

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

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(N: int, M: int, A: "List[int]"):
    A_ = sorted(A)
    s = sum(A)
    count = 0
    for i in range(N):
        if A_[i] >= (s/4/M):
            count += 1
    if count > M - 1:
        print(YES)
    else:
        print(NO)


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, M, A)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
def input():
    return sys.stdin.readline()[:-1]
N,M = map(int,input().split(' '))
l = list(map(int, input().split()))

cnt = 0
S = sum(l)
for i in range(N):
    if l[i]>=(S/(4*M)):
        cnt += 1

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

Submission status: Accepted

Solution code:
from collections import deque
from copy import copy,deepcopy
from itertools import permutations,combinations
from pprint import pprint

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

def mycol(data,col):
    return [ row[col] for row in data ]

def mysort(data,col):
    data.sort(key=lambda x:x[col],reverse=False)
    return data

n,m = myinput()
a = list(myinput())

s = sum(a)
th = s/(4*m)

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

if a[m-1]>=th:
    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 ai in a:
    if ai >= sum(a)/(4*m):
        cnt += 1

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

Submission status: Accepted

Solution code:
from decimal import Decimal

N, M = map(int, input().split())
A = sorted(list(map(int, input().split())), reverse=True)
if Decimal(A[M-1]) >= Decimal(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()))
B = []
a = sum(A)
for i in A:
    if i >= a/(4*M):
        B.append(i)
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()

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

Submission status: Accepted

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

a=list(map(int,input().split()))
b=[]
aa=sum(a)
for i in a:
    if i>=aa/(4*m):
        b.append(i)
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()))
total = sum(A)
A.sort(reverse=True)
#print(A)
ans = 'No'
if A[M-1]>=total/(4*M):
  ans = 'Yes'


print(ans)
#print(*ans,sep=' ')

Submission status: Accepted

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


sumn=0
for a in a_list:
    sumn+=a

lim=1.*sumn/(4.*m)

cnt=0
for a in a_list:
    if a >= lim:
        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()))
    tot =sum(A)
    v = sum([v >= tot/4/M for v in A])
    if v >= M:
        return 'Yes'
    return 'No'

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

Submission status: Accepted

Solution code:
N, M = [int(i) for i in input().split()]
A = sorted([int(i) for i in input().split()])[::-1]
summ = sum(A)
mini = summ / (4 * M)
if A[M - 1] >= mini:
    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)
if len([x for x in a if x*4*m >= s]) >= 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()]
all = sum(a)

bi = all/(4*m)
ans = 0
for i in a:
  if i >= bi:
    ans += 1

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
N, M= (int(i) for i in input().split())
A = [int(x) for x in input().split()]
#A = [[int(i) for i in input().split()] for i in range(N)]
count = 0

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

for e in A:
    if thre <= e:
        count += 1

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

Submission status: Accepted

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

sum_touhyou = sum(a)

a.sort(reverse=True)
for i in range(m):
  if a[i] / sum_touhyou < 1 / (4*m):
    print('No')
    sys.exit()

print('Yes')

Submission status: Accepted

Solution code:
import heapq
from collections import defaultdict, deque
from math import ceil, factorial
from fractions import gcd
import sys
sys.setrecursionlimit(10**7)
INF = float('inf')
MOD = 10**9+7

si = lambda: input().strip()
ii = lambda: int(input())
mii = lambda: map(int, input().split())
lmii = lambda: list(map(int, input().split()))
smii = lambda: sorted(map(int, input().split()))


N, M = mii()
A = lmii()

sm = sum(A)

polular = [a for a in A if a >= sm/(4*M)]

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

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

Submission status: Accepted

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

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

for i in range(N):
  if A[i] >= all / (4 * M):
    count = 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()))
ok = True
s = sum(a)
a.sort(reverse = True)
for i in range(m):
  if a[i]*4*m<s:
    ok = False
print("Yes" if ok else "No")

Submission status: Accepted

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

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

total = sum(A_list)

count = total / (4 * M)

if len(list(filter(lambda a: a >= count, A_list))) >= 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)
sum_A = sum(A)
ninki = A[:m]
if 4*m*ninki[-1] < sum_A:
    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)
l = sum(A)/(4*m)
cnt = 0
for i in range(n):
    if A[i]>=l:
        cnt += 1
print('Yes'  if cnt>=m else 'No')

Submission status: Accepted

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

total = sum(a)

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

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

Submission status: Accepted

Solution code:
import numpy as np
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
if sum(np.array(a) >= sum(a)/4/m) >= 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)
if B[-M] < sum(B)/(4*M):
    print('No')
else:
    print('Yes')

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

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

if flag:
    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)
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()))


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

Submission status: Accepted

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