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
def input(): return sys.stdin.readline().rstrip()

def main():
    N, M = map(int, input().split())
    A = sorted(map(int, input().split()))[::-1]

    if A[M-1] * 4 * M >= sum(A):
        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()))
total = sum(a)
b = [ai for ai in a if 4*m*ai >= total]
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()))
A.sort(reverse=True)
m = sum(A)/(4*M)
if A[M-1] < m:
    print('No')
else:
    print('Yes')

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
from collections import *

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

all_vote = sum(A)

cnt = 0
for a in A:
    if a * 4 * m >= all_vote:
        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)
s=sum(a)
if a[m-1]*4*m>=s:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
import sys
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N, M = map(int, readline().split())
A = list(map(int, readline().split()))
thresh = sum(A) / (4 * M)
cnt = sum([a >= thresh for a in A])

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()))
count = 0
s = sum(a)
for i in range(n):
    if a[i]*4*m >= s:
        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()))
    T = sum(A)
    count = 0
    for a in A:
        if a*4*M >= T:
            count += 1
    if count >= 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)
ans = 0
for x in a:
	if x * 4 * m >= s:
		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)
cnt = 0
for a in A:
  if a * 4 * m >= s:
    cnt += 1
if cnt >= m:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
def main() -> None:
    N, M = map(int, input().split())
    A = [int(x) for x in input().split()]
    sum_A = sum(A)
    cnt = sum(a * 4 * M >= sum_A for a in A)
    print("Yes" if cnt >= M else "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=True)
S = sum(A)
if N >= M:
    if A[M-1] >= S/(4*M):
        print("Yes")
    else:
        print("No")
else:
    print("No")

Submission status: Accepted

Solution code:
from sys import exit, setrecursionlimit
setrecursionlimit(10**6)

def array2D(row, col ,val=0):
    return [[val]*col for i in range(row)]

n,m = map(int, input().split())
A = list(map(int, input().split()))
s = sum(A)
for i in range(n):
    A[i] *= (4*m)
cnt = 0

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
*A, = map(int, input().split())
s = sum(A)
cnt = 0
for a in A:
    if 4*M*a >= s:
        cnt += 1

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

Submission status: Accepted

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

def f():
    for i in range(M):
        if sum(A) / (4 * M) > A[i]: return False
    return True

if f():
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

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

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

count = 0

suma = sum(a)

for i in range(n):
    if a[i] >= suma/4/m:
        count+=1

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
n, m = map(int,input().split())
a = [int(i) for i in input().split()]

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

Submission status: Accepted

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

ans = 0

for ai in a:
    if (4 * m * ai >= sum(a)):
        ans += 1

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

Submission status: Accepted

Solution code:
import bisect,sys
import math
from collections import deque

def sRaw():
    return input().rstrip("\r")


def iRaw():
    return int(input())


def ssRaw():
    return input().split()


def isRaw():
    return list(map(int, ssRaw()))

INF = 1 << 29

DIV = (10**9) + 7

def mod_inv_prime(a, mod=DIV):
    return pow(a, mod-2, mod)


def mod_inv(a, b):
    r = a
    w = b
    u = 1
    v = 0
    while w != 0:
        t = r//w
        r -= t*w
        r, w = w, r
        u -= t*v
        u, v = v, u
    return (u % b+b) % b


def CONV_TBL(max, mod=DIV):
    fac, finv, inv = [0]*max, [0]*max, [0]*max
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1
    for i in range(2, max):
        fac[i] = fac[i-1]*i % mod
        inv[i] = mod - inv[mod % i] * (mod//i) % mod
        finv[i] = finv[i-1]*inv[i] % mod

    class CONV:
        def __init__(self):
            self.fac =fac
            self.finv = finv
            pass

        def ncr(self, n, k):
            if(n < k):
                return 0
            if(n < 0 or k < 0):
                return 0
            return fac[n]*(finv[k]*finv[n-k] % mod) % mod
        
    return CONV()



sys.setrecursionlimit(200005)

def main():
    N,M = isRaw()
    As = isRaw()
    As.sort(reverse=True)
    sumA = sum(As)
    ans = "Yes" if As[M-1] >= sumA/(4*M) else "No"
    return ans

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
read = sys.stdin.read


n,m,*a = [int(i) for i in read().split()]

s = sum(a)
good = [1 for i in a if s <= 4*i*m]
if len(good) >= 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=1)
s=sum(a)/(4*m)
f=True
for i in range(m):
    if a[i]<s:
        f=False
print("Yes" if f else "No")

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
*A, = map(int, input().split())
total = sum(A)
choise = 0
for a in A:
    if a * (4 * M) >= total: choise += 1
    if choise == M: print('Yes'); break
else:
    print('No')

Submission status: Accepted

Solution code:
import sys
import math
import collections
from collections import deque
import heapq
#n = int(input())
n, m = map(int, sys.stdin.readline().split())
#s = input()
a = list(map(int, sys.stdin.readline().split()))

x = sum(a)
y = x/(4*m)

a.sort(reverse = True)

for i in range(m):
    if a[i] < y:
        print("No")
        sys.exit()

print("Yes")

Submission status: Accepted

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

X = len([a for a in A if (a / S >= 1 / (4 * M))])
if X >= M:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N, M = map(int,input().split())
A = list(map(int,input().split()))
S = sum(A)
t = 0
for e in A:
    if e >= S/(4*M):
        t += 1

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

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


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

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

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

    cnt = 0
    for x in a:
        if x >= LIM:
            cnt += 1

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


if __name__ == '__main__':
    main()

# import sys
#
# sys.setrecursionlimit(10 ** 7)
#
# input = sys.stdin.readline
# rstrip()
# int(input())
# map(int, input().split())

Submission status: Accepted

Solution code:
import sys

stdin = sys.stdin

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

n,m = nm()
a = nl()
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.sort(reverse=True)

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
from collections import deque, defaultdict
from itertools import combinations, permutations
from itertools import accumulate
from math import ceil, sqrt, pi

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

S = sum(A)
cnt = 0

for a in A:
    if a / S >= 1 / 4 / M:
        cnt += 1

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [input() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [int(input()) for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def divisor(n):
        res = []
        i = 1
        for i in range(1, int(n ** 0.5) + 1):
            if n % i == 0:
                res.append(i)
                if i != n // i:
                    res.append(n // i)
        return res

    @staticmethod
    def round_up(a, b):
        return -(-a // b)

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


def pop_count(x):
    x = x - ((x >> 1) & 0x5555555555555555)
    x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)
    x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f
    x = x + (x >> 8)
    x = x + (x >> 16)
    x = x + (x >> 32)
    return x & 0x0000007f


MOD = int(1e09) + 7
INF = int(1e15)


def isOK(A):
    A.sort()
    for i in range(len(A) - 1):
        if A[i] + 1 != A[i + 1]:
            return False
    return True


def solve():
    N, M = Scanner.map_int()
    A = Scanner.map_int()
    S = sum(A)
    r = 1 / (4 * M) * S
    cnt = 0
    for a in A:
        if a >= r:
            cnt += 1
    print('YNeos'[not cnt >= M::2])


def main():
    # sys.stdin = open("sample.txt")
    solve()


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

A.sort()
A = A[::-1]
flag = 1
for i in range(M):
    if A[i] < line:
        flag = 0
        break
if flag == 1:
    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 = (int(num) for num in input().split())
a = [int(num) for num in input().split()]
a.sort(reverse = True)
if a[m-1] < sum(a) / (4 * m):
    print("No")
else:
    print("Yes")

Submission status: Accepted

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

Submission status: Accepted

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

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, m = na()
a = na()
a.sort()
if a[-m] >= 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()))

cnt=0

s=sum(A)

for i in range(n):
    if A[i]>=s/(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)
    A = sorted(A, reverse=True)
    if A[M-1] < S / (4 * M):
        print(NO)
    else:
        print(YES)
    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:
from sys import stdin,setrecursionlimit
n,m = map(int,stdin.readline().rstrip().split())
li = list(map(int,stdin.readline().rstrip().split()))
li.sort(reverse=True)
if li[m-1] < sum(li)/(4*m):
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby
    #from itertools import product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math
def rMap():
	return map(int,input().split())
def rList():
	return list(map(int,input().split()))
n,m = rMap()
a = sorted(rList())
if a[-m]>=sum(a)/(4*m):
	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()))
total = sum(A)
cnt = 0
for i in range(N):
    if A[i] / total >= 1 / (4 * M):
        cnt += 1
print("Yes" if cnt >= M else "No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print("Yes" if a[-m]>=thread else "No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

a.sort(reverse=True)

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

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

Submission status: Accepted

Solution code:
import itertools
import math
import sys
import heapq
from collections import Counter
from collections import deque
from fractions import gcd
INF = 1 << 60
sys.setrecursionlimit(10 ** 6)

#ここから書き始める
n, m = map(int, input().split())
a = list(map(int, input().split()))
x = (1 / (4 * m)) * sum(a)
cnt = 0
for i in a:
    if i >= x:
        cnt += 1
if cnt >= m:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:

def resolve():

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

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

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




resolve()

Submission status: Accepted

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

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

S=0
SUM=sum(A)
for a in A:
    if a*4*M>=SUM:
        S+=1

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

select = 0
for i in range(n):
    if a[i]>=line:
        select+=1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
total = sum(A)
limit = total / (4*m)

for i in range(m):
    a = A.pop()
    if a < limit:
        print('No')
        exit()

print('Yes')

Submission status: Accepted

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

Submission status: Accepted

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

cnt = 0
sm = sum(arr)
for a in arr:
    if a < sm / (4 * m):
        continue
    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()))
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:
n, m = map(int, input().split())
a = list(map(int, input().split()))
t = sum(a)
ans = 0
for i in range(n):
    if a[i] * 4 * m >= t:
        ans += 1
print('Yes' if ans >= m else 'No')

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.readline

N, M, *A = map(int, read().split())
s = sum(A) / (4 * M)
a = [i for i in A if i >= s]
if len(a) >= 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()]

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 = sorted(list(map(int, input().split())))[::-1]
if A[M-1] >= sum(A)/4/M:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    n, m = map(int, input().split())
    a = list(map(int, input().split()))
    cnt = 0
    x = sum(a)
    for v in a:
        if v >= x/(4*m):
            cnt += 1
    if cnt >= 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()))
    A.sort(reverse=True)
    s = sum(A)
    if A[M-1] >= s/(4*M):
        return True
    return False
if main():
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from bisect import bisect_right, bisect_left
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, gamma, log
from operator import mul
from functools import reduce
from copy import deepcopy

sys.setrecursionlimit(2147483647)
INF = 10 ** 20
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7



n, m = LI()
ret = 0
A = LI()
for a in A:
    if a >= sum(A) / (4 * m):
        ret += 1


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

k = 0
for a in A:
    if a*4*M < s: continue
    k += 1
print('Yes' if k>=M else 'No')

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
arr = list(map(int, input().split()))
ans = 0
for i in arr:
    if i >= sum(arr)/(4*M):
        ans += 1
if ans >= M:
    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)
x=sum(l)/(4*m)
for i in range(m):
  if l[i]<x:
    print("No")
    break
else:
  print("Yes")

Submission status: Accepted

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

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

def main():
    mod=10**9+7
    N,M=MI()
    A=LI()
    S=sum(A)
    A.sort(reverse=True)
    a=A[M-1]
    if a>=S/(4*M):
        print("Yes")
    else:
        print("No")

main()

Submission status: Accepted

Solution code:
N,M = map(int,input().split())
A = list(map(int,input().split()))
A.sort()
A = A[::-1]
ans = []
s = sum(A)
for i in range(M):
    if A[i]>=s/(4*M):
        ans.append(A[i])
if len(ans)==M:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
read = lambda: map(int, input().split())
n, m = read()
a = list(read())
s = sum(a)
cnt = sum(i * (4 * m) >= s for i in a)
print('Yes' if cnt >= m else 'No')

Submission status: Accepted

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

A = list(map(int, input().split()))
t = 0
sum_A = sum(A)
for i in A:
    if i >= sum_A/ (4 * m):
        t += 1

if m <= t:
    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)
count=0
for i in range(N):
    if A[i]>= S/(4*M):
        count+=1

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Asum = sum(A)
cnt = sum(a >= Asum / (4 * M) for a in A)
if cnt >= M:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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