Problem:


Score : 200 points

Problem Statement

We have held a popularity poll for N items on sale. Item i received A_i votes.

From these N items, we will select M as popular items. However, we cannot select an item with less than \dfrac{1}{4M} of the total number of votes.

If M popular items can be selected, print Yes; otherwise, print No.

Constraints

1 \leq M \leq N \leq 100

1 \leq A_i \leq 1000

A_i are distinct.

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N M
A_1 ... A_N

Output

If M popular items can be selected, print Yes; otherwise, print No.

Sample Input 1

4 1
5 4 2 1

Sample Output 1

Yes

There were 12 votes in total. The most popular item received 5 votes, and we can select it.

Sample Input 2

3 2
380 19 1

Sample Output 2

No

There were 400 votes in total. The second and third most popular items received less than \dfrac{1}{4\times 2} of the total number of votes, so we cannot select them. Thus, we cannot select two popular items.

Sample Input 3

12 3
4 56 78 901 2 345 67 890 123 45 6 789

Sample Output 3

Yes



Sample input:
4 1
5 4 2 1


Sample output:
Yes

Submission status: Accepted

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

treshold = sum(a)/(4*nm[1])
judge = 'Yes'
for i in range(nm[1]):
    a_max = max(a)
    a[a.index(a_max)] = 0
    if a_max < treshold:
        judge = 'No'
        break

print(judge)

Submission status: Accepted

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

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

#print(border)
ans = len(list(filter(lambda x:x>=border,a)))
#print(ans)
if m <= ans:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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/(4*M):
        cnt += 1
if cnt >= M:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

# print(n, m)
# print(a)

a.sort(reverse=True)
# print(a)

last = a[m-1]
# print(last)
total = sum(a)

if (last >= (total / (4 * m))):
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

cnt = 0
for a in A:
    if a >= lower_limit:
        cnt += 1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/ python3.8
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, M, *A = map(int, read().split())
A.sort(reverse=True)
x = A[M - 1]
S = sum(A)

answer = 'Yes' if 4 * M * x >= S else 'No'
print(answer)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, M = input().split()
N = int(N)
M = int(M)
votes_str = list(input().split())
votes = [int(i) for i in votes_str]
votes_sum = sum(votes)
votes.sort(reverse=True)
thresh = votes[M-1]
if thresh < votes_sum/(4*M):
  print("No")
else:
  print("Yes")

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
votes = list(map(int, input().split()))
vote_total = sum(votes)
base_4m = vote_total / (4 * m)
over4m_count = 0

for i in votes:
    if i >= base_4m:
        over4m_count += 1

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

Submission status: Accepted

Solution code:


def solve():

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

    Alist.sort(reverse=True)

    needRatio = 1/(4*M)
    total = sum(Alist)

    for i in range(M):
        ratio = Alist[i] / total
        if ratio < needRatio:
            print("No")
            exit()

    print("Yes")


if __name__ == "__main__":
    solve()

Submission status: Accepted

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

border = sum(A) / (4 * M)
pnum = 0
for i in range(N):
    test = A[i] - border
    if test >= 0:
        pnum +=1
    else:   #test < 0
        pass
    if pnum >= M:
        break
    else:
        pass

if pnum >= M:
    print('Yes')
else: #pnum < M
    print('No')

Submission status: Accepted

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

count = 0

for tg in l:
	if tg >= 1 / (4 * m)* sum(l):
		count += 1


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

Submission status: Accepted

Solution code:
n, m = [int(i) for i in input().split()]
l = [int(i) for i in input().split()]
goukei = sum(l)
tokuhyo = goukei / (4 * m)
f = True
for i in range(m):
  if max(l) >= tokuhyo:
    goukei -= max(l)
    l.pop(l.index(max(l)))
  else:
    f = False    

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

Submission status: Accepted

Solution code:

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

a=sorted(a,reverse=True)
item=a[m-1]
s=sum(a)/(4*m)

if item >= s:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
a = [int(_) for _ in input().split()]
aa = [0] * n

for i in range(n):
    aa[i] = a[i] * (4*m)

lim = sum(a)
ans = 0
for i in range(n):
    if aa[i] >= lim:
        ans += 1
    else:
        pass
if m <= ans:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

min_voted_num = 1 / (4 * M) * sum(Ai)
num_selected = sum(A >= min_voted_num for A in Ai)
if num_selected >= M:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

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

c = 0
for i in A:
    if i < a:
        c+=1
d = N-c

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

for i in range(N):
    if int(A[i]) >= (tokuhyo/(4 * M)):
        num += 1
if num >= M:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

flag = True
diff = 0
s = sum(a_L)
a_L = list(sorted(a_L))



for i in range(n):

    if float(a_L[i]) >= s/(4*m):
        diff += 1

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

Submission status: Accepted

Solution code:
N,M,*A = map(int,open(0).read().split())
A.sort()
A.reverse()
A2=A[:M]
j = sum(A) / (4*M)
print("Yes" if all(a>=j for a in A2) else "No")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sat Apr  4 20:49:19 2020

@author: naoki
"""

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    _, M = [int(x) for x in input().split()]
    A = [int(x) for x in input().split()]
    border = sum(A) / (M * 4)
    count = 0
    for a in A:
        if a >= border:
            count += 1
            if count >= M:
                print("Yes")
                return
    print("No")

if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

l_sort = sorted(l , reverse=True)

l_sum = sum(l)

s = l_sum/(m*4)

ans = 0
for i in range(m):
    if l_sort[i] >= s:
        ans += 1



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

Submission status: Accepted

Solution code:
a=list(map(int,input().split()))
b=list(map(int,input().split()))
count = a[0]
choice = a[1]
all = sum(b)
answer = 1
b.sort(reverse=True)
for i in range(choice):
     if b[i]<(all/(4*choice)):
          answer = answer*0
if answer==0:
     print("No")
else:
     print("Yes")

Submission status: Accepted

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

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

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

d=c/(4*M)

for j in range(N):
    if A[j]>=d:
        ans=ans+1
    else:
        pass

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!python3



def main():
    # input
    N, M = list(map(int, input().split()))
    A = list(map(int, input().split()))
    s = sum(A)
    t = s / (4 * M)
    A.sort()
    A = A[::-1]
    ans = 'Yes'
    for i in range(M):
        if A[i] < t:
            ans = 'No'
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n, m = input().split(" ")
n, m = int(n), int(m)
a = [int(i) for i in input().split(" ")]
vote = sum(a)
voted4 = vote / (4 * m)
a = sorted(a, reverse=True)
ans = 0
for i in a:
    if (i >= voted4):
        ans += 1
    else:
        break
if (ans >= m):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n,m = iim()
A = sorted(iil(),reverse=True)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,m = map(int,input().split())
a = [int(i) for i in input().split()]
s = sum(a)
c=0

for i in range(n):

   if a[i]*4*m >= s:
       c+=1

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

Submission status: Accepted

Solution code:
import sys

n, m = map(int, input().split())
table = list(map(int, input().split()))
table.sort(reverse=True)
for x in range(0, m):
    if table[x] < sum(table) / (4 * m):
        break
else:
    print('Yes')
    sys.exit()
print('No')

Submission status: Accepted

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

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

min = arr_sum * (1 / (4 * int(M)))

for x in A[:int(M)]:
    if x < min:
        print('No')
        break
else:
    print('Yes')

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
n = list(map(int,input().split()))
m = list(map(int,input().split()))
m.sort()
l = []
for i in m:
    l.insert(0,i)
ans = 0
s = 0
for i in m:
    s += i
for i in range(n[1]):
    if l[i]<s/4/n[1]:
        ans = 1
#print(l)
if ans == 0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

x = sum(A)
for a in A[:m]:
    if a < x / (4 * m):
        print("No")
        exit()
print("Yes")

Submission status: Accepted

Solution code:
import numpy as np
S = input().split(" ")
N = int(S[0])
M = int(S[1])

ARR = np.array([int(s) for s in input().split(" ")])


criterion = np.sum(ARR) / (4 * M)

res = ARR >= criterion

result = np.sum(res)

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

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse=True)
total_vote = 0
result = True
for a in A:
    total_vote += a
for m in range(M):
    if A[m] < (total_vote/(4*M)):
        result = False
if result:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
#Input
n, m = map(int, input().split())
l_a = list(map(int, input().split()))

#Process
sum_a = sum(l_a)
l_a.sort(reverse=True)
for i in range(m):
    if(l_a[i] < sum_a / 4 / m):
        Ans = 'No'
        break
    else:
        Ans = 'Yes'

#Output
print(Ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

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

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

if t.is_integer():
    t = sum(A) // (4*M)

for i in range(M):
    if A[i] < t:
        print("No")
        sys.exit()

print("Yes")

Submission status: Accepted

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

sou_tokuhyousuu = sum(A)
count = 0
for i in A:
    if sou_tokuhyousuu / (4 * NM[1]) <= i:
        count += 1

if NM[1] <= count:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

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

if checkPopular() < M:
    print('No')
else:
    print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
# input = sys.stdin.buffer.readline
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getlist():
    return list(map(int, input().split()))
def getlist2():
    return [int(x) * 100000 for x in input().split()]
import math
import bisect
import heapq
from decimal import Decimal
# from collections import defaultdict, Counter, deque
MOD = 10**9 + 7
INF = 10**15
def main():
    n,m = getlist()
    nums = getlist()
    sou = sum(nums)
    ans = 0
    for num in nums:
        if num >= sou / (4*m):
            ans += 1
    if ans >= m:
        print("Yes")
    else:
        print("No")
    return

if __name__ == '__main__':
    main()

"""
9999
3

2916
"""

Submission status: Accepted

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


def value_evaluator(x:int)->bool:
    return x >= sum(a) / (4 * m)

flt_a = list(filter(value_evaluator, a))

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

Submission status: Accepted

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

Submission status: Accepted

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

amax = max(a)
s = sum(a)

mm = s / (4 * m)
a.sort(reverse=True)

y = True
for i in range(m):
    if a[i] < mm:
        print('No')
        y = False
        break

if y:
    print('Yes')

Submission status: Accepted

Solution code:
def main():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    A.sort(reverse=True)
    ans = 1
    for i in range(M):
        if A[i] < sum(A)/(4*M): ans = 0

    if ans == 1: print("Yes")
    else: print("No")


main()

Submission status: Accepted

Solution code:
N,M = list(map(int,input().split()))
A = list(map(int,input().split()))
A=sorted(A,reverse=True)
sum_A=sum(A)
count=0
for i in range(M):
    if A[i]<sum_A/(4*M):
        break
    count+=1
if count==M:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
def main():
  # import bisect
  # from collections import Counter
  # from collections import defaultdict
  # from collections import deque
  # from copy import deepcopy
  # from fractions import gcd
  # from heapq import heappop,heappush
  # from itertools import accumulate
  # from itertools import combinations
  # from itertools import permutations
  # from itertools import product
  # from math import ceil,floor, pi
  import sys
  sys.setrecursionlimit(10**6)
  readline = sys.stdin.readline
  ints = lambda: map(int, readline().split())
  floats = lambda: map(float, readline().split())
  pyes = lambda: print("Yes")
  pno = lambda: print("No")
  lli = lambda I, J: [[0] * J for _ in range(I)]
  mod = 10**9+7

  n,m = ints()
  a = list(ints())
  sm = sum(a) / 4 / m
  x = len([i for i in a if i >= sm])
  if x < m:
    pno()
  else:
    pyes()

if __name__ == '__main__':
  main()

Submission status: Accepted

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

sums = 0
for i in range(n):
  sums += List[i]
border = sums / (4*m)

counter = 0
for i in range(n):
  if List[i] >= border:
    counter += 1
  else:
    break
if counter >= m:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
from decimal import *

n , m = map(int, input().split())
arr = list(map(int, input().split()))
check = Decimal(1/(4*m)) * sum(arr)
count = 0
for i in arr:
	if i < check:
		continue
	else:
		count+=1
if count >= m:
	print("Yes")
else:
	print("No")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
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)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

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
        # for line in sys.stdin:
        #     lines.append(line)
        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()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
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')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#M番目が1/4M以下ならだめ

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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)
    # print(crit, cnt)
    m -= 1
    if cnt < crit:
        print('No')
        break
else:
    print('Yes')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# AtCoder Beginner Contest 161: B (2020/04/04)
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')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
from decimal import Decimal

# 標準入力 <int><int>
N, M = map(int, input().split())

# 標準入力 <int> list[]
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")

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

for i in range(M):
    if A[i] >= sum(A)*(1/(4*M)):
        continue
    else:
        print("No")
        break
else:
    print("Yes")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

total = np.sum(a)
#print(len(a[a>=total/(4*m)]))

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

Submission status: Accepted

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

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