Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

answer = N
mark = 0
for i in range(N-1):
    #print('%d, %d, %d' % (i, mark, answer))
    if i < mark:
        answer += mark - i
        v = A[i]
        for x in range(i+1, mark+1):
            v += A[x]
        start_j = mark + 1
    else:
        v = A[i]
        start_j = i + 1
    for j in range(start_j, N):
        vx = v ^ A[j]
        vp = v + A[j]
        if vx == vp:
            answer += 1
            v = vx
            mark = j
        else:
            break
print(answer)


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

f = {}
right = 0
accum = A[0]
for left in range(N):
    if right < left:
        right = left
        accum = A[left]

    while(right < N-1):
        if accum & A[right+1] == 0:
            accum += A[right+1]
            right += 1
        else:
            break

    f[left] = right
    accum -= A[left]

answer = 0
for i in range(N):
    answer += f[i] - i + 1

print(answer)

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

answer = N
mark = 0
for i in range(N-1):
    #print('%d, %d, %d' % (i, mark, answer))
    if i < mark:
        answer += mark - i
        v = A[i]
        for x in range(i+1, mark+1):
            v += A[x]
        start_j = mark + 1
    else:
        v = A[i]
        start_j = i + 1
    for j in range(start_j, N):
        vx = v ^ A[j]
        vp = v + A[j]
        if vx == vp:
            answer += 1
            v = vx
            mark = j
        else:
            break
print(answer)


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

f = {}
right = 0
accum = A[0]
for left in range(N):
    if right < left:
        right = left
        accum = A[left]

    while(right < N-1):
        if accum & A[right+1] == 0:
            accum += A[right+1]
            right += 1
        else:
            break

    f[left] = right
    accum -= A[left]

answer = 0
for i in range(N):
    answer += f[i] - i + 1

print(answer)

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

answer = N
for i in range(N-1):
    v = A[i]
    for j in range(i+1, N):
        vx = v ^ A[j]
        vp = v + A[j]
        if vx == vp:
            answer += 1
            v = vx
        else:
            break
print(answer)


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

f = {}
right = 0
accum = A[0]
for left in range(N):
    if right < left:
        right = left
        accum = A[left]

    while(right < N-1):
        if accum & A[right+1] == 0:
            accum += A[right+1]
            right += 1
        else:
            break

    f[left] = right
    accum -= A[left]

answer = 0
for i in range(N):
    answer += f[i] - i + 1

print(answer)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

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

if N%2 == 1:
    ans_right = A.pop()
else:
    ans_right = 1

ans_left = 1

for i in range(N//2):
    right = A.pop()
    left = A.popleft()
    if right==0 or left==0:
        print(0)
        exit();
    
    ans_right = ans_right * right
    ans_left = ans_left * left


if ans_left*ans_right > 10**18:
        print(-1)
        exit();
else:
    print(ans_right*ans_left)


Fixed submission:
from collections import deque

N = int(input())
A = list(map(int,input().split()))
if 0 in A:
    print(0)
    exit();

A = deque(A)

if N%2 == 1:
    ans_right = A.pop()
else:
    ans_right = 1

ans_left = 1

for i in range(N//2):
    right = A.pop()
    left = A.popleft()
    
    ans_right = ans_right * right
    ans_left = ans_left * left

    if ans_right > 10**18 or ans_left> 10**18 or ans_left*ans_right> 10**18:
        print(-1)
        exit()


else:
    print(ans_right*ans_left)

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

ans = 1

for i in A:
    ans = ans * i

if ans > 10**18:
    print(-1)
else:
    print(ans)

Fixed submission:
from collections import deque

N = int(input())
A = list(map(int,input().split()))
if 0 in A:
    print(0)
    exit();

A = deque(A)

if N%2 == 1:
    ans_right = A.pop()
else:
    ans_right = 1

ans_left = 1

for i in range(N//2):
    right = A.pop()
    left = A.popleft()
    
    ans_right = ans_right * right
    ans_left = ans_left * left

    if ans_right > 10**18 or ans_left> 10**18 or ans_left*ans_right> 10**18:
        print(-1)
        exit()


else:
    print(ans_right*ans_left)
Buggy python submission (verdict: Time Limit Exceeded):
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

N = int(input())
if N == 1:
    print(0)
    exit();

S = factorization(N)
ans = 0

for i in S:
    cnt = 1
    while i[1] > 0:
        if  i[1] >= cnt:
            i[1] -= cnt
            cnt += 1
            ans += 1
        else:
            continue;

print(ans)

Fixed submission:
def factorization(n):
    ans = 0
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            ch_point = 1
            while temp%i==0:
                cnt+=1
                if cnt == ch_point:
                    cnt = 0
                    ans += 1
                    ch_point += 1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])
        ans += 1

    if arr==[]:
        arr.append([n, 1])
        ans += 1

    return ans

N = int(input())
if N == 1:
    print(0)
    exit();


print(factorization(N))
Buggy python submission (verdict: Runtime Error):
from itertools import combinations

S = input()[::-1] # 入力文字列を逆順でsに格納

counts = [0] * 2019
counts[0] = 1

a = 1
d = 0

for s in S:
    d = d + int(s)*a
    num = d%2019
    counts[num] += 1
    a *= 10

ans = 0

for i in counts:
    if i >=2:
        x = len(list(combinations(list(range(i)),2)))
        ans += x

print(ans)

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

if S <= W:
    print('unsafe') 
else :
    print('safe')
Buggy python submission (verdict: Time Limit Exceeded):
S = input()[::-1]

counts = [0] * 2019
counts[0] = 1

a = 1
d = 0

for s in S:
    d = d + int(s)*a
    num = d%2019
    counts[num] += 1
    a *= 10

ans = 0

for i in counts:
    if i >=2:
        x = (i*(i-1))//2
        ans += x

print(ans)

Fixed submission:
#ACの人のやつ丸パクリです。自分のソースコードがTLEになるので試しに使わせてもらいます。

s = input()[::-1] # 入力文字列を逆順でsに格納

counts = [0] * 2019
counts[0] = 1

num, d = 0, 1

for char in s:
    num += int(char) * d
    num %= 2019
    d *= 10
    d%= 2019
    counts[num] += 1

ans = 0
for cnt in counts:
    ans += cnt * (cnt - 1) // 2

print(ans) # 答えの出力

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import combinations

S = input()[::-1] # 入力文字列を逆順でsに格納

counts = [0] * 2019
counts[0] = 1

a = 1
d = 0

for s in S:
    d = d + int(s)*a
    num = d%2019
    counts[num] += 1
    a *= 10

ans = 0

for i in counts:
    if i >=2:
        x = (i*(i-1))//2
        ans += x

print(ans)

Fixed submission:
#ACの人のやつ丸パクリです。自分のソースコードがTLEになるので試しに使わせてもらいます。

s = input()[::-1] # 入力文字列を逆順でsに格納

counts = [0] * 2019
counts[0] = 1

num, d = 0, 1

for char in s:
    num += int(char) * d
    num %= 2019
    d *= 10
    d%= 2019
    counts[num] += 1

ans = 0
for cnt in counts:
    ans += cnt * (cnt - 1) // 2

print(ans) # 答えの出力

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import combinations

S = input()[::-1] # 入力文字列を逆順でsに格納

counts = [0] * 2019
counts[0] = 1

a = 1
d = 0

for s in S:
    d = d + int(s)*a
    num = d%2019
    counts[num] += 1
    a *= 10

ans = 0

for i in counts:
    if i >=2:
        x = len(list(combinations(list(range(i)),2)))
        ans += x

print(ans)

Fixed submission:
#ACの人のやつ丸パクリです。自分のソースコードがTLEになるので試しに使わせてもらいます。

s = input()[::-1] # 入力文字列を逆順でsに格納

counts = [0] * 2019
counts[0] = 1

num, d = 0, 1

for char in s:
    num += int(char) * d
    num %= 2019
    d *= 10
    d%= 2019
    counts[num] += 1

ans = 0
for cnt in counts:
    ans += cnt * (cnt - 1) // 2

print(ans) # 答えの出力

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import combinations

S = input()[::-1] # 入力文字列を逆順でsに格納

counts = [0] * 2019
counts[0] = 1

a = 1
d = 0

for s in S:
    d = d + int(s)*a
    num = d%2019
    counts[num] += 1
    a *= 10

ans = 0

for i in counts:
    if i >=2:
        x = len(list(combinations(list(range(i)),2)))
        ans += x

print(ans)

Fixed submission:
#ACの人のやつ丸パクリです。自分のソースコードがTLEになるので試しに使わせてもらいます。

s = input()[::-1] # 入力文字列を逆順でsに格納

counts = [0] * 2019
counts[0] = 1

num, d = 0, 1

for char in s:
    num += int(char) * d
    num %= 2019
    d *= 10
    d%= 2019
    counts[num] += 1

ans = 0
for cnt in counts:
    ans += cnt * (cnt - 1) // 2

print(ans) # 答えの出力
Buggy python submission (verdict: Runtime Error):
import math 

R = int(input())

pai = 3.1415926535

circle_pond = 2*R*math.pai
print(circle_pond)

Fixed submission:
import math 

R = int(input())

circle_pond = 2*R*math.pi
print(circle_pond)
Buggy python submission (verdict: Runtime Error):
K = int(input())
arr = list(map(int, input()))
a = arr[1] % K
b = arr[1] - arr[0]
if a > b:
    print("OK")
else:
    print("NG")


Fixed submission:
K = int(input())
arr = list(map(int, input().split()))
a = arr[1] % K
b = arr[1] - arr[0]
if a <= b:
    print("OK")
else:
    print("NG")
Buggy python submission (verdict: Runtime Error):
coin = int(input())
Max = int(input())
total = coin*500
if total >= Max:
    print("Yes")
else:
    print("No")
 

Fixed submission:
inp = input()
arr = [int(i) for i in inp.split() if i.isdigit()]
total = arr[0]*500
if total >= arr[1]:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
coin = int(input())
max = int(input())
total = coin*500
if total >= max:
    print("Yes")
else:
    print("No")

Fixed submission:
inp = input()
arr = [int(i) for i in inp.split() if i.isdigit()]
total = arr[0]*500
if total >= arr[1]:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
from collections import deque

N, M, K = map(int, input().split())
A = deque([int(x) for x in input().split()])
B = deque([int(x) for x in input().split()])
tsundoku = 0

while K > 0:
    if not A:
        K -= B.popleft()
    elif not B:
        K -= A.popleft()
    elif A[0] < B[0]:
        K -= A.popleft()
    elif A[0] > B[0]:
        K -= B.popleft()
    elif A[0] == A[0]:
        if A[1] < B[1]:
            K -= A.popleft()
        elif A[1] > B[1]:
            K -= B.popleft()

    if K >= 0:
        tsundoku += 1

print(tsundoku)


Fixed submission:
N, M, K = map(int, input().split())
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]


def cusum(array):
    for i in range(len(array) - 1):
        array[i + 1] += array[i]


cusum(A)
cusum(B)
A = [0] + A
B = [0] + B
tsundoku = 0
ia = 0
ib = M

for ia in range(N + 1):
    if A[ia] > K:
        break
    while A[ia] + B[ib] > K and ib >= 0:
        ib -= 1
    tsundoku = max(ia + ib, tsundoku)

print(tsundoku)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = map(int, input().split())
Q = int(input())

val = []
heavy = []

for x in A:
    if x in heavy:
        val[heavy.index(x)] += 1
    else:
        heavy.append(x)
        val.append(1)

for i in range(Q):
    B, C = input().split()
    B = int(B)
    C = int(C)
    if C not in heavy:
        heavy.append(C)
        val.append(0)
    if B in heavy:
        val[heavy.index(C)] += val[heavy.index(B)]
        val[heavy.index(B)] = 0
    sum = 0
    for x, y in zip(val, heavy):
        sum += x * y
    print(sum)


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
Q = int(input())

heavy = [0] * (10 ** 5 + 1)
for x in A:
    heavy[x] += 1
suma = sum(A)

for i in range(Q):
    B, C = map(int, input().split())
    suma -= B * heavy[B]
    suma += C * heavy[B]
    heavy[C] += heavy[B]
    heavy[B] = 0
    print(suma)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = map(int, input().split())
Q = int(input())

val = []
heavy = []

for x in A:
    if x in heavy:
        val[heavy.index(x)] += 1
    else:
        heavy.append(x)
        val.append(1)

for i in range(Q):
    B, C = input().split()
    B = int(B)
    C = int(C)
    if C not in heavy:
        heavy.append(C)
        val.append(0)
    val[heavy.index(C)] += val[heavy.index(B)]
    val[heavy.index(B)] = 0
    sum = 0
    for x, y in zip(val, heavy):
        sum += x * y
    print(sum)


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
Q = int(input())

heavy = [0] * (10 ** 5 + 1)
for x in A:
    heavy[x] += 1
suma = sum(A)

for i in range(Q):
    B, C = map(int, input().split())
    suma -= B * heavy[B]
    suma += C * heavy[B]
    heavy[C] += heavy[B]
    heavy[B] = 0
    print(suma)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = map(int, input().split())
Q = int(input())

dic = [0] * (10 ** 5 + 1)
for x in A:
    dic[x] += 1

for i in range(Q):
    B, C = map(int, input().split())
    dic[C] += dic[B]
    dic[B] = 0
    sum = 0
    for j, x in enumerate(dic):
        sum += j * x
    print(sum)


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
Q = int(input())

heavy = [0] * (10 ** 5 + 1)
for x in A:
    heavy[x] += 1
suma = sum(A)

for i in range(Q):
    B, C = map(int, input().split())
    suma -= B * heavy[B]
    suma += C * heavy[B]
    heavy[C] += heavy[B]
    heavy[B] = 0
    print(suma)
Buggy python submission (verdict: Runtime Error):
import sys
x, n = map(int, input().split())

if n > 0:
    p_list = [int(i) for i in input().split()]
else:
    print(x)
    sys.exit(0)

table = {i for i in range(1, 101)}
table = list(table - set(p_list))
diff = 0
d_min = 101
pre_i = table[0]

for i in table:
    diff = abs(x - i)
    if d_min > diff:
        d_min = diff
    else:
        break
    pre_i = i

print(pre_i)


Fixed submission:
x, n = map(int, input().split())
p = [int(i) for i in input().split()]

min = 1000
pre_i = 0
for i in range(102):
    if i in p:
        continue
    if min > abs(x - i):
        min = abs(x - i)
    else:
        break
    pre_i = i

print(pre_i)

Buggy python submission (verdict: Runtime Error):
import sys
x, n = map(int, input().split())

if n > 0:
    p_list = [int(i) for i in input().split()]
else:
    print(x)
    sys.exit(0)

table = {i for i in range(101)}
table = table - set(p_list)
diff = 0
d_min = 100

for i in table:
    diff = abs(x - i)
    if d_min > diff:
        d_min = diff
    else:
        break
    pre_i = i

print(pre_i)


Fixed submission:
x, n = map(int, input().split())
p = [int(i) for i in input().split()]

min = 1000
pre_i = 0
for i in range(102):
    if i in p:
        continue
    if min > abs(x - i):
        min = abs(x - i)
    else:
        break
    pre_i = i

print(pre_i)
Buggy python submission (verdict: Time Limit Exceeded):
s = str(input())
q = int(input())
usd = False

for _ in range(q):
    t, *fc = input().split()
    t = int(t)
    if fc:
        fc[0] = int(fc[0])

    if t == 1:
        usd = not usd
        continue
    if t == 2:
        if (fc[0] == 1 and not usd) or (fc[0] == 2 and usd):
            s = fc[1] + s
        else:
            s = s + fc[1]

if usd:
    s = s[::-1]
print(s)

Fixed submission:
# TLE 乙
from collections import deque


s = input()
q = int(input())
usd = False
d = deque(s)

for _ in range(q):
    t, *fc = input().split()
    t = int(t)
    if fc:
        fc[0] = int(fc[0])

    if t == 1:
        usd = not usd
        continue
    if t == 2:
        if (fc[0] == 1 and not usd) or (fc[0] == 2 and usd):
            d.appendleft(fc[1])
        else:
            d.append(fc[1])

s = ''.join(list(d))
if usd:
    s = s[::-1]
print(s)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
dic = {}

for i in range(n):
    s = input()
    if s in dic:
        dic[s] += 1
    else:
        dic[s] = 1
keys = sorted([x[0] for x in dic.items() if x[1] == max(dic.values())])
print('\n'.join(keys))

Fixed submission:
n = int(input())
dic = {}

for i in range(n):
    s = input()
    if s in dic:
        dic[s] += 1
    else:
        dic[s] = 1

dic = sorted(dic.items())
dic = sorted(dic, key=lambda x: -x[1])
dic.append(('_', 0))
for i in range(n):
    if dic[i][1] == dic[i + 1][1]:
        print(dic[i][0])
    else:
        print(dic[i][0])
        break
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

for i in range(n):
    print(a.index(i+1) + 1, end=' ')


Fixed submission:
n = int(input())
a = [int(i) for i in input().split()]

a = sorted(range(n), key=lambda x: a[x])
a = [print(i+1, end=' ') for i in a]
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = [input() for i in range(n)]
ss = [sorted(s[i]) for i in range(n)]
dic = [''.join(ss[i]) for i in range(n)]
key = [i for i in set(dic) if dic.count(i) > 1]
cnt = 0
for i in key:
    a = dic.count(i)-1
    cnt += (a * (a+1))/2
print(int(cnt))


Fixed submission:
n = int(input())
s = {}
cnt = 0
for i in range(n):
    j = ''.join(sorted(input()))
    if j in s:
        s[j] += 1
    else:
        s[j] = 0
    cnt += s[j]
print(int(cnt))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = [input() for i in range(n)]
dic = [''.join(sorted(i)) for i in s]
key = [i for i in set(dic)]
cnt = 0
cnt = [str(dic.count(i)-1) for i in key]
ad = [int(int(a) * (int(a)+1)/2) for a in cnt]
print(sum(ad))


Fixed submission:
n = int(input())
s = {}
cnt = 0
for i in range(n):
    j = ''.join(sorted(input()))
    if j in s:
        s[j] += 1
    else:
        s[j] = 0
    cnt += s[j]
print(int(cnt))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = [input() for i in range(n)]
dic = [''.join(sorted(i)) for i in s]
key = [i for i in set(dic)]
cnt = 0
for i in key:
    a = dic.count(i)-1
    cnt += (a * (a+1))/2
print(int(cnt))


Fixed submission:
n = int(input())
s = {}
cnt = 0
for i in range(n):
    j = ''.join(sorted(input()))
    if j in s:
        s[j] += 1
    else:
        s[j] = 0
    cnt += s[j]
print(int(cnt))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = [input() for i in range(n)]
dic = [''.join(sorted(i)) for i in s]
key = [i for i in set(dic)]
cnt = 0
for i in key:
    a = dic.count(i)-1
    cnt += (a * (a+1))/2
print(int(cnt))


Fixed submission:
n = int(input())
s = {}
cnt = 0
for i in range(n):
    j = ''.join(sorted(input()))
    if j in s:
        s[j] += 1
    else:
        s[j] = 0
    cnt += s[j]
print(int(cnt))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = [input() for i in range(n)]
ss = [sorted(i) for i in s]
dic = [''.join(i) for i in ss]
key = [i for i in set(dic)]
cnt = 0
for i in key:
    a = dic.count(i)-1
    cnt += (a * (a+1))/2
print(int(cnt))


Fixed submission:
n = int(input())
s = {}
cnt = 0
for i in range(n):
    j = ''.join(sorted(input()))
    if j in s:
        s[j] += 1
    else:
        s[j] = 0
    cnt += s[j]
print(int(cnt))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = [input() for i in range(n)]
ss = [sorted(s[i]) for i in range(n)]
dic = [''.join(ss[i]) for i in range(n)]
key = [i for i in set(dic)]
cnt = 0
for i in key:
    a = dic.count(i)-1
    cnt += (a * (a+1))/2
print(int(cnt))


Fixed submission:
n = int(input())
s = {}
cnt = 0
for i in range(n):
    j = ''.join(sorted(input()))
    if j in s:
        s[j] += 1
    else:
        s[j] = 0
    cnt += s[j]
print(int(cnt))
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter

N, *S = open(0).read().split()
count = Counter(S)
ans_list = [i for i, j in count.items() if j == max(count.values())]
ans_list.sort()
print("\n".join(ans_list))

Fixed submission:
from collections import Counter

N, *S = open(0).read().split()
count = Counter(S)
max_value = max(count.values())
ans_list = [i for i, j in count.items() if j == max_value]
ans_list.sort()
print("\n".join(ans_list))

Buggy python submission (verdict: Time Limit Exceeded):
N, *S = open(0).read().split()
dict = {i : 0 for i in S}
for i in S:
  dict[i] += 1
ans_list = [i for i, j in dict.items() if j == max(dict.values())]
ans_list.sort()
print("\n".join(ans_list))

Fixed submission:
from collections import Counter

N, *S = open(0).read().split()
count = Counter(S)
max_value = max(count.values())
ans_list = [i for i, j in count.items() if j == max_value]
ans_list.sort()
print("\n".join(ans_list))

Buggy python submission (verdict: Time Limit Exceeded):
N, *S = open(0).read().split()
dict = {i : 0 for i in S}
for i in S:
  dict[i] += 1
print("\n".join(sorted([i for i, j in dict.items() if j == max(dict.values())])))

Fixed submission:
from collections import Counter

N, *S = open(0).read().split()
count = Counter(S)
max_value = max(count.values())
ans_list = [i for i, j in count.items() if j == max_value]
ans_list.sort()
print("\n".join(ans_list))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = []

for i in range(N):
  S.append(input())

dict = {i : 0 for i in S}
for i in S:
  dict[i] += 1
for k in sorted([i for i, j in dict.items() if j == max(dict.values())]):
  print(k)

Fixed submission:
from collections import Counter

N, *S = open(0).read().split()
count = Counter(S)
max_value = max(count.values())
ans_list = [i for i, j in count.items() if j == max_value]
ans_list.sort()
print("\n".join(ans_list))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = []

for i in range(N):
  S.append(input())

dict = {i : 0 for i in set(S)}
for i in S:
  dict[i] += 1
for k in sorted([i for i, j in dict.items() if j == max(dict.values())]):
  print(k)

Fixed submission:
from collections import Counter

N, *S = open(0).read().split()
count = Counter(S)
max_value = max(count.values())
ans_list = [i for i, j in count.items() if j == max_value]
ans_list.sort()
print("\n".join(ans_list))
Buggy python submission (verdict: Runtime Error):
import math
A, B = map(int, input().split())
print(A * B / math.gcd(A, B))

Fixed submission:
import fractions
A, B = map(int, input().split())
print(A * B // fractions.gcd(A, B))
Buggy python submission (verdict: Runtime Error):
A, B = list(map(int, input().split()))
if A <= 9 and B =< 9 :
	print(A * B)
else :
	print(-1)

Fixed submission:
A, B = list(map(int, input().split()))
if A <= 9 and B <= 9 :
	print(A * B)
else :
	print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

ans = ""
for i in range(1, N + 1):
  ans += str(A.index(i) + 1) + " "
print(ans)

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

ans = [0] * N
for i, j in enumerate(A, 1):
  ans[j - 1] = i
print(" ".join(map(str, ans)))
Buggy python submission (verdict: Runtime Error):
N = int(input())
if N < 10 :
	print(N)
elif N < 100 :
	print(9)
elif N < 1000 :
	print(9 + (N - 100 + 1))
elif N < 10000 :
	print(9 + 900)
elif N < 100000 :
	print(9 + 900 + (N - 10000 + 1))
else :
	print(9 + 900 + 90000)


Fixed submission:
A, B, C = list(map(int, input().split()))
ans = C - (A - B)
if ans >= 0 :
	print(ans)
else :
	print(0)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = []
tmp = 0
for i in range(N):
  A.append(int(input()))
for j in range(N):
  tmp = A[j]
  A[j] = 0
  print(max(A))
  A[j] = tmp

Fixed submission:
N = int(input())
A = []
for i in range(N):
  A.append(int(input()))
A_sort = list(sorted(A))
for i in range(N):
  print([A_sort[-2], A_sort[-1]][A[i] < A_sort[-1]])
Buggy python submission (verdict: Runtime Error):
X, A = list(map(input().split()))
if X < A :
	print(0)
else :
	print(10)

Fixed submission:
X, A = list(map(int, input().split()))
if X < A :
	print(0)
else :
	print(10)