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

"""
Created on Sun Jan 19 20:52:57 2020

@author: over-
"""

N,M=map(int,input().split())
A=input().split()
A=[int(i) for i in A]
A.sort(reverse=True)

ans="Yes"
if A[M-1] < sum(A)/4/M:
    ans="No"

print(ans)

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

A.sort(reverse=True)

s = sum(A)
c = s / (4 * M)

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

Solution (Python):


import sys
import math


debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        
        
        lines.append(input())
        lines.append(input())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    (n, m) = [int(e) for e in lines[0].split(' ')]
    a = [int(e) for e in lines[1].split(' ')]

    return (n, m, a)


def solve(n, m, a):


    total = sum(a)

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

    if cnt >= m:
        result = 'Yes'
    else:
        result = 'No'

    
    return result
    


def main():
    
    result = solve(*parse_input())
    if isinstance(result, list):
        for r in result:
            print("%s" % r, sep='')
    else:
        print("%s" % result, sep='')

if __name__ == '__main__':

    main()

Solution (Python):
n,m = map(int, input().split())
lis = list(map(int, input().split()))
total = sum(lis)
count = 0
for e in lis:
    if e>=(1/(4*m))*total:
        count += 1
if count >= m:
    print("Yes")
else:
    print("No")

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

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


def solve(N, M, A):
    s = sum(A)
    threshold = 1.0 * s / (4 * M)
    count = sum([a >= threshold for a in A])
    return 'Yes' if count >= M else 'No'
    

if __name__ == '__main__':
    inputs = read()
    print("{}".format(solve(*inputs)))

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

Solution (Python):


n,m=map(int,input().split())
a_list=list(map(int,input().split()))
popular= []

for a in a_list:
    if a >= sum(a_list)/(4*m):
        popular.append(a)

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

Solution (Python):
def main():
    N,M = map(int,input().split())
    A = list(map(int,input().split()))
    m_count = sum(x >= sum(A)/(4*M) for x in A)
    if M <= m_count:
        print("Yes")
    else:
        print("No")
if __name__ == '__main__':
    main()

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

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

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

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

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

Solution (Python):

x,y = map(int,input().split())
A = list(map(int,input().split()))
B = sorted(A,reverse=True)
K = sum(A)
ct = 0 
for i in range(1,1+y):
    if B[i-1]*4*y < K:
        ct +=1

if ct == 0:
    print('Yes')
else:
    print('No')

Solution (Python):
n, m = map(int, input().split())
A = sorted([int(x) for x in input().split()], reverse=True)
Asum = sum(A)
lmt = (Asum/(m*4))


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

Solution (Python):
import numpy as np

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

total_vote = np.sum(A)
threshold = total_vote/(4*M)
A.sort(reverse = True)
if A[M-1] >= threshold:
    print('Yes')
else:
    print('No')

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


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


count= 0

for i in a:
  if i >= sh:
    count +=1

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

Solution (Python):


N, M = map(int, input().split())
A = list(map(int, input().split()))
total = 0
A.sort(reverse=True)

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

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

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

A = [0] * N
A = list(map(int, input().split()))



oks = [A[i] for i in range(N) if(sum(A)/(4*M) <= A[i])]

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

Solution (Python):
N, M = map(int, input().split())
c = 0
A = [int(i) for i in input().split()]
s = sum(A)/( 4*M)

for a in A:
    if a >= s:
        c+=1

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

Solution (Python):
inp = list(map(int, input().split()))
n = inp[0]
m = inp[1]

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

lim = total / (4 * m)
count = 0
flag = 0

for i in range(n):
    if a[i] >= lim:
        count += 1
    if count >= m:
        flag = 1
        break

if flag:
    print('Yes')
else:
    print('No')

Solution (Python):
n,m=map(int,input().split())
if m==1:
  print("Yes")
  exit()
x=list(map(int,input().split()))

z=sum(x)
w=z/4/m
y=list(sorted(x,reverse=True))

if y[m-1]<w:
  print("No")
else:
  print("Yes")

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

sum_a = sum(A)

count = 0

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

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

Solution (Python):
INT_MAX=10**18+7
MOD=10**9+7
def INPUT():return list(int(i) for i in input().split())
def LIST_1D_ARRAY(n):return [0 for _ in range(n)]
def LIST_2D_ARRAY(m,n):return [[0 for _ in range(n)]for _ in range(m)]

n,m=INPUT()
A=INPUT()
A.sort(reverse=True)
votes=0
for i in range(n):
    votes+=A[i]
limit=votes/(4*m)
count=0
for i in range(m):
    if A[i]<limit:
        break
    else:
        count+=1
if count!=m:
    print("No")
else:
    print("Yes")

Solution (Python):
import math
import random
import sys
import heapq
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque, UserString
from functools import lru_cache, cmp_to_key
from itertools import (chain, combinations, combinations_with_replacement,
                       permutations, product)

sys.setrecursionlimit(10**7)
input = sys.stdin.readline
MAX_INT = 2**62-1

n, m = map(int, input().split())
arr = [-int(s) for s in input().split()]
heapq.heapify(arr)

crit = -sum(arr) / (4*m)
while m > 0:
    cnt = -heapq.heappop(arr)
    
    m -= 1
    if cnt < crit:
        print('No')
        break
else:
    print('Yes')

Solution (Python):
n, m = [int(x) for x in input().split()]
A = sorted([int(x) for x in input().split()])[::-1]
s = sum(A)
if all([A[i] >= s/4/m for i in range(m)]):
  print('Yes')
else:
  print('No')

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

kijun = sum(li) / (4*m)

if sum([x >= kijun for x in li]) >= m:
    print("Yes")
else:
    print("No")

Solution (Python):

N, M = map(int, input().split())
S = input().split()
A = [0 for i in range(N)]
for i in range(N):
    A[i] = int(S[i])
A.sort(reverse=True)
if A[M-1] < sum(A)/(4*M):
    print('No')
else:
    print('Yes')

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

a.sort(reverse = True)

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

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

Solution (Python):

from decimal import Decimal


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


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

n = sorted(n)
sosu = Decimal(str(sum(n)))
toku = Decimal("1") / Decimal(str((4 * M)))
border = sosu * toku

if n[M * -1] < border:
  print("No")
else:
  print("Yes")

Solution (Python):

N, M = map(int, input().split())
A = list(map(int,input().split()))
B = sorted(A)
flag = 1
for i in range(M):
    
    
    if B[len(B)-i-1] < sum(A)/4/M:
        flag = 0

if flag == 0:
    print('No')
else:
    print('Yes')

Solution (Python):
from math import ceil
N, M = map(int, input().split())
A = list(map(int, input().split()))       
limit = ceil(sum(A) / (4 * M))
if M <= len([1 for a in A if a >= limit]):
    print("Yes")
else:
    print("No")

Solution (Python):
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)*(1/(4*M)):
        continue
    else:
        print("No")
        break
else:
    print("Yes")

Solution (Python):
n, m, *a = map(int, open(0).read().split())

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

max_choice = 0
for x in a:
    if min_count <= x:
        max_choice = max_choice + 1

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

Solution (Python):
import math

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

threshold = math.ceil(sum(sequence) / (4*m))

sequence.sort(reverse = True)
index = 0

while m > 0:
	if sequence[index] >= threshold:
		m -= 1
		index += 1
	else:
		break

if m == 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)/4/M:
  print("No")
else:
  print("Yes")

Solution (Python):
a,b=input().split()
a=int(a)
b=int(b)
d=input().split()
d= [int(n) for n in d]
d.sort(reverse=True)
k=4*b
t=1/k
q=sum(d)
if d[b-1]<t*q:
    print("No")
else:
    print("Yes")

Solution (Python):
import numpy as np
n, m = list(map(int, input().split()))

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

total = np.sum(a)


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

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

if len([c for c in A if c >= sum(A) / (4 * M)]) >= M:
    print("Yes")
else:
    print("No")

Solution (Python):
if __name__ == "__main__":
    N, M = list(map(int, input().split()))
    A = list(map(int, input().split()))
    sorted_A = sorted(A, reverse=True)
    num_of_vote = sum(A)
    flag = True
    for i in range(M):
        if sorted_A[i]*4*M < num_of_vote:
            flag = False
            break

    if flag:
        print('Yes')
    else:
        print('No')

Solution (Python):
import sys
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]



N, M = mi()
a = li()
all_a = float(sum(a)) /(4.0*M)

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

for a in A:
    if a < all_a:
        print('No')
        exit()
print('Yes')

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

total = sum(arr)
count = 0
for i in range(n):
    if arr[i] >= (total/(4*m)):
        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 = sorted(A,reverse=True)

suma = sum(A)
sup = (1 / (4*M)) * suma

count = 0
flag = 0
for a in A:
    if a < sup:
        break
    else:
        count += 1

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

Solution (Python):
import numpy as np

n, m = map(int, input().split())
v_list = list(map(int, input().strip().split()))
v_ar = np.array(v_list)
total = v_ar.sum()
th = total/(4 * m)
print('Yes' if m <= np.count_nonzero(v_ar >= th) else 'No')

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

total = sum(A)
A.sort()
A.reverse()
com = 0
for i in A:
    if(i < total/(4*m)):
        break
    else:
        com += 1
if(com>=m):
    print('Yes')
else:
    print('No')

Solution (Python):
def main():
    N,M = map(int,input().split())
    array = list(map(int,input().split()))
    array.sort(reverse=True)
    all = sum(array)
    for i in range(M):
        if(array[i] < all/(4*M)):
            print("No")
            return 0
    print("Yes")
if __name__ == "__main__":
    main()

Solution (Python):
def main():
    n, m = [int(i) for i in input().split()]
    a = [int(i) for i in input().split()]
    a = sorted(a)[::-1]
    th = sum(a) / float(4*m)
    if a[m-1] >= th:
        print('Yes')
    else:
        print('No')
        

if __name__ == '__main__':
    main()

Solution (Python):
s=input().split()
t=input().split()

A=0

for Ai in t:
    A=A+int(Ai)


J=0

M=s[1]
MM=4*int(M)

for i in t:
   if int(i) >= A/MM:
       J=J+1

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

c = 0
for i in range(n):
    if (A[i] >= s):
        c = c + 1

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

Solution (Python):
N, M = map(int, input().split())
vote_lst = tuple(map(int, input().split()))
ans_count = 0
total_votes = sum(vote_lst)
for votes in vote_lst:
    if votes >= total_votes/(4*M):
        ans_count += 1
if ans_count >= M:
    out_mes = "Yes"
else:
    out_mes = "No"
print(out_mes)

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

Solution (Python):
NM  = input().split()
A = input().split()
N = int(NM[0])
M = int(NM[1])

A = [int(i) for i in A]





total = sum(A)

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


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

Solution (Python):
import numpy as np
N,M = (int(x) for x in input().split(' '))
A = np.array([int(x) for x in input().split(' ')])
A = A/np.sum(A)


if len(np.where(A>=1/4/M)[0]) >= M:
	print("Yes")
else:
	print("No")

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

th = sum(A)/(4*M)
A.sort(reverse=True)
if A[M-1] < th:
  print('No')
else:
  print('Yes')

Solution (Python):



from sys import stdin


def main():
    N, M = map(int, stdin.readline().split())
    A = list(map(int, stdin.readline().split()))
    j = sum(A) / (4 * M)
    cnt = 0
    for a in A:
        if a >= j:
            cnt += 1
            if cnt == M:
                print('Yes')
                return
    print('No')


if __name__ == "__main__":
    main()

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

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

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

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

AList.sort(reverse=True)
sumVote = sum(AList)

if AList[M-1] < sumVote/(4 * M):
    print('No')
else:
    print('Yes')

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())
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=map(int,input().split())
a = list(map(int, input().split()))
criteria = 1 / (4 * m) * sum(a)
a.sort(reverse=True)
if m == len([v for v in a[:m] if v>=criteria]):
    print('Yes')
else:
    print('No')

Solution (Python):
def main():
    n, m = map(int, input().split())
    a = list(map(int, input().split()))
    sum_a = 0
    count = 0
    for i in a:
        sum_a += i

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


if __name__ == "__main__":
    main()

Solution (Python):
import numpy as np
N, M = list(map(int, input().split()))
A = np.array(sorted(list(map(int, input().split())), reverse=True))
sumA = np.sum(A)
cnt = np.sum(np.where(A >= sumA / (4 * M) , 1, 0))
if cnt >= M :
    print("Yes")
else:
    print("No")

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

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

sum_a = sum(A)

cnt = 0
for a in A:
    if a * 4 * M >= sum_a:
        cnt += 1

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

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

a_sum= sum(a_list)

count = 0
for i in range(len(a_list)):
    if a_list[i] >= a_sum / (4 * m):
        count += 1
if count >= m:
    print('Yes')
else:
    print('No')

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

Solution (Python):
import math

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

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

if isinstance(th, int):
    th -= 1

ls = [i for i in a if i >= th]

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

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

lim = sum(A) / 4 / M
ans = A[:M]

for a in ans:
  if a < lim:
    print('No')
    exit()

print('Yes')

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

SUM_A = sum(A)
ans = 0

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

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

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

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

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

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

border = sum(a_list) * (1/(4*m))

cnt = 0
for i in a_list:
    if cnt == m:
        print('Yes')
        exit()

    if i >= border:
        cnt += 1

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

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

Solution (Python):
nm=list(map(int, input().split()))
a=list(map(int, input().split()))
n=nm[0]
m=nm[1]
suma=sum(a)
standard=suma/(4*m)
answer=sum(1 for i in a if i>=standard)
if answer>=m:
    print('Yes')
else:
    print('No')

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

t = 0 
c = 0 

for i in A:
        t += i

for i in A:
        if i >= (t / (4*M)):
                c += 1
if c >= M:
        print("Yes")
else:
        print("No")

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

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

A.sort(reverse=True)

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

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

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

total = sum(A)
def is_4M(x):
    a = total / (4*M)
    if x < a:
        return False
    return True

cnt = 0
for a in A:
    if is_4M(a):
        cnt += 1

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

Solution (Python):
n, m = list(map(int, input().split()))
lower_bound = 1 / (4*m)

goods = list(map(int, input().split()))
lower_bound *= sum(goods)
goods.sort()
goods.reverse()

        
if goods[m-1] >= lower_bound:
    print('Yes')
else:
    print('No')

Solution (Python):
n,m = map(int,input().split())
l = sorted(list(map(int,input().split())))[::-1]
s = float(sum(l)/(4*m))
t = "Yes"
for i in range(m):
  if l[i]<s:
    t = "No"
    break
print(t)

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

sumA = sum(A)
count = 0

for i in A:
    if(i >= sumA/(4*M)):
        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)
total = sum(a)

canPick = True
for i in range(m):
    if a[i] < total / (4 * m):
        canPick = False

if canPick is True:
    print("Yes")
else:
    print("No")

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

Solution (Python):
import sys

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

total=sum(A)


sou=1/(M*4)
s=0
for a in A:
    tmp=a/total
    if(tmp >= sou):
        s+=1
        if(s == M):
            print("Yes")
            sys.exit()

print('No')

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

  sum_v = sum(data)

  count = 0
  for d in data:
    if sum_v / ( 4 * m ) <= d:
      count += 1
    else:
      pass
  
  if count >= m:
    print("Yes")
  else:
    print("No")

if __name__ == "__main__":
  main()

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

tot_num = sum(a_list)
selectable = len([el for el in a_list if el>=tot_num/4/m]) >= m

if selectable:
    print('Yes')
else:
    print('No')

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

    limit = sum(a) / (4 * m)
    a.sort(reverse=True)
    for aa in a[0:m]:
        if aa < limit:
            print("No")
            return
    print("Yes")

solution()

Solution (Python):
N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse=True)
mx = A[:M]
t = False

for n in mx:
    if n/sum(A) < (1/(4*M)):
        print("No")
        t = True
        break

if not t:
    print("Yes")

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

Solution (Python):
def solve(N, M, A):
    total = sum(A)
    if sum([1 if i >= total/(4*M) else 0 for i in A]) >= M:
        return 'Yes'
    else:
        return 'No'

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

if __name__ == "__main__":
    
    main()

Solution (Python):
i = list(map(int, input().split())) 
N = i[0]
M = i[1]
A =list(map(int, input().split())) 

A_S = sorted(A, reverse=True)
ashi = sum(A) * (1/(4*M))

if A_S[M-1] >= ashi:
    print("Yes")
else:
    print('No')

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

sum_a = sum(a)
count = 0
check = sum_a/(4*m)

for i in a:
    if i>=check:
        count+=1

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

Solution (Python):
n, m = map(int, input().split())
*A, = map(int, input().split())
A = sorted(A)[::-1]
if A[m-1]*4*m >= sum(A):
    print('Yes')
else:
    print('No')

Solution (Python):

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

sss = list(map(int, input().split()))
sss.sort(reverse = True)

a = sum(sss)

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

Solution (Python):
n,m = map(int,input().split())
a = sorted(list(map(int,input().split())))[::-1]

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

Solution (Python):
n,m = map(int,input().split())
s = list(map(int,input().split()))
check = 1/(4*m)*sum(s)

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

Solution (Python):
import sys
from math import ceil, floor
from collections import deque, Counter, defaultdict
from fractions import gcd
input = lambda: sys.stdin.readline().rstrip()

def eprint(s):
    sys.stderr.write('DEBUG: {}'.format(s))
    return

def main():
    n,m = map(int, input().split())
    As = list(map(int, input().split()))
    As.sort()
    As.reverse()
    cnt = 0
    sm = sum(As)
    k = sm / (4*m)
    for i in range(n):
        if not (As[i] < k):
            cnt += 1
    if cnt >= m:
        print('Yes')
    else:
        print('No')
    return

if __name__ == '__main__':
    main()

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

list_sort = sorted(list_a, reverse = True)

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

Solution (Python):
import math
def main(n,m,a):
    hyou = sum(a)
    sikii = hyou / (4*m)
    count=0
    for i in range(len(a)):
        if a[i] >= sikii:
            count += 1
    return "Yes" if count >= m else "No"

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

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

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

a=sum(A)

A_new=sorted(A, reverse=True)

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

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

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

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

Solution (Python):
nm=list(map(int,input().split(' ')))
a=list(map(int,input().split(' ')))
s=sum(a)
c=0
for i in a:
    if i>=s/(4*nm[1]):
        c+=1
if c>=nm[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 = len(A[A>=A.sum()/(4*M)])

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

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

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

t=sum(a)

cnt=0
d=(t/(4*m))


for i in range(n):

  if d<=a[i]:
    cnt+=1

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

Solution (Python):

"""
Created on Sat Apr  4 21:06:52 2020

@author: liang
"""

N, M = map(int,input().split())
A = list(map(int,input().split()))
sum_A = sum(A)
level = sum_A/(4*M)
catch = 0


for a in A:
    if a >= level:
        catch += 1

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

Solution (Python):


num, m = map(int, input().split())
item = list(map(int, input().split()))

item.sort(reverse=True)

flag = 0
for i in range(m):
    if item[i] < 1/(4*m) * sum(item):
        flag = 1
        break

if flag == 0:
    print("Yes")
else:
    print("No")

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

Solution (Python):
n,m = (int(x) for x in input().split())
la = list(map(int, input().split()))

h = 0
s = sum(la)
for i in range(n):
  if la[i] >= s/(4*m):
    h += 1

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

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

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

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

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

flag = 0


for i in range(N):
    if S/(4*M)<=A[i]:
        flag+=1

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

Solution (Python):
_, m, *a = map(int, open(0).read().split())
s = sum(a)
print("No" if m > sum(s <= 4*m*i for i in a) else "Yes")

Solution (Python):

import sys
import numpy as np

YES = "Yes"  
NO = "No"  


def solve(N: int, M: int, A: "List[int]"):
    A = np.array(A)
    n_sum = np.sum(A)/4/M
    if (A >= n_sum).sum() >= M:
        print(YES)
    else:
        print(NO)

    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    M = int(next(tokens))  
    A = [int(next(tokens)) for _ in range(N)]  
    solve(N, M, A)

if __name__ == '__main__':
    main()

Solution (Python):
from sys import stdin

def main():

    input = stdin.readline

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

    A.sort(reverse=True)

    sum_num = sum(A)

    for i in range(M):
        if A[i] * 4 * M < sum_num:
            print("No")
            return
    else:
        print("Yes")


if __name__ == "__main__":
    main()

Solution (Python):
import sys
import numpy as np

import fractions
from collections import deque 
from functools import reduce

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

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

s.sort(reverse=True)

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

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 A[i]>=s*(1/(4*m)):
        cnt += 1
if cnt>=m:
    print("Yes")
else:
    print("No")

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

Solution (Python):


import math

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

s = sum(A)
print('Yes' if A[-M] >= math.ceil(s/(4*M)) else 'No')