Problem p02718 (python)

Fixed submission:
#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()

S = sum(A)
cnt = 0

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

Buggy submission (verdict: Runtime Error):
#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()

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

Buggy submission (verdict: Runtime Error):
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()

Buggy submission (verdict: Runtime Error):
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()

Buggy submission (verdict: Runtime Error):
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()

Buggy submission (verdict: Runtime Error):
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()

Buggy submission (verdict: Runtime Error):
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()

Buggy submission (verdict: Runtime Error):
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()

Buggy submission (verdict: Runtime Error):
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()