Problem: 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`.

Submission attempts (in order):
N, M= map(int, input().split())

if M == 0:
    print('No')
if N < M:
    print('No')

A = [int(input()) for i in range(N)]


B = []
for i in range(len(A)):
    if A[i] > sum(A)/4/M:
        B.append(1)
    else:
        B.append(0)

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


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

if M == 0:
    print('No')
if N < M:
    print('No')

A = [int(input()) for i in range(N)]


B = []
for i in range(len(A)):
    if A[i] > sum(A)/4/M:
        B.append(1)
    else:
        B.append(0)

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

import numpy as np
N, M= map(int, input().split())

if M == 0:
    print('No')
if N < M:
    print('No')

A = [int(input()) for i in range(M)]


B = []
for i in range(len(A)):
    if A[i] > sum(A)/4/M:
        B.append(0)
    else:
        B.append(1)

if sum(B) > N - M + 1:
    print('No')
else:
    print('Yes')

import sys

sys.setrecursionlimit(10**6)

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

A = [int(input()) for i in range(N)]

B = []
for i in range(len(A)):
    if A[i] > sum(A)/4/M:
        B.append(1)
    else:
        B.append(0)

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


import numpy as np
N, M= map(int, input().split())

if M == 0:
    print('No')
if N < M:
    print('No')

A = [int(input()) for i in range(N)]


B = []
for i in range(len(A)):
    if A[i] > sum(A)/4/M:
        B.append(1)
    else:
        B.append(0)

if sum(B) > N - M + 1:
    print('Yes')
else:
    print('No')


import numpy as np
N, M= map(int, input().split())

if M == 0:
    print('No')
if N < M:
    print('No')

A = [int(input()) for i in range(N)]


B = []
for i in range(len(A)):
    if A[i] > sum(A)/4/M:
        B.append(0)
    else:
        B.append(1)

if sum(B) > N - M + 1:
    print('No')
else:
    print('Yes')


import numpy as np
N, M= map(int, input().split())

A = [int(input()) for i in range(N)]


B = []
for i in range(len(A)):
    if A[i] > sum(A)/4/M:
        B.append(0)
    else:
        B.append(1)

if sum(B) > N - M + 1:
    print('No')
else:
    print('Yes')



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

C = map(int, input().split())

A = list(C)

B = []
for i in range(len(A)):
    if A[i] > sum(A)/4/M:
        B.append(1)
    else:
        B.append(0)

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


import sys
sys.setrecursionlimit(10**3)

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

A = [int(input()) for i in range(N)]

B = []
for i in range(len(A)):
    if A[i] > sum(A)/4/M:
        B.append(1)
    else:
        B.append(0)

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


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

C = map(int, input().split())

A = list(C)

B = []
for i in range(len(A)):
    if A[i] > sum(A)/4/M:
        B.append(1)
    else:
        B.append(0)

if sum(B) > N - M  +1:
    print('Yes')
else:
    print('No')



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

C = map(int, input().split())

A = list(C)

#if N < M:
#    print('No')
#if M == 0:
#    print('No')

B = []
for i in range(len(A)):
    if A[i] >= sum(A)/4/M:
        B.append(1)
    else:
        B.append(0)

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


Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Wrong Answer

Runtime Error

Wrong Answer

Accepted