Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()

ans = 0
for i in range(1000):
    target = str(i).zfill(3)
    char_idx = 0
    for c in S:
        if c == target[char_idx]:
            char_idx += 1

        if char_idx == 3:
            ans += 1
            break

print(ans)

Fixed submission:
N = int(input())
S = input()

ans = 0
for i in range(1000):
    target = str(i).zfill(3)
    char_idx = 0
    for c in S:
        if c == target[char_idx]:
            char_idx += 1

        if char_idx == 3:
            ans += 1
            break

print(ans)

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

ans = 0
for i in range(1000):
    target = str(i).zfill(3)
    char_idx = 0
    for c in S:
        if c == target[char_idx]:
            char_idx += 1

        if char_idx == 3:
            ans += 1
            break

print(ans)

Fixed submission:
N = int(input())
S = input()

ans = 0
for i in range(1000):
    target = str(i).zfill(3)
    char_idx = 0
    for c in S:
        if c == target[char_idx]:
            char_idx += 1

        if char_idx == 3:
            ans += 1
            break

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()

count = 0
removed = True
while removed:
    removed = False
    for i in range(1, len(s)):
        if s[i-1] != s[i]:
            s = s[0:i-1] + s[i+1:]
            removed = True
            count += 2
            break
print(count)


Fixed submission:
s = input()
ans = min(s.count('1'), s.count('0')) * 2
print(ans)
Buggy python submission (verdict: Runtime Error):
import fractions

def monsters_battle_royal(n, a):
    gcd = a[0]
    for i in range(1, n):
        gcd = fractions.gcd(gcd, a[i])
    return gcd

n = int(input())
a = list(map(int, input()))

ans = monsters_battle_royal(n, a)
print(ans)


Fixed submission:
import fractions

def monsters_battle_royal(n, a):
    gcd = a[0]
    for i in range(1, n):
        gcd = fractions.gcd(gcd, a[i])
    return gcd

n = int(input())
a = list(map(int, input().split()))

ans = monsters_battle_royal(n, a)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
count = 0

def rec(l, r):
    global count
    global h

    if l >= r:
        return

    zero = list()
    for i in range(l, r):
        if h[i] == 0:
            zero.append(i)

    if len(zero) > 0:
        for i in zero:
            rec(l, i)
            rec(i+1, r)
    else:
        for i in range(l, r):
            h[i] -= 1
        count += 1
        rec(l, r)

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

rec(0, len(h))
print(count)


Fixed submission:
count = 0

def rec(l, r):
    global count
    global h
    global s

    if l >= r:
        return

    zero = list()
    for i in range(l, r):
        if h[i] == 0:
            zero.append(i)

    if len(zero) > 0:
        for i in zero:
            if not (l, i) in s:
                rec(l, i)
                s.add((l, i))
            if not (i+1, r) in s:
                rec(i+1, r)
                s.add((i+1, r))
    else:
        for i in range(l, r):
            h[i] -= 1
        count += 1
        rec(l, r)

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

rec(0, len(h))
print(count)
Buggy python submission (verdict: Runtime Error):
import math

n, x = [int(x) for x in input().split(' ')]
cities = [int(x) for x in input().split(' ')]

ans = abs(x - cities[0])
for i in range(1, n):
    ans = math.gcd(ans, x-cities[i])

print(ans)


Fixed submission:
import fractions

n, x = [int(x) for x in input().split(' ')]
cities = [int(x) for x in input().split(' ')]

ans = abs(x - cities[0])
for i in range(1, n):
    d = abs(x - cities[i])
    ans = fractions.gcd(ans, d)

print(ans)

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

n, x = [int(x) for x in input().split(' ')]
cities = [int(x) for x in input().split(' ')]

ans = abs(x - cities[0])
for i in range(1, n):
    ans = math.gcd(ans, x-cities[1])

print(ans)


Fixed submission:
import fractions

n, x = [int(x) for x in input().split(' ')]
cities = [int(x) for x in input().split(' ')]

ans = abs(x - cities[0])
for i in range(1, n):
    d = abs(x - cities[i])
    ans = fractions.gcd(ans, d)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
def is_even(n):
    return n & 1 == 0

n = int(input())
a = list(map(int, input().split(" ")))


count = 0
while True:
    maxidx = 0
    maxval = 0
    even_flag = False
    for i, v in enumerate(a):
        if is_even(v):
            even_flag = True
            if maxval < v:
                maxval = v
                maxidx = i
        a[i] *= 3

    if not even_flag:
        break

    a[maxidx] = int(a[maxidx] / 6)
    count += 1

print(count)


Fixed submission:
def is_even(n):
    return n & 1 == 0

n = int(input())
a = list(map(int, input().split(" ")))


count = 0
for v in a:
    while is_even(v):
        v = int(v / 2)
        count += 1

print(count)
Buggy python submission (verdict: Runtime Error):
import math
A, B, C, X, Y = map(int, input().split())

# xn, yn = 0, 0
# price = 0
# 
# if (A+B) >= 2*C and A >= 1 and B >= 1:
#     ammount = min(X, Y)
#     price += C * ammount * 2
#     xn += ammount
#     yn += ammount
# 
# if A >= 2*C and X > xn:
#     ammount = X - xn
#     price += C * X * 2
#     xn += X
#     yn += X
# 
# if B >= 2*C and Y > yn:
#     ammount = Y - yn
#     price += C * ammount * 2
#     xn += ammount
#     yn += ammount
# 
# price += A * (X - xn)
# price += B * (Y - yn)
# 
# print(price)
# 

min_price = math.inf
for i in range(max(X, Y)+1):
    xn, yn = i, i
    price = (2*C) * i
    price += (max(0, X - xn)) * A
    price += (max(0, Y - yn)) * B
    min_price = min(min_price, price)

print(min_price)

Fixed submission:
A, B, C, X, Y = map(int, input().split())

# xn, yn = 0, 0
# price = 0
# 
# if (A+B) >= 2*C and A >= 1 and B >= 1:
#     ammount = min(X, Y)
#     price += C * ammount * 2
#     xn += ammount
#     yn += ammount
# 
# if A >= 2*C and X > xn:
#     ammount = X - xn
#     price += C * X * 2
#     xn += X
#     yn += X
# 
# if B >= 2*C and Y > yn:
#     ammount = Y - yn
#     price += C * ammount * 2
#     xn += ammount
#     yn += ammount
# 
# price += A * (X - xn)
# price += B * (Y - yn)
# 
# print(price)
# 

min_price = 1 << 32 
for i in range(max(X, Y)+1):
    xn, yn = i, i
    price = (2*C) * i
    price += (max(0, X - xn)) * A
    price += (max(0, Y - yn)) * B
    min_price = min(min_price, price)

print(min_price)
Buggy python submission (verdict: Runtime Error):
import bisect

N = int(input())

A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

A.sort()
B.sort()
C.sort()

alters_count = 0
for a in A:
    count += 1
    bidx = bisect.bisect_left(B, a)
    if bidx == N:
        continue
    for b in B[bidx:]:
        count += 1
        cidx = bisect.bisect_left(C, b)
        if cidx == N:
            continue
        alters_count += N - cidx

print(alters_count)

Fixed submission:
from bisect import bisect_left, bisect_right

N = int(input())

A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
B.sort()
C.sort()

alters_count = 0
for b in B:
    aidx = bisect_left(A, b)
    cidx = bisect_right(C, b)
    if cidx == N:
        continue
    alters_count += aidx * (N - cidx)

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

tot=A[0]
for i in range(1,N):
    tot=tot*A[i]
if tot<=10**18:
    print(tot)
else:
    print(-1)


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

tot=A[0]
b=True
if (0 in A)==True:
    print(0)
    b=False
a=True
if b==True:
    for i in range(1,N):
        tot=tot*A[i]
        if tot>10**18:
            print(-1)
            a=False
            break
    if a==True:
        print(tot)
Buggy python submission (verdict: Runtime Error):
import math
A,B,H,M=map(int,input().split())

for i in range(10):
    if 0<abs(360*i-abs(30*H+int(M/2)-6*M))<360:
        a=abs(360*i-abs(30*H+int(M/2)-6*M))
        c=abs((180-abs(360*i-abs(30*H+int(M/2)-6*M))))
        break
b=min(a,c)

print("{:.12f}".format(((A**2+B**2-2*A*B*(math.cos(b*(math.pi/180))))**(1/2))))

Fixed submission:
import math
A,B,H,M=map(int,input().split())

for i in range(10):
    if 0<=abs(360*i-abs(30*H+(M/2)-6*M))<360:
        a=abs(360*i-abs(30*H+(M/2)-6*M))
        c=abs(360-abs(360*i-abs(30*H+(M/2)-6*M)))
        break
b=min(a,c)

print("{:.9f}".format(((A**2+B**2-2*A*B*(math.cos(b*(math.pi/180))))**(1/2))))

Buggy python submission (verdict: Runtime Error):
import math
A,B,H,M=map(int,input().split())

C=[]
for i in range(10):
    if 0<abs(360*i-abs(30*H+int(M/2)-6*M))<180:
        a=abs(360*i-abs(30*H+int(M/2)-6*M))
        c=abs((180-abs(360*i-abs(30*H+int(M/2)-6*M))))
        break
b=min(a,c)

print("{:.12f}".format(((A**2+B**2-2*A*B*(math.cos(b*(math.pi/180))))**(1/2))))


Fixed submission:
import math
A,B,H,M=map(int,input().split())

for i in range(10):
    if 0<=abs(360*i-abs(30*H+(M/2)-6*M))<360:
        a=abs(360*i-abs(30*H+(M/2)-6*M))
        c=abs(360-abs(360*i-abs(30*H+(M/2)-6*M)))
        break
b=min(a,c)

print("{:.9f}".format(((A**2+B**2-2*A*B*(math.cos(b*(math.pi/180))))**(1/2))))

Buggy python submission (verdict: Runtime Error):
import math
A,B,H,M=map(int,input().split())

C=[]
for i in range(10):
    if 0<abs(360*i-abs(30*H+int(M/2)-6*M))<180:
        a=abs(360*i-abs(30*H+int(M/2)-6*M))
        c=(180-abs(360*i-abs(30*H+int(M/2)-6*M)))
        break
b=min(a,c)

print("{:.12f}".format(((A**2+B**2-2*A*B*(math.cos(b*(math.pi/180))))**(1/2))))

Fixed submission:
import math
A,B,H,M=map(int,input().split())

for i in range(10):
    if 0<=abs(360*i-abs(30*H+(M/2)-6*M))<360:
        a=abs(360*i-abs(30*H+(M/2)-6*M))
        c=abs(360-abs(360*i-abs(30*H+(M/2)-6*M)))
        break
b=min(a,c)

print("{:.9f}".format(((A**2+B**2-2*A*B*(math.cos(b*(math.pi/180))))**(1/2))))

Buggy python submission (verdict: Runtime Error):
import math
A,B,H,M=map(int,input().split())

C=[]
for i in range(10):
    if 0<abs(360*i-abs(30*H-6*M))<180:
        a=abs(360*i-abs(30*H-6*M))
        break
b=min(a,abs(30*H-6*M))

print("{:.12f}".format(((A**2+B**2-2*A*B*(math.cos(b*(math.pi/180))))**(1/2))))

Fixed submission:
import math
A,B,H,M=map(int,input().split())

for i in range(10):
    if 0<=abs(360*i-abs(30*H+(M/2)-6*M))<360:
        a=abs(360*i-abs(30*H+(M/2)-6*M))
        c=abs(360-abs(360*i-abs(30*H+(M/2)-6*M)))
        break
b=min(a,c)

print("{:.9f}".format(((A**2+B**2-2*A*B*(math.cos(b*(math.pi/180))))**(1/2))))
Buggy python submission (verdict: Runtime Error):
N=int(input())
S=[input() for i in range(N)]
print(len(set(S)))

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

if int(W)>=int(S):
    print("unsafe")
else:
    print("safe")
Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))

for j in range(1,N+1):
    totalj=0
    for i in range(N-1):
        if A[i]==j:
            totalj=totalj+1
    print(totalj)

Fixed submission:
R=input()
import math
print(2*math.pi*int(R))
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))

for j in range(1,N+1):
    print(A.count(j))

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

D={}
for i in range(N-1):
    if (A[i] in D.keys())==True:
        D[A[i]]+=1
    elif (A[i] in D.keys())==False:
        D[A[i]]=1
for i in range(1,N+1):
    try:
        print(D[i])
    except:
        print(0)

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

for j in range(1,N+1):
    print(A.count(j))

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

D={}
for i in range(N-1):
    if (A[i] in D.keys())==True:
        D[A[i]]+=1
    elif (A[i] in D.keys())==False:
        D[A[i]]=1
for i in range(1,N+1):
    try:
        print(D[i])
    except:
        print(0)

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

for j in range(1,N+1):
    print(A.count(j))

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

D={}
for i in range(N-1):
    if (A[i] in D.keys())==True:
        D[A[i]]+=1
    elif (A[i] in D.keys())==False:
        D[A[i]]=1
for i in range(1,N+1):
    try:
        print(D[i])
    except:
        print(0)

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

for j in range(1,N+1):
    totalj=0
    for i in range(N-1):
        if A[i]==j:
            totalj=totalj+1
    print(totalj)

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

D={}
for i in range(N-1):
    if (A[i] in D.keys())==True:
        D[A[i]]+=1
    elif (A[i] in D.keys())==False:
        D[A[i]]=1
for i in range(1,N+1):
    try:
        print(D[i])
    except:
        print(0)

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

for j in range(1,N+1):
    totalj=0
    for i in range(N-1):
        if A[i]==j:
            totalj=totalj+1
    print(totalj)

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

D={}
for i in range(N-1):
    if (A[i] in D.keys())==True:
        D[A[i]]+=1
    elif (A[i] in D.keys())==False:
        D[A[i]]=1
for i in range(1,N+1):
    try:
        print(D[i])
    except:
        print(0)
Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int,input().split())

a=N
while True:
    if a-K>=0:
        a=a-K
    elif K-a>=a:
        a=a
        break
    else:
        a=K-a
print(a)

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

a=N
while True:
    if a-10**16*K>=0:
        a=a-10**16*K
    elif a-10**14*K>=0:
        a=a-10**14*K
    elif a-10**12*K>=0:
        a=a-10**12*K
    elif a-10**10*K>=0:
        a=a-10**10*K
    elif a-10**8*K>=0:
        a=a-10**8*K
    elif a-10**6*K>=0:
        a=a-10**6*K
    elif a-10**4*K>=0:
        a=a-10**4*K
    elif a-10**2*K>=0:
        a=a-10**2*K
    elif a-K>=0:
        a=a-K
    elif K-a>=a:
        a=a
        break
    else:
        a=K-a
print(a)
Buggy python submission (verdict: Time Limit Exceeded):
S=list(input())
q=int(input())
Q=[input().split() for i in range(q)]

reverse=0
for i in range(q):
    if Q[i][0]=="1":
        reverse+=1
    elif Q[i][0]=="2" and reverse%2==0:
        if Q[i][1]=="1":
            S.insert(0,Q[i][2])
        elif Q[i][1]=="2":
            S.append(Q[i][2])
    elif Q[i][0]=="2" and reverse%2==1:
        if Q[i][1]=="2":
            S.insert(0,Q[i][2])
        elif Q[i][1]=="1":
            S.append(Q[i][2])
if reverse%2==1:
    S.reverse()
for i in S:
    print(i,end="")

Fixed submission:
S=list(input())
q=int(input())
Q=[input().split() for i in range(q)]

reverse=0
Top=[]
Bottom=[]
for i in range(q):
    if Q[i][0]=="1":
        reverse+=1
    elif Q[i][0]=="2" and reverse%2==0:
        if Q[i][1]=="1":
            Top.append(Q[i][2])
        elif Q[i][1]=="2":
            Bottom.append(Q[i][2])
    elif Q[i][0]=="2" and reverse%2==1:
        if Q[i][1]=="2":
            Top.append(Q[i][2])
        elif Q[i][1]=="1":
            Bottom.append(Q[i][2])
if reverse%2==1:
    Top.reverse()
    SS=Top+S+Bottom
    SS.reverse()
elif reverse%2==0:
    Top.reverse()
    SS=Top+S+Bottom
for i in SS:
    print(i,end="")

Buggy python submission (verdict: Time Limit Exceeded):
S=list(input())
q=int(input())
Q=[input().split() for i in range(q)]

for i in range(q):
    if Q[i][0]=="1":
        S.reverse()
    elif Q[i][0]=="2":
        if Q[i][1]=="1":
            S.insert(0,Q[i][2])
        elif Q[i][1]=="2":
            S.append(Q[i][2])
for i in S:
    print(i,end="")


Fixed submission:
S=list(input())
q=int(input())
Q=[input().split() for i in range(q)]

reverse=0
Top=[]
Bottom=[]
for i in range(q):
    if Q[i][0]=="1":
        reverse+=1
    elif Q[i][0]=="2" and reverse%2==0:
        if Q[i][1]=="1":
            Top.append(Q[i][2])
        elif Q[i][1]=="2":
            Bottom.append(Q[i][2])
    elif Q[i][0]=="2" and reverse%2==1:
        if Q[i][1]=="2":
            Top.append(Q[i][2])
        elif Q[i][1]=="1":
            Bottom.append(Q[i][2])
if reverse%2==1:
    Top.reverse()
    SS=Top+S+Bottom
    SS.reverse()
elif reverse%2==0:
    Top.reverse()
    SS=Top+S+Bottom
for i in SS:
    print(i,end="")
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=[input() for i in range(N)]

D={}
for i in range(N):
    if (S[i] in D.keys())==True:
        D[S[i]]+=1
    elif (S[i] in D.keys())==False:
        D[S[i]]=1

m=max(D.values())

M=[]
for i in D.keys():
    if D[i]==m:
        M.append(i)

M2=sorted(M)
for i in M2:
    print(i)

Fixed submission:
N=int(input())
S=[input() for i in range(N)]

D={}
for i in range(N):
    try:
        if D[S[i]]>=1:
            D[S[i]]+=1
    except:
        D[S[i]]=1
E=sorted(D.items(),key=lambda x:x[1])
m=E[-1][1]
ans=[]
for i in E:
    if i[1]==m:
        ans.append(i[0])
for i in sorted(ans):
    print(i)

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

s=set(S)

D={}
for i in s:
    total=0
    for j in S:
        if i==j:
            total+=1
    D[i]=total

V=[]
for value in D.values():
       V.append(value)
m=max(V)

A=[]
for i in D.keys():
    if D[i]==m:
        A.append(i)

B=sorted(A)
for i in B:
    print(i)

Fixed submission:
N=int(input())
S=[input() for i in range(N)]

D={}
for i in range(N):
    try:
        if D[S[i]]>=1:
            D[S[i]]+=1
    except:
        D[S[i]]=1
E=sorted(D.items(),key=lambda x:x[1])
m=E[-1][1]
ans=[]
for i in E:
    if i[1]==m:
        ans.append(i[0])
for i in sorted(ans):
    print(i)
Buggy python submission (verdict: Runtime Error):
N=int(input())
A=input().split()

B=set(A)
if len(A)=len(B):
    print("YES")
else:
    print("NO")

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

B=set(A)
if len(A)==len(B):
    print("YES")
else:
    print("NO")

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

a=True
for i in range(N):
    b=A[0]
    A.remove(b)
    if (b in A)==True:
        print("NO")
        a=False
        break
if a==True:
    print("YES")

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

B=set(A)
if len(A)==len(B):
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
N=int(input())
P=list(map(int,input().split()))

total=1
minP=P[0]
for i in range(1,N):
    if P[i]<minP:
        total+=1
        minP=P[i]
print(total)


Fixed submission:
N,M=input().split()
if N==M:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
N=int(input())
P=list(map(int,input().split()))

total=1
minP=P[0]
for i in range(1,N):
    if P[i]<minP:
        total=+=1
        minP=P[i]
print(total)

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

total=1
minP=P[0]
for i in range(1,N):
    if P[i]<minP:
        total+=1
        minP=P[i]
print(total)

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

total=0
for i in range(1,N+1):
    A=P[:i]
    B=sorted(A)
    if B[0]==A[i-1]:
        total+=1
print(total)

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

total=1
minP=P[0]
for i in range(1,N):
    if P[i]<minP:
        total+=1
        minP=P[i]
print(total)

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

total=1
for i in range(1,N):
    A=P[:i:]
    if P[i]<min(A):
        total+=1
print(total)

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

total=1
minP=P[0]
for i in range(1,N):
    if P[i]<minP:
        total+=1
        minP=P[i]
print(total)
Buggy python submission (verdict: Runtime Error):
N=int(input())
S=input()
s=list(S)

total=0
for i in range(N):
    if s[i]=="A":
        if s[i+1]=="B":
            if s[i+2]=="C":
                total=total+1
print(total)

Fixed submission:
N=int(input())
S=input()
s=list(S)

total=0
for i in range(N-2):
    if s[i]=="A" and s[i+1]=="B" and s[i+2]=="C":
        total=total+1
print(total)
Buggy python submission (verdict: Runtime Error):
import math
A,B=map(int,input().split())

def lcm(x,y):
    return int((x*y)/math.gcd(x,y))

print(lcm(A,B))

Fixed submission:
import fractions
A,B=map(int,input().split())

def lcm(x,y):
    return int((x*y)/fractions.gcd(x,y))

print(lcm(A,B))

Buggy python submission (verdict: Runtime Error):
import math
A,B=map(int,input().split())

def lcm(x,y):
    return (x*y)//math.gcd(x,y)

print(lcm(A,B))

Fixed submission:
import fractions
A,B=map(int,input().split())

def lcm(x,y):
    return int((x*y)/fractions.gcd(x,y))

print(lcm(A,B))
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())

a=[]
for i in range(1,N):
    a.append(i)

print(sum(a))


Fixed submission:
N=int(input())
print(N*(N-1)//2)
Buggy python submission (verdict: Runtime Error):
N=int(input())
A=[int(input()) for i in range(N)]
M=sorted(A)

for i in range(N):
    if M[N-1]>A[i]:
        print(M[N])
    elif M[N-1]==A[i]:
        print(M[N-1])

Fixed submission:
N=int(input())
A=[int(input()) for i in range(N)]
M=sorted(A)

for i in range(N):
    if M[N-1]>A[i]:
        print(M[N-1])
    elif M[N-1]==A[i]:
        print(M[N-2])

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=[int(input()) for i in range(N)]
M=max(A)

for i in range(N):
    if M>A[i]:
        print(M)
    elif M==A[i]:
        A[i]=0
        print(max(A))
        A[i]=M

Fixed submission:
N=int(input())
A=[int(input()) for i in range(N)]
M=sorted(A)

for i in range(N):
    if M[N-1]>A[i]:
        print(M[N-1])
    elif M[N-1]==A[i]:
        print(M[N-2])
Buggy python submission (verdict: Runtime Error):
IN = input()
if IN.isupper():
  return "A"
else:
  return "a"

Fixed submission:
IN = input()
if IN.isupper():
  print("A")
else:
  print("a")
Buggy python submission (verdict: Runtime Error):
n = int(input())
arr = list(map(int, input().split()))

ans,flag = 1,0
for elem in arr:
  ans = ans*elem
  if ans>1e18:
  	flag=1
    break
    
if flag==1: print(-1)
else: print(ans)

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

ans,flag = 1,0
for elem in sorted(arr):
    ans = ans*elem
    if ans>1e18:
        flag = 1
        break
    if ans==0: break
    
if flag==1: print(-1)
else: print(ans)