Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
input = sys.stdin.buffer.readline

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))
def RN(N): return [input().strip() for i in range(N)]


def main():
    N, M = MI()
    H = LI()
    H.insert(0,0)
    A = [0]*M
    B = [0]*M
    ans = 0
    for i in range(M):
        A[i], B[i]=MI()
    for i in range(1,N+1):
        #print("hi",i,H[i])
        ng = 0
        for j in range(M):
            if A[j] == i:
                if H[i]<=H[B[j]]:
                    ng += 1
                    #print(i, "no")
                    break
            if B[j] == i:
                if H[i]<=H[A[j]]:
                    ng += 1
                    break
        if ng == 0:
            ans += 1
    print(ans)


    


if __name__ == "__main__":
	main()

Fixed submission:
import sys
input = sys.stdin.readline
input = sys.stdin.buffer.readline

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))
def RN(N): return [input().strip() for i in range(N)]


def main():
    N, M = MI()
    H = LI()
    H.insert(0,0)
    A = [0]*M
    B = [0]*M
    ans = 0
    for i in range(M):
        A[i], B[i]=MI()

    Hnum = [0]*(N+1)
    Hnum[0] = 1

    for i in range(M):
        if H[A[i]]>H[B[i]]:
            Hnum[B[i]]+=1
        elif H[A[i]]<H[B[i]]:
            Hnum[A[i]]+=1
        elif H[A[i]]==H[B[i]]:
            Hnum[A[i]]+=1
            Hnum[B[i]]+=1
    print(Hnum.count(0))


    """
    for i in range(1,N+1):
        ng = 0
        for j in range(M):
            if A[j] == i:
                if H[i]<=H[B[j]]:
                    ng += 1
                    break
            if B[j] == i:
                if H[i]<=H[A[j]]:
                    ng += 1
                    break
        if ng == 0:
            ans += 1
    print(ans)"""


    


if __name__ == "__main__":
	main()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
input = sys.stdin.buffer.readline

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))
def RN(N): return [input().strip() for i in range(N)]

def a(A,B,x): return (A*x//B)-A*(x//B)

def main():
    A,B,N = MI()
    max = 0
    for x in range(0, N+1):
        if max < a(A,B,x):
            max = a(A,B,x)
    
    print(max)



    


if __name__ == "__main__":
	main()

Fixed submission:
import sys
input = sys.stdin.readline
input = sys.stdin.buffer.readline

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))
def RN(N): return [input().strip() for i in range(N)]

def a(A,B,x): return (A*x//B)-A*(x//B)

def main():
    A,B,N = MI()
    """
    max = 0
    m = 0
    for x in range(0, N+1):
        ai = a(A,B,x)
        if max < ai :
            max = ai
        elif ai<0 and m == 0:
            max = ai
            m +=1

        print(x,a(A,B,x))
    """
    if N >= B:
        x = (N//B)*B-1
    elif N == B:
        x = N-1
    elif N < B:
        x = N
    print(a(A,B,x))

    



    


if __name__ == "__main__":
	main()

Buggy python submission (verdict: Time Limit Exceeded):
import sys
import math
input = sys.stdin.readline
input = sys.stdin.buffer.readline

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))
def RN(N): return [input().strip() for i in range(N)]

def a(A,B,x): return math.floor(A*x/B)-A*math.floor(x/B)

def main():
    A,B,N = MI()
    max = 0
    #print(a(A,B,x))
    for x in range(0, N+1):
        if max < a(A,B,x):
            max = a(A,B,x)
    
    print(max)



    


if __name__ == "__main__":
	main()

Fixed submission:
import sys
input = sys.stdin.readline
input = sys.stdin.buffer.readline

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))
def RN(N): return [input().strip() for i in range(N)]

def a(A,B,x): return (A*x//B)-A*(x//B)

def main():
    A,B,N = MI()
    """
    max = 0
    m = 0
    for x in range(0, N+1):
        ai = a(A,B,x)
        if max < ai :
            max = ai
        elif ai<0 and m == 0:
            max = ai
            m +=1

        print(x,a(A,B,x))
    """
    if N >= B:
        x = (N//B)*B-1
    elif N == B:
        x = N-1
    elif N < B:
        x = N
    print(a(A,B,x))

    



    


if __name__ == "__main__":
	main()
Buggy python submission (verdict: Runtime Error):
N = int(NM[0])
M = int(NM[1])
ALL = sum(A)
k = 0
c = ALL/(4*M)

print(N, M, ALL, c)
for Ai in A:
    if Ai>=c:
        k += 1

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


Fixed submission:

NM = input("").split()
A = list(map(int, input().strip().split()))

N = int(NM[0])
M = int(NM[1])
ALL = sum(A)
k = 0
c = ALL/(4*M)

for Ai in A:
    if Ai>=c:
        k += 1

if k >= M:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):

KN = input("").split()
A = input("").split()

K = int(KN[0])
N = int(KN[1])
A_0 = int(A[0])
A_N = int(A[N-1])
L = A_0

for j in range(N):
    A_i = int(A[j+1])
    A_m = int(A[j])
    if A_i - A_m > L:
        L == A_i - A_m

if L > K - A_N + A_0:
    print(K-L)
else:
    print(K - A_N + A_0)



Fixed submission:

X = int(input(""))

X500 = X//500
X_a = X%500

X5 = X_a//5

happy = X500*1000 + X5*5

print(happy)
Buggy python submission (verdict: Runtime Error):
    n = int(input())
    a = list(map(int, input().split()))
    b = [0 for _ in range(max(a)+1)]
    for x in a:
        b[x] += 1
    c = sum([x*(x-1)//2 for x in b])
    for i in range(n):
        print(c-b[a[i]]+1)

Fixed submission:
from collections import Counter
N = int(input(""))
A = list(map(int,input().split()))
X = 0

A_e = list(set(A))

x = Counter(A)

for i in A_e:
    if x[i] >= 2:
        xc2 = x[i]*(x[i]-1)/2
        X = X + xc2

for k in A:
    print(int(X-x[k]+1))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input(""))
A = list(map(int,input().split()))
X = 0

A_e = list(set(A))

#print(list(set(A)))

for i in A_e:
    x = A.count(i)
    if x >= 2:
        xc2 = x*(x-1)/2
        X = X + xc2
#print("ALL", X)

for k in range(N):
    xk = A.count(A[k])
    print(int(X-xk+1))


Fixed submission:
from collections import Counter
N = int(input(""))
A = list(map(int,input().split()))
X = 0

A_e = list(set(A))

x = Counter(A)

for i in A_e:
    if x[i] >= 2:
        xc2 = x[i]*(x[i]-1)/2
        X = X + xc2

for k in A:
    print(int(X-x[k]+1))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input(""))
A = input("").split()
x_all = 0

ak = 0

for i in range(N-1):
    for j in range(N):
        if A[i] == A[i+j+1]:
            x_all += 1
        if i+j+1 == N-1:
            break

for k in range(N): 
    x = 0
    for m in range(N):
        if A[k] == A[m]:
            x += 1
    ak = x - 1

    if x_all-ak > 0:
        print(x_all-ak)
    elif x_all-ak <= 0:
        print(0)





Fixed submission:
from collections import Counter
N = int(input(""))
A = list(map(int,input().split()))
X = 0

A_e = list(set(A))

x = Counter(A)

for i in A_e:
    if x[i] >= 2:
        xc2 = x[i]*(x[i]-1)/2
        X = X + xc2

for k in A:
    print(int(X-x[k]+1))
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
input = sys.stdin.buffer.readline

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))


def main():
    N,M = LI()
    s = [0]*M
    c = [0]*M
    n = 0
    for i in range(M):
        Sn,Cn = LI()
        s[i] = Sn
        c[i] = Cn

    ans = [0]*N
    for k in range(0, M):
        if ans[s[k-1]] == 0:
            ans[s[k]-1]=c[k]
        else:
            n += 1
    if ans[0] == 0 or n!=0:
        print(-1)
    else:
        ans = map(str,ans)
        print(''.join(ans))




if __name__ == "__main__":
	main()

Fixed submission:
import sys
input = sys.stdin.readline
input = sys.stdin.buffer.readline

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))


def main():
    N,M = LI()
    s = [0]*M
    c = [0]*M
    n = [0]*3
    for i in range(M):
        Sn,Cn = LI()
        s[i] = Sn
        c[i] = Cn

    if N == 1:
        ans = [0]
    elif N == 2:
        ans = [1, 0]
    elif N == 3:
        ans = [1, 0, 0]

    for k in range(0, M):
        if ans[s[k]-1] != c[k]:
            n[s[k]-1] += 1
        ans[s[k]-1] = c[k]


    if (ans[0] == 0 and N != 1) or  n[0]>=2 or n[1]>=2 or n[2]>=2:
        print(-1)
    else:
        ans = map(str,ans)
        print(''.join(ans))




if __name__ == "__main__":
	main()
Buggy python submission (verdict: Time Limit Exceeded):
import sys

def II(): return int(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))
def RN(N): return [input().strip() for i in range(N)]


def main():
    N = II()
    A = LI()
    ans = 0

    for i in range(N):
        for j in range(i+1,N):
            if A[i] == A[j]:
                ans+=1
                break
    
    if ans == 0:
        print("YES")
    else:
        print("NO")


if __name__ == "__main__":
	main()

Fixed submission:
import sys

def II(): return int(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))
def RN(N): return [input().strip() for i in range(N)]


def main():
    N = II()
    A = LI()
    numa = len(set(A))
    #print(numa)
        
    if numa == N:
        print("YES")
    else:
        print("NO")


if __name__ == "__main__":
	main()
Buggy python submission (verdict: Time Limit Exceeded):
import sys

def II(): return int(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))
def RN(N): return [input().strip() for i in range(N)]


def main():
    N = II()
    P = LI()
    ans = 0

    for i in range(N):
        for j in range(0,i+1):
            if P[j]<P[i]:
                break
            elif j == i:
                ans += 1

    
    print(ans)

if __name__ == "__main__":
	main()

Fixed submission:
import sys

def II(): return int(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))
def RN(N): return [input().strip() for i in range(N)]


def main():
    N = II()
    P = LI()
    ans = 0
    min = N+1

    for i in range(N):
        if P[i]<min:
            ans += 1
            min = P[i]

    print(ans)

if __name__ == "__main__":
	main()

Buggy python submission (verdict: Time Limit Exceeded):
import sys

def II(): return int(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))
def RN(N): return [input().strip() for i in range(N)]


def main():
    N = II()
    P = LI()
    ans = 0

    for i in range(N):
        for j in range(0,i+1):
            if P[j]<P[i]:
                break
            elif j == i:
                ans += 1

    
    print(ans)

if __name__ == "__main__":
	main()

Fixed submission:
import sys

def II(): return int(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))
def RN(N): return [input().strip() for i in range(N)]


def main():
    N = II()
    P = LI()
    ans = 0
    min = N+1

    for i in range(N):
        if P[i]<min:
            ans += 1
            min = P[i]

    print(ans)

if __name__ == "__main__":
	main()
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
res = 1

for i in range(n):
    res = res * a[i]
    
if res > 1000000000000000000:
    res = -1

print(res)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
res = 1

if 0 not in a:

    for i in range(n):
        res = res * a[i]
        
        if res > 1000000000000000000:
            res = -1
            break
else:
    res = 0

print(res)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
res = 1

for i in range(n):
    res = res * a[i]
    
if res > 1000000000000000000:
    res = -1

print(res)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
res = 1

if 0 not in a:

    for i in range(n):
        res = res * a[i]
        
        if res > 1000000000000000000:
            res = -1
            break
else:
    res = 0

print(res)
Buggy python submission (verdict: Time Limit Exceeded):
import math
a,b,n = list(map(int,input().split()))
x = 1
temp = 0
res = 0

for i in range(n):
    temp = math.floor((a*x)/b) - a * math.floor(x/b)
    if res < temp:
        res = temp
    x += 1

print(res)

Fixed submission:
import math
a,b,n = list(map(int,input().split()))
x = 1
temp = 0
res = 0

if (b - 1) > n:
    x = n
    # for i in range(n):
    #     temp = math.floor((a*x)/b) - a * math.floor(x/b)
    #     print(str(x) + " " + str(temp))
    #     if res < temp:
    #         res = temp
    #     x += 1
else:
    x = (b - 1)

res = math.floor((a*x)/b) - a * math.floor(x/b)
print(res)

Buggy python submission (verdict: Time Limit Exceeded):
import math
a,b,n = list(map(int,input().split()))
x = 1
temp = 0
res = 0

for i in range(n):
    temp = math.floor((a*x)/b) - a * math.floor(x/b)
    if res < temp:
        res = temp
    x += 1

print(res)

Fixed submission:
import math
a,b,n = list(map(int,input().split()))
x = 1
temp = 0
res = 0

if (b - 1) > n:
    x = n
    # for i in range(n):
    #     temp = math.floor((a*x)/b) - a * math.floor(x/b)
    #     print(str(x) + " " + str(temp))
    #     if res < temp:
    #         res = temp
    #     x += 1
else:
    x = (b - 1)

res = math.floor((a*x)/b) - a * math.floor(x/b)
print(res)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
res = []

for i in range(n):
    s = str(input())
    if (s in res) == False:
        res.append(s)

print(len(res))

Fixed submission:
n = int(input())
res = []

for i in range(n):
    s = str(input())
    #if (s in res) == False:
    res.append(s)

#print(len(res))
print(len(set(res)))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))

for i in range(n):
    print(a.count(i+1))


Fixed submission:
import collections
n = int(input())
a = list(map(int,input().split()))

c = collections.Counter(a)

for i in range(n):
    print(c[i+1])

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))

for i in range(n):
    print(a.count(i+1))


Fixed submission:
import collections
n = int(input())
a = list(map(int,input().split()))

c = collections.Counter(a)

for i in range(n):
    print(c[i+1])
Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

k = int(input())
kl = list(range(1,k+1))
res = 0

for i in kl:
    for j in kl:
        for k in kl:
            res += gcd(i,j,k)

print(res)



Fixed submission:
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

k = int(input())
kl = list(range(1,k+1))
res = 0

for i in kl:
    for j in kl:
        for k in kl:
            res += gcd(i,j,k)

print(res)
Buggy python submission (verdict: Time Limit Exceeded):
n,k = list(map(int,input().split()))

if n < k:
    print(min(n,k - n))
else:
    if n % k == 0:
        print(0)
    else:
        while True:
            if abs(n - k) < k:
                print(min(abs(n - k), abs(abs(n - k)-k)))
                break
            else:
                n = n - k


Fixed submission:
n,k = list(map(int,input().split()))

if n < k:
    print(min(n,k - n))
else:
    if n % k == 0:
        print(0)
    else:
        print(min(n % k,abs((n % k) - k)))

Buggy python submission (verdict: Runtime Error):
import math
n,k = list(map(int,input().split()))

if n < k:
    if k - n > n:
        print(n)
    else:
        print(k - n)
else:
    if n % k == 0:
        print(0)
    else:
        print(math.gcd(n, k))

Fixed submission:
n,k = list(map(int,input().split()))

if n < k:
    print(min(n,k - n))
else:
    if n % k == 0:
        print(0)
    else:
        print(min(n % k,abs((n % k) - k)))

Buggy python submission (verdict: Runtime Error):
import math
n,k = list(map(int,input().split()))

if n < k:
    if k - n > n:
        print(n)
    else:
        print(k - n)
else:
    if n % k == 0:
        print(0)
    else:
        print(math.gcd(n, k))

Fixed submission:
n,k = list(map(int,input().split()))

if n < k:
    print(min(n,k - n))
else:
    if n % k == 0:
        print(0)
    else:
        print(min(n % k,abs((n % k) - k)))
Buggy python submission (verdict: Time Limit Exceeded):
x,y,a,b,c = list(map(int,input().split()))
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))
res = 0

p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)

p = p[:x]
q = q[:y]

p_sum = sum(p)
q_sum = sum(q)

for i in r:
    p_temp = (p_sum - p[-1] + i)
    q_temp = (q_sum - q[-1] + i)
    if p_temp >= p_sum or q_temp >= q_sum:        
        if p_temp - p_sum > q_temp - q_sum:
            p_sum = p_temp
            p.insert(0, i)
            p.pop(-1)        
        else:
            q_sum = q_temp
            q.insert(0, i)
            q.pop(-1)
    else:
        break

print(p_sum + q_sum)
    

Fixed submission:
x,y,a,b,c = list(map(int,input().split()))
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))
res = 0

p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)

p = p[:x]
q = q[:y]

p_sum = sum(p)
q_sum = sum(q)

p_num = -1
q_num = -1

for i in r:
    if p_num >= (len(p) * -1):
        p_temp = (p_sum - p[p_num] + i)
    else:
        p_temp = -1
    if q_num >= (len(q) * -1):
        q_temp = (q_sum - q[q_num] + i)
    else:
        q_temp = -1

    if p_temp >= p_sum or q_temp >= q_sum:        
        if p_temp - p_sum > q_temp - q_sum:
            p_sum = p_temp
            p_num -= 1        
        else:
            q_sum = q_temp
            q_num -= 1        
    else:
        break
    




print(p_sum + q_sum)

Buggy python submission (verdict: Runtime Error):
x,y,a,b,c = list(map(int,input().split()))
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))
res = 0

p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)

p = p[:x]
q = q[:y]

p_sum = sum(p)
q_sum = sum(q)

for i in r:
    p_temp = (p_sum - p[-1] + i)
    q_temp = (q_sum - q[-1] + i)
    if p_temp >= p_sum or q_temp >= q_sum:        
        if p_temp - p_sum > q_temp - q_sum:
            p_sum = p_temp
            p.pop(-1)        
        else:
            q_sum = q_temp
            q.pop(-1)

print(p_sum + q_sum)
    

Fixed submission:
x,y,a,b,c = list(map(int,input().split()))
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))
res = 0

p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)

p = p[:x]
q = q[:y]

p_sum = sum(p)
q_sum = sum(q)

p_num = -1
q_num = -1

for i in r:
    if p_num >= (len(p) * -1):
        p_temp = (p_sum - p[p_num] + i)
    else:
        p_temp = -1
    if q_num >= (len(q) * -1):
        q_temp = (q_sum - q[q_num] + i)
    else:
        q_temp = -1

    if p_temp >= p_sum or q_temp >= q_sum:        
        if p_temp - p_sum > q_temp - q_sum:
            p_sum = p_temp
            p_num -= 1        
        else:
            q_sum = q_temp
            q_num -= 1        
    else:
        break
    




print(p_sum + q_sum)
Buggy python submission (verdict: Time Limit Exceeded):
import collections

n = int(input())
a = []
max_list = []
max_i = 1

for i in range(n):
    a.append(str(input()))

c = collections.Counter(a)
max_i = c.most_common()[0][1]

for i in range(len(c)):
    if max_i == c.most_common()[i][1]:
        max_list.append(c.most_common()[i][0])
    else:
        break

max_list.sort()

for i in max_list:
    print(i)       
    

Fixed submission:
import collections

n = int(input())
a = []
max_list = []
max_i = 1

a = [str(input()) for x in range(n)]

c = collections.Counter(a)
c = c.most_common()
max_i = c[0][1]

for i in range(len(c)):
    if max_i == c[i][1]:
        max_list.append(c[i][0])
    else:
        break

max_list.sort()

for i in max_list:
    print(i)

Buggy python submission (verdict: Time Limit Exceeded):
import collections

n = int(input())
a = []
max_list = []
max_i = 1

for i in range(n):
    a.append(str(input()))

c = collections.Counter(a)
max_i = c.most_common()[0][1]

max_list = [x for x in set(a) if a.count(x) == max_i]

max_list.sort()

for i in max_list:
    print(i)       
    

Fixed submission:
import collections

n = int(input())
a = []
max_list = []
max_i = 1

a = [str(input()) for x in range(n)]

c = collections.Counter(a)
c = c.most_common()
max_i = c[0][1]

for i in range(len(c)):
    if max_i == c[i][1]:
        max_list.append(c[i][0])
    else:
        break

max_list.sort()

for i in max_list:
    print(i)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = []
max_list = []
max_i = 0

for i in range(n):
    a.append(str(input()))

a2 = a
for i in set(a2):
    if max_i < a.count(i):
        max_i = a.count(i)

max_list = [x for x in set(a) if a.count(x) == max_i]

max_list.sort()

for i in max_list:
    print(i)       
    

Fixed submission:
import collections

n = int(input())
a = []
max_list = []
max_i = 1

a = [str(input()) for x in range(n)]

c = collections.Counter(a)
c = c.most_common()
max_i = c[0][1]

for i in range(len(c)):
    if max_i == c[i][1]:
        max_list.append(c[i][0])
    else:
        break

max_list.sort()

for i in max_list:
    print(i)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = []
max_list = []
max_i = 0

for i in range(n):
    a.append(str(input()))

a2 = a
for i in set(a2):
    if max_i < a.count(i):
        max_list = [i]
        max_i = a.count(i)
    elif max_i == a.count(i):
        max_list.append(i)

max_list.sort()

for i in max_list:
    print(i)       
    

Fixed submission:
import collections

n = int(input())
a = []
max_list = []
max_i = 1

a = [str(input()) for x in range(n)]

c = collections.Counter(a)
c = c.most_common()
max_i = c[0][1]

for i in range(len(c)):
    if max_i == c[i][1]:
        max_list.append(c[i][0])
    else:
        break

max_list.sort()

for i in max_list:
    print(i)
Buggy python submission (verdict: Time Limit Exceeded):

n,k = list(map(int,input().split()))
h = list(map(int,input().split()))

h.sort(reverse=True)

for i in range(k):
    h.pop(0)
    
    if h == []:
        break

if h == []:
    print(0)
else:
    print(sum(h))


Fixed submission:

n,k = list(map(int,input().split()))
h = list(map(int,input().split()))

h.sort(reverse=True)

del h[:k]
    
if h == []:
    print(0)
else:
    print(sum(h))