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

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

Submission status: Accepted

Solution code:


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

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

votes = sum(arr)

c = n

for i in arr:
    if i < votes / (4 * m):
        c -= 1

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

Submission status: Accepted

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

crit = 1/4/m * sum(alist)

count = 0

for a in alist:
    if a >= crit:
        count += 1

# print(count)

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

Submission status: Accepted

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

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

result = 0
for a in As:
    if a >= comp:
        result += 1

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
import string
def num():
    return int(input())
def nums():
    return list(map(int,input().split()))

N,M = nums()
A = nums()
sum_v = sum(A)
ans = 0
for i in A:
    if i >= sum_v / (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()))

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

Submission status: Accepted

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

su_li = sum(lis)
line = su_li / 4 / m
for item in lis:
  if item >= line:
    count += 1
if count >= m:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

cnt = 0

for x in range(0,N):
  if lst[x] >= sum(lst)/(4*M):
    cnt +=1

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

Submission status: Accepted

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

criteria = sum(A) / m * 0.25
if A[-m] >= criteria:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

# N, M = 4, 1
# A = [5, 4, 2, 1]

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

A.sort(reverse=True)

count = 0
for i in range(M):
    # i = 0
    if A[i] / sum_vote >= th:
        count += 1
    else:
        break

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

Submission status: Accepted

Solution code:
import sys

def main():
    N, M = map(int, input().split())
    As = list(map(int, input().split()))
    sys.stderr.write(str(As))
    sys.stderr.write('\n')


    s = sum(As)
    cnt = len([a for a in As if a >= 1.0 * s / (4*M)])
    sys.stderr.write(str(s))
    sys.stderr.write('\n')
    sys.stderr.write(str(cnt))
    sys.stderr.write('\n')


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

    return 0

if __name__ == '__main__':
    sys.exit(main())

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 4*M*a[i] >= 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()))
ax = sorted(a,reverse=True)[:m]


sa = sum(a)

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

Submission status: Accepted

Solution code:
n,m=map(int,input().split())
a=list(map(int,input().split()))
a = sorted(a)[::-1]
sou=sum(a)
if sou>a[m-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()
if a[-m] < 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()))
sum = 0
for i in a:
	sum += i
cnt = 0
for j in range(len(a)):
	if a[j] * 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 = [int(i) for i in input().split()]

a_sum = sum(a_list)
a_sorted = sorted(a_list)[::-1]

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

Submission status: Accepted

Solution code:
n,m=map(int,input().split())
alist=list(map(int,input().split()))
soutokuhyou = sum(alist) / (4*m)
count = 0

for i in alist:
    if i >= soutokuhyou:
        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 = [x for x in A if x >= sum(A)/(4*M)]
print("Yes" if len(B) >= M else "No")

Submission status: Accepted

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

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

if A[M-1]*4*M<total:
    print("No")
else:
    print("Yes")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,m = map(int,input().strip().split())
ls = list(map(int,input().strip().split()))
mini = sum(ls)/(4*m)
i = 0
while i<n and m>0:
    if ls[i]>=mini:
        m -= 1
    i += 1
if m<=0:
    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]*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()))
vote = sum(A)
count = 0
for i in A:
    if i >= vote/(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()))
result = 0
s = sum(A)
for i in A:
    if i >= (1/(4*M))*s:
        result += 1
if result >= 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)

ans = [a_i for a_i in A if a_i>=A_sum/(4*m)]

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

Submission status: Accepted

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

cnt = 0
for a in A:
    if a >= div:
        cnt += 1
if cnt >= M:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
from math import ceil


n, m = map(int, input().split())
a = list(map(int, input().split()))
a_sum = sum(a)
a.sort(reverse=True)
a_limit = ceil(a_sum / (4 * m))
if a[m-1] < a_limit:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
n, m = [int(x) for x in input().split()]
a = [-int(x) for x in input().split()]
a.sort()
if -a[m - 1] * 4 * m < -sum(a):
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
N,M = map(int,input().split())
A = list(map(int,input().split()))
all = sum(A)
ans = lambda x:"Yes" if x >= M else "No"
k = 0
for item in A:
    if(item >= all/(4*M)):
        k += 1
print(ans(k))

Submission status: Accepted

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

A.sort(reverse=True)
ans="Yes"
for i in range(m):
    if A[i]<sum(A)/4/m:
        ans="No"
        break
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
A = [int(i) for i in input().split()]
boarder = sum(A) / (4 * M)
A.sort()
if A[-M] < boarder:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
n,m=map(int,input().split())
a=list(map(int,input().split()))
a=sorted(a)[::-1]
sum_a=sum(a)
flag=True
for i in range(m):
    if a[i] <sum_a/(4*m):
        flag=False
        break
if flag==True:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
A = sorted([int(a) for a in input().split()], reverse=True)

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

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

Submission status: Accepted

Solution code:
N,M = map(int,input().split())
L = [i for i in map(int,input().split())]
Vote = sum(L)
Res = [i for i in L if i >= (Vote/(4*M))]
if len(Res) >= 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) >= (1 / (4*M)):
        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 = [int(x) for x in input().split()]

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

Submission status: Accepted

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

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

if lst[m-1]<S/(4*m):
    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)
c = sum(1 for a in A if a*4*M >= S)
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()))

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

Submission status: Accepted

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

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


def solve(N: int, M: int, A: "List[int]"):
    s = sum(A)
    cnt = 0
    for i in range(N):
        if A[i] >= s / (4 * M):
            cnt += 1
    print(YES if cnt >= M else NO)

    return


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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#!/usr/bin/python3
# -*- coding: utf-8 -*-
n, m = map(int, input().split())
a_list = list(map(int, input().split()))
sum_a = sum(a_list)
count = 0

for a in a_list:
    if a < sum_a / (4 * m):
        continue
    else:
        count += 1

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

Submission status: Accepted

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

    
if __name__ == "__main__":
    resolve()

Submission status: Accepted

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

count = 0
for a in A:
    if a >= least:
        count += 1

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

Submission status: Accepted

Solution code:
d = input().split(" ")
n = int(d[0])
m = int(d[1])
a = input().split(" ")
t = 0
for i in range(n):
	b = int(a[i])
	a[i] = b
	t += b
c = t /(m * 4)
e = 0
for i in range(n):
	if a[i] >= c:
		e += 1
if e >= 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)

bdr = total /(4*M)

A.sort(reverse=True)

C = 1

if A[M-1] < bdr:
  C = 0
  
if C == 1:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
import math

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

tot = sum(A)

a = 0
for i in range(N):
    if A[i] >= math.ceil(tot / (4 * M)):
        a += 1

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    n,m = tuple([int(t)for t in input().split()])

    a = [int(t)for t in input().split()]

    votesum = sum(a)

    ans = 0
    for a_i in a:
        if a_i < votesum/4/m:
            pass
        else:
            ans+=1
    if ans>=m:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
lst = list(map(int, input().split()))
low = sorted(lst, reverse=True)[M-1]
limit = sum(lst)/(4*M)

if low < limit:
    print('No')
else:
    print('Yes')

Submission status: Accepted

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

Submission status: Accepted

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

flag = True
total = sum(a)

for i in range(m):
    if a[i] < total / (4 * m):
        flag = False
        break

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

Submission status: Accepted

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

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

gross = sum(A)
pop = 0
for i in range(n):
    if A[i]/gross >= 1/(4*m):
        pop += 1

if pop >= 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()))
    min_value = sum(A)/(4*M)
    A2 = [a for a in A if a >= min_value]
    if len(A2) >= M:
        print("Yes")
    else:
        print("No")

if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

total = sum(As)
count = len([i for i in As if i >= total/(4*m) ])
if count < m:
    print('No')
else:
    print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, M = map(int,input().split())
a = list(map(int, input().split()))
lim = sum(a)/(4*M)
c = 0
for k in range(N):
    if a[k] >=lim:
        c+=1
    if c ==M:
        break

if c ==M:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

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

def cond():
    total = sum(a)
    limit = total / (4 * m)
    ans = []
    for v in a:
        if v >= limit:
            ans.append(v)
    return len(ans) >= m


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

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
A = sorted(map(int, input().split()), 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()))
limit = sum(a) / 4 / m
a.sort()
a = a[::-1]
if a[m-1] < limit:
    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)

B = list(filter(lambda x: x >= total/(4*M), A))

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

Submission status: Accepted

Solution code:
import sys
import os

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

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

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

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

result = "Yes"

for m in range(M):
    if A[m] < thr_A:
        result = "No"
        break

print(result)

Submission status: Accepted

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

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

th = sum(la) / (4*m)
num = sum([1 if i >= th else 0 for i in la])
if num >= 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)
print('Yes' if len([x for x in A if x >= total/4/M]) >= M else 'No')

Submission status: Accepted

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

for a in A:
    if a >= deadline:
        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()))
th=sum(A)/(4*M)
A.sort(reverse=True)

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

Submission status: Accepted

Solution code:
n,m=map(int,input().split())
arr=list(map(int,input().split()))
arr=sorted(arr,reverse=True)
cnt=0
for val in arr:
  if val*4*m>=sum(arr):
    cnt+=1
if cnt>=m:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10 ** 7)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

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

S = sum(A)
m = S / (4 * M)
cnt = 0
for a in A:
    if a < m:
        continue
    cnt += 1

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

Submission status: Accepted

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

a.sort(reverse=True)
sum=0

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

temp=sum/(4*m)

count=0

for i in range(0,n):
    if(a[i]<temp):
        break
    else:
        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)
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()))
A = sorted(A, reverse=True)

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

A.sort()

total = sum(A)

if total/(4*m) <= A[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.sort(reverse=True)

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

flag = True

for i in range(M):
    if tokuhyo > A[i]:
        flag = False
if flag:
    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_M = [A_i for A_i in A if A_i >= (sum_A / (4 * M))]

m = len(A_M)

if m >= 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)
c = 0
for a in A:
  if a >= s/(4*M):
    c += 1
print('Yes' if c >= M else 'No')

Submission status: Accepted

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

b = sum(a) / (4 * m)

cnt = 0
for v in a:
    if v >= b:
        cnt += 1

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

Submission status: Accepted

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

border = sum(A) / (4*M)
ans = "No"

popular = 0
for item in A:
    if item >= border:
        popular += 1
        if popular == M:
            ans = "Yes"
            break

print(ans)

Submission status: Accepted

Solution code:


############ ---- USER DEFINED INPUT FUNCTIONS ---- ############
def inp():
    return(int(input().rstrip()))
def inlt():
    return(list(map(int,input().rstrip().split())))
def insr():
    s = input().rstrip()
    return(s[:len(s) - 1])
def invr():
    return(map(int,input().rstrip().split()))
################################################################
n,m = invr()
nums = inlt()
standard = (sum(nums))/(4*m)
nums.sort(reverse = True)
has = True
index = 0
while index < m:
    if nums[index] < standard:
        has = False
        break
    index += 1
if has:
    print('Yes')
else:
    print('No')
#print()

Submission status: Accepted

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

cnt = 0
c = sum(A)

b = c /(4 * m)

for a in A:
    if a >= b:
        cnt += 1
    
if cnt >= m:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()

def main():
    N,M=map(int,input().split())
    A=list(map(int,input().split()))
    A.sort(reverse=1)
    z=-(-sum(A)//(4*M))
    if A[M-1]>=z:
        print('Yes')
    else:
        print('No')
    

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys

N, M = map(int, sys.stdin.readline().rstrip().split())
A = list(map(int, sys.stdin.readline().rstrip().split()))

sumA = sum(A)
candidates = sorted(A, reverse=True)[:M]
if candidates[-1] < sumA / (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()))
x=sum(a);c=0
for i in a:
  if i*4*m>=x:
  	c+=1
if c>=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)
total_point = sum(A)

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

print("Yes")

Submission status: Accepted

Solution code:
mod = 10 ** 9 + 7
mod2 = 2 ** 61 + 1
from collections import deque
import heapq


def iip(listed):
    ret = [int(i) for i in input().split()]
    if len(ret) == 1 and not listed:
        return ret[0]
    return ret


def main():
    N, M = iip(True)
    A = iip(True)

    A.sort()
    A.reverse()
    st = sum(A)

    border = st / 4 / M
    res = 0
    #print(A)
    #print(border)
    for a in A:
        if a >= border:
            res += 1

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


def solve():
    N = iip(False)
    S = input()


#####################################################ライブラリ集ここから

def split_print_space(s):
    print(" ".join([str(i) for i in s]))


def split_print_enter(s):
    print("\n".join([str(i) for i in s]))


def koenai_saidai_x_index(sorted_list, n):
    l = 0
    r = len(sorted_list)
    if len(sorted_list) == 0:
        return False
    if sorted_list[0] > n:
        return False

    while r - l > 1:
        x = (l + r) // 2
        if sorted_list[x] == n:
            return x
        elif sorted_list[x] > n:
            r = x
        else:
            l = x
    return l


def searchsorted(sorted_list, n, side):
    if side not in ["right", "left"]:
        raise Exception("sideはrightかleftで指定してください")

    l = 0
    r = len(sorted_list)

    if n > sorted_list[-1]:
        # print(sorted_list)
        return len(sorted_list)
    if n < sorted_list[0]:
        return 0

    while r - l > 1:
        x = (l + r) // 2
        if sorted_list[x] > n:
            r = x
        elif sorted_list[x] < n:
            l = x
        else:
            if side == "left":
                r = x
            elif side == "right":
                l = x

    if side == "left":
        if sorted_list[l] == n:
            return r - 1
        else:
            return r

    if side == "right":
        if sorted_list[l] == n:
            return l + 1
        else:
            return l


def soinsuu_bunkai(n):
    ret = []
    for i in range(2, int(n ** 0.5) + 1):
        while n % i == 0:
            n //= i
            ret.append(i)
        if i > n:
            break
    if n != 1:
        ret.append(n)
    return ret


def conbination(n, r, mod, test=False):
    if n <= 0:
        return 0
    if r == 0:
        return 1
    if r < 0:
        return 0
    if r == 1:
        return n
    ret = 1
    for i in range(n - r + 1, n + 1):
        ret *= i
        ret = ret % mod

    bunbo = 1
    for i in range(1, r + 1):
        bunbo *= i
        bunbo = bunbo % mod

    ret = (ret * inv(bunbo, mod)) % mod
    if test:
        # print(f"{n}C{r} = {ret}")
        pass
    return ret


def inv(n, mod):
    return power(n, mod - 2)


def power(n, p, mod_=mod):
    if p == 0:
        return 1
    if p % 2 == 0:
        return (power(n, p // 2, mod_) ** 2) % mod_
    if p % 2 == 1:
        return (n * power(n, p - 1, mod_)) % mod_


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,m = map(int,raw_input().split())
a = map(int,raw_input().split())
# m[0],m[1] = m[1],m[0]
# m[0],m[-1] = m[-1],m[0]
# print ' '.join([str(i) for i in m])
res= "Yes"
lt = (float(1)/(4*m))*sum(a)
ctr= 0

for i in a:
    if i >= lt:
        ctr+=1
if ctr>=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)

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

Submission status: Accepted

Solution code:
n,m=map(int,input().split())
l=sorted(list(map(int,input().split())),reverse=True)
if l[m-1]*4*m>=sum(l):
  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)

ninki = [a_i for a_i in a if a_i >= s / (4 * m)]

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