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

Submission status: Accepted

Solution code:
n,m=map(int,input().split())
# 商品iをそれぞれN個入力
num=[int(i) for i in input().split()]
# 降順で並び替え
num=sorted(num,reverse=True)
# 総得票数
sum_num=sum(num)
# m-1番目つまり人気商品の中の一番人気がない商品が
# 総得票数の1/4Mは未満は人気商品と言えないNo
if num[m-1]<sum_num/(4*m):
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
n,m=map(int,input().split())
# 商品iをそれぞれN個入力
num=[int(i) for i in input().split()]
# 降順で並び替え
num=sorted(num,reverse=True)
# 総得票数
sum_num=sum(num)
# そう得票数の1/4Mは未満は人気商品と言えないNo
if num[m-1]<sum_num/(4*m):
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
item_count, select_count = map(int, input().split())

total = 0
votes = list(map(int, input().split()))

for score in votes:
    total += score

selected = 0
div = total / (4 * select_count)
for score in votes:
    if div <= score:
        selected += 1

if select_count <= selected:
    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)
count=0

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

Submission status: Accepted

Solution code:
import sys

input = lambda: sys.stdin.readline().rstrip()


def solve():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    asum = sum(A)

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

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


if __name__ == '__main__':
    solve()

Submission status: Accepted

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


#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode('utf-8')


#import numpy as np

def main():
	n,m=MI()
	A=LI()
	A.sort(reverse=True)

	ans="Yes"

	if A[m-1]*4*m<sum(A):
		ans="No"

	print(ans)














if __name__ == "__main__":
	main()

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
a = list(map(int, input().split()))
t = 0
for i in a:
    t += i
t_avg = t * (1 / (4 * m))

count = 0
for j in a:
    if j >= t_avg:
        count += 1
if count >= m:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

b=sorted(a,reverse=True)
if b[m-1]*4*m >= sum(b):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

if count < m:
  print("No")
else:
  print("Yes")

Submission status: Accepted

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

for i in sort:
  if i<b/(4*m):
    break
  else:
    count+=1

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

Submission status: Accepted

Solution code:
N,M = map(int, input().split())
A = list(map(int, input().split()))
MAX = sum(A)
A = sorted(A,reverse=True)
M_count = 0
for i in A:
  if i >= MAX/(4*M):
    M_count += 1
  else:
    break
if M_count >= M:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

for i in sort:
  if i>=b/(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()))
ans = 0
vote = sum(a)
for i in a:
    if i >= vote/4/m:
        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()))
s = sum(a)
for i in range(m):
  if a[-1-i] < s*1/(4*m):
    print('No')
    exit(0)
print('Yes')

Submission status: Accepted

Solution code:
import math
N, M = map(int, input().split())
A = list(map(int, input().split()))
c = 0
t = math.ceil(sum(A)/(4*M))

for i in A:
    if i >= 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()
a.reverse()
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=[]
array=input().split()
for i in array:
    A.append(int(i))

limit=(1/(4*M))*sum(A)
count=0

for i in range(N):
    if limit<=A[i]:
        count+=1

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

th = math.ceil(sum(A)/(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:
n,m=map(int,input().split())
cnt=0
a=list(map(int,input().split()))
s=sum(a)
for i in range(n):
  if 4*m*a[i]/s>=1:
    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)
cnt = 0

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

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

Submission status: Accepted

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

A.sort(reverse=True)
lim = sum(A) / 4 / M
for i in range(M):
  if A[i] < lim:
    print('No')
    exit(0)
    
print('Yes')

Submission status: Accepted

Solution code:
import numpy as np
import math
import collections
import fractions
import itertools

def mput(): return map(int, input().split())
def lput(): return list(map(int, input().split()))
def iput(): return int(input())

def solve():
    n, m = mput()
    a = lput()
    line = sum(a) / (4 * m)
    bit = 0
    for i in a:
        if i >= line:
            bit += 1
    if bit >= m:
        print("Yes")
    else:
        print("No")
    return 0

if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:

try:
    N_s,M_s=input().split(' ')
    N=int(N_s)
    M=int(M_s)
    
    if N>=1 and N<=100 and M>=1 and M<=100:
        votes=input().split(' ')
        counter=0
        vote = [int(i) for i in votes]
        summer=sum(vote)
        percent=summer/(4*M)
        for i in votes:
            if int(i)>=percent:
                counter+=1
        if counter>=M:
            print('Yes')
        else :
            print('No')
        
except Exception as e:
    print(e)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
A = list(map(int, input().split()))
tot_sum = sum(A)
arr = [val for val in A if val >= tot_sum / (4 * M)]
print("{}".format("Yes" if len(arr) >= M else "No"))

Submission status: Accepted

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

all_sum = sum(a)
standard = all_sum/(4*m)
ans = 0

for i in a:
  if i >= standard:
    ans += 1

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

Submission status: Accepted

Solution code:
N, M = map(int, input().split( ))
A = set(map(int, input().split( )))
SUM = sum(A)
cnt = 0
for num in A:
    if 4 * num * M >= SUM:
        cnt = cnt + 1

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

t = sum(a) / (4*m)
select = 0


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

Submission status: Accepted

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

s = sum(A)

selected = []
for a in A:
    if a >= s/(4*m):
        selected.append(a)

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

Submission status: Accepted

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

Submission status: Accepted

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

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


#print(sum(a))
for i in a:
    if i>=sum(a)/(4*m):
        ans+=1
if ans>=m:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
n,m=map(int, input().split())
a=list(map(int, input().split()))
su=0
co=0
for x in a:
    su+=x
iki=su/int((4*m))
for x in a:
    if x>=iki:
        co+=1
if co>=m:
    out='Yes'
else:
    out='No'
print(out)

Submission status: Accepted

Solution code:
n, m = [int(i) for i in input().split()]
A = [int(i) for i in input().split()] #A[0]-A[n-1]
S = sum(A)
threshold = S /(4 * m) 
ans = 0
no = 0
for i in range(n):
    if A[i] >= threshold:
        ans = ans +1
        if ans == m:
            print("Yes")
            break
        else:
            continue
    else:
        no = no +1
        if no == (n-m+1):
            print("No")
            break
        else:
            continue

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
*A, = map(int, input().split())
s = sum(A)
A.sort(reverse=True)

for i in A[:M]:
  if 4*M*i<s:
    print("No")
    break
else:
  print("Yes")

Submission status: Accepted

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

second = input().split(" ")
items = []
total = 0
for i in range(n):
    items.append(int(second[i]))
    total += int(second[i])

popu = 0
for item in items:
    if item >= (1/(4*m))*total:
        popu += 1

if popu >= 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)
c=0

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

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

Submission status: Accepted

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


main()

Submission status: Accepted

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

samu = 0

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

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

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
ns = [int(i) for i in input().split()]
lmt = sum(ns)/(m*4)
nns = list(filter(lambda x: x >= lmt, ns))
print("Yes" if len(nns) >= m else "No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

    total = sum(a)
    count = 0

    for i in a:
        if i >= total / (4 * m):
            count += 1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
num_of_product, num_of_popular = map(int, input().split())
votes = list(map(int, input().split()))

populars = [i for i in votes if i >= sum(votes) / (4 * num_of_popular)]
if len(populars) >= num_of_popular:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
import os
import heapq
import sys
import math
from collections import defaultdict
from io import BytesIO, IOBase
def check_kth_power(n, k):
        while n%k == 0:
            n = n/k

        if n != 1:
            return False
        return True
def main():
    #for _ in range(int(input())):
    n,m=map(int,input().split())
    arr=[int(k) for k in input().split()]
    
    total=0
    for i in range(n):
        total+=arr[i]
    val=(total/(4*m))
    counter=0
    #print(val)
    ans="No"
    for i in range(n):
        if arr[i]>=val:
            counter+=1
        if counter==m:
            ans="Yes"
    print(ans)
        
BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N,M = map(int, input().split())
List = list(map(int, input().split()))
List.sort(reverse=True)
#print(List)
if List[M-1]>=sum(List)/(4*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)
c = b / (4*m)

res = 0
for i in a:
  if i >= c:
    res += 1

if res < m:
  print('No')
else:
  print('Yes')

Submission status: Accepted

Solution code:
N,M = [int(v) for v in input().split(' ')]
A = [int(v) for v in input().split(' ')]
P = [(i >= sum(A)/4.0/M) for i in A]
print('Yes' if sum(P) >= M else 'No')

Submission status: Accepted

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

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

ans = [i for i in A if i >= S]

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

Submission status: Accepted

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

a = sorted(a)

min_vote = a[-m]
sum_vote = sum(a)

if min_vote < sum_vote * (1/(4*m)):
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
import math
#####sorting a dictionary#####
def dict_sort(ans):
    ans=sorted(ans.items(),reverse=True,key=lambda kv:(kv[1]))
def is_prime(n,k):
    if n==1:
        return 0
    for i in range(2,int(math.sqrt(n))+1):
        if n%i==0:
            res=i
            break
    return res
def inp():
    ls=list(map(int,input().split()))
    return ls
n,m=map(int,input().split())
ls=inp()
ans=0
for i in range(n):
    if ls[i] >= sum(ls)/(4*m):
        ans+=1
if ans>=m:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

count = 0
al = sum(s)

for i in range(N):
  if not(s[i] < al / (4 * M)):
    count += 1
    
if count >= M:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
from fractions import Fraction

N,M = map(int,input().split())
A = sorted(list(map(int,input().split())))
vote_num = sum(A)
ans = 0
x = Fraction(1, 4*M)

for i in A:
        if i >= vote_num*x:
                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 = 0
for i in a:
  b += i
c = [c for c in a if c >= b/4/m]

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

Submission status: Accepted

Solution code:
import numpy as np
N,M = map(int,input().split())
A = np.array(list(map(int,input().split())))
if np.count_nonzero(A >= np.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=sum(a)
c=0
for i in range(n):
    if a[i]>=b/4/m:
        c+=1
    else:
        c=c
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)
frag=0
for i in (0,M-1):
    if(sum(a)/(4*M)>a[i]):
        print("No")
        frag=1
        break
if(frag==0):
    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(list(map(int, input().split())), 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())
a=list(map(int,input().split()))

count=sum(a)
a=sorted(a,reverse=True)
sum=0
for i in range(m):
	sum += a[i]

for i in range(m):
	if(a[i]*4*m < count):
		print("No")
		break
else:
	print("Yes")

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
products = [int(i) for i in input().split()]
get = [j for j in products if j >= (sum(products) * (1 / (4*m)))]
if len(get) >= m:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

COUNT = 0
for i in range(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()))
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:
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 = list(map(int,input().split()))

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

print("Yes")

Submission status: Accepted

Solution code:
x = input().split()
a = sorted(list(map(int, input().split())), reverse=True)
n = int(x[0])
m = int(x[1])
goukei = 0
count = 0
for i in a:
  goukei += i
for i in a:
  if goukei/(4*m) <= i:
    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()))

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

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

Submission status: Accepted

Solution code:
from sys import stdin, stdout

def solve(a,M):
    total = sum(a)
    a.sort(reverse = True)
    #print(total)
    if a[M - 1]*4*M >= total: return 'Yes'
    return 'No'



N, M = map(int,stdin.readline().rstrip().split())
a = [int(x) for x in stdin.readline().rstrip().split()]

stdout.write(solve(a,M))

Submission status: Accepted

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

X = sum(Li) / (4*M)
Li.sort(reverse = True)

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

Submission status: Accepted

Solution code:
n,m=map(int,input().strip().split(' '))
a=list(map(int,input().strip().split(' ')))
x=sum(a) 
count=0 
x=x/(4*m)
for i in a:
    if i>=x:
        count+=1 
    if count>=m:
        break 
if count>=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)

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()))
tot = sum(A)
cnt = 0
for a in A:
    if a * 4 * M >= tot: cnt += 1
if M <= cnt: print('Yes')
else: print('No')

Submission status: Accepted

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

product = [int(i) for i in input().split()]

# 投票数
votes = 1 / (4 * M)


# 総投票数
Total_votes = sum(product)

for p in product:
    if p / Total_votes >= votes:
        M -= 1
    if M == 0:
        break

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

Submission status: Accepted

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

Submission status: Accepted

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

flag = 1

lim = 1/(m*4)*sum(nlist)

for i in range(m):
    if nlist[i] >= lim:
        pass
    else:
        flag = 0
        
if flag:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

#n,m = 3,2
#a = [380,19,1]

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

b = [i for i in a if i >= x]

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

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    n, m = map(int, input().split())
    a = [int(i) for i in input().split()]
    s = sum(a)
    a = sorted(a)[::-1]
    if a[m-1] >= (s / (4 * m)):
        print("Yes")
    else:
        print("No")

Submission status: Accepted

Solution code:
n,m = map(int,input().split())
a = list(map(int,input().split()))
count = 0
for i in range(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())
As = list(map(int, input().split()))
s = sum(As)
bs = [not A*4*M < s  for A in As]
if bs.count(True) >= M:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
import sys
#import numpy as np
import math
from fractions import Fraction
import itertools

input=sys.stdin.readline

n,m=map(int,input().split())
a=list(map(int ,input().split()))
s=sum(a)
s=s/(4*m)
c=0

for i in range(n):
    if a[i]>=s:
        c+=1
if c>=m:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, M = lr()
A = np.array(lr())
total = A.sum()
A *= 4 * M
A = A[A>=total]
bl = len(A) >= M
print('Yes' if bl else 'No')

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
#n = int(input())
#l = list(map(int, input().split()))
'''
A=[]
B=[]
for i in range():
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)'''

n,m=map(int, input().split())
a=list(map(int, input().split()))
a.sort()
v=sum(a)
cnt=0
#print(a,v)
for i in range(n):
    if a[i]>=v/(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()))

count = 0

a.sort(reverse=True)
sum_a = sum(a)
thresh = sum_a * (1/(4*m))

for i in range(m):
    if a[i] >= thresh:
        count += 1
    else:
        break

if count < m:
    print("No")
else:
    print('Yes')

Submission status: Accepted

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

TB = sum(A)
count = 0

for i in range(N):
    if TB/4/M <= A[i]:
        count += 1

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

Submission status: Accepted

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

Submission status: Accepted

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

sums = sum(a)
count = 0

for i in a:
  #print(i, sum)
  if i >= (sums / ( M * 4 )):
    count += 1

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

Submission status: Accepted

Solution code:
N,M = map(int,input().split())
counter = 0
inpu_ = list(map(int,input().split()))
sum_p = sum(inpu_)
for i in inpu_:
    if i >= sum_p/(4*M): 
        counter += 1

if counter >= 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)

ok = [a[i]*4*m >= s for i in range(n)]

print("Yes" if ok.count(True) >= m else "No")

Submission status: Accepted

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

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

total = sum(A)

bodor = total / (4 * M)
cnt = 0

for i in A:
    if i >=  bodor:
        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()))

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

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

Submission status: Accepted

Solution code:
# N = int(input())
N, M = [int(_) for _ in input().split()]
A = [int(_) for _ in input().split()]
P = [a for a in A if a >= (sum(A)/(4 * M))]
if len(P) >= M:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
import sys

def ILI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def ISI(): return map(int, sys.stdin.readline().rstrip().split())

n, m = ISI()
l = ILI()
cnt = 0
s = sum(l)
for a in l:
	if a >= s/(4*m): cnt +=1
if cnt<m:print("No")
else:print("Yes")

Submission status: Accepted

Solution code:
n,m=map(int,input().split())
ai=list(map(int,input().split()))
bi=[i for i in ai if i>=sum(ai)/(4*m)]
if len(bi)>=m:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

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

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

A.sort(reverse=True)

if A[M-1] >= check:
    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)
fav = sum(A) / (4 * M)
ans = 'Yes'

for i in range(M):
    if A[i] < fav:
        ans = 'No'
        break
print(ans)

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
A = sorted(list(map(int, input().split())))
all = sum(A)
L = len(A)
for a in A:
  if all / (4 * M) > a:
    L -= 1
  else:
    break
print("Yes" if L >= M else "No")