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


total_votes_checker = lambda M, total_votes: (False 
                                        if total_votes <= 1 / (4 * M) 
                                        else True)

total_votes = sum(A)
A_iter = iter(A)

acceptable_A = list(filter(lambda A_item: total_votes_checker(A_item, total_votes), A))
    
print(acceptable_A)


# acceptable_A = list(filter(total_votes_checker(next(A_iter),total_votes), A))

#item_num_checker = lambda N, A: True if len(A) == N else False

print(max(A),A[M])
popular_checker = lambda A, M: True if A[M] == max(A) else False

print(popular_checker(acceptable_A,M))

TF = popular_checker(acceptable_A,M)

printer = lambda TF : print("Yes") if TF else print("No")

printer(TF)

import functools

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


total_votes_checker = lambda M, total_votes: (False 
                                        if total_votes < 1 / (4 * M) 
                                        else True)

total_votes = sum(A)
A_iter = iter(A)

is_acceptable = filter(total_votes_checker(next(A_iter)), total_votes)

#item_num_checker = lambda N, A: True if len(A) == N else False

popular_checker = lambda A, M: True if A[M] == max(A) else False

total_votes_checker(M, total_votes)
popular_checker(A,M)

TF = total_votes_checker(M, total_votes) and popular_checker(A,M)

printer = lambda TF : print("Yes") if True else print("No")

printer(TF)

import functools

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


total_votes_checker = lambda M, total_votes: (False 
                                        if total_votes < 1 / (4 * M) 
                                        else True)

total_votes = sum(A)

#item_num_checker = lambda N, A: True if len(A) == N else False

popular_checker = lambda A, M: True if A[M] == max(A) else False

total_votes_checker(M, total_votes)
popular_checker(A,M)

TF = total_votes_checker(M, total_votes) and popular_checker(A,M)

printer = lambda TF : print("yes") if True else print("No")

printer(TF)

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

total_votes_checker = lambda M, i, total_votes: (False if i <= (1 / (4 * M)) * total_votes else True)

A = list(filter(lambda i: total_votes_checker(M, i, total_votes), A))

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



import functools

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


total_votes_checker = lambda M, total_votes: (False 
                                        if total_votes < 1 / (4 * M) 
                                        else True)

total_votes = sum(A)

#item_num_checker = lambda N, A: True if len(A) == N else False

popular_checker = lambda A, M: True if A[M] == max(A) else False

total_votes_checker(M, total_votes)
popular_checker(A,M)

TF = total_votes_checker(M, total_votes) and popular_checker(A,M)

printer = lambda TF : print("yes") if True else print("No")

printer(TF)

import functools

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


total_votes_checker = lambda M, total_votes: (False 
                                        if total_votes < 1 / (4 * M) 
                                        else True)

total_votes = sum(A)

#item_num_checker = lambda N, A: True if len(A) == N else False

popular_checker = lambda A, M: True if A[M] == max(A) else False

total_votes_checker(M, total_votes)
popular_checker(A,M)

TF = total_votes_checker(M, total_votes) and popular_checker(A,M)

printer = lambda TF = print("yes") if True else print("No")

printer(TF)

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

total_votes = sum(A)

total_votes_checker = lambda M, i, total_votes: (False if i < (1 / (4 * M)) * total_votes else True)

A = list(filter(lambda i: total_votes_checker(M, i, total_votes), A))

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

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted