Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
h = list(map(int,input().split()))
ans = [1]*n
for i in range(m):
    print(ans)
    a,b = map(int,input().split())
    if h[a-1]>h[b-1]:
        ans[b-1] = 0
    else if h[b-1]>h[a-1]:
        ans[a-1] = 0
    else:
        print("a")
        ans[a-1] = 0
        ans[b-1] = 0
print(ans.count(1))    

Fixed submission:
n,m = map(int,input().split())
h = list(map(int,input().split()))
ans = [1]*n
for i in range(m):
    a,b = map(int,input().split())
    if h[a-1]>h[b-1]:
        ans[b-1] = 0
    elif h[b-1]>h[a-1]:
        ans[a-1] = 0
    else:
        #print("a")
        ans[a-1] = 0
        ans[b-1] = 0
print(ans.count(1))
Buggy python submission (verdict: Runtime Error):
import math

data = input()
data = data.split()
n = data[0]
m = data[1]

v = (math.factorial(int(n)) // (math.factorial(int(n) - 2) * math.factorial(2)))+(math.factorial(int(m)) // (math.factorial(int(m) - 2) * math.factorial(2)))

print(v)

Fixed submission:
import math

data = input()
data = data.split()
n = data[0]
m = data[1]
v1 = 0
v2 = 0

if int(n) > 1:
	v1 = (math.factorial(int(n)) // (math.factorial(int(n) - 2) * math.factorial(2)))

if int(m) > 1:
    v2 = (math.factorial(int(m)) // (math.factorial(int(m) - 2) * math.factorial(2)))

print(v1+v2)
Buggy python submission (verdict: Runtime Error):
l=[]
s = "1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51"
s = s.replace(' ','')
l = s.split(',')
k = input()
print(l[int(k)])

Fixed submission:
l=[]
s = "1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51"
s = s.replace(' ','')
l = s.split(',')
k = input()
print(l[int(k)-1])
Buggy python submission (verdict: Runtime Error):
import sys
sys.stdin=open('input.txt','r')
sys.stdout=open('output.txt','w')
import math
a=int(input())
print(2*math.pi*a)


#a,b=map(input(),int.split())


Fixed submission:

import math
a=int(input())
print(2*math.pi*a)


#a,b=map(input(),int.split())
Buggy python submission (verdict: Runtime Error):
a=int(input())

print(a+a**2+a**3)

Fixed submission:
S=input()
T=input()

count=0
for i in range(len(S)):
  if S[i]!=T[i]:
    count+=1
    
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
 
N=int(input())
#print(N)
A=input().split()
A_int = [int(s) for s in A]
#print(A_int)
ans=1
for i in range(N):
  ans=ans*A_int[i]

if(ans>10**18):
  ans=-1

print(ans)

Fixed submission:
import sys
 
N=int(input())
#print(N)
A=input().split()
A_int = [int(s) for s in A]
#print(A_int)
if 0 in A_int:
  print(0)
  sys.exit()


ans=1
for i in range(N):
  ans=ans*A_int[i]
  if(ans>10**18):
    ans=-1
    break

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
x,n = map(int,input().split())
P = list(map(int,input().split()))
i = 0
while True:
    ans = x - i
    if ans in P:
        ans = x + i
        if ans in P:
            continue
        else:
            print(ans)
            break
    else:
        print(ans)
        break
    i = i + 1

Fixed submission:
x,n = map(int,input().split())
P = list(map(int,input().split()))
i = 0
if not x in P:
    print(x)
else:
    while True:
        ans = x - i
        if not ans in P:
            print(ans)
            break
        else:    
            ans = x + i
            if not ans in P:
                print(ans)
                break
        i = i + 1
Buggy python submission (verdict: Runtime Error):
A, V = map(int,input().split())
B, W = map(int,input().split())
T = int(input())
if A >= B
    if A + V * T >= B + W * T:
        print('YES')
    else:
        print('NO')
else:
    if V >= W:
        print('NO')
    elif A + V * T >= B + W * T:
        print('YES')
    else:
        print('NO')

Fixed submission:
A, V = map(int,input().split())
B, W = map(int,input().split())
T = int(input())
if A <= B:
    if A + V * T >= B + W * T:
        print('YES')
    else:
        print('NO')
else:
    if A - V * T <= B -  W * T:
        print('YES')
    else:
        print('NO')
Buggy python submission (verdict: Runtime Error):
from decimal import Decimal
a,b = input().split()
c = (int(a)*(decimal(b)*1000000))/1000000
print(int(c//1)

Fixed submission:
from decimal import Decimal
a,b = input().split()
c = int(a)*Decimal(b)
print(int(c))

Buggy python submission (verdict: Runtime Error):
a,b = input().split()
c = a*b
print(c//1)

Fixed submission:
from decimal import Decimal
a,b = input().split()
c = int(a)*Decimal(b)
print(int(c))

Buggy python submission (verdict: Runtime Error):
a,b = input().split()
c = (a*b)//1
print(c)

Fixed submission:
from decimal import Decimal
a,b = input().split()
c = int(a)*Decimal(b)
print(int(c))

Buggy python submission (verdict: Runtime Error):
a,b = input().split()
c = a*b
if type(c) == int:
	s = c
s,t =c.split('.')
print(s)

Fixed submission:
from decimal import Decimal
a,b = input().split()
c = int(a)*Decimal(b)
print(int(c))

Buggy python submission (verdict: Runtime Error):
a,b = input().split()
c = a*b
if type(c) == int:
    s = c
s,t =c.split('.')
print(s)

Fixed submission:
from decimal import Decimal
a,b = input().split()
c = int(a)*Decimal(b)
print(int(c))

Buggy python submission (verdict: Runtime Error):
a,b = input().split()
c = a*b
if type(c) == 'int':
    s = c
s,t =c.split('.')
print(s)

Fixed submission:
from decimal import Decimal
a,b = input().split()
c = int(a)*Decimal(b)
print(int(c))

Buggy python submission (verdict: Runtime Error):
a,b = map(float,input().split())
c = a*b
s,t =c.split('.')
print(s)

Fixed submission:
from decimal import Decimal
a,b = input().split()
c = int(a)*Decimal(b)
print(int(c))

Buggy python submission (verdict: Runtime Error):
a,b = map(float,input().split())
c = a*b
s,sc =c.split('.')
print(s)

Fixed submission:
from decimal import Decimal
a,b = input().split()
c = int(a)*Decimal(b)
print(int(c))

Buggy python submission (verdict: Runtime Error):
a,b = input().split()
c = a*b
s,sc =c.split('.')
print(s)

Fixed submission:
from decimal import Decimal
a,b = input().split()
c = int(a)*Decimal(b)
print(int(c))

Buggy python submission (verdict: Runtime Error):
a,b = input().split()
c = a*b
print('{:1g}'.format(c))

Fixed submission:
from decimal import Decimal
a,b = input().split()
c = int(a)*Decimal(b)
print(int(c))

Buggy python submission (verdict: Runtime Error):
a,b = input().split()
c = a*b
print('{:g}'.format(c))

Fixed submission:
from decimal import Decimal
a,b = input().split()
c = int(a)*Decimal(b)
print(int(c))

Buggy python submission (verdict: Runtime Error):
a,b = input().split()
c = a*b
print('{:,}'.format(c))

Fixed submission:
from decimal import Decimal
a,b = input().split()
c = int(a)*Decimal(b)
print(int(c))
Buggy python submission (verdict: Runtime Error):
a,b,c,d,e,f = map(int,input().split())
kis = a * 60 + b
nel = c * 60 + d
print(nel - f - kis)

Fixed submission:
a,b,c,d,e = map(int,input().split())
kis = a * 60 + b
nel = c * 60 + d
print(nel - e - kis)
Buggy python submission (verdict: Runtime Error):
T = input()
	print(T.replace('?','D'))

Fixed submission:
T = input()
print(T.replace('?','D'))

Buggy python submission (verdict: Runtime Error):
T = input()
	print(T.replace("?","D"))

Fixed submission:
T = input()
print(T.replace('?','D'))

Buggy python submission (verdict: Runtime Error):
t = input()
if t[len(t)]=="?":
    g == "D"
for i in range(len(t-1)):
    if t[i+1] == "?":
        if i == 0 and t[i+2] =="D":
            f="P"
        elif i == 0:
            f="D"
        if i > 1 and (t[i]=="P" or s[i] =="P"):
            f="D"
    s=s+f
print(s+g)
     

Fixed submission:
T = input()
print(T.replace('?','D'))

Buggy python submission (verdict: Runtime Error):
t = input()
if t[len(t)]=="?":
    g == "D"
for i in range(len(t-1)):
    if t[i+1] == "?":
        if i == 0 and t[i+2] =="D":
            f="P"
        elif i == 0:
            f="D"
        if i > 1 and t[i]=="P" or s[i] =="P":
            f="D"
    s=s+f
print(s+g)

Fixed submission:
T = input()
print(T.replace('?','D'))

Buggy python submission (verdict: Runtime Error):
t = input()
if t[len(t)]=="?":
    g == "D"
for i in range(len(t-1)):
    if t[i+1] == "?":
        if i == 0 and t[i+2] =="D":
            f="P"
        elif i == 0:
            f="D"
        if t[i]=="P" or s[i] =="P":
            f="D"
    s=s+f
print(s+g)

Fixed submission:
T = input()
print(T.replace('?','D'))

Buggy python submission (verdict: Runtime Error):
t = input()
if t[len(t)]=="?":
    g == "D"
for i in range(len(t-1)):
    if t[i+1] == "?":
        if i == 0 and t[i+2] =="D":
            f="P"
        elif i == 0:
            f="D"
        s[i+1] = t[i+1]
        if t[i]=="P" or s[i] =="P":
            f="D"
    s=s+f
print(s+g)
     

Fixed submission:
T = input()
print(T.replace('?','D'))

Buggy python submission (verdict: Runtime Error):
t = input()
if t[len(t)]=="?":
  s[len(t)] == "D"
for i in range(len(t-1)):
    if t[i+1] == "?":
        if i == 0 and t[i+2] =="D":
            s[i+1]="P"
        elif i == 0:
            s[i+1]="D"
        s[i+1] = t[i+1]
        if t[i]=="P" or s[i] =="P":
            s[i+1]="D"
    s=s+s[i+1]
print(s+s[len(t)])

Fixed submission:
T = input()
print(T.replace('?','D'))
Buggy python submission (verdict: Runtime Error):
a = int(input())
if a[-1] == 3:
    print('bon')
elif a[-1]==0 or a[-1]==1 or a[-1]==6 or a[-1]==8:
    print('pon')
else:
    print('hon')

Fixed submission:
a = str(input())
if a[-1] == '3':
    print('bon')
elif a[-1]=='0' or a[-1]=='1' or a[-1]=='6' or a[-1]=='8':
    print('pon')
else:
    print('hon')
Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
tree = list(map(int,input().split())) #比較用
tree_sub = tree #データの削除用
count = 0
for i in range(M):
    a,b = map(int,input().split())
    if (tree[a-1] > tree[b-1]) and (tree[b-1]== tree_sub[b-1]):
        tree_sub[b-1] = 0
    elif (tree[a-1] < tree[b-1]) and (tree[a-1] == tree_sub[a-1]):
        tree_sub[a-1] = 0
for i in range(M):
    if tree_sub[i] !=0:
        count += 1
print(count)

Fixed submission:
N,M = map(int,input().split())
tree = list(map(int,input().split())) #比較用
tree_sub = list(tree) #データの削除用
for i in range(M):
    a,b = map(int,input().split())
    if tree[a-1] > tree[b-1]:
        tree_sub[b-1] = 0
    elif tree[a-1] < tree[b-1]:
        tree_sub[a-1] = 0
    else:
        tree_sub[a-1] = 0
        tree_sub[b-1] = 0
print(len(tree_sub)-tree_sub.count(0))

Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
tree = list(map(int,input().split())) #比較用
tree_sub = tree #データの削除用
for i in range(M):
    a,b = map(int,input().split())
    if (tree[a-1] > tree[b-1]) and (int(tree[b-1]) in tree_sub):
        tree_sub[b-1] = 0
    elif (tree[a-1] < tree[b-1]) and (tree[a-1] in tree_sub):
        tree_sub[a-1] = 0
count = 0
for i in range(M):
    if tree_sub[i] != 0:
        count += 1
print(count)

Fixed submission:
N,M = map(int,input().split())
tree = list(map(int,input().split())) #比較用
tree_sub = list(tree) #データの削除用
for i in range(M):
    a,b = map(int,input().split())
    if tree[a-1] > tree[b-1]:
        tree_sub[b-1] = 0
    elif tree[a-1] < tree[b-1]:
        tree_sub[a-1] = 0
    else:
        tree_sub[a-1] = 0
        tree_sub[b-1] = 0
print(len(tree_sub)-tree_sub.count(0))

Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
tree = list(map(int,input().split())) #比較用
tree_sub = tree #データの削除用
for i in range(M):
    a,b = map(int,input().split())
    if (tree[a-1] > tree[b-1]) and (tree[b-1] in tree_sub):
        tree_sub.remove(b)
    elif (tree[a-1] < tree[b-1]) and (tree[b-1] in tree_sub):
        tree_sub.remove(a)
print(len(tree_sub))

Fixed submission:
N,M = map(int,input().split())
tree = list(map(int,input().split())) #比較用
tree_sub = list(tree) #データの削除用
for i in range(M):
    a,b = map(int,input().split())
    if tree[a-1] > tree[b-1]:
        tree_sub[b-1] = 0
    elif tree[a-1] < tree[b-1]:
        tree_sub[a-1] = 0
    else:
        tree_sub[a-1] = 0
        tree_sub[b-1] = 0
print(len(tree_sub)-tree_sub.count(0))
Buggy python submission (verdict: Runtime Error):
K = int(input())
A,B = map(int,input().split())
n = 1
while True:
    if A <= K*n and K*n <= B:
        print('OK')
        break
    elif Kn > B:
        print('NG')
        break
    n = n + 1 

Fixed submission:
K = int(input())
A,B = map(int,input().split())
n = 1
while True:
    if A <= K*n and K*n <= B:
        print('OK')
        break
    elif K*n > B:
        print('NG')
        break
    n = n + 1
Buggy python submission (verdict: Runtime Error):
from decimal import Decimal
import math 
X = int(input())
yen = 100
n = 1
while yen < X:
    yen = decimal(math.floor(yen*1.01*n))
    if X <= yen:
        print(n)
    n = n + 1

Fixed submission:
import math 
X = int(input())
yen = 100
n = 0
while yen < X:
    n = n + 1
    yen = math.floor(yen*1.01)
    if X <= yen:
        print(n)

Buggy python submission (verdict: Runtime Error):
from decimal import Decimal
import math 
X = int(input())
yen = 100
n = 1
while True:
    yen = decimal(math.floor(yen*1.01*n))
    if X <= yen:
        print(n)
        break
    n = n + 1

Fixed submission:
import math 
X = int(input())
yen = 100
n = 0
while yen < X:
    n = n + 1
    yen = math.floor(yen*1.01)
    if X <= yen:
        print(n)

Buggy python submission (verdict: Runtime Error):
from decimal import Decimal
from floor import math 
X = int(input())
yen = 100
n = 1
while True:
    yen = decimal(math.floor(yen*1.01*n))
    if X <= yen:
        print(n)
        break
    n = n + 1

Fixed submission:
import math 
X = int(input())
yen = 100
n = 0
while yen < X:
    n = n + 1
    yen = math.floor(yen*1.01)
    if X <= yen:
        print(n)

Buggy python submission (verdict: Runtime Error):
import decimal
import math 
X = int(input())
yen = 100
n = 1
while True:
    yen = decimal(math.floor(decimal(yen*1.01*n)))
    if X <= yen:
        print(n)
        break
    n = n + 1

Fixed submission:
import math 
X = int(input())
yen = 100
n = 0
while yen < X:
    n = n + 1
    yen = math.floor(yen*1.01)
    if X <= yen:
        print(n)

Buggy python submission (verdict: Runtime Error):
import decimal
import math 
X = int(input())
yen = desimal(100)
n = 1
while True:
    yen = math.floor(decimal(yen*1.01*n))
    if X <= yen:
        print(n)
        break
    n = n + 1

Fixed submission:
import math 
X = int(input())
yen = 100
n = 0
while yen < X:
    n = n + 1
    yen = math.floor(yen*1.01)
    if X <= yen:
        print(n)
Buggy python submission (verdict: Runtime Error):
S,W = int(input().split())
if S <= W:
    print('unsafe')
print('safe')

Fixed submission:
S,W = map(int,input().split())
if S <= W:
    print('unsafe')
else:
    print('safe')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
biki = []
bise = {}
for i in range(N):
    S = input()
    biki.append(S)
    bise=set(biki)
print(len(bise))

Fixed submission:
N = int(input())
biki = []
bise = {}
for i in range(N):
    S = input()
    biki.append(S)
bise=set(biki)
print(len(bise))

Buggy python submission (verdict: Runtime Error):
N = int(input())
biki = {}
for i in range(N):
    S = input()
    biki.append(S)
print(len(biki))


Fixed submission:
N = int(input())
biki = []
bise = {}
for i in range(N):
    S = input()
    biki.append(S)
bise=set(biki)
print(len(bise))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
biki = []
for i in range(N):
    S = input()
    if not S in biki:
        biki.append(S)
print(len(biki))

Fixed submission:
N = int(input())
biki = []
bise = {}
for i in range(N):
    S = input()
    biki.append(S)
bise=set(biki)
print(len(bise))
Buggy python submission (verdict: Runtime Error):
args = [int(input()) for in range(2)]

a = args[0]
b = args[1]

tap = 1
socket = a
while socket < b:
  tap += 1
  socket = socket + a - 1

print(tap)

Fixed submission:
args = input().split()
a = int(args[0])
b = int(args[1])
 
tap = 0
socket = 1
while socket < b:
  socket -= 1
  tap += 1
  socket += a
  
print(tap)

Buggy python submission (verdict: Runtime Error):
import sys
args = []
for l in sys.stdin:
  args.append(int(l))

a = args[0]
b = args[1]

tap = 1
kuti = a
while kuti < b:
  tap += 1
  kuti += (a - 1)
  
print(tap)
  

Fixed submission:
args = input().split()
a = int(args[0])
b = int(args[1])
 
tap = 0
socket = 1
while socket < b:
  socket -= 1
  tap += 1
  socket += a
  
print(tap)
Buggy python submission (verdict: Runtime Error):
if n == 1:
  print(0)
else:
  st = 0
  val = h[st]
  max_len = 0
  for i in range(1, n):
    next_val = h[i]
    if val < next_val:
      max_len = max(max_len, i - st -1)
      if i + max_len >= n:
        break
      st = i
    val = next_val
  
  if i == n - 1:
    max_len = max(max_len, n - 1 - st)
  
  print(max_len)

Fixed submission:
args = [input() for _ in range(2)]

N = int(args[0])
H = [int(l) for l in args[1].split()]

max_len = 0
val = H[0]
st = 0
for i in range(1, N):
  next_val = H[i]
  if val < next_val:
    max_len = max(max_len, i - st - 1)
    st = i
    if st + max_len >= N:
      break
  val = next_val

if (N != 1) and (i == N - 1):
  max_len = max(max_len, N - 1 - st)
  
print(max_len)

Buggy python submission (verdict: Runtime Error):
args = [input() for _ in range(2)]

N = int(args[0])
H = [int(l) for l in args[1].split()]

max_len = 0
val = H[0]
st = 0
for i in range(1, N):
  next_val = H[i]
  if val < next_val:
    max_len = max(max_len, i - st - 1)
    st = i
    if st + max_len >= N:
      break
  val = next_val

if i == N - 1:
  max_len = max(max_len, N - 1 - st)
  
print(max_len)

Fixed submission:
args = [input() for _ in range(2)]

N = int(args[0])
H = [int(l) for l in args[1].split()]

max_len = 0
val = H[0]
st = 0
for i in range(1, N):
  next_val = H[i]
  if val < next_val:
    max_len = max(max_len, i - st - 1)
    st = i
    if st + max_len >= N:
      break
  val = next_val

if (N != 1) and (i == N - 1):
  max_len = max(max_len, N - 1 - st)
  
print(max_len)

Buggy python submission (verdict: Runtime Error):
args = [input() for _ in range(2)]

N = int(args[0])
H = [int(l) for l in args[1].split()]

import numpy as np

H = np.array(H)

def get_max_len(arr):
  
  max_ind = np.argmax(arr)
  next_ind = max_ind + 1
  val = arr[max_ind]
  if next_ind >= len(arr):
    max_len = 0
  else:
    next_val = arr[next_ind]

    while val > next_val:
      val = next_val
      next_ind += 1
      if next_ind >= len(arr):
        break

      next_val = arr[next_ind]
    max_len = next_ind - max_ind - 1
	
  if max_ind >= max_len:
  	tmp_max_len = get_max_len(arr[:max_ind])
  	max_len = max(max_len, tmp_max_len)
  if len(arr[next_ind:]) - 1 > max_len:
  	tmp_max_len = get_max_len(arr[next_ind:])
  	max_len = max(max_len, tmp_max_len)
    
  return max_len

print(get_max_len(H))

Fixed submission:
args = [input() for _ in range(2)]

N = int(args[0])
H = [int(l) for l in args[1].split()]

max_len = 0
val = H[0]
st = 0
for i in range(1, N):
  next_val = H[i]
  if val < next_val:
    max_len = max(max_len, i - st - 1)
    st = i
    if st + max_len >= N:
      break
  val = next_val

if (N != 1) and (i == N - 1):
  max_len = max(max_len, N - 1 - st)
  
print(max_len)
Buggy python submission (verdict: Time Limit Exceeded):
n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

A = [0]
B = [0]
for i in range(len(a)):
    A.append(A[i]+a[i])
for i in range(len(b)):
    B.append(B[i]+b[i])

cnt = 0
for i, a_ in enumerate(A):
    m = k-a_
    j = len(B)-1
    t = 0
    if m < 0:
        break
    while m < B[j]:
        j-=1
    t = i+j
    cnt = max(cnt, t)
print(cnt)

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

A = [0]
B = [0]
for i in range(n):
    A.append(A[i]+a[i])
for i in range(m):
    B.append(B[i]+b[i])

cnt, j = 0, m#ここをfor文に入れなくていい。
for i, a_ in enumerate(A):
    d = k-a_
    t = 0
    if d < 0:
        break
    while d < B[j]:
        j-=1
    t = i+j
    cnt = max(cnt, t)
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

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

ans = 1
for num in a:
    ans = ans * num

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


Fixed submission:
import collections
import sys


def pow2(x, n):
    ret = 1
    while (n > 0):
        if (n & 1):
            ret *= x
        x *= x
        n = n >> 1
    return ret


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

if 0 in a:
    print(0)
    sys.exit(0)

c = collections.Counter(a)

l = sorted(list(c.keys()))

ans = 1
for num in l:
    ans *= pow2(num, c[num])
    if ans > 1000000000000000000:
        print(-1)
        sys.exit(0)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from operator import mul
from functools import reduce

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

ans = reduce(mul, a)

if ans > 1000000000000000000:
    print(-1)
else:
    print(ans)

Fixed submission:
import collections
import sys


def pow2(x, n):
    ret = 1
    while (n > 0):
        if (n & 1):
            ret *= x
        x *= x
        n = n >> 1
    return ret


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

if 0 in a:
    print(0)
    sys.exit(0)

c = collections.Counter(a)

l = sorted(list(c.keys()))

ans = 1
for num in l:
    ans *= pow2(num, c[num])
    if ans > 1000000000000000000:
        print(-1)
        sys.exit(0)
print(ans)

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

ans = 1
for n in a:
    ans = ans * n

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

Fixed submission:
import collections
import sys


def pow2(x, n):
    ret = 1
    while (n > 0):
        if (n & 1):
            ret *= x
        x *= x
        n = n >> 1
    return ret


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

if 0 in a:
    print(0)
    sys.exit(0)

c = collections.Counter(a)

l = sorted(list(c.keys()))

ans = 1
for num in l:
    ans *= pow2(num, c[num])
    if ans > 1000000000000000000:
        print(-1)
        sys.exit(0)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import math
a, b, n = map(int, input().split())

max_num = 0

x_list = [i for i in range(1, n + 1)]
for x in x_list:
    num = math.floor(a * x / b) - (a * math.floor(x / b))
    if max_num < num:
        max_num = num

print(max_num)

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

x = min(b - 1, n)

max_num = (a * x) // b - a * (x // b)
print(max_num)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

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


Fixed submission:
import collections

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

c = collections.Counter(a)

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

N = int(input())


def u_gcd(a, b):
    x = a
    y = b
    while True:
        tmp = x % y
        if tmp == 0:
            return y
        else:
            x = y
            y = tmp


def gcd(*numbers):
    return reduce(u_gcd, numbers)


sum_N = 0
for i in range(1, N + 1):
    for j in range(1, N + 1):
        for k in range(1, N + 1):
            sum_N += gcd(i, j, k)

print(sum_N)

Fixed submission:
import math
from functools import reduce
N = int(input())
 
 
def gcd(*numbers):
    return reduce(math.gcd, numbers)
 
 
sum_N = 0
for i in range(1, N + 1):
    for j in range(1, N + 1):
        for k in range(1, N + 1):
            sum_N += gcd(i, j, k)
 
print(sum_N)

Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce
N = int(input())


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


sum_N = 0
for i in range(1, N + 1):
    for j in range(1, N + 1):
        for k in range(1, N + 1):
            sum_N += gcd(i, j, k)

print(sum_N)


Fixed submission:
import math
from functools import reduce
N = int(input())
 
 
def gcd(*numbers):
    return reduce(math.gcd, numbers)
 
 
sum_N = 0
for i in range(1, N + 1):
    for j in range(1, N + 1):
        for k in range(1, N + 1):
            sum_N += gcd(i, j, k)
 
print(sum_N)