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

Solution (Python):


import sys

N, M = [int(x) for x in sys.stdin.readline().strip().split()]
votes = [int(x) for x in sys.stdin.readline().strip().split()]

thres = sum(votes) / (4.0 * M)
cnt = 0
for v in votes:
    if v >= thres:
        cnt += 1

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

Solution (Python):
from math import ceil

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

a.sort(reverse=True)

thold = ceil(sum(a) / (4 * m))

if a[m-1] < thold:
    print('No')
else:
    print('Yes')

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

cnt = 0
for i in b:
    if i >= sum(b)/(4*a[1]):
        cnt +=1
    else:
        pass
    
if cnt >= a[1]:
    print("Yes")
else:
    print("No")

Solution (Python):
N,M = map(int,input().split(" "))
MER = list(map(int,input().split(" ")))
mer_sum = sum(MER)

threshold = mer_sum / (4 * M)
mer_over = [1 if i >= threshold else 0 for i in MER]
mer_threshold = sum(mer_over)

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

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

Solution (Python):
n,m=map(int,input().split())
A=[int(_) for _ in input().split()]
sum_a=sum(A)
A_x=[a for a in A if a>=sum_a/(4*m)]
if m<= len(A_x):print("Yes")
else:print("No")

Solution (Python):
val1= input()
val2= input()
num1= list(map(int,val1.split()))
num2= list(map(int,val2.split()))
n= num1[0]
m= num1[1]
sumup=0;
for i in range(0,n):
    sumup= sumup+ num2[i]

border= sumup/ (4* m)
judge=0
for j in range(0,n):
    if num2[j] >= border:
        judge= judge + 1
if judge >= m:
    print("Yes")
else:
    print("No")

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

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

S = 0

for k in range (0 , N):
	S += A[k]

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

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

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

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

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

Solution (Python):
x = input()
y = input()

n_num = int(x.split()[0])
m_num = int(x.split()[1])
y = y.split()
sum = 0
count = 0

for i in range(0, n_num):
    y_num = int(y[i])
    sum = sum + y_num

for i in range(0, n_num):
    y_num = int(y[i])
    rate = 1 / (4 * m_num)
    if y_num < sum * rate:
        count = count + 1
    else:
        count

if (n_num - m_num) < count:
    print('No')
else:
    print('Yes')

Solution (Python):
N,M = map(int, input().split())
anything = list(map(int, input().split()))
count = 0
sum = 0
for a in anything:
    sum = sum + a

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

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

Solution (Python):
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('No')
else:
  print('Yes')

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

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

Solution (Python):
N ,M = map(int, input().split())
List = list(map(int, input().split()))
stand = 1 / (4 * M) * sum(List)
arr = []
for i in range(len(List)):
  if List[i] >= stand:
    arr.append(List[i])
if len(arr) >= M:
  print("Yes")
else:
  print("No")

Solution (Python):
n, m=map(int, input().split())
a = input().split()
point = [int(s) for s in a]
point.sort(reverse=True)
if sum(point)/(4*m) <= point[m-1]:
    print("Yes")
else:
    print("No")

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

to = 0
s = sum(a)

for i in range(n):
    if a[i] * 4 * m >= s:
        to += 1

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

Solution (Python):
n,m=map(int,input().split())
l=list(map(int,input().split()))
l.sort(reverse=True)
min=sum(l)*(1/(4*m))
ans=0
for i in l:
    if i>=min:
        ans+=1
if ans>=m:
    print ("Yes")
else:
    print ("No")

Solution (Python):
a,b=map(int,input().split())
l=sorted(list(map(int,input().split())))
l.reverse()
m=l[0:b]
t='Yes'
for i in m:
    if i<sum(l)*(1/(4*b)):
        t='No'
        break
print(t)

Solution (Python):
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")

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

ans = 0
for i in range(N):
    if (4*M*A[i] >= sum_A):
        ans+=1
    else:
    	ans+=0
    	
if (ans >= M):
    print('Yes')
else:
    print('No')

Solution (Python):
import numpy as np 

kind, popular = map(int, input().split(" "))
data = np.array(input().split(" "), dtype=np.int)
level = np.sum(data) / (4 * popular)
count = 0
for i in range(kind):
    if data[i] >= level:
        count += 1
        
if count >= popular:
    print("Yes")
else:
    print("No")

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




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


judge = True

for i in range(m):
    if (total / (4*m)) <= A[i]:
        continue
    else:
        judge = not judge
        break

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

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

Solution (Python):
N,M = map(int, input().split())
x = list(map(int, input().split()))
total_vote = sum(x)
count = 0
for y in x:
    if y >=(total_vote/(4*M)):
        count+=1
      
if count>=M:
    print('Yes')
else:
    print('No')

Solution (Python):

input_line = input()

inputs = input_line.split(' ')
N, M = [int(s) for s in inputs]
input_line = input()
inputs = input_line.split(' ')
A = [int(s) for s in inputs]
A = sorted(A, reverse=True)
a_tot = sum(A)
fg = True
for i in range(M):
    if A[i] < a_tot/(4*M):
        fg = False
if fg:
    print('Yes')
else:
    print('No')

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

if sorted(hoge)[-M] >= sum(hoge)/(4*M):
  print('Yes')
else:
  print('No')

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

if sorted(hoge)[-M] >= sum(hoge)/(4*M):
  print('Yes')
else:
  print('No')

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
 
N, M  = MAP()
A = LIST()
sum_A = sum(A)
c = 0
 
for i in range(N):
  if A[i] >= sum_A/4/M:
    c = c+1
      
if c >= M:
  print("Yes")
else:
  print("No")

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

N, M = MAP()
A = LIST()
sum_A = sum(A)
if sum([x >= sum_A/(4*M) for x in A]) >= M:
  		print("Yes")
else:
  		print("No")

Solution (Python):
n,m = map(int,input().split())
num = list(map(int,input().split()))
sum_num = sum(num)

cnt = 0
for i in range(n):
    tmp = num.pop(num.index(max(num)))
    if tmp >= sum_num*1/(4*m):
        cnt += 1

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

Solution (Python):


inputted = list(map(int, input().split()))
N = inputted[0]
M = inputted[1]
A = list(map(int, input().split()))

total_votes = sum(A)
can_select = lambda votes: not (votes < total_votes / (4 * M))
answer = 'Yes' if len(list(filter(can_select, A))) >= M else 'No'

print(answer)

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

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

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

Solution (Python):
n, m = list(map(int, input().split(" ")))
a_list = sorted(list(map(int, input().split(" "))), reverse=True)
if m == 0:
    print('Yes')
else:
    if a_list[m-1] >= sum(a_list) / (4 * m):
        print('Yes')
    else:
        print('No')

Solution (Python):


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

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

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

Solution (Python):
n_m = [int(n) for n in input().split()]
N = n_m[0]
M = n_m[1]

votes = [int(n) for n in input().split()]

total_votes = sum(votes)
thresh = total_votes / (4 * M) 

count = 0

for A in votes:
    if 4*M*A >= total_votes:
        count += 1
    if count >= M:
        print('Yes')
        break

if count < M:
    print('No')

Solution (Python):
n,m = map(int, input().split())
a = list(map(int, input().split()))
cnt = 0
s = sum(a)
for i in range(n):
    if 4*a[i]*m >= s:
        cnt += 1

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

Solution (Python):
from sys import stdin
N,M=list(map(int,(stdin.readline().strip().split())))
A=list(map(int,(stdin.readline().strip().split())))
hyou=(sum(A)/(4*M))
count=0
for i in range(N):
    if (A[i])<hyou:continue
    count+=1
if count>=M:print("Yes")
else:print("No")

Solution (Python):
a,b=map(int,input().split())
l=sorted(list(map(int,input().split())))
l.reverse()
m=l[0:b]
t='Yes'
for i in m:
    if i<sum(l)*(1/(4*b)):
        t='No'
        break
print(t)

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

A.sort(reverse=True)

T = (sum(A)/(4*M))
n = 0
for i in range(N):
    if A[i] < T:
        continue
    n += 1

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

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

Solution (Python):
nm_list = input().split()
n = int(nm_list[0])
m = int(nm_list[1])
a_list = input().split()
a = [int(item) for item in a_list]
a.sort(reverse=True)

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

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

items = [int(i) for i in input().split()]
items.sort(reverse=True)
total = sum(items)

flag = 1
for i in range(M):
  if total / (4 * M) <= items[i]:
    pass
  else:
    flag = 0
if flag:
  print('Yes')
else:
  print('No')

Solution (Python):
import sys
N, M = map(int, sys.stdin.readline().split())
A = list(map(int, sys.stdin.readline().split()))
sum_A = sum(A)
A.sort(reverse = True)

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

Solution (Python):

from sys import stdin, stdout  
  


def main(): 
  
    
    info_input = stdin.readline() 
    vote_input = stdin.readline() 

    info = [int(x) for x in info_input.split()] 
    votes = [int(x) for x in vote_input.split()] 

    n = info[0]; m = info[1]; 

    counter = 0 
    bound = 1/(4*m)
    total = sum(votes)

    votes.sort(reverse=True)

    for vote in votes:
    	if vote >= bound*total:
    		counter += 1
    		if counter == m:
    			return "Yes"
    	else:
    		return "No"

   

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

Solution (Python):
a,b = map(int, input().split())
List = list(map(int, input().split()))
c = sum(List)
List = sorted(List)[::-1]
d = List[b-1]
if d < c/4/b:
	print("No")
else:
	print("Yes")

Solution (Python):

from sys import stdin, stdout  
  


def main(): 
  
    
    info_input = stdin.readline() 
    vote_input = stdin.readline() 

    info = [int(x) for x in info_input.split()] 
    votes = [int(x) for x in vote_input.split()] 

    n = info[0]; m = info[1]; 

    counter = 0 
    bound = 1/(4*m)
    total = sum(votes)

    for vote in votes:
    	if vote >= bound*total:
    		counter += 1
    		if counter == m:
    			return "Yes"
    return "No"

   

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

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

Solution (Python):
N,M=(int(a) for a in input().split());
A=input();
A=A.split()
B = [int(s) for s in A]
sum = sum(B)

line = sum/4/M
point = 0;
length = len(B);

for i in range(length):
    if B[i] >= line:
        point += 1;
    else:
        pass;
    
if point >= M:
    print("Yes");
else:
    print("No");

Solution (Python):
N,M = (int(a) for a in input().split());
A = input();

A = A.split();


B = [int(s) for s in A];

sum = sum(B)

line = sum/4/M
point = 0;
length = len(B);

for i in range(length):
    if B[i] >= line:
        point += 1;
    else:
        pass;
    
if point >= M:
    print("Yes");
else:
    print("No");

Solution (Python):
def pickup(vote, choice):
	flag = 0
	sum_vote = 0
	for i in vote:
		sum_vote = sum_vote + i
	for i in vote:
		if i >= sum_vote / (choice * 4):
			continue
		else:
			flag = flag + 1
	if  choice <= int(len(vote)) - flag:
		return 0
	else:
		return 1

numbers, choice = list(map(int, input().split()))

vote = [numbers - 1]
vote = list(map(int, input().split()))

if pickup(vote, choice) == 0:
	print("Yes")
else:
	print("No")

Solution (Python):
n,m=map(int,input().split())
A=list(map(int,input().split()))
A.sort(reverse=True)
if A[m-1]/sum(A)<0.25/m:
  print('No')
else:
  print('Yes')

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

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

Solution (Python):
n=input().split()
m=input().split()

N=n[0]
Nn=n[1]
l = 0
a = 0

for k in range(int(N)):
    a+=int(m[k])

for i in range(int(N)):
    if int(m[i])/(a/(int(Nn)*4)) >= 1:
        l+=1

if l >= int(Nn) :
    print("Yes")
else :
    print("No")

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

all_A = sum(A)
limit = all_A / 4.0 / M

count = 0
for a in A:
  if a >= limit:
    count += 1
    
if count >= M:
  print('Yes')
else:
  print('No')

Solution (Python):
N,M = map(int,input().split())
A = list(map(int,input().split()))
shreshold = sum(A)/(4*M)
ret = [a for a in A if a >= shreshold]
if len(ret) < M:
    print('No')
else:
    print('Yes')

Solution (Python):
A = list(map(int, input().split()))
votes = list(map(int, input().split()))
check = []
total = 0
for i in votes:
    total +=i
for i in votes:
  if i >= ((1/4)/A[1])*total:
    check.append(i)
if len(check) >= A[1]:
  print ("Yes")
else:
  print ("No")

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

Solution (Python):
N, M = map(int,input().split())
A = list(map(int,input().split()))
S = sum(A)

Border = S/(4*M)

count = 0

for i in A:

    if(i>=Border):
        count +=1

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

else:
    print("No")

Solution (Python):



def main():
    import sys
    input = sys.stdin.readline

    n, m = map(int, input().split())
    a = list(map(int, input().split()))
    total = sum(a)
    count = 0

    for ai in sorted(a, reverse=True):
        if (ai * 4 * m) >= total:
            count += 1

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


if __name__ == '__main__':
    main()

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

Solution (Python):
import numpy as np
N,M=map(int,input().split())
A=np.array(list(map(int,input().split())))
print('Yes' if sum(A>=sum(A)/(4*M))>=M else 'No')

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

Solution (Python):
def main():
    N, M = map(int, input().split())
    A = [int(i) for i in input().split()]
    count = 0
    ok = 0
    for i in range(N):
        count += A[i]
    for i in range(N):
        if A[i] / count >= 1 / (4 * M):
            ok += 1
    if ok >= M:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()

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

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

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

b = [x for x in a if x >= sum(a)/(4*m)]

print(["Yes","No"][len(b)<m])

Solution (Python):

n, m = map(int, input().split())
a = list(int(i) for i in input().split())
s = sum(a)
a.sort(reverse=True)
c = 0

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

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

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

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

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

Solution (Python):
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')

Solution (Python):
import math, sys

a, b = map(int, input().split())
data = list(map(int, input().split()))
data.sort(reverse=True)

for i in range(b):
  if data[i] >= math.ceil(sum(data) / (4 * b)):
    pass
  else:
    print('No')
    sys.exit()
print('Yes')

Solution (Python):
length, select = map(int, input().split())
vote = list(map(int, input().split()))
vote.sort(reverse=True)
max_vote = sum(vote)

flag = False
for v in vote[:select]:
  if v < max_vote/(4*select):
    print('No')
    break
else:
  print('Yes')

Solution (Python):
n = [int(e) for e in input().split(" ")]
a = [int(e) for e in input().split(" ")]
c = 0
s = sum(a) / (4 * n[1])
for e_a in a:
    if s <= e_a:
        c += 1
print("Yes" if n[1] <= c else "No")

Solution (Python):
N, M = map(int, input().split())
A = list(map(int, input().split()))
for i in range(N-1):
  for j in range(i+1):
    if A[i+1-j] > A[i-j]:
      a = A[i-j]
      A[i-j] = A[i+1-j]
      A[i+1-j] = a

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

if A[M-1] < float(S)/(4.0*float(M)):
  print("No")
else:
  print("Yes")

Solution (Python):


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

num = 0
s = sum(al)/(4*m)
ans = 'No'

for a in al:
    if s <= a:
        num += 1

if num >= m:
    ans = 'Yes'

print(ans)

Solution (Python):



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


A_list = sorted(A_list, reverse=True)
is_ok = True
test_limit = sum(A_list) / (4*M)


test_list = A_list[:M]
for t in test_list:
    if t<test_limit:
        is_ok = False
        break


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

Solution (Python):
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
A_sorted = sorted(A, reverse=True)
max_numbers = A_sorted[:M]
A_sum = sum(A)
for i in max_numbers:
    if i < A_sum / (4 * M):
        print("No")
        break
else:
    print("Yes")

Solution (Python):
num=list(map(int, input().split()))
a=list(map(int, input().split()))
ok=[]
for i in range(len(a)):
  if a[i]>=sum(a)/(4*num[1]):
  	ok.append(a[i])
if len(ok)>=num[1]:
  print("Yes")
else:
  print("No")

Solution (Python):
a=list(map(int,input().split()))
n,m=a[0],a[1]
a=list(map(int,input().split()))
b=sum(a)/(4*m)

c=[i for i in a if b<=i]
d=len(c)

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

Solution (Python):
n,m = list(map(int,input().split()))
votes = [int(x) for x in input().split()]
votesum = sum(votes)
st = votesum / (4 * m)
count = 0
for v in votes :
    if v >= st:
        count += 1
print("Yes" if count >= m else "No")

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

xs = []
for i in input().split():
    xs.append(int(i))

bound = 1/4/m * sum(xs)

count = 0
for x in xs:
    if x >= bound:
        count += 1

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

Solution (Python):


import sys
INT_MAX = sys.maxsize
INT_MIN = -(sys.maxsize)
sys.setrecursionlimit(10**7)
mod = 1000000007


def IOE():
    sys.stdin = open("input.txt", "r")
    sys.stdout = open("output.txt", "w")


def main():
    n, m = map(int, sys.stdin.readline().split())
    a = list(map(int, sys.stdin.readline().split()))
    s = sum(a)
    need = s / (4*m)
    cnt = []
    for i in a:
        if i >= need:
            cnt.append(i)
    if len(cnt) >= m:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    try:
        IOE()
    except:
        pass
    main()

Solution (Python):
import math
import bisect
def Main(N, M, A):
    A.sort()
    wa = sum(A)
    thres = math.ceil(wa/(4*M))
    i = bisect.bisect_left(A, thres)
    return "Yes" if len(A)-i >= M else "No"
    

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

if __name__ == '__main__':
    main()

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

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

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

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

Solution (Python):
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")

Solution (Python):
N,M = map(int, input().split())
A = sorted(map(int, input().split()), reverse=True)
S = sum(A)


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

Solution (Python):
from collections import Counter

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

border = sum(arr) / (4 * m)
ans = len(list(filter(lambda x: x >= border, arr)))

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

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

A = list(map(int, input().split()))
S = sum(A)
x = S/(4*M)

count = 0

for i in A:
    if i >= x:
        count += 1

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

Solution (Python):
x = [int(i) for i in input().split(' ')]
A = [int(i) for i in input().split(' ')]
N, M = x


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

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

Solution (Python):
list_NM = list(map(int, input().split())) 
list_A = list(map(int, input().split())) 
i = 0
number_all = 0
N = list_NM[0]
M = list_NM[1]
while all:
    number_all += list_A[i]
    i += 1
    if(i==N):
        break
i = 0
kijun = number_all/(4*M)
flag = 0
while all:
    if(kijun<=list_A[i]):
        flag +=1
    i += 1

    if(i==N):
        break

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

Solution (Python):
val1 = input().split()
val2 = input().split()
total = 0
for votes in val2:
  total += int(votes)
thres = total * 1/4 / int(val1[1]) 
i = 0
for votes in val2:
  if int(votes) >= thres:
    i += 1
if i >= int(val1[1]):
  print("Yes")
else:
  print("No")

Solution (Python):



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

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

MAX_VOTE_NUM = 1000

x = [-1] * MAX_VOTE_NUM
total_vote_num = 0
for i in range(n):
  x[a[i] - 1] = i
  total_vote_num += a[i]

popular_num = 0
for i in range(MAX_VOTE_NUM):
  index = MAX_VOTE_NUM - i
  if x[index - 1] != -1 and (index * 4 * m) >= total_vote_num:
    popular_num += 1

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

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

Solution (Python):
N,M=input().split()
N,M=[int(N),int(M)]
 
a = list(map(int,input().strip().split()))[:N]
  
number=0
total=0
for i in range(N):
  v=a[i]
  total=total+v
for i in range(N):
  v=a[i]
  if v < (1/(4*M))*total:
    number=number
  else:
    number = number+1
if number >= M:
  print("Yes")
else:
  print("No")

Solution (Python):
n, m = map(int, input().split())
num_list = sorted(list(map(int, input().split())), reverse=True)
flg = 0
for i in num_list[:m]:
    if i < sum(num_list) / (4 * m):
        flg = 1
        break
if flg == 0:
    print("Yes")
else:
    print("No")

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

Solution (Python):
N, M = map(int, input().split())
num = 0
As = [int(x) for x in input().split()]
s = sum(As)
for Ai in As:
    if Ai >= s/4/M:
        num += 1
if num >= M:
    print("Yes")
else:
    print("No")

Solution (Python):
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
total = sum(A)
result = []
for i in A:
    if i >= (total * (1/(4*M))):
        result.append(i)
if len(result) < M:
    print("No")
else:
    print("Yes")

Solution (Python):
def popularity(votes, N, M):

  total_votes = sum(votes)
  limit = total_votes / (4.0 * M)
  cnt = 0
  for vote in votes:
    if vote >= limit:
      cnt += 1
    if cnt >= M:
      return "Yes"

  return "No"
  
N, M = [int (x) for x in input().split()]
votes = [int (x) for x in input().split()]
print(popularity(votes, N, M))

Solution (Python):
def popularity(votes, N, M):
    
    total_votes = sum(votes)
    limit = total_votes / (4.0 * M)
    
    cnt = 0
    for vote in votes:
        if vote >= limit:
            cnt += 1
    
    if cnt >= M:
        return "Yes"
    
    return "No"
  
N, M = [int (x) for x in input().split()]
votes = [int (x) for x in input().split()]
print(popularity(votes, N, M))

Solution (Python):
N,M=map(int,input().split())
As=list(map(int,input().split()))
print('Yes' if len([a for a in As if a>=sum(As)/(4*M)])>=M else 'No')

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

list.sort(reverse=True)

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

Solution (Python):
N, M = map(int, input().split())
A = [ int(_) for _ in input().split()]
S = 0
G =0
for i in range(N):
    S += A[i]
L = S/(4*M)
for i in range(N):
    if A[i] >= L:
        G += 1
if G < M:
    print("No")
else:
    print("Yes")

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

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

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

Solution (Python):
import math
def I(): return(list(map(int,input().split())))
n,m=I()
a=I()
t=math.ceil((1/(4*m))*sum(a))
c=0
for i in a:
	if i>=t:c+=1
print(["No","Yes"][c>=m])

Solution (Python):
n, m = map(int, input().split())
a = list(map(int, input().split()))
if len(list(filter(lambda x:x>=sum(a)/(4*m),a)))>=m:
  print('Yes')
else:
  print('No')

Solution (Python):
N,M = map(int,input().split())
A = map(int,input().split())
B = list(A)
C = sorted(B,reverse=True)
S = sum(B)


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

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

s = sum(A)

cnt = len(list(filter(lambda x: x * M * 4 >= s, A)))

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

Solution (Python):
import numpy as np

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

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

Solution (Python):


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

A = np.array(A)

num = np.sum(A >= np.sum(A)/(4*M))

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