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):
N,M=map(int, input().split())
A=list(map(int, input().split()))
if sum(A)%(4*M)==0:
  a=sum(A)//(4*M)
else:
  a=sum(A)//(4*M)
  a+=1
cnt=0
for i in A:
  if i>=a:
    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)

flag = True
total = sum(a)

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

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

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

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

gross = sum(A)
pop = 0
for i in range(n):
    if A[i]/gross >= 1/(4*m):
        pop += 1

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

Solution (Python):
def main():
    N,M = map(int,input().split())
    A = list(map(int,input().split()))
    min_value = sum(A)/(4*M)
    A2 = [a for a in A if a >= min_value]
    if len(A2) >= M:
        print("Yes")
    else:
        print("No")

if __name__ == "__main__":
    main()

Solution (Python):
import sys
input = sys.stdin.readline

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

total = sum(As)
count = len([i for i in As if i >= total/(4*m) ])
if count < m:
    print('No')
else:
    print('Yes')

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

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

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

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

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

def cond():
    total = sum(a)
    limit = total / (4 * m)
    ans = []
    for v in a:
        if v >= limit:
            ans.append(v)
    return len(ans) >= m


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

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

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

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

total = sum(A)

B = list(filter(lambda x: x >= total/(4*M), A))

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

Solution (Python):
import sys
import os

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

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

A = sorted(A)[::-1]

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

result = "Yes"

for m in range(M):
    if A[m] < thr_A:
        result = "No"
        break

print(result)

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

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

th = sum(la) / (4*m)
num = sum([1 if i >= th else 0 for i in la])
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)
print('Yes' if len([x for x in A if x >= total/4/M]) >= M else 'No')

Solution (Python):
N, M = map(int, input().split())
A = list(map(int, input().split()))
deadline, ans = sum(A)/(4*M), 0

for a in A:
    if a >= deadline:
        ans += 1

if ans >= 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("Yes")
else:
    print("No")

Solution (Python):
n,m=map(int,input().split())
arr=list(map(int,input().split()))
arr=sorted(arr,reverse=True)
cnt=0
for val in arr:
  if val*4*m>=sum(arr):
    cnt+=1
if cnt>=m:
  print('Yes')
else:
  print('No')

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 7)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

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

S = sum(A)
m = S / (4 * M)
cnt = 0
for a in A:
    if a < m:
        continue
    cnt += 1

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

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

a.sort(reverse=True)
sum=0

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

temp=sum/(4*m)

count=0

for i in range(0,n):
    if(a[i]<temp):
        break
    else:
        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 = sum(A)
num = 0
for i in range(N):
  if A[i] >= total / (4 * M):
    num += 1
if num >= 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)

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

print(ans)

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

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

Solution (Python):

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

A.sort()

total = sum(A)

if total/(4*m) <= A[n-m]:
    print("Yes")
else:
    print("No")

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

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

flag = True

for i in range(M):
    if tokuhyo > A[i]:
        flag = False
if flag:
    print('Yes')
else:
    print('No')

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

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

A_M = [A_i for A_i in A if A_i >= (sum_A / (4 * M))]

m = len(A_M)

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

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

s = sum(A)
c = 0
for a in A:
  if a >= s/(4*M):
    c += 1
print('Yes' if c >= M else 'No')

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

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

cnt = 0
for v in a:
    if v >= b:
        cnt += 1

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

Solution (Python):

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

border = sum(A) / (4*M)
ans = "No"

popular = 0
for item in A:
    if item >= border:
        popular += 1
        if popular == M:
            ans = "Yes"
            break

print(ans)

Solution (Python):



def inp():
    return(int(input().rstrip()))
def inlt():
    return(list(map(int,input().rstrip().split())))
def insr():
    s = input().rstrip()
    return(s[:len(s) - 1])
def invr():
    return(map(int,input().rstrip().split()))

n,m = invr()
nums = inlt()
standard = (sum(nums))/(4*m)
nums.sort(reverse = True)
has = True
index = 0
while index < m:
    if nums[index] < standard:
        has = False
        break
    index += 1
if has:
    print('Yes')
else:
    print('No')

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

cnt = 0
c = sum(A)

b = c /(4 * m)

for a in A:
    if a >= b:
        cnt += 1
    
if cnt >= m:
    print('Yes')
else:
    print('No')

Solution (Python):

import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()

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

if __name__ == '__main__':
    main()

Solution (Python):
import sys

N, M = map(int, sys.stdin.readline().rstrip().split())
A = list(map(int, sys.stdin.readline().rstrip().split()))

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

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

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

A = sorted(list(map(int, input().split())), reverse=True)
total_point = sum(A)

for i in range(M):
    if A[i] < total_point / (4 * M):
        print("No")
        exit(0)

print("Yes")

Solution (Python):
mod = 10 ** 9 + 7
mod2 = 2 ** 61 + 1
from collections import deque
import heapq


def iip(listed):
    ret = [int(i) for i in input().split()]
    if len(ret) == 1 and not listed:
        return ret[0]
    return ret


def main():
    N, M = iip(True)
    A = iip(True)

    A.sort()
    A.reverse()
    st = sum(A)

    border = st / 4 / M
    res = 0
    
    
    for a in A:
        if a >= border:
            res += 1

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


def solve():
    N = iip(False)
    S = input()




def split_print_space(s):
    print(" ".join([str(i) for i in s]))


def split_print_enter(s):
    print("\n".join([str(i) for i in s]))


def koenai_saidai_x_index(sorted_list, n):
    l = 0
    r = len(sorted_list)
    if len(sorted_list) == 0:
        return False
    if sorted_list[0] > n:
        return False

    while r - l > 1:
        x = (l + r) // 2
        if sorted_list[x] == n:
            return x
        elif sorted_list[x] > n:
            r = x
        else:
            l = x
    return l


def searchsorted(sorted_list, n, side):
    if side not in ["right", "left"]:
        raise Exception("sideはrightかleftで指定してください")

    l = 0
    r = len(sorted_list)

    if n > sorted_list[-1]:
        
        return len(sorted_list)
    if n < sorted_list[0]:
        return 0

    while r - l > 1:
        x = (l + r) // 2
        if sorted_list[x] > n:
            r = x
        elif sorted_list[x] < n:
            l = x
        else:
            if side == "left":
                r = x
            elif side == "right":
                l = x

    if side == "left":
        if sorted_list[l] == n:
            return r - 1
        else:
            return r

    if side == "right":
        if sorted_list[l] == n:
            return l + 1
        else:
            return l


def soinsuu_bunkai(n):
    ret = []
    for i in range(2, int(n ** 0.5) + 1):
        while n % i == 0:
            n //= i
            ret.append(i)
        if i > n:
            break
    if n != 1:
        ret.append(n)
    return ret


def conbination(n, r, mod, test=False):
    if n <= 0:
        return 0
    if r == 0:
        return 1
    if r < 0:
        return 0
    if r == 1:
        return n
    ret = 1
    for i in range(n - r + 1, n + 1):
        ret *= i
        ret = ret % mod

    bunbo = 1
    for i in range(1, r + 1):
        bunbo *= i
        bunbo = bunbo % mod

    ret = (ret * inv(bunbo, mod)) % mod
    if test:
        
        pass
    return ret


def inv(n, mod):
    return power(n, mod - 2)


def power(n, p, mod_=mod):
    if p == 0:
        return 1
    if p % 2 == 0:
        return (power(n, p // 2, mod_) ** 2) % mod_
    if p % 2 == 1:
        return (n * power(n, p - 1, mod_)) % mod_


if __name__ == "__main__":
    main()

Solution (Python):
n,m = map(int,input().split())
a = [int(i) for i in input().split()]
b = sum(a)
count = 0
ans = False
for i in range(n):
    if a[i]/b >= 1/(4*m):
        count += 1
    if count == m:
        ans = True
        break
if ans:
    print('Yes')
else:
    print('No')

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



res= "Yes"
lt = (float(1)/(4*m))*sum(a)
ctr= 0

for i in a:
    if i >= lt:
        ctr+=1
if ctr>=m:
    print "Yes"
else:
    print 'No'

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

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

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

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

s = sum(a)

ninki = [a_i for a_i in a if a_i >= s / (4 * m)]

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

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

if sum([A[i] > b for i in range(n)]) >= m:
    print("Yes")
else:
    print("No")

Solution (Python):
def main():
    N,M = map(int,input().split())
    A = [int(i) for i in input().split()]
    A.sort(reverse=True)
    S = sum(A)
    border = S / (4 * M)
    flag = True
    for i in range(M):
        if border > A[i]:
            flag = False
    if flag:
        print("Yes")
    else:
        print("No")

if __name__ == '__main__':
    main()

Solution (Python):
n, m = map(int,input().split())
num = list(map(int, input().split()))
SumVote = sum(num)
cnt = 0
for i in num:
  if i*4*m >= SumVote:
    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_key = sum(a)/(4*m)
count = 0
for i in range(n):
    if a[i] >= a_key:
        count += 1
if count >= m:
    print('Yes')
else:
    print('No')

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

count = 0
sum_vote = sum(a)

for i in a:
    if i >= sum_vote/(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()))
sum=0
ctr=0
for i in a:
  sum+=i
for i in a:
  if(i>=sum/(4*m)):
    ctr+=1
print("Yes" if ctr>=m else "No")

Solution (Python):
N, M = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
A.sort(reverse=True)
total = sum(A)
ans = 0
for a in A:
    if a * 4 * M >= total:
        ans += 1
print('Yes' if ans >= M else 'No')

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

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

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

Solution (Python):

n, m, *a = map(int, open(0).read().split())
a.sort(reverse=True)
s = sum(a)/(4*m)
cant = False
for i in range(m):
	if a[i]<s: cant = True
print("YNeos"[cant::2])

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

l = sorted(l)
if l[n-m] >= sum(l) / (4*m):
  print('Yes')
else:
  print('No')

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

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

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

Solution (Python):

import sys,os
from collections import defaultdict, deque
from fractions import gcd
from math import ceil, floor
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in os.environ else lambda *x: 0
def main(given=sys.stdin.readline):
    input = lambda: given().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    XLMIIS = lambda x: [LMIIS() for _ in range(x)]
    YN = lambda c : print('Yes') if c else print('No')
    MOD = 10**9+7

    N,M = LMIIS()
    A = LMIIS()
    count = 0
    sum_vote = sum(A)
    for a in A:
        if a * 4 * M >= sum_vote:
            count += 1
    YN(count >= M)
    

if __name__ == '__main__':
    main()

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

A = sorted(A, reverse=True)
sumA = sum(A)
b = sumA / (4*M)

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

Solution (Python):
N,M=map(int,input().split())
A=list(map(int,input().split()))
ans=[]
border=sum(A)/(4*M)

for i in A:
    if i>=border:
        ans.append(i)
    else:
        pass
print("Yes" if len(ans)>=M else "No")

Solution (Python):

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

Solution (Python):
N, M = map(int, input().split())
A = list(map(int, input().split()))
sumA = sum(A)
rankM = list(reversed(sorted(A)))[M-1]

if rankM * 4 * M < sumA:
  print('No')
else:
  print('Yes')

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

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

Solution (Python):
import sys

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

s = sum(A)
res = 0
tmp = sorted(A,reverse=True)

c = s/(4*M)
for i in range(M):
    if c > tmp[i]:
        print('No')
        sys.exit()
print('Yes')

Solution (Python):
n,m = map(int, input().split())
a = list(map(int, input().split()))
s = sum(a)
count = 0
for i in a:
  if 1/(4*m) <= i/s:
    count+=1

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

Solution (Python):
from collections import deque
from collections import Counter
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect




from fractions import gcd
from math import ceil,floor, sqrt, cos, sin, pi, factorial
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7

def main():
  n,m = map(int, readline().split())
  a = list(map(int, readline().split()))
  total = sum(a)
  count = 0
  for i in a:
    if i>=total/(4*m):
      count +=1
  if count>=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)
ans = 0
for a in A:
    if a >= S / (4 * m):
        ans += 1
if ans >= m:
    print("Yes")
else:
    print("No")

Solution (Python):


            
def main():
    n, m = map(int, input().split())
    a = list(map(int, input().split()))
    sumv = sum(a)
    s = sumv / (4 * m)
    cnt = 0
    for v in a:
        if v >= s:
            cnt += 1
    if cnt >= m:
        print('Yes')
    else:
        print('No')
    
if __name__ == '__main__':
    main()

Solution (Python):
N,M = list(map(int, input().split()))
A = list(map(int, input().split()))
total = sum(A)
th = total/4/M
Asorted = sorted(A, reverse=True)
flag = 0
for i in range(M):
  if(Asorted[i] < th):
    flag = 1
if(flag==0):
  print("Yes")
else:
  print("No")

Solution (Python):
import sys
from math import ceil
RI = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
 

n,m = RI()
a = RI()
summ = sum(a)
cnt = ceil(summ/(4*m))
tot = 0
for i in range(len(a)):
    if a[i] >= cnt:
        tot+=1
if tot >= m:
    Yes()
else:
    No()

Solution (Python):
import sys,math,copy,queue,itertools,bisect
from fractions import gcd
sys.setrecursionlimit(10**7)
LI = lambda : [int(x) for x in sys.stdin.readline().split()]
_LI = lambda : [int(x)-1 for x in sys.stdin.readline().split()]
NI = lambda : int(sys.stdin.readline())
INF = 10**18
MOD = 10**9 + 7
DD = ((1,0),(0,1),(-1,0),(0,-1))
N,M = LI()
A = LI()
A.sort(reverse=True)
s = sum(A)
for i in range(M):
    if A[i] < s / (4 * M):
        print ('No')
        exit (0)
print ('Yes')

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

data.sort(reverse=True)
if data[m - 1] >= sum(data) / (4 * m):
    print("Yes")
else:
    print("No")

Solution (Python):



def main():
    n, m = map(int, input().split())
    votes = list(map(int, input().split()))

    sum_vote = sum(votes)
    filter_list = list(filter(lambda x : x >= sum_vote / (4 * m), votes))

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


if __name__ == '__main__':
    main()

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

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

Solution (Python):

MOD = 10 ** 9 + 7
INFI = 10**10

import math

import itertools
import heapq


import copy
from functools import lru_cache

def sosuhante(n):
    for k in range(2, int(math.sqrt(n))+1):
        if n% k ==0:
            return False
    return True
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def kingaku(a,b,n):
    keta=len(str(n))
    return a*n+b*keta

def my_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default




def ret(a):
    c=[None]*(len(a)-1)
    if len(a)==1:
        return a[0]
    elif len(a)==0:
        return 0
    for i in range(1,len(a)):
        c[i-1]=abs(a[i]-a[i-1])
    return ret(c)


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


if __name__ == "__main__":

    main()

Solution (Python):
import math

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

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

can_be_chosen = 0
for i in range(N):
  if A[i] >= sumA/4.0/M:
    can_be_chosen += 1

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

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

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

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

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

sousu = sum(a)

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

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

Solution (Python):
N, M = map(int, input().split())
A = list(map(int, input().split()))
s = sum(A)
A.sort(reverse=True)
yes = sum(a * 4 * M >= s for a in A) >= M
print('Yes' if yes else 'No')

Solution (Python):
import math

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

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

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

Solution (Python):
import numpy as np

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

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

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

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

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

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

Solution (Python):
n, m = [int(x) for x in input().split()]
items = tuple(int(x) for x in input().split())
threshould = sum(items) / 4 / m
chosen = 0
for i in items:
    if i >= threshould:
        chosen += 1
    if chosen >= m:
        print('Yes')
        break
else:
    print('No')

Solution (Python):




import sys
from io import StringIO
import unittest

def yn(b):
    print("Yes" if b==1 else "No")
    return

def resolve():
    readline=sys.stdin.readline

    n,m=map(int, readline().rstrip().split())
    aa=list(map(int, readline().rstrip().split()))
    aa=sorted(aa,reverse=True)
    sth=sum(aa)
    yn(aa[m-1]>=sth/(4*m))
    
    
    

    return

if 'doTest' not in globals():
    resolve()
    sys.exit()

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

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

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

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

Solution (Python):
N,M=map(int, input().split())
li = list(map(int, input().split()))
li = sorted(li, reverse=True)
n_M = sum(li)
cri = n_M/(4*M)

if li[M-1] < cri:
  print("No")
else:
  print("Yes")

Solution (Python):
n, m, *A = map(int, open(0).read().split())
A.sort(reverse=1)
x = sum(A)
print('Yes' if A[m-1] >= x/(4*m) else 'No')

Solution (Python):

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


total=sum(al)

thre=total/(4*m)
count=0
for i in range(n):
    if al[i]>=thre:
        count+=1

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

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

Solution (Python):

n, m = map(int, input().split())
a = list(map(int, input().split()))
s = sum(a)
print(["No", "Yes"][sum(x >= s / 4 / m for x in a) >= m])

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


if __name__ == '__main__':
    main()

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

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

S = sum(A)

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

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

Solution (Python):
n, m = [int(c) for c in input().split()]
As = [int(c) for c in input().split()]
total = sum(As)
thre = total / (4*m)
num = sum(item>=thre for item in As)
if num>=m:
    print("Yes")
else:
    print("No")

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

Solution (Python):
import sys

input = sys.stdin.readline


def main():
    n, m = map(int, input().split())
    arr = list(map(int, input().split()))
    limit = sum(arr) / (4 * m)
    cnt = 0
    for num in arr:
        if num >= limit:
            cnt += 1
        if cnt >= m:
            break

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


if __name__ == '__main__':
    main()

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

A.sort(reverse=True)
miman = sum(A)/(4*M)

for i in range(M):
    if not(A[i] >= miman):
        print('No')
        exit(0)
print('Yes')

Solution (Python):
import sys
input = sys.stdin.readline

n, m = map(int, input().split()) 
A = [int(i) for i in input().split()]
total = sum(A)

cond = total / (4 * m)
ans = 0
for a in A:
    if a >= cond:
        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(reverse=True)

for i in a[:m]:
    if i < sum(a)/(4*m):
        print('No')
        exit()
print('Yes')

Solution (Python):


MOD = 10**9
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors

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

s = sum(A)
k = s/float(4*M)
cnt = 0
for a in A:
    if a >= k:
        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()]

a = sum(A)

b = 0
for i in range(len(A)):
  if A[i] >= a/(4*M):
    b += 1

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