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:
n,m = map(int,input().split())
a_list = list(map(int,input().split()))

count = 0
x = sum(a_list)/(4*m)
for i in range(0,n):
  if a_list[i] >= x :
    count += 1
if count >= 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)
print("Yes" if a[m-1]*4*m >= sum(a) else "No")

Submission status: Accepted

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

s = sum(a)
crit = s / (4 * m)
a.sort()
a.reverse()

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

Submission status: Accepted

Solution code:
import math

n,m = map(int,input().split())
s = list(map(int,input().split()))
 
votes = 0
for i in range(n):
    votes += s[i]
 
s.sort(reverse=True)
 
for i in range(m):
    if s[i] < math.ceil(votes/(4*m)):
        print("No")
        exit()
 
print("Yes")

Submission status: Accepted

Solution code:
species, num = [int(i) for i in input().split()]
votes = [int(i) for i in input().split()]

sum_vote = sum(votes)
min_rate = sum_vote / 4 / num
votes.sort(reverse=True)

ans = 'Yes' if votes[num - 1] >= min_rate else 'No'

print(ans)

Submission status: Accepted

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

A_list.sort(reverse=True)
SUM = sum(A_list)

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

Submission status: Accepted

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

for i in range(len(a)):
    Sum+=a[i]

a.sort(reverse=True)

for i in range(nm[1]):
    if a[i]<Sum/(4*nm[1]):
        flag=1
        break

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

Submission status: Accepted

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

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

ans = 0
for i in range(N):
    if A[i] >= judge:
        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()))
sum_a = sum(a)

# print(n)
# print(m)

# print(sum_a)
# print(sum_a // n)

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

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
lists = list(map(int, input().split()))
# print(lists)
sigma_A = sum(lists)
val = 1/(4 * M) * sigma_A

count = 0
for i in range(M):
    if max(lists) >= val:
        count += 1
        lists.remove(max(lists))
# print(lists)

if count == 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)
if A[M-1]>=sum(A)/(4*M):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

all_num = sum(As)

test = []
test = sorted(As)[::-1]

is_true = True
new = []
key = all_num * (1 / (4 * M))
for idx in range(len(test)):

    if test[idx] < key:
        new = test[:idx]
        is_true = False
        break

if is_true:
    len_ans = len(test)

else:
    len_ans = len(new)


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

Submission status: Accepted

Solution code:
#総商品数N 選ぶ数M
N, M = map(int, input().split())
arr = list(map(int, input().split()))

new_arr = sorted(arr, reverse=True)
ans=new_arr[M-1]
total=sum(new_arr)
waru =4*M


if ans >= total/waru:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

#intの場合
N ,M = map(int,input().split())

intlist = list(map(int, input().split()))
newlist = sorted(intlist, reverse=True)[:M]

if newlist[M-1] >= ( sum(intlist) / (4 * M)):
  print ("Yes")
else:
  print ("No")

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(1000000000)
import math
from fractions import gcd
def lcm(a, b): return a * b // gcd(a, b)
from itertools import count, permutations
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
INF = float('inf')
N1097 = 10**9 + 7

def meg(f, ok, ng):
    while abs(ok-ng)>1:
        mid = (ok+ng)//2
        if f(mid):
            ok=mid
        else:
            ng=mid
    return ok

def get_inv(n, modp):
    return pow(n, modp-2, modp)

def factorials_list(n, modp):    # 10**6
    fs = [1]
    for i in range(1, n+1):
        fs.append(fs[-1] * i % modp)
    return fs

def invs_list(n, fs, modp):     # 10**6
    invs = [get_inv(fs[-1], modp)]
    for i in range(n, 1-1, -1):
        invs.append(invs[-1] * i % modp)
    invs.reverse()
    return invs

def comb(n, k, modp):
    num = 1
    for i in range(n, n-k, -1):
        num = num * i % modp
    den = 1
    for i in range(2, k+1):
        den = den * i % modp
    return num * get_inv(den, modp) % modp

def comb_from_list(n, k, modp, fs, invs):   
    return fs[n] * invs[n-k] * invs[k] % modp

#

class UnionFindEx:
    def __init__(self, size):
        #正なら根の番号、負ならグループサイズ
        self.roots = [-1] * size
    def getRootID(self, i):
        r = self.roots[i]
        if r < 0:   #負なら根
            return i
        else:
            r = self.getRootID(r)
            self.roots[i] = r
            return r
    def getGroupSize(self, i):
        return -self.roots[self.getRootID(i)]
    def connect(self, i, j):
        r1, r2 = self.getRootID(i), self.getRootID(j)
        if r1 == r2:
            return False
        if self.getGroupSize(r1) < self.getGroupSize(r2):
            r1, r2 = r2, r1
        self.roots[r1] += self.roots[r2]    #サイズ更新
        self.roots[r2] = r1
        return True

Yes = 'Yes'
No = 'No'

def main():
    N,M=mis()
    A = lmis()
    S = sum(A)
    ok = sum((4*M)*a>=S for a in A)
    if ok >= M:
        print(Yes)
    else:
        print(No)



main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
A = list(map(int, input().split()))
total_vote = sum(A)
selectable = total_vote / (4 * M)
A.sort(reverse = True)
count = 0

for i in range(N):
    if A[i] >= selectable :
        count += 1
        if count == M:
            print('Yes')
            break;

    else:
        print('No')
        break;

Submission status: Accepted

Solution code:
#coding:utf-8
import sys
n, m = map(int, input().split())
a = list(map(int, input().split()))
vote = sum(a)
rank = sorted(a, reverse=True)
border = vote / (4*m)
#print(border, rank)
count = 0

for i in range(0, n):
    if rank[i] >= border:
        count += 1

    if count == m:
        print('Yes')
        sys.exit()

print('No')

Submission status: Accepted

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

for i in range(n):
	total=total+a[i]
th=total/(4*m)
#print(total,th)

for i in range(n):
  if(a[i]>=(th)):
    count=count+1
#print(count)
if(count>=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()]
b=0
c=0
for j in range(n):
	b+=a[j]
for k in range(n):
	if b/(4*m)<=a[k]:
		c+=1
if c>=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)
s = sum(a)

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

Submission status: Accepted

Solution code:
def main():
    I = [int(_) for _ in input().split()]
    N = I[0]
    M = I[1]
    A = [int(_) for _ in input().split()]

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

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



if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
from itertools import permutations,combinations,groupby
import sys,bisect,string,math,time,functools,random
def Golf():*a,=map(int,open(0))
def I():return int(input())
def S_():return input()
def IS():return input().split()
def LS():return [i for i in input().split()]
def LI():return [int(i) for i in input().split()]
def LI_():return [int(i)-1 for i in input().split()]
def NI(n):return [int(input()) for i in range(n)]
def NI_(n):return [int(input())-1 for i in range(n)]
def StoLI():return [ord(i)-97 for i in input()]
def ItoS(n):return chr(n+97)
def LtoS(ls):return ''.join([chr(i+97) for i in ls])
def GI(V,E,Directed=False,index=0):
    org_inp=[];g=[[] for i in range(n)]
    for i in range(E):
        inp=LI();org_inp.append(inp)
        if index==0:inp[0]-=1;inp[1]-=1
        if len(inp)==2:
            a,b=inp;g[a].append(b)
            if not Directed:g[b].append(a)
        elif len(inp)==3:
            a,b,c=inp;aa=(inp[0],inp[2]);bb=(inp[1],inp[2]);g[a].append(bb)
            if not Directed:g[b].append(aa)
    return g,org_inp
def GGI(h,w,boundary=1,search=[],replacement_of_found='.',mp_def={'#':1,'.':0}):
#h,w,g,sg=GGI(h,w,boundary=1,search=['S','G'],replacement_of_found='.',mp_def={'#':1,'.':0}) # sample usage
    mp=[boundary]*(w+2);found={}
    for i in range(h):
        s=input()
        for char in search:
            if char in s:
                found[char]=((i+1)*(w+2)+s.index(char)+1)
                mp_def[char]=mp_def[replacement_of_found]
        mp+=[boundary]+[mp_def[j] for j in s]+[boundary]
    mp+=[boundary]*(w+2)
    return h+2,w+2,mp,found
def TI(n):return GI(n,n-1)
def bit_combination(k,n=2):return [[tb//(n**bt)%n for bt in range(k)] for tb in range(n**k)]
def show(*inp,end='\n'):
    if show_flg:print(*inp,end=end)
def show2d(g,h,w):
    for i in range(h):show(g[i*w:i*w+w])

YN=['YES','NO'];Yn=['Yes','No']
mo=10**9+7
inf=float('inf')
l_alp=string.ascii_lowercase
#sys.setrecursionlimit(10**7)
input=lambda: sys.stdin.readline().rstrip()

def ran_input():
    n=random.randint(4,16)
    rmin,rmax=1,10
    a=[random.randint(rmin,rmax) for _ in range(n)]
    return n,a

show_flg=False
show_flg=True

ans=0



n,m=LI()
a=sorted(LI())

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

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
A = list(map(int, input().split()))
total = 0
flag = 0
ans = []
for a in A:
    total += a
to = total / (4 * M)
sort_A = sorted(A)
length = len(sort_A)
for i in range(M):
    ans.append(sort_A[length - i - 1])
for ans_sub in ans:
    if ans_sub < to:
        flag += 1
        break
if flag == 0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
# A = [int(x) for x in line2.split()]

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


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

Submission status: Accepted

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

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


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

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

Submission status: Accepted

Solution code:
N, M = (int(x) for x in input().split())
array = list(map(int, input().strip().split()))
list.sort(array, reverse = True)
sum = 0
for i in range(N):
  sum += array[i]
if array[M-1] * 4 * M >= sum:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# coding: utf-8

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

threshold = sum(As) / (4*M)

popular = sorted(As, reverse=True)[:M]

if all(A >= threshold for A in popular):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
a = list(map(int, input().split()))
items = sum(a)
b = items * (1/(4*m))
popular = sorted(a, reverse=True)
popular_item = 0
for i in popular:
    if i >= b:
        popular_item += 1
if popular_item >= m:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
def solve(n, m, arr):
    arr.sort()
    for i in range(m):
        if arr[-1 - i] < sum(arr) * (1 / (4 * m)):
            return False
    return True

if __name__ == "__main__":
    n, m = map(int, input().split(' '))
    arr = [int(s) for s in list(input().split())]
    if solve(n, m, arr):
        print('Yes')
    else:
        print('No')

Submission status: Accepted

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

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


def solve(N: int, M: int, A: "List[int]"):
    A.sort(reverse=True)
    a=sum(A)
    count=0
    for i in range(M):
        if A[i]>=a/(4*M):
            count+=1
    if count<M:
        print(NO)
    else:
        print(YES)
    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:
N,M=map(int,input().split())
num = list(map(int, input().split()))
num1 = sorted(num, reverse=True)
num2 = num1[:M]
if num2[M-1]<((sum(num))*(1/(4*M))):
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
n,m = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
thresh = sum(A)/float(4*m)

tmp = [a for a in A if a >= thresh]

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
#sys.setrecursionlimit(150000)

#def my_index_multi(l, x):
#    return [i for i, _x in enumerate(l) if _x == x]

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


def solve(N: int, M: int, A: "List[int]"):
    A=sorted(A,reverse=True)
    sa=sum(A)
    if N==1:
        print(YES)
    else:
        print(YES if sa/(4*M)<=A[M-1] else NO)

    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
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:
N,M = map(int,input().split())
A = [int(i) for i in input().split()]
A.sort(reverse=True)
B = sum(A)
if A[M-1] >= B/(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)
ans = []
a.sort()
ans = a[-m:]
for i in ans:
    if float(i) < total / (4 * m):
        print("No")
        exit(0)
print("Yes")

Submission status: Accepted

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

Submission status: Accepted

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

s = np.sum(arr)
choosable = len(np.where(4*m*arr >= s)[0])
if m > choosable:
    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)
total_vote = sum(a)
ischoose = True

for i in range(m):
    if(a[i]< total_vote*(1/(4*m))):
        ischoose = False
    

if(ischoose == False):
    print("No")
else:
    print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
nm = input().split(" ")
N, M = int(nm[0]), int(nm[1])
# print(N, M)

sorted_data = sorted(list(map(int, input().split(" "))), reverse=True)
# print(sorted_data[M - 1] * 4 * M , sum(sorted_data))
if sorted_data[M - 1] * 4 * M >= sum(sorted_data):
  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())) 

An=np.array(A)
S=sum(A)/(4*M)

X=np.count_nonzero(An >= S)

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

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

a.sort(reverse=True)
S = sum(a)

if not a[M-1] < (S/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()))
n_votes = sum(A)
print('Yes' if sum(map(lambda x: 4 * M * x >= n_votes, A)) >= M
            else 'No')

Submission status: Accepted

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

ans = sum([1 for a in A if a>=total/(4*M)])
print('Yes' if ans >=M else 'No')

Submission status: Accepted

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

  counter = 0

  for i in range(M):
    if A[i]*4*M >= sum(A):
      counter+=1
    else:
      pass

  if counter == 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()))
a.sort(reverse=True)
asum= sum(a)
pop=0

for i in range(n):
  if a[i]>=asum/(4*m):
    pop = pop+1
    if pop == m:
      break
if pop==m:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
inputLine=input()
N=int(inputLine.split(" ")[0])
M=int(inputLine.split(" ")[1])
#print(N,M)

inputLine=input()
A=inputLine.split(" ")
for i in range(len(A)):
    A[i]=int(A[i])


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


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

Submission status: Accepted

Solution code:
def LI():
	return [ int(s) for s in input().split() ]
N,M = LI()
A = LI()
sum_A = sum(A)
 
print('Yes') if sum(map(lambda x: x >= sum_A*(1/4/M), A)) >= M else print('No')

Submission status: Accepted

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

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

sum = 0
for v in a:
  sum += v

result = []
for s in a:
    if s >= sum * (1 / (4 * m)):
        result.append(s)
if len(result) >= m:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# 入力
n, m = map(int, input().split())
a = [int(n) for n in input().split()]

# 出力
a = sorted(a, reverse=True)
sum = sum(a)

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

print("Yes")

Submission status: Accepted

Solution code:
# python3
# -*- coding: utf-8 -*-
import sys
import math
#from math import gcd
from itertools import count, permutations
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint

INF = float('inf')

ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
sys.setrecursionlimit(1000000000)


def lcm(a, b):
    return (a * b) // gcd(a, b)


# main
n,m = mis()
alist = lmis()

alist.sort()
alist.reverse()

min = sum(alist) * float(1/(4*m))

for i in range(m):
    if alist[i] < min:
        print('No')
        exit(0)

print('Yes')

Submission status: Accepted

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

Submission status: Accepted

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

for a in A:
    sum += a

for a in A:
    if 4 * M * a >= sum:
        count += 1

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

Submission status: Accepted

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

flag = "Yes"
for i, item in enumerate(populars):
    if item < sum(populars)*(1/(4*m)):
        flag = "No"
    if i >= m-1 : break
print(flag)

Submission status: Accepted

Solution code:


n, m = [0] * 2
a = []

def format_input(filename = None):
	global n, m
	global a
	if filename == None:
		n, m = list(map(int, input().split()))
		a = list(map(int, input().split()))

	elif filename == '__random__':
		from random import randint as rng
		n = rng(1, 10**2)
		m = rng(1, n)
		a = [rng(1, 10**3) for i in range(n)]
		print(n, m)
		print(' '.join(list(map(str, a))))

def get_answer():
	sorted_a = sorted(a)
	if sorted_a[-m] > (sum(a) - 1) // (4 * m):
		answer = 'Yes'
	else:
		answer = 'No'
	return answer

if __name__ == '__main__':
	format_input()

	ans = get_answer()
	print(ans)

Submission status: Accepted

Solution code:
N, M = [int(element) for element in input().split(" ")]
AList = [int(element) for element in sorted(input().split(" "), key=int)]
AList = AList[::-1]

count = 0
s = sum(AList) / (4 * M)

text = "Yes"

for n in range(M):
    if AList[n] < s:
        text = "No"
        break
    
print(text)

Submission status: Accepted

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

Submission status: Accepted

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

total = sum(A)

th = total/(4*m)
A = sorted(A,reverse=True)

ans = 'Yes'
for i in range(m):
  if A[i] >= th:
    continue
  else:
    ans = 'No'
  

print(ans)

Submission status: Accepted

Solution code:
NM = input().split()
A = input().split()
N = int(NM[0])
M = int(NM[1])
for j in range(N):
    A[j] = int(A[j])
A.sort(reverse=True)
for i in range(M):
    if int(A[i]) < sum(A)/4/M:
        print("No")
        exit()
print("Yes")

Submission status: Accepted

Solution code:
#At coder 2020/3/27 C

# スペース区切りの整数の入力
N,M= map(int, input().split())
A = list(map(int, input().split())) 
sumA=sum(A)
numM = sum(x>=(sumA*0.25/M) for x in A)
if numM>=M:
    ans='Yes'
else:
    ans='No'
#print(numM,M)
print(ans)

Submission status: Accepted

Solution code:
"""
N M
A1 ... AN
この中から人気商品 M 個を選びます。ただし、得票数が総投票数の 1/4M 未満であるような商品は選べません。
人気商品 M 個を選べるなら Yes、選べないなら No を出力してください。
"""
n,m=map(int,input().split())
a=list(map(int,input().split()))
#print(a)
#print(a.sort())
b=sorted(a, reverse=True)
#print(s#orted(a, reverse=True))
#print(b[m-1])
#print(sum(b))
#print(sum(b)/(4*m))
if b[m-1]>= (sum(b) /(4*m)) :
  print("Yes")
else:
  print("No")
  

"""
x,y,z=map(int,input().split())
a,b,c=x,y,z
a,b=b,a
a,c=c,a
print(a,b,c)
"""

Submission status: Accepted

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

S = sum(a)
cond = S / 4 / m
Buy = True

for i in range(m):
    if a[i] < cond:
        Buy = False
        break

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

Submission status: Accepted

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

Submission status: Accepted

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

###
# main
if(__name__ == '__main__'):
    # input
    n, m = map(int, input().split(" "))
    a_arr = list(map(int, input().split(" ")))
 
    sum = 0
    for a in a_arr:
        sum += a
    threshold = sum / (4*m)
 
    a_arr.sort()
 
    if a_arr[n-m] < threshold:
        print("No")
    else:
        print("Yes")

# else:
    # do nothing

Submission status: Accepted

Solution code:

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


total = 0
for num in a:
    total += num

pjn =  1/(4*m)
x = total * pjn
count = 0
for each_n in a:
    if each_n < x:
        continue;
    else:
        count += 1
if count >= m:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
list2=[]
a,b=map(int,input().split())
if a>=b:
    k=0
    c=list(map(int,input().split()))
    for i in c:
        k=k+i
    for j in c:
        if j>=(k)/(4*b):
            list2.append(j)
    g=len(list2)
    if b <= g:
        print("Yes")
    else:
        print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def printYN(c): print("Yes") if c else print("No")


n, m = [int(w) for w in input().split()]
a = [int(w) for w in input().split()]
total = sum(a)

choice = [t for t in a if t >= total / (4 * m)]
# print([t for t in a if t >= total / (4 * m)])

printYN(len(choice) >= m)

Submission status: Accepted

Solution code:
import numpy as np
N,M = list(map(int,input().split()))
A= np.array(list(map(int,input().split())))
limit = A.sum()/4/M
#print(limit)
over = np.where(A >= limit)[0]
#print(over)
ans = over.size
#print(ans)
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(reverse=True)
limit = 1/(m*4) * sum(a)
#a = [i for i in a if i >= limit]
flag = 0

for i in range(m):
    if a[i] >= limit:
        flag += 1
    else:
        flag = -1
        break
if flag == m:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

# assert len(a) == n, "length doesn't match n"

"""
n = # of products
m = # of products to be selected
a = votes for product 1 >= i >= n
"""

minimum_vote = sum(a) / (4 * m)
# print(minimum_vote)

eligible = list(filter(lambda x: x >= minimum_vote, a))
# print(eligible)

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

Submission status: Accepted

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

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

if count >= 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()]

A_sum = 0
for i in A:
    A_sum += i

A.sort(reverse = True)

YN = True
for i in range(M):
    if A[i] < A_sum / (4 * M):
        YN = False
        break

if YN == True:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
a = list(map(int, input().split()))
sort = sorted(a, reverse=True)
sum = sum(sort)
count = 0
for i in range(m):
    if sort[i] < float(sum / (4 * m)):
        count += 1
    else:
        continue
if count == 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()
a.reverse()
_sum = sum(a)
ans = "Yes" if a[m - 1] >= _sum / (4 * m) else "No"
print(ans)

Submission status: Accepted

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

for i in A:
    if i >= sum(A)/(4*m):
        B.append(i)

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

Submission status: Accepted

Solution code:
import numpy as np
import math
import scipy as sp
import queue
import collections

MOD = 10 ** 9 + 7
INF = 10 ** 9

def main(kwargs):
    n = kwargs["n"]
    m = kwargs["m"]
    A = kwargs["A"]

    sumA = sum(A)
    count = 0
    res = "No"

    for i in range(n):
        if A[i] * 4 * m >= sumA:
            count += 1

        if count == m:
            res = "Yes"

    return res

if __name__ == "__main__":
    kwargs = {}

    cin = input().split()
    #kwargs["n"] = cin[0]
    #kwargs["n"], kwargs["k"] = cin
    #kwargs["n"] = [int(i) for i in cin][0]
    kwargs["n"], kwargs["m"] = [int(i) for i in cin]
    cin = input().split()
    kwargs["A"] = [int(i) for i in cin]

    cout = main(kwargs)
    print(cout)

Submission status: Accepted

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

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