Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N = int(input())
nums = [int(s) for s in input().split()]

min_breaks = -1

count_num = 1
for i in range(N):
  check_num = count - nums[i]
  if nums[i] == count_num:
      if min_breaks == -1:
          min_breaks = 0
      min_break += i - count_num
      
if min_break < N:    
    print(min_break)
else:
    print(-1)

Fixed submission:
N = int(input())
nums = [int(s) for s in input().split()]
 
min_breaks = -1
 
count_num = 1
break_index = 1

for i in range(N):
  if nums[i] == count_num:
      if min_breaks == -1:
          min_breaks = 0
      if count_num == 1:
      	 min_breaks += ((i+1) - break_index)
      else:
         min_breaks += ((i+1) - break_index - 1)
      
      break_index = (i+1)
      count_num+=1

if break_index < N and min_breaks != -1:
  min_breaks += ((i+1) - break_index)
  
print(min_breaks)
Buggy python submission (verdict: Runtime Error):
str_original = input()
N = len(str_original)
loop = floor(N/2)

count = 0
for i in range(loop):
  if str_original[i] != str_original[N-i]:
     count+= 1
      
return count

Fixed submission:
str_original = input()
N = len(str_original)
loop = int(N/2)
 
count = 0
for i in range(loop):
  if str_original[i] != str_original[(N-1)-i]:
     count+= 1
      
print(count)
Buggy python submission (verdict: Runtime Error):
def LI:
	return [int(s) for s in input().split()]
  

D1 = LI()
D2 = LI()

if print(0) if D2[0] != D1[0] else print(1)

Fixed submission:
def LI():
	return [int(s) for s in input().split()]

D1 = LI()
D2 = LI()
 
print(1) if D2[1] == 1 else print(0)
Buggy python submission (verdict: Runtime Error):
N = int(input())
str_input = input()
 
if N % 2 != 0:
  print('No')
else:
  print('Yes') if str_input[:N/2] == str_input[(N/2):] else print('No')

Fixed submission:
N = input()
S = input()
index = len(S) // 2

if len(S) % 2 != 0:
  print('No')
elif S[:index] != S[index:]:
  print('No')
else:
  print('Yes')

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

N = int(input())
str_input = input()

if N % 2 != 0:
  print('No')
else:
  print('Yes') if str_input[:N/2] == str_input[:N] else print('No')


Fixed submission:
N = input()
S = input()
index = len(S) // 2

if len(S) % 2 != 0:
  print('No')
elif S[:index] != S[index:]:
  print('No')
else:
  print('Yes')

Buggy python submission (verdict: Runtime Error):
S = input()

if len(S) % 2 != 0:
  matched = False
else:
  matched = True
  index = len(S)//2
  for i in range(index+1):
  	if S[i] != S[index+1]
    	matched = False
        break
        
if mathed:
  print('Yes')
else:
  print('False')
      
      

Fixed submission:
N = input()
S = input()
index = len(S) // 2

if len(S) % 2 != 0:
  print('No')
elif S[:index] != S[index:]:
  print('No')
else:
  print('Yes')
Buggy python submission (verdict: Runtime Error):
import math
N = int(input())

def distance(x1,x2,y1,y2):
  return math.sqrt((x1-x2)**2 + (y1-y2)**2)

x1,y1 = [int(s) for s in input().split()]

total_distance = 0
for i in range(1,N):
  x2,y2 = [int(s) for s in input().split()]
  total_distance += distance(x1,x2,y1,y2)
  
print total_distance / N

Fixed submission:
import math
import numpy as np
import itertools

def LI():
  return [int(s) for s in input().split()]

def distance(x1,x2):
  return math.sqrt((x1[0] - x2[0])**2 + (x1[1] - x2[1])**2)

def roots_distance(roots):
  dist = 0
  for i in range((len(roots)-1)):
    dist+=distance(locates[roots[i]],locates[roots[i+1]])
    
  return dist

N = int(input())

locates = np.array([LI() for i in range(N)])

dist = 0
count = 0
for roots in itertools.permutations(range(N),N):
  dist+=roots_distance(roots)
  count+=1
  
print(dist / count)
Buggy python submission (verdict: Runtime Error):
def LI():
  return [int(s) for s in input.split()]

A,B = LI()

print(A*B) if A < 10 and B < 10 else print(-1)

Fixed submission:
def LI():
  return [int(s) for s in input().split()]

A,B = LI()

print(A*B) if A < 10 and B < 10 else print(-1)

Buggy python submission (verdict: Runtime Error):
def LI():
  return [int(s) for s in input.split()]

A,B = LI()

print(A*B)

Fixed submission:
def LI():
  return [int(s) for s in input().split()]

A,B = LI()

print(A*B) if A < 10 and B < 10 else print(-1)

Buggy python submission (verdict: Runtime Error):
def LI():
  return [int(s) for s in input.split()]

A,B = LI()

print(A*B)

Fixed submission:
def LI():
  return [int(s) for s in input().split()]

A,B = LI()

print(A*B) if A < 10 and B < 10 else print(-1)
Buggy python submission (verdict: Runtime Error):
import math

N = int(input())

min_cand = 10**9

for i in range(1,(int(math.sqrt(N))+1):
  if N % i == 0 and min_cand < (i + (N // i)):
    min_cond = (i + (N // i))
    
print(min_cond - 2)
    

Fixed submission:
import math
 
N = int(input())
 
min_cand = 10**12
 
for i in range(1,(int(math.sqrt(N))+1)):
  if N % i == 0 and min_cand > (i + (N // i)):
    min_cand = (i + (N // i))
    
print(min_cand - 2)

Buggy python submission (verdict: Time Limit Exceeded):
import math
import numpy as np
import itertools

N = int(input())
prime_factor = []
for i in range(2,int(math.sqrt(N))+1):
  while N%i == 0:
    prime_factor.append(i)
    N/=i
    
if N > 1:
  prime_factor.append(N)
  prime_factor.append(1)

  
prime_factor = np.array(prime_factor)
prime_len = len(prime_factor) // 2
comb = set(range(0,len(prime_factor)))

min_root = -1

for i in range(1,(prime_len+1)):
  for sets in itertools.combinations(list(comb),i):
    sets = set(sets)
    sets_c = comb - sets
    min_cand = prime_factor[list(sets)].prod() + prime_factor[list(sets_c)].prod()
    if min_cand < min_root or min_root < 0:
      min_root = min_cand
      
print(int(min_root - 2))

Fixed submission:
import math
 
N = int(input())
 
min_cand = 10**12
 
for i in range(1,(int(math.sqrt(N))+1)):
  if N % i == 0 and min_cand > (i + (N // i)):
    min_cand = (i + (N // i))
    
print(min_cand - 2)
Buggy python submission (verdict: Runtime Error):
 LI():
  return [int(s) for s in input().split()]
 
A,B = LI()
 
print(int(A-2*B)) if A > 2*B else print(0)

Fixed submission:
def LI():
  return [int(s) for s in input().split()]
 
A,B = LI()
 
print(int(A-2*B)) if A > 2*B else print(0)
Buggy python submission (verdict: Runtime Error):
import numpy

N,K = [int(s) for s in input.split()]
heights = np.array([int(s) for s in input().split()])

sum(heights > K)

Fixed submission:
N,K = [int(s) for s in input().split()]
heights = [int(s) for s in input().split()]
 
count = 0
 
for i in range(N):
  if heights[i] >= K:
    count+=1
    
print(count)

Buggy python submission (verdict: Runtime Error):
N,K = [int(s) for s in inpput().split()]
heights = [int(s) for s in input().split()]

count = 0

for i in range(N):
  if heights[i] >= K:
    count+=1
    
print(count)

Fixed submission:
N,K = [int(s) for s in input().split()]
heights = [int(s) for s in input().split()]
 
count = 0
 
for i in range(N):
  if heights[i] >= K:
    count+=1
    
print(count)
Buggy python submission (verdict: Runtime Error):
import numpy as np

def LI():
  return [int(s) for s in input().split()]

N,K,Q = LI()
A_s = np.array([K]*N)

for i in range(Q):
  seikai = int(input())
  for j in range(N):
    if j != (seikai-1):
      A_s[j]-=1
      
for i in range(N):
  if A_s[i] > 0:
    print('Yes')
  else:
    print('No')

Fixed submission:
import numpy as np
 
def LI():
  return [int(s) for s in input().split()]
 
N,K,Q = LI()
Seikai_s = np.array([Q]*N)
 
for i in range(Q):
  seikai = int(input())
  Seikai_s[seikai-1]-=1
      
for i in range(N):
  if K-Seikai_s[i] > 0:
    print('Yes')
  else:
    print('No')

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

def LI():
  return [int(s) for s in input().split()]

N,K,Q = LI()
A_s = np.array([K]*N)

for i in range(Q):
  seikai = int(input())
  for j in range(N):
    if j != (seikai-1):
      A_s[j]-=1
      
for i in range(N):
  if A_s[i] > 0:
    print('Yes')
  else:
    print('No')

Fixed submission:
import numpy as np
 
def LI():
  return [int(s) for s in input().split()]
 
N,K,Q = LI()
Seikai_s = np.array([Q]*N)
 
for i in range(Q):
  seikai = int(input())
  Seikai_s[seikai-1]-=1
      
for i in range(N):
  if K-Seikai_s[i] > 0:
    print('Yes')
  else:
    print('No')
Buggy python submission (verdict: Runtime Error):
import heapq

K = input()
a = LI()

a = list(map(lambda x: x*(-1), a))  # 各要素を-1倍

heapq.heapify(a)

for i in range(
print(heapq.heappop(a)*(-1))  # 最大値の取り出し
print(a)

Fixed submission:
import heapq
import math
 
def LI():
  return [int(s) for s in input().split()]
 
N,M = LI()
a = LI()
a = list(map(lambda x: x*(-1), a))  # 各要素を-1倍
 
heapq.heapify(a)
 
for i in range(M):
    x = (-1)*(abs(heapq.heappop(a))//2)
    heapq.heappush(a,x)

cost = 0
for i in range(N):
  x = heapq.heappop(a)
  cost+=abs(x)
  
print(cost)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
print(sum(range(1,N)))

Fixed submission:
N = int(input())
print(N*(N-1)//2)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A_s = LI()

total = 0
for a in A_s:
  total+=(1/a)
  
print(1/total)

Fixed submission:
def LI():
  return [int(s) for s in input().split()]

N = int(input())
A_s = LI()
 
total = 0
for a in A_s:
  total+=(1/a)
  
print(1/total)
Buggy python submission (verdict: Runtime Error):
def LI():
  return [int(s) for s in input().split()]

A,B = LI()

print(max(A+B,A-B,int(A*B))

Fixed submission:
def LI():
  return [int(s) for s in input().split()]
 
A,B = LI()
 
print(max([A+B,A-B,int(A*B)]))
Buggy python submission (verdict: Runtime Error):
from collections import Counter
N = int(input())
S = [sorted(input()) for _ in range(N)]
S = sorted(S)
print(sum(map(lambda x: x*(x-1)//2, Counter(S).values())))


Fixed submission:
import string
import collections

N = int(input())
count = 0

s = []

for i in range(0,N):
  s.append(''.join(sorted(input())))

  
c = collections.Counter(s)
go = c.most_common()

for i in range(len(go)):
  k = go[i][1]
  count+=k*(k-1)//2
  
print(count)

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

N = int(input())
groups = {0: 1}
groups_sorted = {0: sorted(input())}

count = 0

for i in range(1,N):
  s = sorted(input())
  
  add_grouped = False
  
  for key,s_check in groups_sorted.items():
    if s == s_check:
      count += groups[key]
      groups[key]+=1
      add_grouped = True
      break
      
  if not add_grouped:
    groups[len(groups.keys())] = 1
    groups_sorted[len(groups_sorted.keys())] = s
  
print(count)

Fixed submission:
import string
import collections

N = int(input())
count = 0

s = []

for i in range(0,N):
  s.append(''.join(sorted(input())))

  
c = collections.Counter(s)
go = c.most_common()

for i in range(len(go)):
  k = go[i][1]
  count+=k*(k-1)//2
  
print(count)

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

N = int(input())
groups = {0: 1}
groups_sorted = {0: sorted(input())}

count = 0

for i in range(1,N):
  s = sorted(input())
  
  add_grouped = False
  
  for key,s_check in groups_sorted.items():
    if s == s_check:
      count += groups[key]
      groups[key]+=1
      add_grouped = True
      break
      
  if not add_grouped:
    groups[len(groups.keys())] = 1
    groups_sorted[len(groups_sorted.keys())] = s
  
print(count)

Fixed submission:
import string
import collections

N = int(input())
count = 0

s = []

for i in range(0,N):
  s.append(''.join(sorted(input())))

  
c = collections.Counter(s)
go = c.most_common()

for i in range(len(go)):
  k = go[i][1]
  count+=k*(k-1)//2
  
print(count)

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

def bwords(str):
  str = list(str)
  bword = [0]*len(string.ascii_lowercase)
  for s in str:
  	bword[string.ascii_lowercase.index(s)]+=1
  return bword

def check_bword(a_word,b_word):
  for a,b in zip(a_word,b_word):
    if a != b:
      return False
  return True

N = int(input())
groups = {0: 1}
groups_bword = {0: bwords(input())}

for i in range(1,N):
  s = input()
  b_w = bwords(s)
  
  add_grouped = False
  
  for key,bword in groups_bword.items():
    if check_bword(b_w,bword):
      groups[key]+=1
      add_grouped = True
      break
      
  if not add_grouped:
    groups[len(groups.keys())] = 1
    groups_bword[len(groups_bword.keys())] = b_w

count = 0

for key,nums in groups.items():
  count+=nums*(nums-1)//2
  
print(count)

Fixed submission:
import string
import collections

N = int(input())
count = 0

s = []

for i in range(0,N):
  s.append(''.join(sorted(input())))

  
c = collections.Counter(s)
go = c.most_common()

for i in range(len(go)):
  k = go[i][1]
  count+=k*(k-1)//2
  
print(count)
Buggy python submission (verdict: Runtime Error):
N = int(input())
H = [int(s) for s in input().split()]
for i in range(N - 1):
    if H[i + 1] - H[i] >= 0:
        H[i + 1] -= H[i + 1] != H[i]
    else:
        print('No')
        exit()

print('Yes')


Fixed submission:
N = int(input())
count = 0
for i in range(1,N+1):
  s = str(i)
  if len(s) % 2 == 1:
    count+=1
    
print(count)
Buggy python submission (verdict: Runtime Error):
A = [int(s) for s in input().split()]
first, second = sorted(A)[::-1][:2]
for a in A:
    print(first if a != first else second)

Fixed submission:
import numpy as np

N = int(input())
A_s = []
for i in range(N):
  A_s.append(int(input()))
  
A_s = np.array(A_s)
  
m_index = A_s.argmax()
sort_A_s = sorted(A_s)
m_value = A_s[m_index]
m_second = sort_A_s[N-2]

for i in range(N):
  if i != m_index:
    print(m_value)
  else:
    print(m_second)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A_s = []
for i in range(N):
  A_s.append(int(input()))
  
A_s = np.array(A_s)
  
m_index = A_s.argmax()
sort_A_s = sorted(A_s)
m_value = A_s[m_index]
m_second = sort_A_s[N-2]

for i in range(N):
  if i != m_index:
    print(m_value)
  else:
    print(m_second)

Fixed submission:
import numpy as np

N = int(input())
A_s = []
for i in range(N):
  A_s.append(int(input()))
  
A_s = np.array(A_s)
  
m_index = A_s.argmax()
sort_A_s = sorted(A_s)
m_value = A_s[m_index]
m_second = sort_A_s[N-2]

for i in range(N):
  if i != m_index:
    print(m_value)
  else:
    print(m_second)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
inf = 10 ** 9 + 7
total = 0

l = len(a)

for i in range(l - 1):
    for j in range(i + 1, l):
        total += ((a[i]*a[j]) % inf)

print(total % inf)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
inf = 10 ** 9 + 7

S = sum(a)
S2 = 0

for i in a:
    S2 += i * i

print((S*S - S2)//2 % inf)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
inf = 10 ** 9 + 7
total = 0

l = len(a)

for i in range(l - 1):
    for j in range(i + 1, l):
        a[i] %= inf
        a[j] %= inf
        total += (a[i]*a[j])

print(total % inf)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
inf = 10 ** 9 + 7

S = sum(a)
S2 = 0

for i in a:
    S2 += i * i

print((S*S - S2)//2 % inf)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
inf = 10 ** 9 + 7
total = 0

l = len(a)

for i in range(l - 1):
    for j in range(i + 1, l):
        a[i] %= inf
        a[j] %= inf
        total += (a[i]*a[j]) % inf

print(total % inf)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
inf = 10 ** 9 + 7

S = sum(a)
S2 = 0

for i in a:
    S2 += i * i

print((S*S - S2)//2 % inf)
Buggy python submission (verdict: Time Limit Exceeded):
a, b, c = map(int, input().split())
k = int(input())

while k != 0:
    if a > b:
        b *= 2
        k -= 1
    if b > c:
        c *= 2
        k -= 1
if a < b and b < c:
    print('Yes')
else:
    print('No')

Fixed submission:
a, b, c = map(int, input().split())
k = int(input())
ans = 'Yes'

while a >= b:
    b *= 2
    k -= 1

while b >= c:
    c *= 2
    k -= 1

if k < 0:
    ans = 'No'

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
def divisors(n):
    i = 1
    cnt = 0
    while i*i <= n:
        if n % i == 0:
            cnt += 1
            if i * i != n:
                cnt += 1
        i += 1
    return cnt

n = int(input())
ans = 0
for i in range(1, n + 1):
    ans += i * divisors(i)

print(ans)

Fixed submission:
def cal(b, e):
    return ((b + (e//b) * b) * (e//b))//2

n = int(input())
ans = 0

for i in range(1, n+1):
    ans += cal(i, n)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
q = int(input())
a_list = [[i, 0] for i in range(10**5 +1)]

for elem in a:
    a_list[elem][1] += 1

for i in range(q):
    b, c = map(int,(input().split()))
    a_list[c][1] += a_list[b][1]
    a_list[b][1] = 0
    ans = 0
    for j in a_list:
        ans += j[0] * j[1]
    print(ans)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
q = int(input())
a_dic = {}

for elem in a:
    if elem not in a_dic:
        a_dic[elem] = 1
    else:
        a_dic[elem] += 1

a_sum = sum(a)

for i in range(q):
    b, c = map(int,input().split())
    if b in a_dic:
        diff = c - b
        a_sum += diff * a_dic[b]
        print(a_sum)
        if c in a_dic:
            a_dic[c] += a_dic[b]
            del a_dic[b]
        else:
            a_dic[c] = a_dic[b]
            del a_dic[b]
    else:
        print(a_sum)

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

for elem in a:
    if elem not in a_dic:
        a_dic[elem] = 1
    else:
        a_dic[elem] += 1

for i in range(q):
    b, c = map(int,input().split())
    if b in a_dic:
        if c in a_dic:
            a_dic[c] += a_dic[b]
            del a_dic[b]
        else:
            a_dic[c] = a_dic[b]
            del a_dic[b]
    ans = 0
    for ai in a_dic:
        ans += ai * a_dic[ai]
    print(ans)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
q = int(input())
a_dic = {}

for elem in a:
    if elem not in a_dic:
        a_dic[elem] = 1
    else:
        a_dic[elem] += 1

a_sum = sum(a)

for i in range(q):
    b, c = map(int,input().split())
    if b in a_dic:
        diff = c - b
        a_sum += diff * a_dic[b]
        print(a_sum)
        if c in a_dic:
            a_dic[c] += a_dic[b]
            del a_dic[b]
        else:
            a_dic[c] = a_dic[b]
            del a_dic[b]
    else:
        print(a_sum)
Buggy python submission (verdict: Runtime Error):
    x, y = map(int,input().split())
     
    for i in range(x+1):
        if 4 * i + 2*(x - i) == y:
            print('Yes')
            exit()
     
    print('No')

Fixed submission:
x, y = map(int, input().split())

for i in range(x + 1):
    if 4 * i + 2 * (x - i) == y:
        print('Yes')
        exit()

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

cnt = [0] * ((10**6) + 1)
ans = 0

for i in a:
    for j in range(i, (10**6)+1,i):
        cnt[j] += 1

for i in a:
    if cnt[i] == 1:
        ans += 1

print(ans)

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

a_max = max(a)
cnt = [0] * (max(a) + 1)
ans = 0

for ai in a:
    for multi in range(ai, a_max + 1, ai):
        cnt[multi] += 1

for ai in a:
    if cnt[ai] == 1:
        ans += 1

print(ans)

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

a = sorted(a)
a.append(0)

ans = 0
tmp = 0
for i in range(len(a)):
    if a[i] == 1:continue
    tmp = a[i]
    if a[i] != a[i+1]:
        ans += 1
    for j in range(len(a)):
        if a[j] % tmp == 0:
            a[j] = 1
        if all(x == 1 for x in a):
            print(ans)
            exit()

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

a_max = max(a)
cnt = [0] * (max(a) + 1)
ans = 0

for ai in a:
    for multi in range(ai, a_max + 1, ai):
        cnt[multi] += 1

for ai in a:
    if cnt[ai] == 1:
        ans += 1

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

ans = 1
inf = 10**18 + 1
for i in a:
    ans *= i

ans = min(ans, inf)
if ans == inf:
    ans = -1

print(ans)

Fixed submission:
n = int(input())
a = map(int, input().split())
a = sorted(a, reverse=True)
ans = 1

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

for i in a:
    ans *= i
    if ans > 10**18:
        print(-1)
        exit()

print(ans)

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

ans = 1
inf = 10**18 + 1
for i in a:
    ans *= i

ans = min(ans, inf)
if ans == inf:
    print(-1)
else:
    print(ans)

Fixed submission:
n = int(input())
a = map(int, input().split())
a = sorted(a, reverse=True)
ans = 1

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

for i in a:
    ans *= i
    if ans > 10**18:
        print(-1)
        exit()

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = map(int, input().split())
ans = 1
for i in a:
    ans *= i

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

Fixed submission:
n = int(input())
a = map(int, input().split())
a = sorted(a, reverse=True)
ans = 1

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

for i in a:
    ans *= i
    if ans > 10**18:
        print(-1)
        exit()

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = map(int, input().split())
ans = 1
for i in a:
    ans *= i

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

Fixed submission:
n = int(input())
a = map(int, input().split())
a = sorted(a, reverse=True)
ans = 1

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

for i in a:
    ans *= i
    if ans > 10**18:
        print(-1)
        exit()

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

print(len(keihin))

Fixed submission:
N = int(input())
keihin =[]
cnt = 0
for i in range(N):
    keihin.append(str(input()))

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

for i in range(1, N):
    s = A.count(i)
    print(s)

print(0)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
tm = [0] * n

for i in range(n-1):
    tm[a[i] - 1] += 1

for i in tm:
    print(i)

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

for i in range(1, N+1):
    s = A.count(i)
    print(s)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
tm = [0] * n

for i in range(n-1):
    tm[a[i] - 1] += 1

for i in tm:
    print(i)