Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import fractions
import bisect
import math

mod=1000000007
N=int(input())
A=list(map(int,input().split()))
A.sort(reverse=True)
A.sort(key=lambda x: x[1])


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

for i in range(N):
    A,B=map(int,input().split())
    B.append([A,B])

for i in reversed(range(N)):
print(B[i], end="")

B=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']

math.ceil()   #切り上げ
math.floor()  #切り捨て

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


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

def factorize(n):
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b = b + 1
    if n > 1:
        fct.append(n)
    return fct

bisect.bisect_left(a,x)



Fixed submission:
A,B=map(int,input().split())
if A<=B*2:
    print(0)
else:
    print(A-B*2)
Buggy python submission (verdict: Runtime Error):
def divisor(n): #nの約数を全て求める
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table

def primes(n): #エラストテネスの篩
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

A, B = map(int, input().split())
F=primes(max(A,B)//2)
C=divisor(A)
C.sort()
D=divisor(B)
D.sort()
a=0
b=0

E=list(set(C)&set(D))
G=list(set(E)&set(F))
print(len(G)+1)

Fixed submission:
def prime_decomposition(n): #素因数分解でリストを返す
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(i)
    i += 1
  if n > 1:
    table.append(n)
  return table

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

C=prime_decomposition(A)
D=prime_decomposition(B)
E=list(set(C)&set(D))
print(len(E)+1)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=[]
count=0
for i in range(N):
    S=''.join(sorted(input()))
    A.append(S)

for i in range(N):
    for j in range(i,N):
        if A[i]==A[j] and i!=j:
            count+=1
print(count)

Fixed submission:
N=int(input())
A=[]
D={}
count=0
for i in range(N):
    S=''.join(sorted(input()))
    A.append(S)

for s in A:
    if s in D:
        count+=D[s]
        D[s]+=1
    else:
        D[s]=1
print(count)
Buggy python submission (verdict: Runtime Error):
def make_divisors(n):
    #divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            B[i]+=1
            if i != n // i:
                B[n//i]+=1

    # divisors.sort()
    #return divisors

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

B=[0]*3000000
C=[]
count=0
for i in reversed(range(N)):
    if B[i]%2!=A[i]:
        make_divisors(i+1)
        count +=1
        C.append(i+1)
print(count)
if count!=0:
    print(C[0],end="")
    for i in range(1,count):
        print(" "+str(C[i]),end=""

Fixed submission:
def make_divisors(n):
    #divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            B[i]+=1
            if i != n // i:
                B[n//i]+=1

    # divisors.sort()
    #return divisors

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

B=[0]*300000
C=[]
count=0
for i in reversed(range(N)):
    if B[i+1]%2!=A[i]:
        make_divisors(i+1)
        count +=1
        C.append(i+1)
print(count)
#print(B)
if count!=0:
    for i in reversed(range(1,count)):
        print(str(C[i])+" ",end="")
    print(C[0], end="")

Buggy python submission (verdict: Runtime Error):
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            B[i]+=1
            if i != n // i:
                B[n//i]+=1

    # divisors.sort()
    return divisors

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

B=[0]*3000000
C=[]
count=0
for i in reversed(range(N)):
    if B[i]%2!=A[i]:
        make_divisors(i+1)
        count +=1
        C.append(i+1)
print(count)
if count!=0:
    print(C[0],end="")
    for i in range(1,count):
        print(" "+C[i],end="")

Fixed submission:
def make_divisors(n):
    #divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            B[i]+=1
            if i != n // i:
                B[n//i]+=1

    # divisors.sort()
    #return divisors

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

B=[0]*300000
C=[]
count=0
for i in reversed(range(N)):
    if B[i+1]%2!=A[i]:
        make_divisors(i+1)
        count +=1
        C.append(i+1)
print(count)
#print(B)
if count!=0:
    for i in reversed(range(1,count)):
        print(str(C[i])+" ",end="")
    print(C[0], end="")
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N=int(input())

A=list(map(int,input().split()))
for i in range(N):
    A[i]=A[i]*2
C=[]
for i in range(N-1):
    B = [0] * (N)
    B[i]=0.5
    B[i+1]=0.5
    C.append(B)
B = [0] * (N)
B[0]=0.5
B[N-1]=0.5
C.append(B)

X=np.linalg.solve(C,A)
for i in range(N):
    print(int(X[i]/2),end=" ")




Fixed submission:
N=int(input())
total=0
A=list(map(int,input().split()))
for i in range(N):
    total+=A[i]
for i in range(N):
    if i%2==1:
        total-=A[i]*2
print(int(total),end=" ")
for i in range(N-1):
    print(int(A[i]*2-total),end=" ")
    total=A[i]*2-total
Buggy python submission (verdict: Runtime Error):

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

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

E=C*D//gcd(C,D)
total=0
if A%C==0 and A>=C:
    total += B//C-A//C+1
else:
    total += B // C - A // C

if A%D==0 and A>=D:
    total += B//D-A//D+1
else:
    total += B // D - A// D

if A%E==0 and A>=E:
    total = total- B//E-A//E+1
else:
    total = total - B // E - A // E

print(B-A+1-tot

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


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


E = C * D // gcd(C, D)
total = 0

total += B // C - (A-1) // C


total += B // D - (A-1) // D


total = total - B // E + (A-1) // E

print(B - A + 1 - total)

Buggy python submission (verdict: Runtime Error):
import math
A,B,C,D = map(int, input().split())
E=C*D//math.gcd(C,D)
total=0
if A%C==0:
    total += B//C-(A)//C+1
else:
    total += B // C - (A) // C

if A%D==0:
    total += B//D-(A-1)//D+1
else:
    total += B // D - (A - 1) // D

if A%E==0:
    total = total- B//E-A//E+1
else:
    total = total - B // E - A // E

print(B-A+1-total)

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


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


E = C * D // gcd(C, D)
total = 0

total += B // C - (A-1) // C


total += B // D - (A-1) // D


total = total - B // E + (A-1) // E

print(B - A + 1 - total)
Buggy python submission (verdict: Runtime Error):
N=int(input())
A=[]
B=[]
len=B.len
str='Yes'
total=0
time=0
for i in range(N):
    a,b = map(int, input().split())
    A.append(a)
    B.append(b)
B.sort()
AB=B+A
time=min(B)
for j in range(N):
    time += AB[j]
    total +=AB[j+len]
    if total>time:
        str='No'
print(str)

Fixed submission:
N=int(input())
A=[]

str='Yes'
total=0
time=0
for i in range(N):
    a,b, = map(int, input().split())
    A.append([b,a])

A.sort()


for j in range(N):
    if time<=A[j][0]:
        time = A[j][0]

    A[j][0]=100000000000
    total +=A[j][1]

    if total>time:
        str='No'
print(str)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=[]
B=[]
str='Yes'
total=0
time=0
for i in range(N):
    a,b = map(int, input().split())
    A.append(a)
    B.append(b)

time=min(B)
for j in range(N):
    if time<=min(B):
        time = min(B)
    K=B.index(min(B))
    B[K]=1000000000000
    total +=A[K]
    if total>time:
        str='No'
print(str)

Fixed submission:
N=int(input())
A=[]

str='Yes'
total=0
time=0
for i in range(N):
    a,b, = map(int, input().split())
    A.append([b,a])

A.sort()


for j in range(N):
    if time<=A[j][0]:
        time = A[j][0]

    A[j][0]=100000000000
    total +=A[j][1]

    if total>time:
        str='No'
print(str)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=[]
B=[]
str='Yes'
total=0
time=0
for i in range(N):
    a,b = map(int, input().split())
    A.append(a)
    B.append(b)

time=min(B)
for j in range(N):
    if time<=min(B):
        time = min(B)
    K=B.index(min(B))
    B.pop(K)
    total +=A[K]
    if total>time:
        str='No'
print(str)

Fixed submission:
N=int(input())
A=[]

str='Yes'
total=0
time=0
for i in range(N):
    a,b, = map(int, input().split())
    A.append([b,a])

A.sort()


for j in range(N):
    if time<=A[j][0]:
        time = A[j][0]

    A[j][0]=100000000000
    total +=A[j][1]

    if total>time:
        str='No'
print(str)
Buggy python submission (verdict: Runtime Error):
from fractions import gcd
from math import gcd

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

total=0
left=[0]*(N+1)
right=[0]*(N+1)

for i in range(N):
    left[i+1]=gcd(left[i],A[i])
    right[N -i - 1] = gcd(right[N-1], A[N-1-i])

for i in range(N):
    total=max(total,gcd(left[i],right[i+1]))

print(total)

Fixed submission:
from fractions import gcd


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

total=0
left=[0]*(N+1)
right=[0]*(N+1)

for i in range(N):
    left[i+1]=gcd(left[i],A[i])
    right[N -i - 1] = gcd(right[N-i], A[N-1-i])

for i in range(N):
    total=max(total,gcd(left[i],right[i+1]))

print(total)

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

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

total=0
left=[0]*(N+1)
right=[0]*(N+1)

for i in range(N):
    left[i+1]=(fractions.gcd(left[i]),A[i])
    left[i + 1] = (fractions.gcd(left[N-1]), A[N-1-i])

for i in range[N]:
    total=max(total,fractions.gcd(left[i]),right[N+1])
    
print(total)

Fixed submission:
from fractions import gcd


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

total=0
left=[0]*(N+1)
right=[0]*(N+1)

for i in range(N):
    left[i+1]=gcd(left[i],A[i])
    right[N -i - 1] = gcd(right[N-i], A[N-1-i])

for i in range(N):
    total=max(total,gcd(left[i],right[i+1]))

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


A.sort()

mini=A[0]
flag=0

for i in range(1,N-1):
    if A[i]%mini!=0:
        mini=min(mini,A[i+1]%mini)
        flag=1

if flag==0:
    print(A[0])
else:
    print(mini)


Fixed submission:
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

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

GCD=gcd(A[0],A[1])
for i in range(2,N):
    GCD=gcd(GCD,A[i])
print(GCD)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
A=[]
count=[1]*100000
ans=[]
for i in range(M):
    a, b, = map(int, input().split())
    A.append([b, a, i])

A.sort()

for i in range(M):
    number=A[i][1]*1000000+count[int(A[i][1])]
    ans.append([A[i][2],str(number).zfill(12)])
    count[int(A[i][1])] +=1
ans.sort()

for i in range(M):
    print(ans[i][1])



Fixed submission:
N, M = map(int, input().split())
A=[]
count=[1]*1000000
ans=[]
for i in range(M):
    a, b, = map(int, input().split())
    A.append([b, a, i])

A.sort()

for i in range(M):
    number=A[i][1]*1000000+count[int(A[i][1])]
    ans.append([A[i][2],str(number).zfill(12)])
    count[int(A[i][1])] +=1
ans.sort()

for i in range(M):
    print(ans[i][1])

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
A=[]
count=[1]*100000
number=0
for i in range(M):
    a, b, = map(int, input().split())
    A.append([b, a])

A.sort()

for i in range(M):
    number=A[i][1]*1000000+count[int(A[i][1])]
    print(str(number).zfill(12))
    count[int(A[i][1])] +=1



Fixed submission:
N, M = map(int, input().split())
A=[]
count=[1]*1000000
ans=[]
for i in range(M):
    a, b, = map(int, input().split())
    A.append([b, a, i])

A.sort()

for i in range(M):
    number=A[i][1]*1000000+count[int(A[i][1])]
    ans.append([A[i][2],str(number).zfill(12)])
    count[int(A[i][1])] +=1
ans.sort()

for i in range(M):
    print(ans[i][1])
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))
total=0
total2=0
count=1
ans=0
for i in range(N):
    total+=A[i]
for i in range(1,N+1):
    total2+=i
while True:
    if total>total2:
        if total//N+total%N>total2:
            count+=(total-total//N+total%N)//N
            total=total//N+total%N
        else:
            break
    elif total<total2:
        if total+total*N<total2:
            count+=total
            total+=total*N
        else:
            break
    else:
        break

if total>total2:
    while True:
        total2 +=N
        count+=1
        if total2>=total:
            if abs(total2-total)<=abs(total2-total-N):
                break
            else:
                count-=1
                break
elif total<total2:
    while True:
        total2 -=N
        count-=1
        if total2<=total:
            if abs(total2-total)<=abs(total2-total-N):
                break
            else:
                count+=1
                break

for i in range(N):
    ans+=abs(A[i]-count)
    count+=1

print(ans)


Fixed submission:
N=int(input())
A=list(map(int,input().split()))
B=[]
total=0
for i in range(N):
    B.append(A[i]-i-1)

B.sort()
#print(B)
if len(A)%2==1:
    for i in range(N):
        total+=abs(A[i]-(B[len(B)//2]+i+1))
        #print(B[len(B)//2+1],total)
else:
    for i in range(N):
        total+=abs(A[i]-(B[len(B)//2]+i+1))
print(total)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))
total=0
total2=0
count=1
ans=0
for i in range(N):
    total+=A[i]
for i in range(1,N+1):
    total2+=i


if total>total2:
    while True:
        total2 +=N
        count+=1
        if total2>=total:
            if abs(total2-total)<=abs(total2-total-N):
                break
            else:
                count-=1
                break
elif total<total2:
    while True:
        total2 -=N
        count-=1
        if total2<=total:
            if abs(total2-total)<=abs(total2-total-N):
                break
            else:
                count+=1
                break

for i in range(N):
    ans+=abs(A[i]-count)
    count+=1

print(ans)


Fixed submission:
N=int(input())
A=list(map(int,input().split()))
B=[]
total=0
for i in range(N):
    B.append(A[i]-i-1)

B.sort()
#print(B)
if len(A)%2==1:
    for i in range(N):
        total+=abs(A[i]-(B[len(B)//2]+i+1))
        #print(B[len(B)//2+1],total)
else:
    for i in range(N):
        total+=abs(A[i]-(B[len(B)//2]+i+1))
print(total)
Buggy python submission (verdict: Runtime Error):
A,B,C=map(int,input().split())
total=abs(max(A,B,C)-A)+abs(max(A,B,C)-B)+abs(max(A,B,C)-C)

if total%2==0:
    print(total//2)
else:
    print((total+1)//2+

Fixed submission:
A,B,C=map(int,input().split())
total=abs(max(A,B,C)-A)+abs(max(A,B,C)-B)+abs(max(A,B,C)-C)

if total%2==0:
    print(total//2)
else:
    print((total+1)//2+1)
Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
A.sort()
a=0
B=[]
C=[]
count=1
for i in range(len(A)):
    if A[i]==a:
        count+=1
    else:
        if count>=2:
            B.append(A[i-1])
        if count>=4:
            C.append(A[i-1])
        a=A[i]
        count=1
if count>=2:
    B.append(A[N-1])
if len(B)<2 and len(C)<1:
    print(0)
else:
    print(max(B[len(B)-1]*B[len(B)-2],C[len(C)]*C[len(C)]))

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
A.sort(reverse=True)
a=0
H=0
W=0
count=1
for i in range(len(A)):
    #print(A[i],H,W)
    if A[i]==a:
        count+=1
    else:
        if count>=4:
            if H<A[i-1]:
                H=A[i-1]
            if W < A[i - 1]:
                W=A[i-1]
        elif count>=2:
            if H!=0:
                W=A[i-1]
            else:
                H=A[i-1]
        a=A[i]
        count=1
        if H!=0 and W!=0:
            print(H*W)
            exit(0)
if count>=4:
    if H<A[i-1]:
        H=A[i-1]
    if W < A[i - 1]:
        W=A[i-1]
elif count>=2:
    if H!=0:
        W=A[i-1]
    else:
        H=A[i-1]
print(H*W)
Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
B=[0]*100000
total=0
mini=1000000000000000000
for i in range(N):
    total+=A[i]
    B[i]=total

for i in range(N):
    if abs(B[i]-(B[N-1]-B[i]))<mini:
        mini=abs(B[i] - (B[N - 1] - B[i]))
print(mini)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
B=[0]*200000
total=0
mini=1000000000000000000
for i in range(N):
    total+=A[i]
    B[i]=total

for i in range(N-1):
    if abs(B[i]-(B[N-1]-B[i]))<mini:
        mini=abs(B[i] - (B[N - 1] - B[i]))
print(mini)

Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
B=[0]*100000
total=0
mini=1000000000000000000
for i in range(N):
    total+=A[i]
    B[i]=total

for i in range(N-1):
    if abs(B[i]-(B[N-1]-B[i]))<mini:
        mini=abs(B[i] - (B[N - 1] - B[i]))
print(mini)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
B=[0]*200000
total=0
mini=1000000000000000000
for i in range(N):
    total+=A[i]
    B[i]=total

for i in range(N-1):
    if abs(B[i]-(B[N-1]-B[i]))<mini:
        mini=abs(B[i] - (B[N - 1] - B[i]))
print(mini)
Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())
total=1
mod=1000000007
if N==M:
    for i in range(1,N+1):
        total=total*i*i
    print((total*2)%mod)

elif N+1==M or M+1==N:
    total*=max(M,N)
    for i in range(1,min(M,N)+1):
        total=total*i*i
    print(total%mod)
else:
    print(0)

Fixed submission:
N,M=map(int,input().split())
total=1
mod=1000000007
if N==M:
    for i in range(1,N+1):
        total=total*i*i
        total=total%mod
    print((total*2)%mod)

elif N+1==M or M+1==N:
    total*=max(M,N)
    for i in range(1,min(M,N)+1):
        total=total*i*i
        total=total%mod
    print(total%mod)
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
B=[0]*10
count=0
for i in range(N):
    B[A[i]//400]+=1

for i in range(8):
    if B[i]>=1:
        count+=1

print(count, end=" ")
print(min(count+int(B[8]),8))

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
color = [0 for _ in range(8)]
e = 0

for a in A:
    k = a // 400
    if k < 8 and color[k] == 0:
        color[k] += 1
    elif k >= 8:
        e += 1

c = color.count(1)
y = e + c

if c == 0:
    x = 1
else:
    x = c

print(x, y)
Buggy python submission (verdict: Runtime Error):
import math
import fractions
N=int(input())
A=fractions.sqrt(N)
A=fractions.ceil(A)
mini=100000000000
for i in range(1,A+1):
    if N%i==0:
        x=len(str(i))
        y=len(str(N//i))
        if mini>max(x,y):
            mini=max(x,y)
print(mini)


Fixed submission:
import math
import fractions
N=int(input())
A=math.sqrt(N)
A=math.ceil(A)
mini=100000000000
for i in range(1,A+1):
    if N%i==0:
        x=len(str(i))
        y=len(str(N//i))
        if mini>max(x,y):
            mini=max(x,y)
print(mini)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
B=[]


for i in range(N):
    a,b, = map(int, input().split())
    B.append([a,b])

a=B[0][0]
b=B[0][1]

for i in range(1,N):
    a1=B[i][0]
    b1=B[i][1]
    if a>B[i][0] or b>B[i][1]:
        while a>a1 or b>b1:
            a1+=B[i][0]
            b1+=B[i][1]
        a=a1
        b=b1
    else:
        a=B[i][0]
        b=B[i][1]
print(a+b)


Fixed submission:
N = int(input())

A = 1
B = 1
for _ in range(N):
    x, y = map(int, input().split())
    na = A // x if A % x == 0 else A // x + 1
    nb = B // y if B % y == 0 else B // y + 1
    n = max(na, nb)
    A = n * x
    B = n * y

print(A + B)
Buggy python submission (verdict: Runtime Error):
S=input()
total=0

for i in range(2**(len(S)-1)):
    a = int(S[0])
    t=format(i,'b').zfill(len(S)-1)
    for j in range(len(t)):
        if t[j]=='0':
            a=a*10+int(S[j+1])
        else:
            total+=a
            a=int(S[j+1])
    total+=a

print(total)


Fixed submission:
S=input()
total=0
if len(S)==1:
    print(S)
    exit(0)
for i in range(2**(len(S)-1)):
    a = int(S[0])
    t=format(i,'b').zfill(len(S)-1)
    for j in range(len(t)):
        if t[j]=='0':
            a=a*10+int(S[j+1])
        else:
            total+=a
            a=int(S[j+1])
    total+=a

print(total)
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = float(input())
c = float(a) * b
ans = int(c//1)
print(ans)

Fixed submission:
a, b = input().split()

c = int(a)
d = int(float(b) * 1000)

e = c * d

ans = e // 1000
print(ans)

Buggy python submission (verdict: Runtime Error):
a = float(input())
b = float(input())
c = a * b
ans = int(c//1)
print(ans)

Fixed submission:
a, b = input().split()

c = int(a)
d = int(float(b) * 1000)

e = c * d

ans = e // 1000
print(ans)

Buggy python submission (verdict: Runtime Error):
a = input()
b = input()

c = float(a) * float(b)

print(c)

ans = int(c//1)

print(ans)

Fixed submission:
a, b = input().split()

c = int(a)
d = int(float(b) * 1000)

e = c * d

ans = e // 1000
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
max = 10 ** 18
ans = 1

for ele in a:
    ans = ans * ele

if ans > max:
    print('-1')
else:
    print(ans)


Fixed submission:
n = int(input())
a = list(map(int,input().split()))
max = 10 ** 18
ans = 1

if 0 in a:
    print('0')
    exit()

for ele in a:
    ans = ans * ele
    if ans > max:
        print('-1')
        exit()

print(ans)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
AB = []
for _ in range(M):
    AB.append(list(map(int, input().split())))

list = [0] * (N+1)

saitan = [1]
for _ in range(M):
    next = []
    for i in range(len(AB)):
        if AB[i][0] in saitan:
            if list[AB[i][1]] == 0:
                list[AB[i][1]] = AB[i][0]
                next.append(AB[i][1])
        if AB[i][1] in saitan:
            if list[AB[i][0]] == 0:
                list[AB[i][0]] = AB[i][1]
                next.append(AB[i][0])
    saitan.extend(next)


print("YES")
for ele in list[2:]:
    print(ele)


Fixed submission:
n = int(input()[-1])
if n == 3:
    ans = "bon"
elif n in [0,1,6,8]:
    ans = "pon"
else:
    ans = "hon"
print(ans)

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

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

cho = (H * 60 + M) / (12 * 60) * 360
tan = M / 60 * 360
degree = abs(cho-tan)

ans_2 = A**2 + B**2 - 2*A*B*math.cos(math.radians(degree))
print(math.sqrt(ans_2))


Fixed submission:
n = int(input()[-1])
if n == 3:
    ans = "bon"
elif n in [0,1,6,8]:
    ans = "pon"
else:
    ans = "hon"
print(ans)