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 = list(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 = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort(reverse=True)
total = sum(a)
ratio = 1 / (4 * m)
print("Yes" if a[m - 1] >= total * ratio else "No")

Submission status: Accepted

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

total = sum(A)
base = total  / (4 * M)

filtered = list(filter(lambda x: x >= base, A))

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

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
c=list(map(int,input().split()))
d=sum(c)/(4*b)
e=[i for i in c if i<d]
if len(e)>a-b:
  print("No")
else:
  print("Yes")

Submission status: Accepted

Solution code:
x, y = map(int, input().split())
l = list(map(int, input().split()))
count = 0

for i in range(x):
  if l[i] >= sum(l)*(1/(4*y)):
    count += 1
    
if count >= y:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

y = sorted(x, reverse=True)
if y[m-1] >= sum(x)/(4*m):
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
import sys
import math
n, m = map(int, sys.stdin.buffer.readline().split())
a = tuple(map(int, sys.stdin.buffer.readline().split()))

lim = math.ceil(sum(a) / (4 * m))
c = sum(1 for aa in a if aa >= lim)
print('Yes' if c >= m else 'No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys, bisect, math, itertools, string, queue, copy
import numpy as np
import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
from fractions import gcd
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

n,m = inpm()
a = list(reversed(sorted(inpl())))
s = sum(a)

ans = "Yes"
for i in range(m):
    if a[i] < s/4/m:
        ans = "No"

print(ans)

Submission status: Accepted

Solution code:
n,m = map(int,input().split())
x = list(map(int,input().split()))
x.sort(reverse = True)
sumx = sum(x)
limit = sumx/4/m
#print(limit)
if x[m-1]>=limit:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

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

b = sum(a) / (4 * m)
ans = 0
for i in range(n):
    if a[i] >= b:
      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()))
h = sum(a)/(4*m)
ans = 0

for i in range(n):
    if a[i] < h:
        continue
    else:
        ans += 1

if ans < m:
    print('No')
else:
    print('Yes')

Submission status: Accepted

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

# for i in range(1,m+1):
#     if a[i-1] < v/(4*i):
#         print("No")
#         exit(0)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# abc161_b.py
# https://atcoder.jp/contests/abc161/tasks/abc161_b

# B - Popular Vote /
# 実行時間制限: 2 sec / メモリ制限: 1024 MB
# 配点 : 200点

# 問題文
# N種類の商品に対して人気投票を行いました。商品 i は Ai票を得ています。
# この中から人気商品 M個を選びます。ただし、得票数が総投票数の 14M未満であるような商品は選べません。
# 人気商品 M個を選べるなら Yes、選べないなら No を出力してください。

# 制約
#     1≤M≤N≤100
#     1≤Ai≤1000
#     Aiは相異なる
#     入力は全て整数

# 入力
# 入力は以下の形式で標準入力から与えられる。
# N M
# A1 ... AN

# 出力
# 人気商品 M個を選べるなら Yes、選べないなら No を出力せよ。

# 入力例 1
# 4 1
# 5 4 2 1

# 出力例 1
# Yes

# 総投票数は 12です。1 位の得票数は 5なので、これを選ぶことができます。

# 入力例 2
# 3 2
# 380 19 1

# 出力例 2
# No

# 総投票数は 400です。
# 2,3 位の得票数は総得票数の 14×2 未満なので、これらを選ぶことはできず、人気商品 2個を選べません。

# 入力例 3
# 12 3
# 4 56 78 901 2 345 67 890 123 45 6 789

# 出力例 3
# Yes


global FLAG_LOG
FLAG_LOG = False


def log(value):
    # FLAG_LOG = True
    # FLAG_LOG = False
    if FLAG_LOG:
        print(str(value))


def calculation(lines):
    # S = lines[0]
    # N = int(lines[0])
    N, M = list(map(int, lines[0].split()))
    values = list(map(int, lines[1].split()))
    # values = list(map(int, lines[2].split()))
    # values = list()
    # for i in range(N):
    #     values.append(int(lines[i]))
    # valueses = list()
    # for i in range(N):
    #     valueses.append(list(map(int, lines[i+1].split())))

    values.sort()
    values = values[::-1]

    log(f'values[M-1]=[{values[M-1]}]')
    log(f'1/(4*M)=[{1/(4*M)}]')

    if values[M-1]/sum(values) < 1/(4*M):
        result = 'No'
    else:
        result = 'Yes'

    return [result]


# 引数を取得
def get_input_lines(lines_count):
    lines = list()
    for _ in range(lines_count):
        lines.append(input())
    return lines


# テストデータ
def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['4 1', '5 4 2 1']
        lines_export = ['Yes']
    if pattern == 2:
        lines_input = ['3 2', '380 19 1']
        lines_export = ['No']
    if pattern == 3:
        lines_input = ['12 3', '4 56 78 901 2 345 67 890 123 45 6 789']
        lines_export = ['Yes']
    return lines_input, lines_export


# 動作モード判別
def get_mode():
    import sys
    args = sys.argv
    global FLAG_LOG
    if len(args) == 1:
        mode = 0
        FLAG_LOG = False
    else:
        mode = int(args[1])
        FLAG_LOG = True
    return mode


# 主処理
def main():
    import time
    started = time.time()
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines(2)
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = calculation(lines_input)

    for line_result in lines_result:
        print(line_result)

    # if mode > 0:
    #     print(f'lines_input=[{lines_input}]')
    #     print(f'lines_export=[{lines_export}]')
    #     print(f'lines_result=[{lines_result}]')
    #     if lines_result == lines_export:
    #         print('OK')
    #     else:
    #         print('NG')
    # finished = time.time()
    # duration = finished - started
    # print(f'duration=[{duration}]')


# 起動処理
if __name__ == '__main__':
    main()

Submission status: Accepted

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

min_limit = sum(A)*(1 / (4*m))
select_ok = 0

for i in A:
  if i >= min_limit:
    select_ok += 1

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

Submission status: Accepted

Solution code:
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#l = list(map(int, input().split()))
n,m = map(int, input().split())
a = list(map(int, input().split()))

total = sum(a)
re = m
for i in range(n):
    if (4*m*a[i] >= total):
        re = re -1
        if (re == 0):
            print("Yes")
            exit()
print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# Generated by https://github.com/kyuridenamida/atcoder-tools
from typing import *
import collections
import itertools
import math
import sys

INF = float('inf')
YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(N: int, M: int, A: "List[int]"):
    t = sum(A)/4/M
    return [YES, NO][len([a for a in A if a >= t]) < M]


def main():

    sys.setrecursionlimit(10 ** 6)

    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]"
    print(f'{solve(N, M, A)}')


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)
if len(list(filter(lambda v: v * 4 * m >= sum(a), a[:m]))) == 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)
sm = sum(a)
if len(list(filter(lambda v: v * 4 * m >= sm, a[:m]))) == m:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

A = sorted(A,reverse=True)

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

Submission status: Accepted

Solution code:
n,m=map(int,input().split())
A=list(map(int,input().split()))
print("NYoe s"[m<=len([i for i in A if i>=sum(A)/(4*m)])::2])

Submission status: Accepted

Solution code:
inputValues = [int(i) for i in input().split()]
n = inputValues[0]
m = inputValues[1]
votes = [int(i) for i in input().split()]
total = sum(votes)
cnt = 0
for i in votes:
    if i >= total*(1/(4*m)):
        cnt += 1
        # print(i)
if cnt >= m:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
import sys
N,M = map(int,input().split())
array = list(map(int,input().split()))

if not ( 1 <= M <= 100 and M <= N <= 100 ): sys.exit()
if not (len(array) == len(set(array))): sys.exit()

count = 0
standard = sum(array) * (1/(4*M))
for I in array:
    if I >= standard:
        count += 1
print('Yes') if count >= M 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 A[M-1]<(sum(A)/(4*M)):
    print("No")
else:
    print("Yes")

Submission status: Accepted

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

Submission status: Accepted

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

cnt=0

for i in a:
	if (sum(a))*(Fraction(1,4*m))<=i:
		cnt+=1
		if cnt==m:
			print("Yes")
            
if cnt<m:
	print("No")

Submission status: Accepted

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

Submission status: Accepted

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

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

total = sum(A)
count = 0

for a in A:
  if a >= 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()))
total = sum(A)
print('Yes' if M <= len(list(filter(lambda x: x, map(lambda x: x * 4 * M >= total, A)))) else 'No')

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict, deque, Counter, OrderedDict
from functools import reduce, lru_cache
import collections, heapq, itertools, bisect
import math, fractions
import sys, copy

sys.setrecursionlimit(1000000)

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI1(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline().rstrip())
def LS(): return [list(x) for x in sys.stdin.readline().split()]
def S(): return list(sys.stdin.readline().rstrip())
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def LIR1(n): return [LI1() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]

dire = [[1, 0], [0, 1], [-1, 0], [0, -1]]
dire8 = [[1, 0], [1, 1], [0, 1], [-1, 1], [-1, 0], [-1, -1], [0, -1], [1, -1]]
MOD = 1000000007

def main():
    N, M = LI()
    A = LI()
    s = sum(A)

    print("Yes" if len(list(filter(lambda x: 4 * M * x >= s, A))) >= M else "No")


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n,m=map(int,input().split())
num=[int(i) for i in input().split()]
num=sorted(num,reverse=True)
sum_num=sum(num)
if num[m-1]<sum_num/(4*m):
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
A = list(map(int, input().split()))
cr = sum(A) / (4*M)
Arev = sorted(A, reverse = True)

if Arev[M-1] >= cr:
    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)
A.sort(reverse=True)
if A[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()))

th = sum(A)/(4*M)
cnt=0

for i in range(N):
    if A[i] >= th:
        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()))

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
n, m = M()
li = LI()
li.sort(reverse=True)
S = sum(li)
if li[m-1] >= S / (4*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(reverse=True)
n_vote = sum(l)
if l[m-1] >= n_vote/(4*m):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
n,m = map(int,input().split())
A = list(map(int,input().split()))
v = sum(A)/(4*m)
cnt = 0
for a in A:
    if a >=v:
        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()))
a.sort()
a_sum=sum(a)
for i in range(1,m+1):
    if a[-i]<a_sum*(1/(4*m)):
        print("No")
        exit()
print("Yes")

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
List = list(map(int, input().split()))
wa = 0
List.sort(reverse = True)
for i in range(a):
  wa += List[i]
thresi = wa / (4 * b)
flag = False
for i in range(b):
  if List[i] >= thresi:
    flag = True
  else:
    flag = False
if flag:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
N,M = map(int, input().split())
vote_list = [int(i) for i in input().split()]
vote_list.sort(reverse=True)

Mth_got_vote = vote_list[M - 1]

if Mth_got_vote < sum(vote_list) / (4 * M):
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
n,m=map(int,input().split());a=sorted(map(int,input().split()),reverse=True)
print('NYoe s'[all([1 if i>=sum(a)/(4*m) else 0 for i in a[:m]])::2])

Submission status: Accepted

Solution code:
n,m=map(int,input().split());a=sorted(map(int,input().split()),reverse=True)
print('NYoe s'[all([1 if a[i]>=sum(a)/(4*m) else 0 for i in range(m)])::2])

Submission status: Accepted

Solution code:
def popular_vote():
    # 入力
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    # 総投票数
    total_vote = sum(A)
    # 総投票数の(1/4*M)以上をカウント
    count = 0
    for i in range(N):
        if A[i] >= total_vote/(4*M):
            count += 1
    if count >= M:
        return 'Yes'
    else:
        return 'No' 

result = popular_vote()
print(result)

Submission status: Accepted

Solution code:
# B Popular Vote

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

A.sort(reverse = True)
border = sum(A) / (4 * M) 
cnt = 0
for a in A:
  if a >= border:
    cnt += 1
  else:
    break

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

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

print("Yes") if all(e >= votes/(4*m) for e in a[:m]) else print("No")

Submission status: Accepted

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

cnt = 0
th = sum(A)/(4*M)

for i in range(len(A)):
  if A[i] >= th:
    cnt += 1

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

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
a = sorted(list(map(int, input().split())), reverse=True)
総投票数 = sum(a)
x = 総投票数 / (4 * m)
for i in range(m):
    if a[i] < x:
        flag = 0
        break
else:
    flag = 1
print(["No", "Yes"][flag])

Submission status: Accepted

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

b = [x for x in a if x >= sum(a)/4/m]

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

Submission status: Accepted

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

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

standard=sum(a_list)/(4*m)

#print(a_list[m-1])
#print(standard)
if a_list[m-1]<standard:
    print("No")
    
else:
    print("Yes")

Submission status: Accepted

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

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

print(['No','Yes'][count >= m])

Submission status: Accepted

Solution code:
import numpy as np
n,m = map(int, input().split())
a = np.array([int(i) for i in input().split()])
ans = (a >= a.sum()/(4*m)).sum()
if ans >= m:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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


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 main():
    N, M = MI()
    A = LI()

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


main()

Submission status: Accepted

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

Submission status: Accepted

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

sum_A = sum(A) / 4 / m
cnt = 0

for i in A:
  if i >= 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(map(int,input().split()))
a=0
for i in A:
    a+=i
b=a/(4*M)
c=0
for n in range(0,N):
    if A[n]>=b:
        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()))
a=0
for i in A:
    a+=i
b=a/(4*M)
c=0
for n in range(0,N):
    if A[n]>=b:
        c+=1
if c>=M:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

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

s = sum(a)
t = (s + (4 * m - 1)) // (4 * m)

cnt = 0
for i in a:
    if t <= i:
        cnt += 1

if m <= cnt:
    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
ttl = sum(a)
for i in a:
    if i >= ttl / (4 * m):
        cnt += 1
print("Yes") if cnt >= m 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(" ")]

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

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

print("Yes")

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, M, *A = map(int, read().split())

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

    return


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)
ans = 0
x = sum(A)
for i in range(M):
    if A[i] >= x/(4*M):
        #print(i)
        ans += 1
#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()))
s = 0
total = sum(a)
for i in a:
    if total/(4*m) <= i:
        s += 1

if s >= 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)

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

Submission status: Accepted

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

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())
a = list(map(int, input().split()))
z = sum(a)
a.sort(reverse=True)

for i in a[:M]:
    if i < z/4/M:
        print('No')
        break
else:
    print('Yes')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    threshold = sum(A) / (4 * M)
    if sorted(A, reverse=True)[M-1] >= threshold:
        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()))

s = sum(a) * (1 / (4 * m))

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

a_thr = sum(a) / (4 * m)
count = 0
for a_i in a:
    if a_i >= a_thr:
        count += 1
print('Yes' if count >= m else 'No')

Submission status: Accepted

Solution code:
N,M=map(int,input().split())
A=list(map(int,input().split()))
s=sum(A)
A.sort(reverse=True)
t=0
for x in range(M):
  if A[x]*4*M<s:
    t=1
    break
if t==0:
  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)

cnt=0
for i in range(N):
    if A[i]*(4*M)>=Total:
        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()))
total_vote = sum(a)
a.sort(reverse=True)
if a[M-1] >= total_vote / (4*M):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
import sys


def solve(m, a, s):
    for i in range(m):
        if a[i] * 4 * m < s:
            return False
    return True


def main():
    input = sys.stdin.buffer.readline
    _, m = map(int, input().split())
    a = sorted(map(int, input().split()), reverse=True)
    s = sum(a)
    print('Yes' if solve(m, a, s) else 'No')


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,M = [int(hoge) for hoge in input().split()]
A = [int(hoge) for hoge in input().split()]
S = sum(A)
kijun = (S-1)//(4*M)#これ以下ならダメ
X = (sum([a>kijun for a in A]))
if X < 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)
ans = 0
total = sum(A)
thre = total / (4 * M)

for a in A:
    if a < thre:
        break
    ans += 1

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

Submission status: Accepted

Solution code:
N,M=map(int,input().split())
K=list(map(int,input().split()))
L=sorted(K)
S=0
for i in range(N):
  S+=L[i]
if L[N-M]*4*M<S:
  print("No")
else:
  print("Yes")

Submission status: Accepted

Solution code:
n,m = map(int,input().split())
a = sorted(list(map(int,input().split())),reverse=True)
b = sum(a)/(4*m)
c=[]
for i in a[:m]:
  if i >= b:
    c.append(i)

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

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
aaa = list(map(int, input().split()))
acc = sum(aaa)
print('Yes' if sum(4 * M * a >= acc for a in aaa) >= M else 'No')

Submission status: Accepted

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

minval = sum(pop) / (4 * m)

nqual = sum(1 for p in pop if p >= minval)

if nqual >= m:
  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)
if len([a for a in A if a * 4 * M >= S]) >= M:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
n,m=map(int,input().split())
l=list(map(int,input().split()))
wa=0
for i in range(n):
  wa+=l[i]
ans=0
for i in range(n):
  if l[i]>=wa/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()))
b = sum(a) / (4 * m)
print('Yes' if b <= sorted(a)[-m] else 'No')

Submission status: Accepted

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

x = 0
for i in a:
    if i * 4 * m >= sum:
        x += 1


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()))
sumA = sum(A)
count = 0
judge = sumA / (4*M)
for i in range(len(A)):
  if A[i] >= judge:
    count += 1
if count < 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()))
A = sorted(A, reverse=True)

s = sum(A)
th = s * 1/(4*M)

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

Submission status: Accepted

Solution code:
import sys

N,M=map(int,input().split())
A=list(map(int,input().split()))
A.sort(reverse=True)
rank=A[:M]
for i in range(M):
  if(rank[i]<sum(A)/(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()))
cnt=0
for i in range(n):
  if a[i]>=sum(a)/(4*m):
    cnt+=1
if cnt>=m:
  ans="Yes"
else:
  ans="No"
  
print(ans)

Submission status: Accepted

Solution code:
n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
result='Yes'
for i in range (m):
    if a[len(a)-i-1]/sum(a)<1/(4*m):
        result='No'
        break
print(result)

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
a = list(map(int, input().split()))
s = sum(a)
a.sort()
a = a[::-1]

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

Submission status: Accepted

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