Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
# For taking integer inputs.
import math


def inp():
    return(int(input()))


# For taking List inputs.
def inlist():
    return(list(map(int, input().split())))


# For taking string inputs. Actually it returns a List of Characters, instead of a string, which is easier to use in Python, because in Python, Strings are Immutable.
def instr():
    s = input()
    return(list(s[:len(s)]))


# For taking space seperated integer variable inputs.
def invr():
    return(map(int, input().split()))


A, B, K = invr()
r1 = []
r2 = []
k = K
for i in range(A, B+1):
    if k > 0:
        r1.append(i)
        print(i)
        k -= 1
k = K
for i in range(B, A-1, -1):
    if k > 0:
        if i not in r1:
            r2.append(i)
        k -= 1
r2 = sorted(r2)
for i in r2:
    print(i)


Fixed submission:
# For taking integer inputs.
import math


def inp():
    return(int(input()))


# For taking List inputs.
def inlist():
    return(list(map(int, input().split())))


# For taking string inputs. Actually it returns a List of Characters, instead of a string, which is easier to use in Python, because in Python, Strings are Immutable.
def instr():
    s = input()
    return(list(s[:len(s)]))


# For taking space seperated integer variable inputs.
def invr():
    return(map(int, input().split()))


A, B, K = invr()
r1 = []
r2 = []
k = K
for i in range(A, B+1):
    if k > 0:
        r1.append(i)
        print(i)
    else:
        break
    k -= 1
k = K
for i in range(B, A-1, -1):
    if k > 0:
        if i not in r1:
            r2.append(i)
    else:
        break
    k -= 1
r2 = sorted(r2)
for i in r2:
    print(i)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
R = list()
for i in range(N):
  R.append(0)
for i in range(M):
  c1, c2 = map(int, input().split())
  R[c1] += 1
  R[c2] += 1
for i in range(N):
  print(R[i])
  


Fixed submission:
N, M = map(int, input().split())
R = list()
for i in range(N):
  R.append(0)
for i in range(M):
  c1, c2 = map(int, input().split())
  R[c1-1] += 1
  R[c2-1] += 1
for i in range(N):
  print(R[i])
Buggy python submission (verdict: Runtime Error):
# For taking integer inputs.
def inp():
    return(int(input()))


# For taking List inputs.
def inlist():
    return(list(map(int, input().split())))


# For taking string inputs. Actually it returns a List of Characters, instead of a string, which is easier to use in Python, because in Python, Strings are Immutable.
def instr():
    s = input()
    return(list(s[:len(s)]))


# For taking space seperated integer variable inputs.
def invr():
    return(map(int, input().split()))


a, b = invr()
res = "Negative"


if a > 0 and b > 0:
    res = "Positive"
if a < 0 and b < 0:
    temp = abs(abs(a)-abs(b)) + 1
    if temp % 2 == 0:
        res = "positive"
    else:
        res = "Negative"
if a == b:
    res = "Positive"
if a <= 0 and b = > 0:
    res = "Zero"

print(res)


Fixed submission:
# For taking integer inputs.
def inp():
    return(int(input()))


# For taking List inputs.
def inlist():
    return(list(map(int, input().split())))


# For taking string inputs. Actually it returns a List of Characters, instead of a string, which is easier to use in Python, because in Python, Strings are Immutable.
def instr():
    s = input()
    return(list(s[:len(s)]))


# For taking space seperated integer variable inputs.
def invr():
    return(map(int, input().split()))


a, b = invr()
res = "Negative"

if 0 < a and a <= b:
    res = "Positive"
if a <= b and b < 0:
    temp = (b-a)+1
    if temp % 2 == 0:
        res = "Positive"
    else:
        res = "Negative"
if a <= 0 and b >= 0:
    res = "Zero"

print(res)
Buggy python submission (verdict: Runtime Error):
k = int(input())
s = 0
for a in range(1, k+1):
    for b in range(1, k+1):
        ab = math.gcd(a, b)
        for c in range(1, k+1):
            s += math.gcd(ab, c)
print(s)


Fixed submission:
import math

k = int(input())
s = 0
for a in range(1, k+1):
    for b in range(1, k+1):
        ab = math.gcd(a, b)
        for c in range(1, k+1):
            s += math.gcd(ab, c)
print(s)

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

k = int(input())
s = 0
for a in range(1, k+1):
  for b in range(1, k+1):
    for c in range(1, k+1):
      s += math.gcd(a, math.gcd(b, c))
print(s)

Fixed submission:
import math

k = int(input())
s = 0
for a in range(1, k+1):
    for b in range(1, k+1):
        ab = math.gcd(a, b)
        for c in range(1, k+1):
            s += math.gcd(ab, c)
print(s)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
a = list(map(int, input().split()))
dp = [float('inf')]*len(a)
dp[0] = 0
for i in range(len(a)):
    for j in range(i+1, min(i+k+1, len(a))):
        dp[j] = min(dp[j], dp[i] + abs(a[j] - a[i]))
print(dp[-1])

Fixed submission:
n, k = map(int, input().split())
a = list(map(int, input().split()))
dp = [float('inf')]*len(a)
dp[0] = 0
for i in range(len(a)):
    for j in range(i+1, min(i+k+1, len(a))):
        dp[j] = min(dp[j], dp[i] + abs(a[j] - a[i]))
print(dp[-1])

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
a = list(map(int, input().split()))
dp = [float('inf')]*len(a)
dp[0] = 0
for i in range(len(a)):
    for j in range(1, k+1):
        if i+j < len(a):
            dp[i+j] = min(dp[i+j], dp[i] + abs(a[i+j] - a[i]))
print(dp[-1])

Fixed submission:
n, k = map(int, input().split())
a = list(map(int, input().split()))
dp = [float('inf')]*len(a)
dp[0] = 0
for i in range(len(a)):
    for j in range(i+1, min(i+k+1, len(a))):
        dp[j] = min(dp[j], dp[i] + abs(a[j] - a[i]))
print(dp[-1])
Buggy python submission (verdict: Runtime Error):
def solve(a):
    dp = [[0]*3 for _ in range(len(a)+1)]
    for i in range(len(a)):
        for j in range(3):
            for k in range(3):
                if j != k:
                    dp[i+1][j] = max(dp[i+1][j], a[i][j] + dp[i][k])
    return max(dp[-1])
  
n = int(input())
a = []
for _ in range(n):
    a.append(list(map(int, input().split())))
print(solve(a))

Fixed submission:
def solve(a):
    dp = [[0]*3 for _ in range(len(a)+1)]
    for i in range(len(a)):
        for j in range(3):
            for k in range(3):
                if j != k:
                    dp[i+1][j] = max(dp[i+1][j], a[i][j] + dp[i][k])
    return max(dp[-1])
  
n = int(input())
a = []
for _ in range(n):
    a.append(list(map(int, input().split())))
print(solve(a))
Buggy python submission (verdict: Time Limit Exceeded):
def solve(c, a):
    dp = {c: 0}
    for w, p in a:
        dp2 = dp.copy()
        for rc, v in dp.items():
            if rc >= w:
                dp2[rc-w] = max(dp2.get(rc-w, 0), v + p)
        dp = dp2
    return max(dp.values())
  
n, k = map(int, input().split())
a = []
for _ in range(n):
    a.append(list(map(int, input().split())))
print(solve(k, a))

Fixed submission:
def solve(c, a):
    dp = [float('inf')]*(2*10**5)
    dp[0] = 0
    for w, v in a:
        for i in range(len(dp)-1, -1, -1):
            if dp[i] != float('inf'):
                dp[i+v] = min(dp[i+v], dp[i] + w)
    return next(i for i in range(len(dp)-1, -1, -1) if dp[i] <= c)
  
n, k = map(int, input().split())
a = []
for _ in range(n):
    a.append(list(map(int, input().split())))
print(solve(k, a))
Buggy python submission (verdict: Runtime Error):
def solve(g):
    dp = [-1]*len(g)
    def _solve(f):
        if dp[f] == -1:
            dp[f] = 0
            for c in g[f]:
                dp[f] = max(dp[f], 1 + _solve(c))
        return dp[f]
    for f in range(len(g)):
        _solve(f)
    # print(dp)
    return max(dp)

n, m = map(int, input().split())
g = [[] for _ in range(n)]
for _ in range(m):
    f, t = map(int, input().split())
    g[f-1].append(t-1)

print(solve(g))

Fixed submission:
import sys
sys.setrecursionlimit(10000)

def solve(g):
    dp = [-1]*len(g)
    def _solve(f):
        if dp[f] == -1:
            dp[f] = 0
            for c in g[f]:
                dp[f] = max(dp[f], 1 + _solve(c))
        return dp[f]
    for f in range(len(g)):
        _solve(f)
    # print(dp)
    return max(dp)

n, m = map(int, input().split())
g = [[] for _ in range(n)]
for _ in range(m):
    f, t = map(int, input().split())
    g[f-1].append(t-1)

print(solve(g))

Buggy python submission (verdict: Runtime Error):
def solve(g):
    dp = [-1]*len(g)
    def _solve(f):
        if dp[f] == -1:
            sol = 0
            for c in g[f]:
                sol = max(sol, 1 + _solve(c))
            dp[f] = sol
        return dp[f]
    for f in range(len(g)):
        _solve(f)
    return max(dp)

n, m = map(int, input().split())
g = [[] for _ in range(n)]
for _ in range(m):
    f, t = map(int, input().split())
    g[f-1].append(t-1)

print(solve(g))

Fixed submission:
import sys
sys.setrecursionlimit(10000)

def solve(g):
    dp = [-1]*len(g)
    def _solve(f):
        if dp[f] == -1:
            dp[f] = 0
            for c in g[f]:
                dp[f] = max(dp[f], 1 + _solve(c))
        return dp[f]
    for f in range(len(g)):
        _solve(f)
    # print(dp)
    return max(dp)

n, m = map(int, input().split())
g = [[] for _ in range(n)]
for _ in range(m):
    f, t = map(int, input().split())
    g[f-1].append(t-1)

print(solve(g))

Buggy python submission (verdict: Runtime Error):
def solve(g):
    dp = [-1]*len(g)
    def _solve(f):
        if dp[f] == -1:
            for c in g[f]:
                dp[f] = max(dp[f], 1 + _solve(c))
            dp[f] = max(dp[f], 0)
        return dp[f]
    for f in range(len(g)):
        _solve(f)
    # print(dp)
    return max(dp)

n, m = map(int, input().split())
g = [[] for _ in range(n)]
for _ in range(m):
    f, t = map(int, input().split())
    g[f-1].append(t-1)

print(solve(g))

Fixed submission:
import sys
sys.setrecursionlimit(10000)

def solve(g):
    dp = [-1]*len(g)
    def _solve(f):
        if dp[f] == -1:
            dp[f] = 0
            for c in g[f]:
                dp[f] = max(dp[f], 1 + _solve(c))
        return dp[f]
    for f in range(len(g)):
        _solve(f)
    # print(dp)
    return max(dp)

n, m = map(int, input().split())
g = [[] for _ in range(n)]
for _ in range(m):
    f, t = map(int, input().split())
    g[f-1].append(t-1)

print(solve(g))
Buggy python submission (verdict: Runtime Error):
n = int(input())
resposta = ""

while n > 26:
    resposta += alfabeto[(n%26) - 1]
    n = (n // 26) 


resposta += alfabeto[(n % 26) - 1]
resposta = resposta[::-1]

print(resposta)


Fixed submission:
alfabeto = "abcdefghijklmnopqrstuvwxyz"

n = int(input())
resposta = ""

for i in range(1, 99):
    if n <= 26 ** i:
        n -= 1

        for j in range(i):
            resposta += chr(ord("a") + n % 26)
            n //= 26

        break

    else:
        n -= 26 ** i

resposta = resposta[::-1]

print(resposta)
Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce

n = int(input())

numeros = list(map(int,input().split()))

multiplicacao = reduce((lambda x, y:x * y),numeros)

if multiplicacao > 1e18:
    print(-1)

else:
    print(multiplicacao)


Fixed submission:
from functools import reduce

n = int(input())

numeros = list(map(int,input().split()))

sim = False
if 0 in numeros:
    print(0)

else:

    multiplicacao = 1

    for i in numeros:
        multiplicacao *= i
        if multiplicacao > 1e18:
            print(-1)
            sim = True
            break
    if sim == False:
        print(multiplicacao)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

numeros = list(map(int,input().split()))

multiplicacao = 1

asdsd = True

for x in numeros:
    multiplicacao *= x
    
    
if multiplicacao > 1e18:
    print(-1)
    
else:
    print(multiplicacao)


Fixed submission:
from functools import reduce

n = int(input())

numeros = list(map(int,input().split()))

sim = False
if 0 in numeros:
    print(0)

else:

    multiplicacao = 1

    for i in numeros:
        multiplicacao *= i
        if multiplicacao > 1e18:
            print(-1)
            sim = True
            break
    if sim == False:
        print(multiplicacao)
Buggy python submission (verdict: Runtime Error):
from queue import Queue

n,m = map(int,input().split())

grafo = [[] for i in range(n)]

for x in range(m):
    a,b = map(int,input().split())
    grafo[a-1].append(b)
    grafo[b-1].append(a)


placas = [0] * (n)

def bfs(a):
    q = Queue(maxsize = n)
    placas[0] = 1
    q.put(a)
    while not q.empty():
        popado = q.get()
        for adj in grafo[popado-1]:
            if not placas[adj-1]:
                placas[adj-1] = popado
                q.put(adj)

    if placas.count(0) == 0:
        print("Yes")
        for x in placas[1::]:
            print(x)
    else:
        print("No")

bfs(1)


Fixed submission:
numero = int(input())

digito_1 = numero % 10

if digito_1 == 2 or digito_1 == 4 or digito_1 == 5 or digito_1 == 7 or digito_1 == 9:
    print("hon")
elif digito_1 == 0 or digito_1 == 1 or digito_1 == 6 or digito_1 == 8:
    print("pon")
elif digito_1 == 3:
    print("bon")

Buggy python submission (verdict: Runtime Error):
import math

A,B,H,M = map(int,input().split())


if M == 0 and H == 6:

    print(A+B)

elif M == 0 and H == 0:

    print(abs(A-B))

else:

    angulo = abs(11 * M - 60 * H)/2

    angulo = math.radians(angulo)

    print(abs(math.sqrt((A**2 + B ** 2) -  (2 * A * B * math.cos(angulo)))))


Fixed submission:
numero = int(input())

digito_1 = numero % 10

if digito_1 == 2 or digito_1 == 4 or digito_1 == 5 or digito_1 == 7 or digito_1 == 9:
    print("hon")
elif digito_1 == 0 or digito_1 == 1 or digito_1 == 6 or digito_1 == 8:
    print("pon")
elif digito_1 == 3:
    print("bon")
Buggy python submission (verdict: Runtime Error):
import math

A,B,H,M = map(int,input().split())


if M == 0 and H == 6:

    print(A+B)

elif M == 0 and H == 0:

    print(abs(A-B))

else:

    angulo = abs(11 * M - 60 * H)/2

    angulo = math.radians(angulo)

    print(abs(math.sqrt((A**2 + B ** 2) -  (2 * A * B * math.cos(angulo)))))
~        

Fixed submission:
import math

A,B,H,M = map(int,input().split())


if M == 0 and H == 6:

    print(A+B)

elif M == 0 and H == 0:

    print(abs(A-B))

else:
    angulo = abs(11 * M - 60 * H)/2

    angulo = math.radians(angulo)

    print(abs(math.sqrt((A**2 + B ** 2) -  (2 * A * B * math.cos(angulo)))))
Buggy python submission (verdict: Runtime Error):
s = input()
t = input()

if s + t[-1] == t:
    print("Yes")
else:
    print("No")
~                 

Fixed submission:
s = input()
t = input()

string = s + t[-1]

if string == t:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
funcionarios = list(map(int,input().split()))
for x in range(1,N+1):
    print(funcionarios.count(x))


Fixed submission:
N = int(input())
funcionarios = list(map(int,input().split()))
frequencia = [0 for i in range(N)]

for i in funcionarios:
    frequencia[i-1] += 1

for i in frequencia:
    print(i)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
funcionarios = list(map(int,input().split()))
lista = [0 for i in range(N)]
a = 1
for x in lista:
    x += funcionarios.count(a)
    a += 1
    print(x)


Fixed submission:
N = int(input())
funcionarios = list(map(int,input().split()))
frequencia = [0 for i in range(N)]

for i in funcionarios:
    frequencia[i-1] += 1

for i in frequencia:
    print(i)
Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())

votos = list(map(int,input().split()))

qtd_votos = sum(votos)

minimo = qtd_votos/(4*M)

votos.sort(reverse = True)

if votos[M-1] >= minimo:
    print("Yes")
else:
    print("No")
トすることで判定できます。

Fixed submission:
N,M = map(int,input().split())

votos = list(map(int,input().split()))

qtd_votos = sum(votos)

minimo = qtd_votos/(4*M)

votos.sort(reverse = True)

if votos[M-1] >= minimo:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
n,W = map(int,input().split())

w = []
v = []

for x in range(n):
    peso,valor = map(int,input().split())
    w.append(peso)
    v.append(valor)

dp = [0] * (W+1)

for i in range(n):
    for j in range(W,-1,-1):
        if j + w[i] <= W:
            dp[j+w[i]] = max(dp[j+w[i]], dp[j] + v[i])


resposta = 0

for x in dp:
    resposta = max(x,resposta)

print(resposta)


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

w = []
v = []

for x in range(n):
    peso,valor = map(int,input().split())
    w.append(peso)
    v.append(valor)

dp = [0] * (W+1)

for i in range(n):
    for j in range(W,-1,-1):
        if j + w[i] <= W:
            dp[j+w[i]] = max(dp[j+w[i]], dp[j] + v[i])


resposta = 0

for x in dp:
    resposta = max(x,resposta)

print(resposta)
Buggy python submission (verdict: Time Limit Exceeded):
def getIndex(l, x, default=-1):
    return l.index(x) if x in l else default

def getLastIndex(l, x, default=-1):
    l = list(reversed(l))
    return len(l) - l.index(x) - 1 if x in l else default

N = int(input())
c = list(input())
ans = 0
while(True):
    indexW = getIndex(c, 'W')
    indexR = getLastIndex(c, 'R')
    if indexR < indexW or indexW == -1 or indexR == -1:
        break
    c[indexW] = 'R'
    c[indexR] = 'W'
    ans += 1
print(ans)


Fixed submission:
W = "W"
R = "R"

N = int(input())
C = list(input())
numR = C.count(R)
result = 0
for i in range(numR):
    if C[i] == W:
        result += 1
print(result)

Buggy python submission (verdict: Time Limit Exceeded):
def getIndex(l, x, default=-1):
    return l.index(x) if x in l else default

def getLastIndex(l, x, default=-1):
    l = list(reversed(l))
    return len(l) - l.index(x) - 1 if x in l else default

N = int(input())
c = list(input())
ans = 0
while(True):
    indexW = getIndex(c, 'W')
    indexR = getLastIndex(c, 'R')
    if indexR < indexW or indexW == -1 or indexR == -1:
        break
    c[indexW] = 'R'
    c[indexR] = 'W'
    ans += 1
print(ans)


Fixed submission:
W = "W"
R = "R"

N = int(input())
C = list(input())
numR = C.count(R)
result = 0
for i in range(numR):
    if C[i] == W:
        result += 1
print(result)
Buggy python submission (verdict: Runtime Error):
N, X, Y = map(int, input().split())
count = [0] * (N-1)
for i in range(N):
    i += 1
    for j in range(N-i):
        j += i + 1
        if i < j:
            normal = j-i
            xtoy = abs(X-i) + 1 + abs(Y-j)
            ytox = abs(Y-i) + 1 + abs(X-j)
            minRoute = min([normal, xtoy, ytox])
            count[minRoute-1] += 1
for c in count:
    print(c)


Fixed submission:
S = input()
if S[2] == S[3] and S[4] == S[5]:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
N, X, Y = map(int, input().split())
count = [0] * (N-1)
for i in range(N):
    i += 1
    for j in range(N-i):
        j += i + 1
        if i < j:
            normal = j-i
            xtoy = abs(X-i) + 1 + abs(Y-j)
            ytox = abs(Y-i) + 1 + abs(X-j)
            minRoute = min([normal, xtoy, ytox])
            count[minRoute-1] += 1
for c in count:
    print(c)


Fixed submission:
N, X, Y = map(int, input().split())
count = [0] * (N-1)
for i in range(N):
    i += 1
    for j in range(N-i):
        j += i + 1
        if i < j:
            normal = j-i
            xtoy = abs(X-i) + 1 + abs(Y-j)
            ytox = abs(Y-i) + 1 + abs(X-j)
            minRoute = min([normal, xtoy, ytox])
            count[minRoute-1] += 1
for c in count:
    print(c)

Buggy python submission (verdict: Time Limit Exceeded):
N, X, Y = map(int, input().split())
count = [0] * (N-1)
for i in range(N):
    i += 1
    for j in range(N):
        j += 1
        if i < j:
            normal = j-i
            xtoy = abs(X-i) + 1 + abs(Y-j)
            ytox = abs(Y-i) + 1 + abs(X-j)
            minRoute = min([normal, xtoy, ytox])
            count[minRoute-1] += 1
for c in count:
    print(c)


Fixed submission:
N, X, Y = map(int, input().split())
count = [0] * (N-1)
for i in range(N):
    i += 1
    for j in range(N-i):
        j += i + 1
        if i < j:
            normal = j-i
            xtoy = abs(X-i) + 1 + abs(Y-j)
            ytox = abs(Y-i) + 1 + abs(X-j)
            minRoute = min([normal, xtoy, ytox])
            count[minRoute-1] += 1
for c in count:
    print(c)
Buggy python submission (verdict: Runtime Error):
import math
from scipy.special import comb

N, M = map(int, input().split())
print(math.floor(comb(N, 2)+comb(M, 2)))


Fixed submission:
def comb(a):
    if a < 2:
        return 0
    else:
        return a * (a-1) // 2


N, M = map(int, input().split())
print(comb(N)+comb(M))
Buggy python submission (verdict: Runtime Error):
b = list(map(int, input().split()))
tmp1 = list(map(int, input().split()))
tmp2 = list(map(int, input().split()))
b.extend(tmp1)
b.extend(tmp2)
answer = [False]*9
N = int(input())
for i in range(N):
    num = int(input())
    if num in b:
        answer[b.index(num)] = True
if (answer[0] and answer[1] and answer[2]) or (answer[3] and answer[4] and answer[5]) or (answer[6] and answer[7] and answer[8]) or (answer[1-1] and answer[4-1] and answer[7-1]) or (answer[2-1] and answer[5-1] and answer[8-1]) or (answer[3-1] and answer[6-1] and answer[9-1]) or (answer[1-1] and answer[5-1] and answer[9-1]) or (answer[3-1] and answer[5-1] and [b7]):
    print("Yes")
else:
    print("No")


Fixed submission:
b = list(map(int, input().split()))
tmp1 = list(map(int, input().split()))
tmp2 = list(map(int, input().split()))
b.extend(tmp1)
b.extend(tmp2)
answer = [False]*9
N = int(input())
for i in range(N):
    num = int(input())
    if num in b:
        answer[b.index(num)] = True
if (answer[0] and answer[1] and answer[2]) or (answer[3] and answer[4] and answer[5]) or (answer[6] and answer[7] and answer[8]) or (answer[1-1] and answer[4-1] and answer[7-1]) or (answer[2-1] and answer[5-1] and answer[8-1]) or (answer[3-1] and answer[6-1] and answer[9-1]) or (answer[1-1] and answer[5-1] and answer[9-1]) or (answer[3-1] and answer[5-1] and [7-1]):
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
dct = {}
for i in range(N):
    S = input()
    if dct.get(S) == None:
        dct[S] = 1
    else:
        dct[S] += 1
sortedDct = sorted(dct.items(), key=lambda x: -x[1])
L = []
maxNum = 0
for k, v in sortedDct:
    if (maxNum <= v):
        L.append(k)
        maxNum = v
L.sort()
for l in L:
    print(l)

Fixed submission:
N = int(input())
dct = {}
for i in range(N):
    S = input()
    if dct.get(S) == None:
        dct[S] = 1
    else:
        dct[S] += 1
sortedDct = sorted(dct.items(), key=lambda x: -x[1])
L = []
maxNum = 0
for k, v in sortedDct:
    if (maxNum <= v):
        L.append(k)
        maxNum = v
L.sort()
for l in L:
    print(l)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
p = list(map(int, input().split()))

res = -1

for i in range(N):
    res = p[i]

print(res)


Fixed submission:
S, T = input().split()
A, B = map(int, input().split())
U = input()
dct = {}
dct[S] = A
dct[T] = B
dct[U] -= 1
print(dct[S], dct[T])