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):
def calc():
    summ  = sum(A)
    low = summ / (4*M)

    num = len([i for i in A if low <= i])

    if M > num:
        print ("No")
    else:
        print ("Yes")

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

calc()


#def calc():
    
    #print(summ)
    
    #low = summ / (4*M)
    #print(low)

    
    #print(newlist)

    
    #print(num)

    #if M <= num:
        #print ("Yes")
    #else:
        #print ("No")

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

#N, M = 5, 2
#A = [110, 2, 20, 10, 0]
#calc()

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

def calc():
    summ  = sum(A)
    #print(summ)
    
    low = summ / (4*M)
    #print(low)

    newlist = [i for i in A if i >= low]
    #print(newlist)

    num = len(newlist)
    #print(num)

    if M <= num:
        print ("Yes")
    else:
        print ("No")

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

#N, M = 5, 2
#A = [110, 2, 20, 10, 0]
calc()


def calc():
    summ  = sum(A)
    #print(summ)
    
    low = summ / (4*M)
    #print(low)

    newlist = [i for i in A if low <= i]
    #print(newlist)

    num = len(newlist)
    #print(num)

    if M > num:
        print ("No")
    else:
        print ("Yes")

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


#N, M = 10, 10
#A = list(range(1, 11))
calc()


def calc():
    summ  = sum(A)
    low = summ * 1 / 4*M
    high = 1000

    newlist = [i for i in A if low <= i < high]

    lot = len(newlist)

    if M > lot:
        print ("No")
    else:
        print ("Yes")

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


#N, M = 10, 2
#A = list(range(1, 12))
calc()

def calc():
    summ  = sum(A)
    low = summ / (4*M)
    high = 1000

    num = len([i for i in A if low <= i])
    #print(num)

    if M > num:
        print ("No")
    else:
        print ("Yes")

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


#N, M = 5, 2
#A = list(range(1, 6))
calc()

def calc():
    summ  = sum(A)
    low = summ / (4*M)
    high = 1000

    newlist = [i for i in A if low <= i < high]
    #print(newlist)

    lot = len(newlist)

    if M > lot:
        print ("No")
    else:
        print ("Yes")

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


#N, M = 10, 2
#A = list(range(1, 11))
calc()


def calc():
    summ  = sum(A)
    low = summ * 1 / 4*M
    high = 1000

    newlist = [i for i in A if low <= i < high]

    lot = len(newlist)

    if M < lot:
        print ("No")
    else:
        print ("Yes")

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

calc()


def calc():
    summ  = sum(A)
    low = summ / (4*M)
    newlist = [i for i in A if i >= low]
    num = len(newlist)
    
    if M <= num:
        print ("Yes")
    else:
        print ("No")

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

#N, M = 5, 2
#A = [110, 2, 20, 10, 0]
calc()

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted