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:
# coding: utf-8
# Your code here!
# coding: utf-8
import sys
sys.setrecursionlimit(10000000)

#const
dxdy=((1,0),(0,1))
# my functions here!
def pin(type=int):
    return map(type,input().rstrip().split())

def resolve():
    N,M=pin()
    A=sorted(list(pin()))
    A.reverse()
    p=(sum(A))/(4*M)
    #print(sum(A),A)
    print(["No","Yes"][A[M-1]>=p])
"""         
#printデバッグ消した？
#前の問題の結果見てないのに次の問題に行くの？
"""
"""
お前カッコ閉じ,るの忘れてるだろ
"""
import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """4 1
5 4 2 1"""
        output = """Yes"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """3 2
380 19 1"""
        output = """No"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """12 3
4 56 78 901 2 345 67 890 123 45 6 789"""
        output = """Yes"""
        self.assertIO(input, output)


if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
A = [int(i) for i in 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 = map(int, input().split())
A_arr = list(map(int, input().split()))
_sum = sum(A_arr)
t = _sum/4/M
A_arr = [A for A in A_arr if A>=t]
if len(A_arr)>=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()))
A = np.array(A)

sum = A.sum()

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

Submission status: Accepted

Solution code:
n,m= map(int,input().split())
l = list(map(int,input().split()))
s = sum(l)
r=s/(4*m)
cnt=0
for i in l:
    
    if i>=r:
        cnt=cnt+1

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

Submission status: Accepted

Solution code:
import bisect

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

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

total = sum(A_list)

if bisect.bisect_left(A_list, total/(4*M)) <= N-M:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

input_line = input()
Line = input_line.split()
Line = [int(s) for s in Line]

input_line = input()
Line2 = input_line.split()
Line2 = [int(s) for s in Line2]

tokuhyou = sum(Line2) / 4 / Line[1]

Line2.sort(reverse=True)

# print(Line2[Line[1]-1],tokuhyou)


if Line2[Line[1]-1] >= tokuhyou:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, m = list(map(int, input().split(' ')))
ls = sorted(list(map(int, input().split(' '))))[::-1]
s = sum(ls)

if s/(4*m) <= ls[m-1]:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
L = sorted(map(int, input().split()), reverse=True)
if L[m-1]*m*4 < sum(L):
  print('No')
else:
  print('Yes')

Submission status: Accepted

Solution code:
n,m = map(int, input().split())
a = list(map(int, input().split()))
v = 0
for i in range(0,len(a)):
    v += a[i]
k = v / (4*m)
u = 0
for i in range(0,len(a)):
    if a[i] >= k:
        u += 1

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:

x=list(map(int, input().split()))
y=list(map(int, input().split()))

y.sort(reverse=True)

if y[(x[1]-1)]>=((sum(y)/(4*(x[1])))):
	print('Yes')
else:
	print('No')

Submission status: Accepted

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

ans = []

for i in range(n):
    if a[i] >=sum(a)/4/m:
        ans.append(a[i])

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

Submission status: Accepted

Solution code:
n,m=list(map(int,input().split()))
A=list(map(int,input().split()))
A_ans=[a for a in A if a>=sum(A)/(4*m)]
if len(A_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)
s=sum(a)
for i in range(m):
    if a[i]<s/(4*m):print("No");exit()
print("Yes")

Submission status: Accepted

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

b = sum(A)/(4*M)
cnt = 0
for i in range(len(A)):
    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())
aList = list(map(int, input().split()))

k = sum(aList) / (4 * m)
count = 0
flag = False
for i in aList:
    if i >= k:
        count += 1
        if count == m:
            flag = True
            break
if flag:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
A = 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
input = sys.stdin.readline


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

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

    ans = [_a for _a in A if _a >= goukei]

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

filtera = [i for i in a if i >= suma*1/(4*m)]

if len(filtera) >= 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/(4*M):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
import sys
from collections import Counter

if __name__ == "__main__":
	N, M = map(int,input().split())
	A = [int(i) for i in input().split()]

	s = sum(A)

	A_sort = sorted(A, reverse=True)
	A_select = A_sort[:M]

	if len(A_select) != M:
		print("No")
		sys.exit()

	for a in A_select:
		if a < (s*(1 / (4*M))):
			print("No")
			sys.exit()

	print("Yes")

Submission status: Accepted

Solution code:
# import sys
# import math #sqrt
# import decimal
# import queue # queue
# import bisect
# import heapq # priolity-queue
# import time
# import itertools
# import collections # deque
# from operator import itemgetter
# from fractions import Fraction

mod = int(1e9+7)
INF = 1<<29
lINF = 1<<35

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

if __name__=='__main__':
    main()

Submission status: Accepted

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

cnt = 0
total = 0
for elm in elms:
  total += elm
  
for elm in elms:
  if( elm*4*m >= total  ):
    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()))
summ = 0
ans = 0
for i in range(n):
    summ += a[i]
summ = summ / (4*m)

for i in range(n):
    if a[i] >= summ:
        ans += 1

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

Submission status: Accepted

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


a = input().split()
for i in range(n):
	a[i] = int(a[i])


sumvote = sum(a)

line = sumvote/(4*m)

c = 0

for i in range(n):
	if a[i]>=line:
		c+=1



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

Submission status: Accepted

Solution code:
import math

def solve(n,m,lst):
  min_vote = math.ceil(sum(lst)/4/m) - 1
  return lst[m-1] > min_vote

if __name__ == "__main__":
  _n, _m = map(int, input().split())
  a_list = [int(i) for i in input().split()]
  a_list = sorted(a_list,reverse=True)
  if solve(_n,_m,a_list):
    print('Yes')
  else:
    print('No')

Submission status: Accepted

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

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import bisect,collections,copy,itertools,math,numpy,string
def I(): return int(input())
def S(): return input()
def LI(): return list(map(int,input().split()))
def LS(): return list(input().split())
##################################################
N,M = LI()
A = LI()
kijun = sum(A)/(4*M)
count = 0
for x in A:
    if x>=kijun:
        count += 1
print('Yes' if M<=count else 'No')

Submission status: Accepted

Solution code:
ans = 'No'
N, M = map(int, input().split())
Alist = list(map(int, input().split()))
s = sum(Alist)
selectnumber = s / (4*M)
count = 0
for i in Alist:
  if i >= selectnumber:
    count += 1
    if count >= M:
      ans = 'Yes'
      break

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
n,m = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
a.reverse()
s=sum(a)
if (a[m-1] >= math.ceil(s/(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 = a[::-1]

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,M=map(int,input().split())
mylist=list(map(int,input().split()))
mylist.sort(reverse=True)
total=sum(mylist)
answer=0
#print(mylist)

for i in range(M):
    if mylist[i]>=total/(4*M):
        answer+=1
    else:
        pass
    
if answer==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()))

total = np.sum(a)
thresh = total / (4 * m)

a = np.sort(np.array(a))[::-1]

mask = a >= thresh
if np.sum(mask) >= m:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

Submission status: Accepted

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

a = [int(x) for x in input().split()]
cnt = 0
th = sum(a) / (4 * m)
for aa in a:
    if aa >= th:
        cnt += 1
if cnt >= m:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
x = list(map(int,input().split(" ")))
n = x[0]
m = x[1]
a = list(map(int,input().split(" ")))
a.sort(reverse=True)
# print(a)
all_a = sum(a)
# print(all_a)
l = 4 * m

if a[m-1] >= (all_a)/l :
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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


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

Submission status: Accepted

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

t=sum(a)*(1/(4*m))

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

print("Yes")

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

count = 0
allhyou = sum(a)

# print(allhyou)

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

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

Submission status: Accepted

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

s = s/(4*m)

if k<s:
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    s = input().rstrip().split(' ')
    N,M = int(s[0]), int(s[1])
    s = input().rstrip().split(' ')
    A = [int(elem) for elem in s]
    A.sort(reverse=True)
    p = 'Yes'
    for elem in A[:M]:
        if(elem < sum(A)*(1.0/(4*M))):
            p = 'No'
            break

    print(p)

Submission status: Accepted

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


check = sum(a) / (4 * m)


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


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

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
nums = list(map(int, input().split()))
total = sum(nums)
ans = 0
for num in nums:
    if num >= total * (1 / (4 * M)):
        ans += 1
print("Yes") if ans >= M else print("No")

Submission status: Accepted

Solution code:
N,M=map(int,input().split())
A=list(map(int,input().split()))
A.sort(reverse=True)
b=sum(A)
if A[M-1]<b/(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()))
sumA = sum(A)
ans = ['Yes', 'No']
count = 0
for a in A:
    if not a < 1 / (4 * M) * sumA:
        count += 1
print(ans[count < M])

Submission status: Accepted

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

ans = 0
a_all = sum(a)

for x in a:
    if x >= a_all / (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()))
c=sum(a)
count=0
for i in range(n):
  if a[i]*4*m>=c:
    count+=1
if count>=m:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

b = sum(a)
c = b / (4 * m)
d = list(i for i in a if i >= c)
if len(d) >= m:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

border = sum(A) / (4 * M)
bordered = [a for a in A if not (a < border)]
print("Yes" if len(bordered) >= M else "No")

Submission status: Accepted

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

ans = "Yes"
vote = sum(a)

a_sort = sorted(a, reverse=True)

# print(vote, a_sort)

if a_sort[m-1] < vote * 1/(4*m):
  ans = "No"

print(ans)

Submission status: Accepted

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

cnt = 0
for num in a:
    if num >= all / (4*m):
        cnt += 1
    if cnt >= m:
        print("Yes")
        break
else:
    print("No")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import itertools#これは色々使える組み込み関数みたいなやつ
import fractions
import copy
import bisect
#import math#数学的計算はこれでいける。普通に0.5乗しても計算可能
#w=input()
from operator import itemgetter
from sys import stdin
#input = sys.stdin.readline#こっちの方が入力が早いが使える時に使っていこう
from operator import mul
from functools import reduce
from collections import Counter


N=3
M=3
i=0
j=0
k=0
n=3
r=1
a=[0]*5
b=[]
#n=int(input())
#r=int(input())
#print(M)
#A=int(input())
#B=int(input())
#print(N)
"1行1つの整数を入力を取得し、整数と取得する"
N,M=map(int, input().split())
number_list=list(map(int, input().split(" ")))
toku_list=sorted(number_list, reverse=True)
if toku_list[M-1]/sum(number_list) < 1/(4*M):
    print("No")
    sys.exit()

print("Yes")

#number_list=list(map(int, input().split(" ")))#数字の時
#print(number_list)
"12 21 332 とか入力する時に使う"
"1行に複数の整数の入力を取得し、整数として扱う"

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
#メモ
for i in number_list:#こっちの方がrage使うより早いらしい
    print(number_list[i-1])#

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

'''
x=[]
y=[]
for i in range(N):
    x1, y1=[int(i) for i in input().split()]
    x.append(x1)
    y.append(y1)
print(x)
print(y)
"複数行に2数値を入力する形式 x座標とy座標を入力するイメージ"
'''

'''
mixlist=[]
for i in range(N):
    a,b=input().split()
    mixlist.append((int(a),b))
print(mixlist)
"複数行にintとstrを複合して入力するやつ，今回はリスト一つで処理している"
'''

'''
#array=[input().split()for i in range(N)]
#print(type(array[0][0]))
#print(array)
"正方行列にstr型の値を入力"
'''

#brray=[list(map(int, input().split(" ")))for i in range(N)]
#print(type(brray[0][0]))
#print(brray)
'''
入力
1 2
4 5
7 8
出力結果
[[1, 2], [4, 5], [7, 8]]
'''
"列数に関して自由度の高いint型の値を入力するタイプの行列"
#以下に別解を記載
#N, M = [int(i) for i in input().split()]
'''
table = [[int(i) for i in input().split()] for m in range(m)]

print(type(N))
print(N)
print(type(M))
print(M)

print(type(table))
print(table)
'''




#s=input()
#a=[int(i) for i in s]
#print(a[0])
#print([a])
#単数値．桁ごとに分割したい．入力と出力は以下の通り
#イメージとして1桁ごとにリストに値を入れているかんじ

'''
入力
1234
出力
1
[[1, 2, 3, 4]]
'''




'''
word_list= input().split(" ")
print(word_list[0])
"連続文字列の入力"
"qw er ty とかの入力に使う"
"入力すると空白で区切ったところでlistの番号が与えられる"
'''



'''
A, B, C=stdin.readline().rstrip().split()#str style 何個でもいけることが多い
print(A)
"リストではなく独立したstr型を入れるなら以下のやり方でOK"
'''


#a= stdin.readline().rstrip()
#print(a.upper())
"aという変数に入っているものを大文字にして出力"


#a,b=map(int, input().split())  #int style 複数数値入力　「A B」みたいなスペース空いた入力のとき

#なんかうまく入力されるけど
#a=[[int(i) for i in 1.strip()]for 1 in sys.stdin]
#a = [[int(c) for c in l.strip()] for l in sys.stdin]]
#print(a)
#複数行の数値を入力して正方行列を作成


##############################################################################################
##############################################################################################
#under this line explains example calculation


#nCr combination
'''
def cmb(n,r):
    #When n < r , this function isn't valid
    r= min(n-r,r)
    #print(n,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n-r, -1))
    #flochart mul(n,n-1)=x
    #next     mul(x,n-2)........(n-r+1,n-r)
    #mul read a,b and returns a*b

    under = reduce(mul, range(1, r+1))
    #print(over, under)
    #reduce is applied mul(1,2)=2
    #next   mul(2,3)=6
    #next   mul(6,4)=4.........last(r!,r+1)=r+1!

    return over // under
    #// is integer divide
    #calc example 5C2
    #over=5*4*3
    #under=3*2*1
a = cmb(n, r)
#print(a)
'''

'''
#集計
#example
#a=[2,2,2,3,4,3,1,2,1,3,1,2,1,2,2,1,2,1]
#a=Counter(a)
for i in a.most_common(n):print(i)
#most_common()メソッドは、出現回数が多い要素順にCounterオブジェクトを並び替えます。
#引数にint型の数字nを設定した場合は、出現回数が高い上位ｎ個の要素を返します。
#何も設定しなければ、コンテナ型にあるすべての要素を出現回数の順番に並び替えたタプル型オブジェクトを返します。
#out put
#(2, 8)
 #(1, 6)
#(3, 3)
#(4, 1)
'''


#二部探索(binary search)
#A = [1, 2, 3, 3, 3, 4, 4, 6, 6, 6, 6]
#print(A)
#index = bisect.bisect_left(A, 5) # 7 最も左(前)の挿入箇所が返ってきている
#A.insert(index, 5)
#print(index)
#print(A)
'''
bisect.bisect_left(a, x, lo=0, h=len(a))
引数
a: ソート済みリスト
x: 挿入したい値
lo: 探索範囲の下限
hi: 探索範囲の上限
(lo, hiはスライスと同様の指定方法)
bisect_leftはソートされたリストaに対して順序を保ったままxを挿入できる箇所を探索します。leftが示す通り、aにすでにxが存在している場合は、挿入箇所は既存のxよりも左側になります。また、lo, hiを指定することで探索範囲を絞り込むことも可能です。デフォルトはaの全体が探索対象です。
'''





########################################################################
########################################################################
#b2=a[:]  #1次元のときはコピーはこれで良い
#print(b2)

#a= [[0]*3 for i in range(5)] #2次元配列はこう準備、[[0]*3]*5だとだめ
#b3=copy.deepcopy(a)  #2次元配列はこうコピーする
#print(b3)

Submission status: Accepted

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

Submission status: Accepted

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

vote_sum = sum(a)
threshold = vote_sum / (4*m)

pick = 0
for a_i in a:
    if(a_i >= threshold):
        pick += 1
if (pick >= m):
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
li = list(map(int, input().split()))
ok = []
limit = sum(li) / (4*M)
for v in li:
    if v >= limit:
        ok.append(v)
print('Yes' if len(ok) >= M else 'No')

Submission status: Accepted

Solution code:
nm = input().split()
al = input().split()

n = int(nm[0])
m = int(nm[1])

ia = [int(i) for i in al]
sa = sorted(ia,reverse = True)
am = sum(sa)
flg = 'Yes'

for i in range(m):
	if sa[i] < am / (4 * m):
		flg = 'No'

print(flg)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8 ff=unix


def solv(N, M, A):
    count = 0
    total = sum(A)
    for a in A:
        if a * 4 * M >= total:
            count += 1
    if count >= M:
        return "Yes"
    else:
        return "No"


if __name__ == "__main__":

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

    ans = solv(N, M, A)

    print(ans)

Submission status: Accepted

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

bd = sum(a_lst) / (4 * m)
cnt = 0

for a in a_lst:
    if bd <= a:
        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()))
ALL = sum(A)
base = ALL/(4*M)
cnt = 0
for i in A:
    if i >=base:
        cnt += 1
if cnt >= M:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

total = sum(A)
border = total/(4*M)
X=[1 for i in range(N) if A[i]>=border]

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

print(ans)

Submission status: Accepted

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

a_list.sort(reverse=True)
if len(a_list) < m:
    print('No')
all_vote = sum(a_list)
a_list = a_list[:m]
if a_list[-1] < (all_vote / (4 * m)):
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
import math

n, m = map(int, input().split())
a_i = list(map(int, input().split()))
min = math.ceil(sum(a_i) / (4 * m))
if len([i for i in a_i if i >= min]) >= 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)
A = A[::-1]

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

Submission status: Accepted

Solution code:
N,M = map(int,input().split())
As = sorted(map(int, input().split()),reverse=True)
V = sum(As)
print("No" if any(map(lambda x: x<V/(4*M), As[:M])) else "Yes")

Submission status: Accepted

Solution code:
from heapq import nlargest

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

print('Yes' if nlargest(M, A)[-1] >= sum(A) / 4 / M else 'No')

Submission status: Accepted

Solution code:
from collections import defaultdict

import sys
sys.setrecursionlimit(10**6)
ii = lambda: int(input())
mis = lambda: map(int,input().split())
lmis = lambda: list(mis())
INF = float('inf')

def main():
    n,m=mis()
    a=lmis()
    at=float(sum(a))/float(4*m)
    cnt=0
    for i in range(n):
        if a[i]>=at: cnt+=1
    print('Yes' if cnt>=m else 'No')


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

s = sum(A)

k = [1 for a in A if 4 * M * a >= s]

if len(k) < M:
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

n, m = nm()

aa = nl()

mx = sum(aa)/(4*m)

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


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

Submission status: Accepted

Solution code:
## coding: UTF-8
from decimal import *
from itertools import permutations, combinations,combinations_with_replacement,product
s = input().split()
t = [int(p) for p in s]

sA = input().split()
p = [int(w) for w in sA]



N = t[0]
M = t[1]
p.sort(reverse=True)
#print('N:{}, M:{}, p:{}'.format(N,M,p))

all_vote = sum(p)
#print(all_vote)
boder = all_vote / ( 4.0 * M ) #これ以下の商品を切り捨てる
#print(boder)

list_clear = []
for i in range(N):
    if(p[i] >= boder):
        list_clear.append(p[i])
#print(list_clear)

if(len(list_clear) >= 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 = 0
s = sum(a)
d = s*(1/(4*m))
for i in a:
    if i>=d:
        b += 1

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

Submission status: Accepted

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

for i in range(n):
    if A[i] >= sum(A)/(4*m):
        x += 1
        
print("YNeos"[m > x::2])

Submission status: Accepted

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

A.sort()
A.reverse()

all = sum(A)

k = 1 / (4 * M)
#print(k)

for c in range(M):
    if A[c] < k * all:
        print("No")
        break
else:
    print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,M =map(int,input().split())
A_list = list(map(int,input().split()))
A_sum = sum(A_list)
cnt = 0
for i in range(N):
  if A_list[i] >= A_sum/(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)
p = []
vote = 0
for i in range(N):
    vote = vote + a[i]
for i in range(N):
    if a[i] >= vote/(4*M):
        p.append(0)
if len(p) >= M:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
input_line = [int(i) for i in input().split()]
n = input_line[0]
m = input_line[1]

input_line = [int(i) for i in input().split()]
thr = sum(input_line) / (4 * m)
input_line.sort(reverse=True)
if input_line[m - 1] < thr:
    print("No")
else:
    print("Yes")

Submission status: Accepted

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


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

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

    Aa  = sorted(A, reverse=True)[:M]
    
    ans = 'Yes'
    for a in Aa:
        if a < deadline:
            ans = 'No'
    
    print(ans)



if __name__ == '__main__':
    main()