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

Submission status: Accepted

Solution code:
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)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

# N = 3 
# M = 2
# A = [380,19,1]

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


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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-*-

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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__":
    # test()
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
import numpy as np

YES = "Yes"  # type: str
NO = "No"  # type: str


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


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, M, A)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import numpy as np
# for AtCoder
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")

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
list_a = list(map(int, input().split()))
cnt = 0
sum_a = sum(list_a)
bdr = sum_a / (4 * m)
for a in list_a:
    if a >= bdr:
        cnt += 1
print('Yes' if cnt >= m else 'No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
 
N,M = list(map(int,input().split()))	
A= list(map(int,input().split()))	
A.sort(reverse=True)
all_A=sum(A)

for i in range(M):
  #print(A[i]/all_A,1/(4*M))
  if not(A[i]/all_A >= 1/(4*M)):
    print("No")
    sys.exit( )
print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def resolve():
    import sys
    input = sys.stdin.readline
    nm = [int(x) for x in input().rstrip().split()]
    a = [int(x) for x in input().rstrip().split()]


    if sorted(a, reverse=True)[nm[1]-1] < sum(a) / (4 * nm[1]):
        print("No")
    else:
        print("Yes")

resolve()

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 1/4/M*sum(A)<=A[i]:
        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(" ")))

val = sum(A) / (4 * M)
A.sort(reverse=True)
flag = True
for i in range(0,M):
    if A[i] < val:
        flag = False
        break
    
if flag:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

s = sum(lis)
line = s / (4 * m)

count = 0
for i in lis:
    if i >= line:
        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()))

sumA = sum(A)
min_vote = sumA/(4*M)
exceed = 0
fl = False

for a in A:
    if a >= min_vote:
	    exceed += 1
    if exceed >= M:
	    fl = True
	    break

if fl:
    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)
sum_a = sum(a)

rets = []
flg = False
for i in range(m):
  if a[i] < sum_a / (4 * m):
    pass
  else:
    rets.append(a[i])
    if len(rets) == m:
      flg = True
      break
  
if flg:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
n,m = map(int, input().split())
t = list(map(int, input().split()))
d = sum(t)/(4*m)
a = [x for x in t if x >= d]

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

Submission status: Accepted

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

min_ = sum(a)/(4*m)
ans = 0
for i in a:
    if i >= min_:
        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()))
mm = sum(A)/(4*M)
r = 0
for x in A:
    if x >= mm:
        r += 1
        if r >= M:
            print("Yes")
            exit()
print("No")

Submission status: Accepted

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

A.sort()
total = sum(A)

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

Submission status: Accepted

Solution code:
def count_section_by_zero(data):
  count = 0
  flg = False
  start = 0
  for i, d in enumerate(data):
    if flg is False and d != 0:
      count += 1
      flg = True
      
    if d == 0:
      flg = False
  return count

def input_list():
  return list(map(int, input().split()))

def input_list_str():
  return list(map(str, input().split()))

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

# 2で割り切れる回数
def divide_two(arg):
  c = 0
  while True:
    if c >= 2:
      break
    if arg % 2 != 0:
      break
    arg //= 2
    c += 1
  return c

# 素因数分解
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

def main():
  n,m = input_list()
  a = input_list()
  div = 1/(4*m)
  sum_a = sum(a)
  border = math.ceil(sum_a * div)
  popular = []
  for v in a:
    if v < border:
      continue
    popular.append(v)
    
  if len(popular) >= m:
    print('Yes')
  else:
    print('No')
    
  
import math
import fractions
import collections
import itertools
from functools import reduce
main()

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, M = map(int, input().split(" "))
A = [int(x) for x in input().split(" ")]
count = 0
s = sum(A)
for i in range(N):
  if A[i] * 4 * M >= s:
    count += 1

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

Submission status: Accepted

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

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

Submission status: Accepted

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

    t = sum(A) * (1 / (4 * m))

    if all(item >= t for item in sorted(A, reverse=True)[:m]):
        print('Yes')
    else:
        print('No')
    

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n,m = map(int,input().split())
a = list(map(int, input().split()))
popular = list(filter(lambda e: e>=(1/(4*m))*sum(a),a))
print("Yes" if len(popular) >= m else "No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
(N, M) = [int(x) for x in input().split()]
line=[int(x) for x in input().split()]
cutoff=sum(line)/(4*M)
count=N
for i in line:
    if i<cutoff:
        count-=1
if count>=M:
    print("Yes")
else:
    print("No")