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:
import sys
from collections import defaultdict, Counter, deque
from itertools import accumulate, permutations, combinations
from operator import itemgetter
from bisect import bisect_left, bisect_right, bisect
from heapq import heappop, heappush
from fractions import gcd
from math import ceil, floor, sqrt, cos, sin, pi
from copy import deepcopy

# If you use recursive call, uncomment this code
#sys.setrecursionlimit(10**6)

def main():
    N,M = map(int, input().split())
    A = list(map(int, input().split()))
    threshold = sum(A)/(4*M)
    count = 0
    for a in A:
        if a >= threshold:
            count += 1
        if count == M:
            return "Yes"
    return "No"

if __name__ == '__main__':
    print(main())

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(1000000)


if __name__ == "__main__":
    N, M = tuple(map(int, input().split(" ")))
    As = list(map(int, input().split(" ")))
    S = sum(As)
    As = [a for a in As if a >= S/(4*M)]
    if len(As) >= M:
        print("Yes")
    else:
        print("No")

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
N,M = list(map(int,input().split()))
A = list(map(int,input().split()))

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

flag = 1
for i in range(M):
    if A[i] < S/(4*M) :
        flag = 0

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

Submission status: Accepted

Solution code:
# coding: utf-8
N,M=map(int,input().split())
A=list(map(int,input().split()))

SA=sum(A)

ans=0

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

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

Submission status: Accepted

Solution code:
n,m,*a,=map(int,open(0).read().split())
A=sum(a)
print("Yes" if sum(i>=A/(4*m) for i in a)>=m else "No")

Submission status: Accepted

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

for i in range(M):
    if A[i] * 4 * M < sum_A:
        print('No')
        exit()
print('Yes')

Submission status: Accepted

Solution code:
import collections
import math
import operator as op
from functools import reduce
from collections import Counter
import numpy as np
import math
import bisect
import heapq


MOD = 1000000007


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


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


def get_inputs(cast_func=None):
    if cast_func is None:
        return input().split()
    else:
        return list(map(cast_func, input().split()))


def get_input(cast_func=None):
    if cast_func is None:
        return input()
    else:
        return cast_func(input())


def is_prime(n):
    if n == 1:
        return False
    for i in range(2, int(n**0.5)+1):
        if n % i == 0:
            return False
    return True


def main():

    N, M = get_inputs(int)
    A = get_inputs(int)
    A.sort(reverse=True)
    # print(A)

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



if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n , m = map(int,input().split())
a = list(map(int,input().split()))
ans = 0
p = sum(a)
for i in range(n):
    if a[i] >= p/(4*m):
        ans += 1

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

Submission status: Accepted

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

a.sort()
a.reverse()

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

print('Yes')

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)
    t = s / 4 / M
    v = [1 if a >= t else 0 for a in A]
    print(YES if sum(v) >= M else NO)


# 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:
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(1000000)
input = sys.stdin.readline
INF = 2**62-1

def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, M, A):
    A.sort(reverse=True)
    T = sum(A)
    t = T / (4*M)
    for i in range(M):
        a = A[i]
        if a < t:
            return 'No'
    return 'Yes'


def main():
    N, M = read_int_n()
    A = read_int_n()
    print(slv(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()
# 得票数*4M<総評数であるような商品は選べません
s = sum(A)
ok = not True in [a * 4 * M < s for a in A[::-1][:M]]

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from bisect import bisect_left as bl, bisect_right as br, insort
import sys
import heapq
from math import *
from collections import defaultdict as dd, deque
def data(): return sys.stdin.readline().strip()
def mdata(): return map(int, data().split())
#def print(x): return sys.stdout.write(str(x)+'\n')
#sys.setrecursionlimit(100000)
mod=int(1e9+7)

n,m=mdata()
A=list(mdata())
cnt=0
A.sort(reverse=True)
s=sum(A)/(4*m)
for i in range(m):
    if A[i]>=s:
        cnt+=1
    else:
        break
if cnt==m:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

n,m=MI()

a=LI()
sou=sum(a)

if sum([i*4*m>=sou for i in a])>=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()]
tmp = sum(a)
count = 0

for i in range(len(a)):
    if a[i] < tmp / 4 / m:
        continue
    else:
        count += 1

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

Submission status: Accepted

Solution code:
from sys import stdin
N,M = [int(x) for x in stdin.readline().rstrip().split()]
A = [int(x) for x in stdin.readline().rstrip().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 = map(int,input().split())
A = list(map(int,input().split()))
S = sum(A)
A.sort()
flag = True
for i in range(M):
  a = A[N-1-i]
  if a * 4 * M >= S:
    continue
  else:
    flag = False
    break
print("Yes" if flag else "No")

Submission status: Accepted

Solution code:
n,m=map(int,input().split())
a=[int(x) for x in input().split()]
ss=sum(a)
pro=ss/(4*m)
c=0
for x in a:
    if x>=pro:
        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 = sorted(A, reverse=True)

S = sum(A)

x = S / (4 * M)

cnt = 0
for i in range(N):
    if A[i] >= x:
        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_a = sum(a)
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,=map(int, input().split())

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

Submission status: Accepted

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

threshold = sum(a_list)/4/m           

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

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
A = list(map(int, input().split()))
total_votes = sum(A)
threshold = total_votes / (4 * M)
A_upper = [a for a in A if a >= threshold]

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

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n,m = na()
a = na()
s = sum(a)
b = 0

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

if b >= m:
    print('Yes')
else:
    print('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):
    if A[i] >= sum(A) / (4 * m):
        ans = ans + 1

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

Submission status: Accepted

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

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

sum_a = sum(a)

res = 0
for i in range(n):
	if a[i] >= sum_a / (4*m):
		res += 1

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

Submission status: Accepted

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

sou = sum(A)

ritu = sou / (4*M)


kazu = 0
for i in A:
    if i >= ritu:
        kazu += 1
    else:
        continue

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

Submission status: Accepted

Solution code:
from functools import reduce
from fractions import gcd
import math
import bisect
import itertools
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
INF = float("inf")


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

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

cnt = 0
judge = sum(A)/(4*M)
for i in A:
    if i >= judge:
        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)

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

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

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
A = list(map(int, input().split()))
S = sum(A)
A.sort(reverse=True)
a = A[:M]
if a[-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()))
total = sum(a)
threshold = float(total/(4*m))
if len([elm for elm in a if elm >= threshold]) >= m:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
n,m = map(int,input().split())
a = list(map(int,input().split()))
aa = 0
s = sum(a)
for i in range(n):
     if a[i] >= s / (4*m):
          aa += 1
if aa >= 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 >= s / (4 * 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)
count = 0
for a in A:
    if a >= S/(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()))
a.sort(reverse=True)
total = sum(a)
if a[m-1] < total /(4*m):
    print('No')
else:
    print('Yes')

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
''' بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ '''
#codeforces
gi = lambda : list(map(int,input().split()))
n, m = gi()
l = sorted(gi())[::-1]
if 4 * m * l[m - 1] < sum(l):
	print("No")
else:
	print("Yes")

Submission status: Accepted

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip()
input_nums = lambda: list(map(int, input().split()))

def main():
    N, M = input_nums()
    A = input_nums()
    total = sum(A)
    h = total/(4*M)
    if len([a for a in A if a >= h]) >= M: print('Yes')
    else: print('No')


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort(reverse=1)
all=sum(a)
all=all/4/m






print('Yes' if a[m-1]>=all else 'No')

Submission status: Accepted

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

def solve():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    B = sum(A)
    if sum(a>=B/4/M for a in A) >= M:
        return 'Yes'
    else:
        return 'No'
        
if __name__ == '__main__':
    print(solve())

Submission status: Accepted

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

ans = 0
flag = sum(a)/(4*m)

for i in a:
    if i >= flag:
        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()))
a.sort(reverse=1)
s=sum(a)
if a[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())))
c = 0
p = sum(A)
for i in range(N):
    if A[i] >= p/4/M:
        c += 1

def yn(p):
    if p:
        return "Yes"
    else:
        return "No"
print(yn(c>=M))

Submission status: Accepted

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

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

goukei = sum(a)

a.sort(reverse=True)

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

Submission status: Accepted

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

A.sort()
A.reverse()

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

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

Submission status: Accepted

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

total = sum(l)

x = 0

for num in l:
  if num * 4 * m >= total:
    	x += 1

if x >= 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()]
j = sum(A) /4/M
t = 0
for i in A:
  if j <= i:
    t += 1
if t >= 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()
line=sum(a)/(4*m)
print('Yes' if a[-m]>=line else 'No')

Submission status: Accepted

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

total = sum(alist)
threshold = total / 4 / m
print("Yes" if all([v >= threshold for v in al[:m]]) else "No")

Submission status: Accepted

Solution code:


def resolve():
    N,M = map(int,input().split())
    A = list(map(int,input().split()))
    A.sort(reverse=True)
    sm =sum(A)
    A= A[0:M]

    for i in A:
        if i * 4* M < sm:
            print("No")
            return
    print("Yes")


if __name__ == "__main__":
    resolve()

Submission status: Accepted

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

sotoku = sum(a)

if len( [aa for aa in a if aa>=sotoku/(4*m) ] ) >=m:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
def examA():
    X, Y, Z = LI()
    X, Y = Y,X
    X,Z = Z, X
    print(X,Y,Z)
    return

def examB():
    N, M = LI()
    A = LI()
    need = (sum(A)-1)//(4*M) + 1
    ans = 0
    #print(need)
    for a in A:
        if a>=need:
            ans += 1
    if ans>=M:
        print("Yes")
    else:
        print("No")
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

sys.setrecursionlimit(10**6)

if __name__ == '__main__':
    examB()

"""

"""

Submission status: Accepted

Solution code:
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

n,m = mi()
ali = li()

summ = 0
for i in range(n):
    summ += ali[i]

ki = summ / 4/ m
ans = 0
for i in range(n):
    if ali[i] >= ki:
        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()))

a.sort(reverse=True)
for x in a[:m]:
    if x * 4 * m < sum(a):
        print('No')
        exit()
print('Yes')

Submission status: Accepted

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

A = sorted(A, key= lambda x: -x)


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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N,M = map(int, input().split())
A = list(map(int, input().split()))

vote = sum(A)
count = 0

for a in A:
  if 4*a*M >= vote:
    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)

s = sum(A)/4/m

if A[m-1] < s:
    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)
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()))
su = sum(A)

a = 0
for i in range(N):
    if A[i] >= su/4/M :
        a += 1

print(["No","Yes"][a>=M])

Submission status: Accepted

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

for i in range(m):
    if a[i] < sum(a) / (4*m):
        print("No"); break
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:
# -*- coding: utf-8 -*-

import sys
from itertools import accumulate

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

N, M = MAP()
A = LIST()

A.sort(reverse=1)
total = sum(A)
a = A[M-1]
if a < total / (4*M):
    No()
else:
    Yes()

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def solve():
    N, M = map(int, rl().split())
    A = list(map(int, rl().split()))
    
    A.sort(reverse=True)
    sa = sum(A)
    t = sa / (4 * M)
    flg = True
    for i in range(M):
        if A[i] < t:
            flg = False
            break
    if flg:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
#
# Written by NoKnowledgeGG @YlePhan
# ('ω')
#
#import math
#mod = 10**9+7
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""
  
def main():
  n,m = map(int,input().split())
  Under = 1/(4*m)
  
  A = list(map(int,input().split()))
  SUM = sum(A)
  A = sorted(A,reverse=True)
  ANS = SUM * Under
  for i in range(m):
    if A[i] < ANS:
      print('No')
      exit()
  print('Yes')
  
if __name__ == '__main__':
  main()

Submission status: Accepted

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

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

total = sum(a)

ans = 0
for i in range(n):
    if a[i] >= total/(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()))
fl = "Yes"

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

for i in range(m):
    if a[i] < s * (1 / (4*m)):
        fl = "No"
        
print(fl)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, M = [int(n) for n in input().split()]
A = [int(n) for n in input().split()]
A.sort(reverse=True)
S = sum(A)
for i in range(M):
    if 4*M*A[i] < S:
        print("No")
        exit()
print("Yes")

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
A = [int(x) for x in input().split()]
s = sum(A)
m = s / (4 * M)
B = []
cnt = 0
for a in A:
    if a < m:
        pass
    else:
        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()))
cnt = 0
SUM = sum(A)
for i in A:
    if i >= SUM/(4*M):
        cnt+=1
if cnt >= M:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

a = 0
for i in da: a += i
co = 0
b = (a-1)//(4*m)
for i in range(n):
    if b < da[i]: co += 1
# print(co)
if co >= 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(key=lambda x: -x)

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()))
s = sorted(a, reverse=True)
if s[m-1] >= sum(a)/(4*m):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

B = list(filter(lambda x: x >= sum(A)/(4*M),A))
if len(B) >= M:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

cnt = 0

s = sum(li)

for i in range(n):
    if li[i] >= s/(4*m):
        cnt += 1
        
if cnt >= m:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
def main():
    import sys
    input=sys.stdin.readline
    n,m=map(int,input().split())
    A=list(map(int,input().split()))
    S=sum(A)
    c=0
    for i in range(n):
        if 4*m*A[i]>=S:
            c+=1
    if c>=m:
        print("Yes")
    else:
        print("No")
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N,M = map(int,input().split())
A= list(map(int,input().split()))
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:
#gcdは3.4.3だとfractionsにある
from fractions import gcd
import math

from math import factorial as f

from math import ceil,floor,sqrt


import bisect
import re
import heapq


from copy import deepcopy
import itertools

from sys import exit

ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

yes = "Yes"
no = "No"

def main():
    n,m = mi()
    a = li()
    s = sum(a)
    kyoukai = s/(4*m)
    cnt = 0
    for i in a:
        if i >= kyoukai:
            cnt+=1
    if cnt>=m:
        print(yes)
    else:
        print(no)

main()

Submission status: Accepted

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

can = 0
total = sum(nums)
for num in nums:
    if num * 4 * m  >= total:
        can += 1
if can >= m:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
N,M=map(int,input().split())

A=list(map(int,input().split()))
A.sort()
A=A[::-1]
#print(A)

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

print("Yes")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

from sys import stdin
import sys
sys.setrecursionlimit(10**8)

def nextLine(): return next(stdin)
def nextStrList(): return nextLine().split()
def nextIntList(): return [int(_) for _ in nextStrList()]


def main():
	n,m=nextIntList()
	aList=nextIntList()
	s=sum(aList)
	th=s/4/m
	
	count=0
	for a in aList:
		if a>=th:
			count+=1
	
	if count>=m:
		print("Yes")
	else:
		print("No")


if __name__=="__main__":
	main()

Submission status: Accepted

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

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

total = sum(A)
a = [x for x in A if not x*4*M < total]

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

Submission status: Accepted

Solution code:
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial
from bisect import bisect_left #bisect_left(list, value)
#from fractions import gcd
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
def pri(x): print('\n'.join(map(str, x)))

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

s = sum(A)
cnt = 0
for a in A:
    if a >= s/(4*M):
        cnt += 1

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