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())
vals = list(map(int,input().split()))
total = sum(vals)
acceptable = 0
for i in range(len(vals)):
  if (vals[i]/total >= 1/(4*m)):
    acceptable += 1
print("Yes" if acceptable >= m else "No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def popularVote():
    n, m = list(map(int, input().split()))
    item_votes = list(map(int, input().split()))
    total = sum(item_votes)

    selected = []
    isSelected = False

    req = 1 / (4 * m)
    for item in item_votes:
        if item / total >= req:
            selected.append(item)

        if len(selected) == m:
            isSelected = True
            print("Yes")
            break

    if not isSelected:
        print("No")


popularVote()

Submission status: Accepted

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

sum_A = sum(As)

As.sort(reverse=True)

if As[M-1] >= sum_A / (4*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()]

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

gokaku = 0

for i in A:
  if i >= threshold:
    gokaku +=1

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

Submission status: Accepted

Solution code:
import numpy as np

tmp = input().split(" ")
allItem, trendingItem = int(tmp[0]), int(tmp[1])

votes = input().split(" ")
votesInt = np.asarray([int(s) for s in votes])
votesTotal = np.sum(votesInt)

standard = votesTotal / (4 * trendingItem)

clearList = votesInt[votesInt >= standard]

result = 'Yes' if len(clearList) >= trendingItem else 'No'

print(result)

Submission status: Accepted

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

sum_line = sum(A) / (4 * M)
arranged = sorted(A, reverse=True)

if arranged[M-1] < sum_line:
  print('No')
else:
  print('Yes')

Submission status: Accepted

Solution code:
def f(m, a):
    poll = sum(a)
    result = [i for i in a if i >= poll/4/m]
    print('Yes' if len(result) >= m else 'No')

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

Submission status: Accepted

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

total = sum(a)

count = 0

valid = total / (4 * m)

for i in a:
    if i >= valid:
        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()))
c = 0
for i in a:
    if i * 4 * m >= sum(a):
        c += 1
if c < m:
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
a = list(map(int, input().split()))
t = sum(a) / (4 * m)
l = sum(x >= t for x in a)
if l >= m:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

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

Submission status: Accepted

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

import sys
input = sys.stdin.readline

def main():
    N,M = map(int, input().split())
    A = list(map(int, input().split()))
    X = sum(A)/(4*M)
    c = sum([1 for i in A if i >= X])
    if c>=M:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Al_s = sorted(Al,reverse=True)
SUM=sum(Al)
trig=1/(4*M)*SUM
Bool=False

for i in range(M):
	if Al_s[i] >= trig:
		Bool=True
		continue
	else:
		Bool=False
		break

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

Submission status: Accepted

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

num = 0
total = sum(A)
t = total / (4*M)
for p in A: num += 1 if p >= t else 0

print("Yes" if num >= M else "No")

Submission status: Accepted

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

tot = sum(A)
cnt = 0

A = sorted(A,reverse = True)


for i in range(N):
    if A[i]/tot >= 1/(4*M):
        cnt += 1
    else:
        break


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()))
A.sort(reverse = True)
threshold = sum(A)/(4*m)
if(A[m-1]>=threshold):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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



total = sum(aList)

if aList[m-1] >= total/(4*m):
    print("Yes")
else:
    print("No")
flag = "Yes"

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np

N,M = map(int, input().split())
An = np.array(input().split(), dtype=int)

vote_sum = np.sum(An)
judge = np.where(An >= vote_sum /(4 * M), 1, 0)
judge_sum = np.sum(judge)

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

Submission status: Accepted

Solution code:
n, m = map(int,input().split())
sum = 0
list = []
for i in input().split():
    sum += int(i)
    list.append(int(i))
judge = 1 / (4 * m)
count = 0
for i in list:
    if i >= sum * judge:
        count += 1
    if count == m:
        print('Yes')
        break
if count < m:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N , M = map(int , input().split())
A = list(map(int, input().split()))
count = 0
A_sorted = sorted(A , reverse = True)
for i in range(M):
    if A_sorted[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 = sorted(list(map(int,input().split())),reverse = True)
temp = 1/(4*m)*(sum(a))
res = list(filter(lambda x:x<temp, a[:m]))
if len(res) == 0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
# ABC161 B

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

    sortedA = sorted(A)[::-1]

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    N, M = map(int, input().split())
    A = sorted([int(a) for a in input().split()], reverse=True)
    t = 1 / (4*M)
    vote_num = sum(A)

    for a in A:
        if t > (a/vote_num):
            print("No")
            return
        else:
            M -= 1
            if M == 0:
                print("Yes")
                return


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Ns = sorted(A)
#print(Ns)

answer = Ns[len(Ns)-M]

sum = 0
for i in range(len(Ns)):
	sum = sum + Ns[i]
#print(sum)

if sum / (4 * M) <= answer:
	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_popular = [i for i in A if i * 4 * M >= total]

if len(A_popular) >= 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)
a.sort(reverse=True)
if a[m - 1] >= sum_a / (4 * m):
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

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

Submission status: Accepted

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

A.sort()
A.reverse()

for i in range(M):
    if A[i] < sum(A) / (4 * M):
        print('No')
        exit(0)
    else:
        continue

print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,M=map(int,input().split())
A=list(map(int,input().split()))
sm=sum(A)
re=0
for a in A:
    if a>=(sm/(4*M)):
        re+=1
#print(re)
if re>=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
through = sum(A) / (4 * M)

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

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

Submission status: Accepted

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

import sys
sys.setrecursionlimit(300000)

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

def solve(N: int, M: int, A: "List[int]"):
    A.sort()
    A.reverse()
    c = 0
    s = sum(A)
    for a in A:
        if a * 4 * M >= s:
            c += 1
    if c >= M:
        ret = YES
    else:
        ret = NO
    print(ret)
    return

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:
def read():
	return list(map(int, input().split()))

def main():
	n, m = read()
	a = read()
	total_vote = sum(a)
	number_of_popular_items = 0
	for i in range(n):
		if a[i]*(4*m) >= total_vote:
			number_of_popular_items += 1
	if number_of_popular_items >= m: print("Yes")
	else: print("No")
main()

Submission status: Accepted

Solution code:
n,m = map(int, input().split())
a = list(map(int, input().split()))
tot = sum(a)
b = tot/(4*m)
a.sort()

cnt = 0
for i in range(n):
	if a[-(i+1)] < b:
		break
	cnt += 1

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

Submission status: Accepted

Solution code:
n,m=map(int,input().split())
v=list(map(int,input().split()))
s=0
for a in v:
    s+=a
c=0
for a in v:
    if 4*m*a >= s:
        c+=1
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)
c = 0
val = s/(4*m)
for a in A :
  if a >= val:
    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()))
s = sum(a)
cnt = 0
for i in a:
    if i >= s / (4*m):
      cnt += 1
if cnt >= m:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

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

Submission status: Accepted

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

for Ai in A:
    if Ai>=S/(4*M):
        cnt += 1

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

Submission status: Accepted

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

for Ai in A:
    if Ai*4*M>=S:
        cnt += 1

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

Submission status: Accepted

Solution code:
#python3
def main():
    n, m = map(int, input().split())
    a = [int(i) for i in input().split()]
    s = sum(a)
    c = 0
    for i in range(n):
        if 4*m*a[i] < s:
            c += 1
    ans = n - c
    print('Yes') if ans >= m else print('No')
main()

Submission status: Accepted

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


ans = "Yes"
sumA = sum(A)
for i in range(m):
    if A[i]*4*m < sumA:
        ans = "No"

print(ans)

Submission status: Accepted

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

count = 0
for i in range(len(a)):
    if a[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()))
total = sum(a)

def counter(val):
  return True if val >= total / (4 * m) else False
  
def main():
  res = list(map(counter, a))
  print("YNeos"[sum(res)<m::2])

if __name__ == "__main__":
  main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#abc161b
n,m=map(int,raw_input().split())
a=map(int,raw_input().split())
x=sum(a)/(4.0*m)
l=[i for i in a if i>=x]
if len(l)>=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
flag = False
A = sorted(A)[::-1]
for a in A:
  if a >= sum(A)*(1/(4*m)):
    cnt += 1
  if cnt == m:
    flag = True
    break
if flag:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N, M = map(int, input().split())
A_list = list(map(int, input().split()))
A_total = sum(A_list)
A_popular = []
for i in range(N):
    if A_list[i] >= A_total/(4*M):
        A_popular.append(A_list[i])
if len(A_popular) >= M:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
m = input()
b = input()
x = int(0)
a = list()

n, m = m.split(' ')
n = int(n)
m = int(m)

b = b.split(' ')
for i in range(len(b)):
    a.append(int(b[i]))

list.sort(a, reverse = True)

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

for i in range(m):
    if int(a[i]) < x / (4 * m):
        print('No')
        exit()

print('Yes')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#python3
def main():
    n, m = map(int, input().split())
    a = [int(i) for i in input().split()]
    s = sum(a)
    c = 0
    for i in range(n):
        if a[i] < (s+4*m-1)//(4*m):
            c += 1
    ans = n - c
    print('Yes') if ans >= m else print('No')
main()

Submission status: Accepted

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

s = sum(a)
a_select = [x for x in a if x >= s / (4 * m)]

print('Yes' if len(a_select) >= m else 'No')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys


def input():
    return sys.stdin.readline().strip()


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

A = list(map(int, input().split()))
A.sort(reverse=True)
all = sum(A)

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

print("Yes")

Submission status: Accepted

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

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

if count >= 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()))
    A_tot = sum(A)
    A = sorted([a / A_tot for a in A], reverse=True)

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

total = sum(list_goods)
list_goods.sort(reverse=True)

flag = "Yes"

if list_goods[M-1] < total/(4*M):
    flag = "No"

print(flag)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# number of items, number of popular items to select
n, m = list(map(int, input().split()))

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

total_item_votes = sum(item_votes)

item_vote_percentages = [item_votes/total_item_votes for item_votes in item_votes]

required_vote_percentage = 1/(4*m)

can_select = 0
for vote_percentage in item_vote_percentages:
    if vote_percentage >= required_vote_percentage:
        can_select += 1

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

Submission status: Accepted

Solution code:
import math
N,M = map(int,input().split())
List = list(map(int,input().split()))
a = 0
b = 0
for i in range(0,N):
    a = a + List[i]
for j in range(0,N):
    if List[j] >= math.ceil(a/(4*M)):
        b = b+1
if b <  M:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
import sys
n,m = [int(_) for _ in input().split()]
alist = sorted([int(_) for _ in input().split()], reverse=True)

base = sum(alist)/(4*m)
for i in reversed(range(m)):
  if base > alist[i]:
    print("No")
    sys.exit()

print("Yes")

Submission status: Accepted

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

Submission status: Accepted

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

A = [int(i) for i in input().split()]

B = [j for j in A if j>=(sum(A)/(4*M))]

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

Submission status: Accepted

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

g = sum(A)/(4*N[1])
cnt = 0

for i in range(N[0]):
  if A[i] >= g:
    cnt += 1

if cnt >= N[1]:
  print('Yes')
  sys.exit()

print('No')

Submission status: Accepted

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

Submission status: Accepted

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

#総投票数を求める
sum_vote = sum(A)
#print(sum_vote)

#投票数が1/4Mを下回る物を削除していく つまり　新しいリストに代入
for i in range(len(A)):
    if A[i] >= sum_vote * 1/(4 * M):
        B.append(A[i])
    else:
        pass

#最終判断
if len(B) >= 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
s = sum(a)
for i in a :
  if i >= s/4/m :
    cnt += 1
    
if cnt >= m :
  print('Yes')
else : 
  print('No')

Submission status: Accepted

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

A_sum = sum(A) 
cnt = 0
for i, a in enumerate(A):
    if a*(4*M) >= A_sum:
        cnt += 1

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
#標準入力の取得
N,M = map(int,input().split())
A = list(map(int,input().split()))

cutoff = sum(A)/(4*M)
count_pop = sum(i >= cutoff for i in A)


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

Submission status: Accepted

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

tot = sum(a)

cnt = 0
for x in a:
    cnt += int(x * 4 * M >= tot)

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

# 候補>=得票数の総和/4m
# 候補*4m>=得票数の総和

Submission status: Accepted

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

Submission status: Accepted

Solution code:
l1 = list(map(int,input().split()))
l2 = list(map(int,input().split()))
s = sum((l2))/(4*l1[1])
c=0
for i in range(l1[0]):
    if l2[i]>=s:
        c +=1
if c>=l1[1]:
    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()]
threshold = float(sum(A) / (4 * M))
cnt=0
for i in A:
  if i >= threshold:
    cnt += 1
if cnt >= M:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

total=sum(A)
if total%(4*M)==0:
  n=total//(4*M)
else:
  n=total//(4*M)+1


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

Submission status: Accepted

Solution code:
nm=input().split()
vote=[int(i) for i in input().split()]
n=int(nm[0])
m=int(nm[1])
selectable=0
all=sum(vote)
for v in vote:
	if v < all/(4*m):
		continue
	else:
		selectable+=1
if selectable>=m:
	print("Yes")
else:
	print("No")

Submission status: Accepted

Solution code:
import sys,math
n,m=[int(x) for x in input().split()]
a = [int(x) for x in input().split()]
total = sum(a)
cnt = n
for i in range(0, n):
  if a[i] < math.ceil(total / (4 * m)):
    cnt -= 1
  if cnt < m:
    print("No")
    sys.exit()
print("Yes")

Submission status: Accepted

Solution code:
import sys
import os

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
A = 0
arr = [int(i) for i in input().split() ]
arr.sort(reverse = True)
A = sum(arr)
x = A/(4 * m)
count = 0
for i in arr:
	if i >= x:
		count +=1
	else:
		break

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

Submission status: Accepted

Solution code:
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)

# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
    return [ int(s) for s in input().split(" ")]

# 改行区切りの入力をn行読み込んで数値リストにして返します。
def get_nums_n(n):
    return [ int(input()) for _ in range(n)]

# 改行またはスペース区切りの入力をすべて読み込んでイテレータを返します。
def get_all_int():
    return map(int, open(0).read().split())

def log(*args):
    print("DEBUG:", *args, file=sys.stderr)

n,m = get_nums_l()
A = get_nums_l()

A.sort(reverse=True)

_sum = sum(A)

print("Yes" if A[m-1] >= (_sum / (4*m)) else "No")

Submission status: Accepted

Solution code:
N,M = map(int,input().split())
A = list(map(int,input().split()))
total = sum(A)
per = 1/(4*M)
count = 0
for i in A:
    if i/total>=per:
        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()))
ord = []
summ = sum(a)
isSmallThan = True
for j in range(m):
  ord.append(max(a))
  a.remove(max(a))
for k in range(m):
  if ord[k]/summ >= 1/(4*m):
    isSmallThan = True
  else:
    isSmallThan = False
    break
print('Yes' if isSmallThan else 'No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,m,*a=map(int,open(0).read().split());print('YNeos'[sorted(a)[-m]*4*m<sum(a)::2])

Submission status: Accepted

Solution code:
n,m,*a=map(int,open(0).read().split());print('YNeos'[sum(i*4*m>=sum(a)for i in a)<m::2])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# B - Popular Vote
def main():
    N, M, *A = map(int, open(0).read().split())
    A.sort(reverse=True)
    lim = sum(A) / (4 * M)
    print("Yes" if A[M - 1] >= lim else "No")


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys
def main():
  n, m = map(int, input().split())
  l = list(map(int, input().split()))
  d = sum(l) / (4 * m)
  cnt = 0;
  for li in l:
    if li >= d:
      cnt = cnt + 1
  if cnt >= m :
    print ("Yes")
  else :
    print ("No")
  return

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

min_hyou = sum/(4*m)

count = 0
for i in range(len(a)):
    if min_hyou <= a[i]:
        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()))
cnt = 0
total = sum(A)
for a in A:
    if a >= total/(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()))

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

min_hyou = sum/(4*m)

count = 0
for i in range(len(a)):
    if a[i] >= min_hyou:
        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(' ')))

sum_votes = sum(a)
pivot = sum_votes / (4*m)
cnt = m
for i in range(len(a)):
    if a[i] >= pivot:
        cnt -= 1
if cnt <= 0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

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

Submission status: Accepted

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

cnt = 0
for ai in A:
    if 4 * M * ai >= sm:
        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()))
A.sort(reverse=True)
sm = sum(A)

ans = None
# if A[7] >= sm * (1/(4*M)):
if 4 * M * A[M-1] >= sm:
    ans = True
else:
    ans = False

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

Submission status: Accepted

Solution code:
import sys

n,m = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse = True)
need = sum(A) / (4 * m)
for i in range(m):
    if A[i] < need:
        print("No")
        sys.exit()
print("Yes")

Submission status: Accepted

Solution code:
n,m=map(int,input().split())
L=list(map(int,input().split()))
LL=sorted(L)[::-1]
cnt=0
for i in range(n):
  if LL[i]>=sum(L)/(4*m):
    cnt=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()))
list.sort(a, reverse=True)

ret = "Yes"
a_sum = sum(a)
a_min = a_sum / (4 * m)
for i in range(m):
    if a[i] < a_min:
        ret = "No"
        break

print("{}".format(ret))

Submission status: Accepted

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

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

A = A[:M]
ans = None

# A[-1] < sm * (1/4M)
if 4 * M * A[-1] < sm:
    ans = False
else:
    ans = True

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

Submission status: Accepted

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