Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import collections
N = int(input())
S_list = []
for i in range(N):
  S_list.append(input())
 
c = collections.Counter(S_list)
 
words = []
counter = 0
 
 
while(True):
  words.append(c.most_common()[counter][0])
  try:
    if c.most_common()[counter][1] == c.most_common()[counter+1][1]:
      counter += 1
    else:
      break
  except:
    break
 
words = sorted(words)
for j in range(len(words)):
  print(words[j])

Fixed submission:
import collections
N = int(input())
S_list = []
for i in range(N):
  S_list.append(input())

c = collections.Counter(S_list)

d = c.most_common() 

keys = [k for k, v in c.items() if v == d[0][1]]

keys = sorted(keys)

for i in keys:
  print(i)
Buggy python submission (verdict: Runtime Error):
N,K = map(int, input().split())
H = list(map(int, input().split()))

H.sort(reverse=True)

if N <= K:
  print(0)
else:
  del l[0:K]
  print(sum(H))

Fixed submission:
N,K = map(int, input().split())
H = list(map(int, input().split()))
 
H.sort(reverse=True)
 
if N <= K:
  print(0)
else:
  del H[0:K]
  print(sum(H))

Buggy python submission (verdict: Runtime Error):
N,K = map(int, input().split())
H = list(map(int, input().split()))

H.sort(reverse=True)

if N <= K:
  print(0)
else:
  for i in range(K):
    H.pop(i)
  print(sum(H))

Fixed submission:
N,K = map(int, input().split())
H = list(map(int, input().split()))
 
H.sort(reverse=True)
 
if N <= K:
  print(0)
else:
  del H[0:K]
  print(sum(H))
Buggy python submission (verdict: Runtime Error):
c = input()
print chr(ord(c) + 1)

Fixed submission:
c = str(input())

print(chr(ord(c)+1))
Buggy python submission (verdict: Runtime Error):
from sympy import sieve

X=int(input())

PL=[i for i in sieve.primerange(1, 10**5+1)]

PL.append(X)
PL.sorted()

ID=PL.index(X)

print(ID+1)

Fixed submission:
import math
 
def is_prime(n):
    for i in range(2, int(math.sqrt(n))+1):
        if n % i == 0:
            return False
    return True
 
def main():
    X = int(input())
    while True:
        result = is_prime(X)
        if result:
            print(X)
            exit()
        X +=1
 
if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
import numpy as np
N,M,X = map(int,input().split())

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

#print(clist)

total_all=[]
for i in range(2**N):
    total=np.zeros(M+1)
    for j in range(N):
        
        # iを2進数表記した場合の下から数えてj番目が1ならtrue
        if ((i >> j) & 1):
            total=total+np.array(clist[j])
    total_all.append(list(total))

#print(total_all)
ans=[]
#print(total_all[1][1:M+1])

for i in range(len(total_all)):
    if min(total_all[i][1:M])>=X:
        ans.append(total_all[i][0])

if len(ans)>=1:
    print(int(min(ans)))
else:
    print("-1")

Fixed submission:
import numpy as np

N,M,X=map(int,input().split())

listC=[]
listall=[]

for i in range(N):
    listC.append(list(map(int,input().split())))

for i in range(2**N):
    total=np.zeros(M+1)
    for j in range(N):
        
        if ((i >> j) & 1):
            total=total+np.array(listC[j])
            #print(total)
    listall.append(list(total))
            


#print(listall)
ans=[]
for i in range(len(listall)):
    flag=True
    for j in range(M):
        if listall[i][j+1] < X:
            #print(j,listall[i][j+1])
            flag=False
        if j==(M-1) and flag==True:
            ans.append(listall[i][0])

if len(ans)>0:
    print(int(min(ans)))
else:
    print("-1")

Buggy python submission (verdict: Runtime Error):
import numpy as np
N,M,X = map(int,input().split())

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

#print(clist)

total_all=[]
for i in range(2**N):
    total=np.zeros(M+1)
    for j in range(N):
        
        # iを2進数表記した場合の下から数えてj番目が1ならtrue
        if ((i >> j) & 1):
            total=total+np.array(clist[j])
    total_all.append(list(total))

#print(total_all)
ans=[]
for i in range(len(total_all)):
    if min(total_all[i][1:M])>=10:
        ans.append(total_all[i][0])

if len(ans)>=1:
    print(int(min(ans)))
else:
    print("-1")

Fixed submission:
import numpy as np

N,M,X=map(int,input().split())

listC=[]
listall=[]

for i in range(N):
    listC.append(list(map(int,input().split())))

for i in range(2**N):
    total=np.zeros(M+1)
    for j in range(N):
        
        if ((i >> j) & 1):
            total=total+np.array(listC[j])
            #print(total)
    listall.append(list(total))
            


#print(listall)
ans=[]
for i in range(len(listall)):
    flag=True
    for j in range(M):
        if listall[i][j+1] < X:
            #print(j,listall[i][j+1])
            flag=False
        if j==(M-1) and flag==True:
            ans.append(listall[i][0])

if len(ans)>0:
    print(int(min(ans)))
else:
    print("-1")
Buggy python submission (verdict: Time Limit Exceeded):

N = int(input())
Alist = list(map(int,input().split()))
import numpy as np
ans=np.zeros(N)

A2list=list(set(Alist))
#print(A2list)
for i in range(len(A2list)):

    ans[int(A2list[i])-1]=int(Alist.count(A2list[i]))

ans=map(int,ans.tolist())
print(*ans,sep="\n")

Fixed submission:

N = int(input())
Alist = list(map(int,input().split()))#iの上司

result = [0]*N

for i in range(N-1):#最後の社員に部下いない
    result[Alist[i]-1] +=1#上司の順番の要素に+1

for i in range(N):
    print(result[i])

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
Alist = list(map(int,input().split()))
ans=[]
for i in range(N):
    if int(i+1) in Alist:
        a=i+1
        #ans.append(str(Alist.count(a))+"\n")
        ans.append(str(Alist.count(a)))
        #print(Alist.count(a))
    else:
        #print(0)
        #ans.append(str(0)+"\n")
        ans.append(str(0))

print(*ans,sep="\n")

Fixed submission:

N = int(input())
Alist = list(map(int,input().split()))#iの上司

result = [0]*N

for i in range(N-1):#最後の社員に部下いない
    result[Alist[i]-1] +=1#上司の順番の要素に+1

for i in range(N):
    print(result[i])

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
Alist = list(map(int,input().split()))
for i in range(N):
    if int(i+1) in Alist:
        a=i+1
        print(Alist.count(a))
    else:
        print(0)

Fixed submission:

N = int(input())
Alist = list(map(int,input().split()))#iの上司

result = [0]*N

for i in range(N-1):#最後の社員に部下いない
    result[Alist[i]-1] +=1#上司の順番の要素に+1

for i in range(N):
    print(result[i])
Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split())
list_A=input().split()
for i in range(len(list_A)):
    list_A[i]=int(list_A[i])
A =int(sum(list_A)/(4*M))
if M<len([i for i in list_A if i> A]):
    print("Yes")
else:
    print("No")

Fixed submission:
X,Y,Z=map(int,input().split())
print(Z,X,Y)
Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split())
slist=[]
for i in range(M):
    slist.append(list(map(int,input().split())))

ans=["0"]*N

for i in range(N):
    if ans[slist[i][0]-1]=="0":
        ans[slist[i][0]-1]=slist[i][1]
    elif ans[slist[i][0]-1]!=slist[i][1]:
        ans=["-1"]
        break



if N>1:
    if ans[0]=="0":
        ans[0]=1
    elif ans[0]==0:
        ans=["-1"]
        

for i in range(len(ans)):
    if ans[i]=="0":
        ans[i]=0

print(*ans,sep=(""))

Fixed submission:

N,M=map(int,input().split())
slist=[]
for i in range(M):
    slist.append(list(map(int,input().split())))
ans=["0"]*N


for i in range(len(slist)):
    #print("i",i)
    if ans[slist[i][0]-1] == "0":
        ans[slist[i][0]-1] = slist[i][1]
    elif ans[slist[i][0]-1] == slist[i][1]:
        continue
    else:
        ans=["-1"]
        break

#print(ans)

if N>=2:
    if ans[0]=="0":
        ans[0]=1
    elif ans[0]==0:
        ans=["-1"]


    
for i in range(len(ans)):
    if ans[i]=="0":
        ans[i]=0

print(*ans,sep=(""))

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

ans=["0"]*N

for i in range(N):
    if ans[slist[i][0]-1]=="0":
        ans[slist[i][0]-1]=slist[i][1]
    elif ans[slist[i][0]-1]!=slist[i][1]:
        ans=["-1"]
        break



if N>1:
    if ans[0]=="0":
        ans[0]=1
    elif ans[0]==0:
        ans=["-1"]
if ans !=["-1"]:
    for i in range(N):
        if ans[i]=="0":
            ans[i]=0

print(*ans,sep=(""))

Fixed submission:

N,M=map(int,input().split())
slist=[]
for i in range(M):
    slist.append(list(map(int,input().split())))
ans=["0"]*N


for i in range(len(slist)):
    #print("i",i)
    if ans[slist[i][0]-1] == "0":
        ans[slist[i][0]-1] = slist[i][1]
    elif ans[slist[i][0]-1] == slist[i][1]:
        continue
    else:
        ans=["-1"]
        break

#print(ans)

if N>=2:
    if ans[0]=="0":
        ans[0]=1
    elif ans[0]==0:
        ans=["-1"]


    
for i in range(len(ans)):
    if ans[i]=="0":
        ans[i]=0

print(*ans,sep=(""))
Buggy python submission (verdict: Runtime Error):
N =int(input())
Alist=list(map(int,input().split()))

Flag=True
for i in range(N):
    print(i)
    if Alist[i]%2==0:
        if Alist[i]%3==0 or Alist[i]%5==0:
            continue
        else:
            Flag=False

if Flag:
    print("APPROVED")
else:
    print("DENIED)

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

Flag=True
for i in range(N):
    if Alist[i]%2==0:
        if Alist[i]%3==0 or Alist[i]%5==0:
            continue
        else:
            Flag=False

if Flag:
    print("APPROVED")
else:
    print("DENIED")
Buggy python submission (verdict: Runtime Error):
n,l = map(int,input().split())
s = sort([input() for i in range(n)])
print(*s,sep="")

Fixed submission:
N,L =input().split()
listA=[]
for i in range(int(N)):
    listA.append(input())

print(*sorted(listA),sep="")
Buggy python submission (verdict: Runtime Error):
import numpy as np


def getNearestValue(li, num):
    idx = np.abs(np.array(li) - num).argmin()
    return li[idx]


x, n = map(int, input().split())
p = list(map(int, input().split()))


ans = 0
print(p)
i = 0
while True:
    mi = getNearestValue(p, x - i)
    ma = getNearestValue(p, x + i)
    if mi or ma:
        break
    i += 1

print(mi if mi < ma else ma)


Fixed submission:
x, n = map(int, input().split())
p = set(map(int, input().split()))


ans = 0
i = 0
while True:
    if (x - i) not in p:
        ans = x - i
        break
    elif (x + i) not in p:
        ans = x + i
        break
    i += 1

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

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

limit = 10**18
ans = 1
for i in range(n):
    ans *= a[i]
    if ans > limit:
        print(-1)
        exit()

print(ans)


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

print(a * b)

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

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

ans = 1
for i in range(n):
    ans *= a[i]
    if ans > 1000000000000000000:
        print(-1)
        exit()

print(ans)


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

print(a * b)
Buggy python submission (verdict: Time Limit Exceeded):
import operator
from functools import reduce


n = int(input())
a = list(map(int, input().split()))
ans = reduce(operator.mul, a)
print(-1 if ans > 10**18 else ans)


Fixed submission:
def main():
    N = int(input())
    A = list(map(int, input().split()))
    if 0 in A:
        print(0)
        return
    prod = 1
    for a in A:
        prod *= a
        if prod > 1000000000000000000:
            print(-1)
            return
    print(prod)


main()

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


n = int(input())
a = list(map(int, input().split()))
ans = reduce(operator.mul, a)
print(-1 if ans > 10**18 else ans)


Fixed submission:
def main():
    N = int(input())
    A = list(map(int, input().split()))
    if 0 in A:
        print(0)
        return
    prod = 1
    for a in A:
        prod *= a
        if prod > 1000000000000000000:
            print(-1)
            return
    print(prod)


main()

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


n = int(input())
a = list(map(int, input().split()))
ans = reduce(lambda x, y: x * y, a)
print(-1 if ans > 10**18 else ans)


Fixed submission:
def main():
    N = int(input())
    A = list(map(int, input().split()))
    if 0 in A:
        print(0)
        return
    prod = 1
    for a in A:
        prod *= a
        if prod > 1000000000000000000:
            print(-1)
            return
    print(prod)


main()

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

ans = 1
limit = 10**18
for i in range(n):
    ans *= a[i]

print(-1 if ans > limit else ans)


Fixed submission:
def main():
    N = int(input())
    A = list(map(int, input().split()))
    if 0 in A:
        print(0)
        return
    prod = 1
    for a in A:
        prod *= a
        if prod > 1000000000000000000:
            print(-1)
            return
    print(prod)


main()

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

ans = 1
for i in input().split():
    ans *= int(i)

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


Fixed submission:
def main():
    N = int(input())
    A = list(map(int, input().split()))
    if 0 in A:
        print(0)
        return
    prod = 1
    for a in A:
        prod *= a
        if prod > 1000000000000000000:
            print(-1)
            return
    print(prod)


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

print(int(a * b))


Fixed submission:
import decimal
import math


a, b = map(str, input().split())
print(math.floor(int(a) * decimal.Decimal(b)))
Buggy python submission (verdict: Runtime Error):
t = list(input())
tl = len(t)

for i in range(tl):
    if t[i] != '?':
        continue

    if tl == 1:
        t[i] = 'D'
    elif t[i-1] == 'P':
        t[i] = 'D'
    elif t[i+1] == '?':
        t[i] = 'P'
    elif t[i+1] == 'D':
        t[i] = 'P'
    else:
        t[i] = 'D'

print(''.join(t))


Fixed submission:
t = list(input())
tl = len(t)

for i in range(tl):
    if t[i] != '?':
        continue

    if tl == 1:
        t[i] = 'D'
    elif i == tl - 1:
        t[i] = 'D'
    elif t[i-1] == 'P':
        t[i] = 'D'
    elif t[i+1] == '?':
        t[i] = 'P'
    elif t[i+1] == 'D':
        t[i] = 'P'
    else:
        t[i] = 'D'

print(''.join(t))
Buggy python submission (verdict: Time Limit Exceeded):
import sys


def test():
    A, B, C, K = map(int, input().split())
    ans = 0
    for _ in range(K):
        if A > 0:
            ans += 1
            A -= 1
        elif B > 0:
            B -= 1
        elif C > 0:
            ans -= 1
            C -= 1
        else:
            break
    print(ans)


if __name__ == "__main__":
    test()


Fixed submission:
import sys


def test():
    A, B, C, K = map(int, input().split())
    ans = 0
    if A > 0 and (K - A) > 0:
        ans += A
        K -= A
    elif A > 0 and (K - A) <= 0:
        ans += K
        print(ans)
        sys.exit()

    if B > 0 and (K - B) > 0:
        K -= B
    elif B > 0 and (K - B) <= 0:
        print(ans)
        sys.exit()

    ans -= K
    print(ans)


if __name__ == "__main__":
    test()
Buggy python submission (verdict: Runtime Error):
def test():
    n, m, x = map(int, input().split())
    books = [list(map(int, input().split())) for _ in range(n)]
    ans = 99999999999999999
    for i in range(2 ** n):
        cost = 0
        level = [0] * (m)
        for j in range(n):
            if ((i >> j) & 1):
                cost += books[j][0]
                for k in range(m):
                    level[k] += books[j][k+1]

        if level and min(*level) >= x:
            ans = min(ans, cost)

    if ans == 99999999999999999:
        print(-1)
    else:
        print(ans)


if __name__ == "__main__":
    test()


Fixed submission:
def bit():
    n, m, x = map(int, input().split())
    books = [list(map(int, input().split())) for _ in range(n)]
    ans = 99999999999999999
    for i in range(2 ** n):
        cost = 0
        level = [0] * (m)
        for j in range(n):
            if ((i >> j) & 1):
                cost += books[j][0]
                for k in range(m):
                    level[k] += books[j][k+1]

        if level and min(level) >= x:
            ans = min(ans, cost)

    if ans == 99999999999999999:
        print(-1)
    else:
        print(ans)


if __name__ == "__main__":
    bit()

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


def test():
    n, m, x = map(int, input().split())
    books = [list(map(int, input().split())) for _ in range(n)]
    ans = 12345678
    is_ok = False
    for i in range(2 ** n):
        cost = 0
        level = [0] * (m)
        for j in range(n):
            if ((i >> j) & 1):
                cost += books[j][0]
                for k in range(m):
                    level[k] += books[j][k+1]

        if min(*level) >= x:
            ans = min(ans, cost)
            is_ok = True

    if is_ok:
        print(ans)
    else:
        print(-1)


if __name__ == "__main__":
    test()


Fixed submission:
def bit():
    n, m, x = map(int, input().split())
    books = [list(map(int, input().split())) for _ in range(n)]
    ans = 99999999999999999
    for i in range(2 ** n):
        cost = 0
        level = [0] * (m)
        for j in range(n):
            if ((i >> j) & 1):
                cost += books[j][0]
                for k in range(m):
                    level[k] += books[j][k+1]

        if level and min(level) >= x:
            ans = min(ans, cost)

    if ans == 99999999999999999:
        print(-1)
    else:
        print(ans)


if __name__ == "__main__":
    bit()
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=input().split()
ans=1
for i in range(n):
 ans=ans*int(a[i])
if ans>(10**18):
 print(-1) 
else:
 print(ans)

Fixed submission:
n=int(input())
a=input().split()
ans=1

if a.count("0"):
 print(0)
 exit()
 
for i in range(n):
 ans=ans*int(a[i])
 if ans>(10**18):
  print(-1)
  exit()
 
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import math
a,b,n=map(int,input().split())
max=0
for i in range(1,n+1):
 s=(math.floor(a*i/b))-a*(math.floor(i/b))
 if s>max:
  max=s
print(max)

Fixed submission:
import math
a,b,n=map(int,input().split())
if b>n:
 max=(math.floor(a*n/b))-a*(math.floor(n/b))
else:
 max=(math.floor(a*(b-1)/b))-a*(math.floor((b-1)/b))
print(max)
Buggy python submission (verdict: Runtime Error):
n=iinput())
s=list()
for i in range(n):
 s.append(input())
print(len(set(s)))

Fixed submission:
n=int(input())
s=list()
for i in range(n):
 s.append(input())
print(len(set(s)))
Buggy python submission (verdict: Runtime Error):
import math
k=int(input())
sum=0
for i in range(1,k+1):
 for j in range(1,k+1):
  for l in range(1,k+1):
   sum=sum+(math.gcd(i,j,l))
print(sum)

Fixed submission:
import math
k=int(input())
sum=0
for i in range(1,k+1):
 for j in range(1,k+1):
  a=(math.gcd(i,j))
  for l in range(1,k+1):
   sum=sum+(math.gcd(a,l))
print(sum)
Buggy python submission (verdict: Runtime Error):
S=input()
if S==AAA or S==BBB:
	print("No")
else:
	print("Yes")

Fixed submission:
S=input()
if S=="AAA" or S=="BBB":
	print("No")
else:
	print("Yes")

Buggy python submission (verdict: Runtime Error):
S=input()
if S==AAA or S==BBB:
	print("No")
else:
	print("Yes")

Fixed submission:
S=input()
if S=="AAA" or S=="BBB":
	print("No")
else:
	print("Yes")
Buggy python submission (verdict: Time Limit Exceeded):
n,a,b=map(int,input().split())
p=n//(a+b)
if n%(a+b)==0:
	r=0
elif n%(a+b)>=a:
	r=a
else:
	for i in range(a):
		if n%(a+b)==i:
			r=i
ans=p*a+r
print(ans)

Fixed submission:
n,a,b=map(int,input().split())
p=n//(a+b)
if n%(a+b)==0:
	r=0
elif n%(a+b)>=a:
	r=a
else:
	r=n%(a+b)
ans=p*a+r
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,a,b=map(int,input().split())
p=n//(a+b)
if n%(a+b)==0:
	r=0
elif n%(a+b)>=a:
	r=a
else:
	for i in range(a):
		if n%(a+b)==i:
			r=i
ans=p*a+r
print(ans)

Fixed submission:
n,a,b=map(int,input().split())
p=n//(a+b)
if n%(a+b)==0:
	r=0
elif n%(a+b)>=a:
	r=a
else:
	r=n%(a+b)
ans=p*a+r
print(ans)
Buggy python submission (verdict: Runtime Error):
x,n=map(int,input().split())
if(n!=0):
    a = list(map(int,input().split()))
flag=True
k = 0

while(True):
    b = x - k
    c = x + k
    if(not(b in a)):
        print(b)
        break
    elif(not(c in a)):
        print(c)
        break
    k = k + 1

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

flag=True
k = 0

while(True):
    b = x - k
    c = x + k
    if(not(b in a)):
        print(b)
        flag = False
        break
    elif(not(c in a) and flag):
        print(c)
        break
    k = k + 1

Buggy python submission (verdict: Runtime Error):
x,n=map(int,input().split())
if(n!=0):
    a = list(map(int,input().split()))
else:
    print(x)
flag=True
k = 0

while(True):
    b = x - k
    c = x + k
    if(not(b in a)):
        print(b)
        break
    elif(not(c in a)):
        print(c)
        break
    k = k + 1

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

flag=True
k = 0

while(True):
    b = x - k
    c = x + k
    if(not(b in a)):
        print(b)
        flag = False
        break
    elif(not(c in a) and flag):
        print(c)
        break
    k = k + 1
Buggy python submission (verdict: Time Limit Exceeded):
import functools
import operator


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

ans=functools.reduce(operator.mul, a)

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


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

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: Runtime Error):
n=int(input())
a=list(map(int,input().split()))

ans=1

for i in a:
  ans*=i


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

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

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):
import numpy as np

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

ans=1

for i in a:
    ans*=i


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


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

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: Runtime Error):
S, T = input().split()
print(T + S)


Fixed submission:
S, T = input().split()
print(T + S)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(i) for i in input().split()]

for id in range(1,n+1):
	ans = a.count(id)
	print(ans)

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

boss = [0 for _ in range(n)]

for id in a:
	boss[id-1] += 1

for cnt in boss:
	ans = cnt
	print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce

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


k = int(input())
sum = 0

for i in range(1, k+1):
	for j in range(1, k+1):
		for l in range(1, k+1):
			sum += gcd(i, j, l)

print(sum)


Fixed submission:
# def gcd(a, b):
# 	while a != 0 and b != 0:
# 		if a >= b:
# 			remain = a % b
# 			a = remain
# 		else:
# 			remain = b % a
# 			b = remain
# 	if a >= b:
# 		return a
# 	else:
# 		return b 

import math

k = int(input())
sum = 0

for i in range(1, k+1):
	for j in range(1, i+1):
		for l in range(1, j+1):
			if i == j and j == l:
				sum += i
			elif i == j or j == l:
				a = math.gcd(i, j)
				b = math.gcd(j,l)
				g = math.gcd(a,b)
				sum += g*3

			else:
				a = math.gcd(i, j)
				b = math.gcd(j,l)
				g = math.gcd(a,b)
				sum += g*6

print(sum)