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()
a=input().split()
a=[int(i) for i in a]
a.sort()
for i in range(m):
  if a[(n-1)-i]<sum(a)/(4*m):
    result=0
  else :
    result=1
    
if result==1:
  print('Yes')
elif result==0:
  print('No')

Submission status: Accepted

Solution code:
import sys


def main():
    n, m = map(int, input().split())
    As = sorted(list(map(int, input().split())))[::-1]

    all_vote = sum(As)
    for i in range(m):
        if all_vote/(4*m) > As[i]:
            print('No')
            sys.exit()

    print('Yes')


if __name__ == "__main__":
    main()

Submission status: Accepted

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


A.sort(reverse = True)

canSelect = True
for i in range(M):
    if A[i] < 1/(4*M)*sum(A):
        canSelect = False

if canSelect:
    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 sum(a) / 4 / m <= a[m-1]:
    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) / (4 * m) 

s = 0
for a in A:
    if a >= t:
        s += 1

print('Yes') if s >= m else print('No')

Submission status: Accepted

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

tmp = sum(A)
tmp2 = 0
for i in range(n):
  if A[i] >= tmp / (4 * m):
    tmp2 += 1
    
if tmp2 >= m:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
tokuhyo = []

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

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

ok = 0

for i in range(N):
    if tokuhyo[i] >= yuukou:
        ok += 1

if ok >= 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()]
cnt = 0
for a in sorted(A,reverse=True):
    if (sum(A)/(4 * M)) <= a:
        cnt +=1 
    if cnt == M:
        print('Yes')
        break
    

if cnt < M:
    print('No')

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
a = list(map(int, input().split()))
sum_a = sum(a)
mini = sum_a / (4 * m)
a.sort(reverse = True)
if a[m-1] < mini:
	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)
c = 0
for i in range(n):
    if a[i] >= x:
        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()))
vote = sum(A)
#print(vote)
count = 0
line = 4*M
line2 = vote/line
#print(line2)
ans = "No"

for i in A:
    if (i >= line2):
        count += 1

#print(count)
if (count >= M):
    ans = "Yes"


print(ans)

Submission status: Accepted

Solution code:
line1 = input().split()
n = int(line1[0])
m = int(line1[1])
line2 = input().split()
line2 = [int(i) for i in line2]
total = sum(line2)
line2 = sorted(line2, reverse=True)
if line2[m-1] >= total / (4 * m):
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
a = input().split()

n = int(a[0])
m = int(a[1])

b = input().split()

x = [int(i) for i in b]

s = sum(x)
lim = s / (m*4)

c = 0

for i in range(0,n):
    if(x[i] >= lim):
      c = c + 1
    else:
      continue

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

a.sort(reverse=True)

for i in range(m):
    if a[i] < sum(a) / (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()))

total = sum(a)
taken = 0
a.sort()

for i in a:
    if i * 4 * m >= total:
        taken += 1
    if taken == m:
        print("Yes")
        exit()

print("No")

Submission status: Accepted

Solution code:
N,M=map(int, input().split())
An=list(map(int,input().split()))
An.sort(reverse=True)
total = 0
for a in An:
  total += a
if An[M-1] >= total / (4 * 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]*4*m >= sum(a):
    cnt+=1

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

Submission status: Accepted

Solution code:
n,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:
N, M = map(int, input().split())
A = list(map(int, input().split()))

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

for i in A:
  if i >= minimum:
    M -= 1
    
if M > 0:
  print('No')
else:
  print('Yes')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,m=map(int,input().split())
A=list(map(int,input().split()))
B=sorted(A)
if B[-m]>=sum(A)/(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()))

t = sum(A)
c = 0

for a in A:
    if t * (1/(4*M)) <= a:
        c += 1
if M <= c: print('Yes')
else: print('No')

Submission status: Accepted

Solution code:
# B - Popular Vote

N, M = map(int, input().split())
A = [int(a) for a in input().split()]
P = [1 for a in A if a >= sum(A) * 1 / (4 * M)]

print('Yes' if len(P) >= M else '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)

if A[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()))
ninki = []
for i in range(n):
    if a[i] >= (sum(a) / (4 * m)):
        ninki.append(a[i])
if len(ninki) >= m:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
n,m=map(int,input().split())
a=list(map(int,input().split()))
count=0
sum=sum(a)
for aa in a:
  if aa>=sum/4/m:
    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)
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()))

sum_post = sum(A) / (4 * M)
count = 0

for i in range(N):
    if A[i] >= sum_post:
        count += 1

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

Submission status: Accepted

Solution code:
array = []

for i in range(2):
    val = input()
    array.append(val.split())

kinds = int(array[0][0])
populars = int(array[0][1])
votes_sum = 0

for vote in array[1]:
    votes_sum = votes_sum + int(vote)

winning = votes_sum / (4 * populars)
numbers = 0

for vote in array[1]:
    if int(vote) >= winning:
        numbers = numbers + 1

if numbers >= populars:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
n,m = map(int,input().split())
a = list(map(int,input().split()))
new_a = [i for i in a if 4*i*m >= sum(a)]
print(['Yes','No'][len(new_a) < m])

Submission status: Accepted

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

cnt=0
sou=sum(a)
for i in range(n):
    if a[i]>=sou/(4*m):
        cnt+=1
print('Yes' if cnt>=m else 'No')

Submission status: Accepted

Solution code:
n,m=map(int,input().split())
l=list(map(int,input().split()))
c=len([i for i in l if i >= sum(l)/(4*m)])
print("Yes" if c>=m else "No")

Submission status: Accepted

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

s = sum(A)
p = s/4/M
cnt = 0
for i in range(N):
  if A[i] >= p:
    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()))
cnt = 0

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

Submission status: Accepted

Solution code:
n,m=map(int,input().split())
List=list(map(int,input().split()))
cnt=0
for i in List:
    if (i/sum(List))>=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=input().split()
a_int = [int(i) for i in a]

su = 0
mm = 0

for k in range(n):
    su += a_int[k]

bor = su*1/(4*m)

for j in range(n):
    if a_int[j] >= bor:
        mm += 1

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

Submission status: Accepted

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

total=sum(A)

pop_List=[]
for i in range(N):
    if A[i]<total/(4*M):
        pop_List.append(i)

#popにより減った分をループするindex番号で補正する
count=0
for i in pop_List:
    i=i-count
    A.pop(i)
    count+=1

print("Yes" if len(A)>=M else "No")

Submission status: Accepted

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

sum = 0
for i in range(n):
    sum = sum + a[i]
sum_divided = sum/(4*m)
cnt = 0
for i in range(n):
    if a[i] >= sum_divided:
        cnt = cnt + 1
if cnt >= m:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
N, M = [int(_) for _ in input().split()]
A = [int(_) for _ in input().split()]
s = sum(A)
print('Yes' if len([a for a in A if a > (s - 1) // (4 * M)]) >= M else 'No')

Submission status: Accepted

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

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

Submission status: Accepted

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

for i in a:
  if i >= s/(4*m):
    counter = counter + 1

if counter >= 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)
ans=[]
a=sorted(a,reverse=True)
for i in range(m):
  if a[i]*4*m >= s:
    ans.append(a[i])

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

Submission status: Accepted

Solution code:
lis1=list(map(int,list(input('').split(' '))))
n=lis1[0]
m=lis1[1]
lis=list(map(int,list(input('').split(' '))))
sum=0 
count=0
for i in range(n) :
  sum+=lis[i]
  
for i in range(n):
  if(lis[i]>=sum/(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()))

B = sorted(A, reverse=True)
if len(B) < m:
    print('No')
elif B[m-1] < sum(B)*1/(4*m):
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
import numpy as np
N, M = map(int, input().split())
A = np.array(input().split(), dtype=np.int16)
print(["Yes", "No"][(A >= A.sum() / (4 * M)).sum() < M])

Submission status: Accepted

Solution code:
N,M=map(int,(input().split()))
A=list(map(int,(input().split())))
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:
n,m = map(int, input().split())
a = list(map(int, input().split()))
s = sum(a)
counter = 0

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

if counter >= 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)
counter = 0

for i in a:
  if i >= s/(4*m):
    counter = counter + 1

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

Submission status: Accepted

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

lower_lim = sum(A) * (1 / (4 * M))

if any(s < lower_lim for s in sorted(A, reverse=True)[:M]):
    print("No")
else:
    print("Yes")

Submission status: Accepted

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

all_vote = sum(a)

cnt = 0
for a in a:
    if( 4 * m *a >= all_vote):
        cnt+=1
if cnt >= m:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
n,m = map(int, input().split())
ar = list(map(int,input().split()))
ans = 0
th = sum(ar)/4/m
for i in ar:
  if i < th:
    continue
  ans+=1

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

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
mod2 = 998244353
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    n,m = LI()
    a = LI()
    s = sum(a)
    r = 0
    for c in a:
        if c / s >= 1 / 4 / m:
            r += 1

    if r >= m:
        return "Yes"

    return "No"


print(main())

Submission status: Accepted

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

is_first = True
while True:
    try:
        if is_first:
            n, m  = [int(i) for i in input().split()]
            is_first = False
        else:
            arr = [int(i) for i in input().split()]
    except EOFError:
        break

total_vote = sum(arr)
sorted_arr = sorted(arr, reverse=True)

list_up_arr = sorted_arr[: m]

flag = True
for l in list_up_arr:
    if l < 1 / (4 * m) * total_vote:
        flag = False

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

Submission status: Accepted

Solution code:
def readInts():
  return list(map(int, input().split()))

n, m = readInts()
a = readInts()
s = sum(a)
cnt = 0
for i in range(n):
  if a[i]*4*m >=s:
    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()))
S=sum(A)
total=0
for i in range(1,N+1):
    if A[i-1]>=S/4/M:
        total=total+1
if total>=M:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
N, M = [int(_) for _ in input().split()]
A = [int(_) for _ in input().split()]
m = len([a for a in A if a >= sum(A)/(4 * M)])
if m >= M:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10 ** 6)
# input = sys.stdin.readline    ####
int1 = lambda x: int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

INF = float('inf')

def solve():
    n, m = MI()
    A = LI()

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


if __name__ == '__main__':
    solve()

Submission status: Accepted

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

A_sorted = sorted(A, reverse=True)
all_points = sum(A)
if (A_sorted[M - 1]) >= all_points * (1 / (M * 4)):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

s = sum(a)

b = [i for i in a if i >= s/(4*m)]


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

Submission status: Accepted

Solution code:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop
from itertools import permutations, accumulate
from math import sqrt, ceil, floor
from bisect import bisect_left, bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
import sys
def I(): return int(input())  # '123' -> 123
def Is(): return map(int, input().split())  # '123 456' -> 123, 456
def LI(): return list(map(int, input().split()))  # '123 456' -> [123, 456]
def TI(): return tuple(map(int, input().split()))  # '123 456' -> (123, 456)
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()  # 'aa bb' -> 'aa','bb' or ['aa','bb']
def LS(): return list(input())  # 'abc123' -> ['a','b','c','1','2','3']
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(1000000)
MOD = 1000000007
INF = float('inf')

n, m = Is()
A = LI()
s = sum(A)
c = s/(4*m)
# print(c)
count = 0
for a in A:
    if a * m * 4 >= s:
        count += 1
        # print(a)

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

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

border = sum / (4*m)

ans = 0
for i in range(n):
    if a[i] >= border:
        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()))
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:
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
n,m = [int(i) for i in readline().split()]
a = [int(i) for i in readline().split()]

a.sort(reverse=True)
tot = sum(a)
if a[m-1] < tot/(4*m):
    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.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()))
vote = 0

for i in range(1, n+1):
    if A[i-1] >= sum(A)/(4*m):
        vote += 1
if vote >= m:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
count = 0
  
for i in range(N):
  if A[i] >= sum(A)/(4*M):
    count = 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)

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

Submission status: Accepted

Solution code:
import math
n,m=map(int,input().split())
a=list(map(int,input().split()))
wa=sum(a)
l=math.ceil(wa/(4*m))
count=0
for i in range(n):
  if a[i]>=l:
    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)
B=A[0:M]
SUM=sum(A)

if any([ b<SUM/(4*M)  for b in B]):
  print("No")
else:
  print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,m=(int(x) for x in input().split())
a=[int(y) for y in input().split()]
z=0
for i in range(0,len(a)):
  if a[i]>=sum(a)/(4*m):
    z=z+1
  else:
    z=z
if m<=z<=n:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))

N, M = LI()
A = LI()

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())
A = sorted(list (map(int, input() .split() ) ) )

if A[N-M] >= sum(A)/M/4 :
	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)
A = sorted(A, reverse = True)
if A[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()))
l = []

for i in range(N):
    if A[i] >= sum(A)/(4*M):
        l.append(i)

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

Submission status: Accepted

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

asum = 0
for ai in a:
    asum += ai
msum = 0
for ai in a:
    if ai>=(asum/(4*m)):
        msum += 1
if msum>=m:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

total = 0
for i in range(n):
    total += a[i]
    
num = 0
for i in range(n):
    if a[i] >= total/(4*m):
        num += 1
        
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()))
l=[]
sum=0
for i in a:
    sum+=i
#print(sum)
for i in a:
    if i>=sum/(4*m):
        l.append(i)
#print(l)
x=len(l)
#print(x)
if x>=m:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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


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

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

Submission status: Accepted

Solution code:
import math
N, M = map(int, input().split())
A = list(map(int, input().split()))
sumA = sum(A)
border = sumA // (4*M) + (sumA % (4*M) > 0)
print(["No", "Yes"][len(list(filter(lambda x: x >= border, A))) >= M])

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
A = list(map(int, input().split()))
check = 1 / (4 * M) * sum(A)

for num in A:
    if num < check:
        N -= 1

if N >= 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)
if sum(a)/(4*M)<=a[M-1]:
  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)
a.sort()
a.reverse()
d = s / 4.0 / m

c = 0
for i in range(n):
    if(a[i] >= d):c+=1
    if(c == m):
        print('Yes')
        exit()

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

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

Submission status: Accepted

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

a_s = sorted(a, reverse=True)
if a_s[m-1] >= sum(a_s)/(4*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()))

l = math.ceil(sum(A)/(4*m))

cnt = 0
for a in A:
    if a >= l:
        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()))

l = sum(A)/(4*m)

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

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

Submission status: Accepted

Solution code:
def main():
	n,m = map(int,input().split())
	a = list(map(int,input().split()))
	
	a_up = [i for i in a if i >= (sum(a)/(4*m))]
	if len(a_up) >= m:
		print("Yes")
	else:
		print("No")

if __name__ == '__main__':
	main()

Submission status: Accepted

Solution code:
def I(): return int(input())
def LI(): return list(map(int,input().split()))
def MI(): return map(int,input().split())

n,m = MI()
a = LI()
a.sort()
a.reverse()
ki = sum(a)/(4*m)
if a[m-1] < ki:
    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)
a.sort()
a.reverse()

for i in range(n):
    if i >= m:
        print('Yes')
        exit()
    if a[i]*4*m < s:
        print('No')
        exit()
print('Yes')

Submission status: Accepted

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

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

Submission status: Accepted

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

total = sum(A)

selcnt = 0
for a_i in reversed(sorted(A)):
    if a_i < total * (1/(4*M)):
        break
    selcnt += 1

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

Submission status: Accepted

Solution code:
# B - Popular Vote
# https://atcoder.jp/contests/abc161/tasks/abc161_bß

# N 商品の種類数
# M 選択したい商品数
# votes 各商品ごとの投票数
N,M = list(map(int,input().split()))
votes = list(map(int,input().split()))

# 総投票数
total_vote = 0

# 総投票数算出
for vote in votes:
    total_vote += vote

# 購入できる商品数
i = 0

for vote in votes:
    # 得票数が総投票数の 1/4M 以上であれば商品を選択
    if vote >= total_vote*(1/(4*M)):
        i += 1

# 商品をM個購入できる場合
if i >= M:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
n, m = list(map(int, input().split()))
al = list(map(int, input().split()))
al.sort(reverse=True)
for i in range(m):
    if al[i] < sum(al)/4/m:
        print('No')
        exit()
print('Yes')

Submission status: Accepted

Solution code:
N, M = map(int,input().split())
A = list(map(int,input().split()))
cnt = 0
sm  = sum(A)
for a in A:
    if a >= sm/(4*M):cnt += 1
    if cnt == M:
        print("Yes")
        exit()
print("No")

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse=True)
chk = True
s = sum(A)
for i in range(m):
    if A[i] >= s/(4*m):
        pass
    else:
        chk = False
if chk == True:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

print('Yes' if len(list(filter(lambda x: x>=sum(a)*(1/(m*4)), a)))>=m else 'No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
A = list(map(int, input().split()))
cut = sum(A) / (4 * M)

A = sorted(A, reverse=True)
cand_A = A[:M]
new_cand = []
for i in range(len(cand_A)):
  if cand_A[i] - cut < 0:
    new_cand.append(0)
  else:
    new_cand.append(1)
    
if 0 in new_cand:
  print('No')
else:
  print('Yes')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np
N,M=map(int,input().split())
A=np.array(list(map(int,input().split())))
A=A>=np.sum(A)/(4*M)
if np.sum(A)>=M:
    print('Yes')
else:print('No')

Submission status: Accepted

Solution code:
from sys import stdin, stdout
from collections import defaultdict
import math
from queue import Queue

n, m = map(int, stdin.readline().strip().split())
arr = list(map(int, stdin.readline().strip().split()))

threshold = 1 / (4 * m) * sum(arr)

arr = sorted(arr, reverse=True)

if arr[m - 1] >= threshold:
    stdout.writelines('Yes\n')
else:
    stdout.writelines('No\n')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

n, m = input().split()
m = int(m)
n = int(n)
a = input().split()
sum_a = sum(int(i) for i in a) / (4 * m)

yes_num = 0
no_num = 0

ok = m
ng = n - m

for i in a:
    if int(i) < sum_a:
        no_num += 1
    else:
        yes_num += 1
    if no_num > ng:
        break
    if yes_num >= ok:
        print("Yes")
        exit(0)

print("No")

Submission status: Accepted

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

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

for i in a[:m]:
    if i < base:
        print('No')
        exit()
print('Yes')