Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02582 (python)

Fixed submission:
S = input().strip()
print(max([len(i) for i in S.split('S')]))

Buggy submission (verdict: Runtime Error):
X, K, D = [int(i) for i in input().strip().split(' ')]

tmp = X // D
d1 = X - (D * tmp)
d2 = X - (D * (tmp + 1))

if tmp >= K:
  ans = X - (D * K)
else:
  if (tmp % 2) ^ (K % 2) == 0:
    ans = d1
  else:
    ans = d2

print(abs(ans))
Problem p02582 (python)

Fixed submission:
n = input()
if n == "RRR":
    print("3")
elif n[:2] == "RR" or n[1:] == "RR":
    print("2")
elif n=="SSS":
    print("0")
else:
    print("1")

Buggy submission (verdict: Runtime Error):
n = input()
    if n == "RRR":
        print("3")
    elif n[:2] == "RR" or n[1:] == "RR":
        print("2")
    elif n=="SSS":
        print("0")
    else:
        print("1")
Problem p02778 (python)

Fixed submission:
S, a = input(), ""
for x in range(len(S)):
    a += "x"
print(a)

Buggy submission (verdict: Runtime Error):
S, T = input().split()
A, B = map(int, input().split())
U = input()
if U == S:    A -= 1
else: B -= 1
print(A, B)
Problem p02811 (python)

Fixed submission:
num = input().split()
if int(num[0])*500 >= int(num[1]):
    print("Yes")
else: 
    print("No")

Buggy submission (verdict: Runtime Error):
num = int(input()).split()
if num[0] * 500 > num[1]: print("Yes")
else: print("No")
Problem p02817 (python)

Fixed submission:
string = input().split()
print(string[1]+string[0])

Buggy submission (verdict: Runtime Error):
n,m = input(),input
print(n+m)
Problem p02582 (python)

Fixed submission:
import sys


def read_input():
    return sys.stdin.readline().strip().split(' ')


def task(s):
    rainy_til = []
    l = len(s)
    i = 0
    while i < l:
        if s[i] == 'R':
            last_rainy = rainy_til[i - 1] if i > 0 else 0
            rainy_til.append(last_rainy + 1)
        else:
            rainy_til.append(0)
        i += 1
    return max(rainy_til)


def main():
    [s] = read_input()
    result = task(s)
    print(result)


main()

Buggy submission (verdict: Runtime Error):
import sys
 
def read_input():
  return sys.stdin.readline().strip().split(' ')
 
def task(s):
  rainy_til = []
  l = len(s)
  i = 0
  while i < l:
    if s[i] == 'R':
      last_rainy = rainy_til[i-1] if i > 0 else 0
      rainy_til[i] = last_rainy + 1
    else:
      rainy_til[i] = 0
  return max(rainy_til)
 
def main():
  s = read_input()
  result = task(s)
  print(result)

main()
Problem p02582 (python)

Fixed submission:
weather = input()
rainyDay = weather.count('R')
if rainyDay < 2:
    print(rainyDay)
else:
    if weather[1] == 'R':
        print(rainyDay)
    else:
        print(1)

Buggy submission (verdict: Runtime Error):
S = input()
RD = weather.count('R')
if RD < 2:
    print(RD)
else:
    if S[1] == 'R':
        print(RD)
    else:
        print(1)
Problem p02717 (python)

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


temp = x
x = z
z = temp

temp = z
z = y
y = temp

print(x,y,z)

Buggy submission (verdict: Runtime Error):
x,y,z = map(int,input().split())


temp = x
x = z
z = temp

temp = z
z = y
y = temp

print(f"{x} {y} {z}")
Problem p02718 (python)

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



def check(A,M):
    flag = 0
    condition = sum(A)/(4*M)
    if(M==1 and max(A)>condition):
        return "Yes"
    for i in A:
        if(i < condition):
            continue
        elif(i >= condition):
            flag+=1
            if(flag==M):
                return "Yes"
    return "No"

print(check(A,M))

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



def check(A,M):
    flag = 0
    sumOfA = 0
    for i in A:
        sumOfA+=A
    condition = sumOfA/(4*M)
    if(M==1 and max(A)>condition):
        return "Yes"
    for i in A:
        if(i <= condition):
            continue
        else:
            flag+=1
            if(flag==M):
                return "Yes"
    return "No"

print(check(A,M) else "No")
Problem p02765 (python)

Fixed submission:
N,M = map(int,input().split(" "))
if N<10:
  print(M+(100*(10-N)))
else:
  print(M)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split(" "))
if N<10:
  print(a+(100*(10-N)))
else:
  print(M)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
if N<10:
  print(a+(100*(10-N)))
else:
   print(M)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
if N<10:
  print(a+(100*(10-N)))
 else:
  print(M)
Problem p02789 (python)

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

print("Yes" if N==M else "No")

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
print("Yes" if N==M : "No")
Problem p02818 (python)

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

def print_ans(A,B):
        print(A,end=" ")
        print(B)


if A+B<=K:
    print("0 0")
elif A==B and A==0:
    print(A,end=" ")
    print(B)
else:

    if K>=A: 
        K-=A 
        A=0
        B-=K
        print_ans(A,B)
    else: 
        A-=K
        K=0
        print_ans(A,B)

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



if A==B:
    print("0 0")
elif A==0 and B==0:
    print(f"{A} {B}")
else:
    least = min(A,B)
    more = max(A,B)
    K-=least
    if K:
        more-=K
    if min(A,B)==A:
        print(f"0 {more}")
    else:
        print(f"{more} 0")
Problem p02823 (python)

Fixed submission:
N,A,B = map(int,input().split())
ans = 0
if (B-A)%2 == 0:
    print(int((B-A)//2))
else:
    print(min(A-1,N-B)+1+int((B-A-1)//2))

Buggy submission (verdict: Runtime Error):
N,A,B = map(int,input.split())
ans = 0
if (B-A)%2 == 0:
    print(int((B-A)//2))
else:
    print(min(A-1,N-B)+1+int((B-A-1)//2))

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

min_num = min(A,B)
max_num = max(A,B)
if max_num >N : print(0)
else:
    matches = 0
    while(True):
        if max_num==min_num:
            print(matches)
            break
        else:
            if max_num - min_num == 1:
                max_num-=1
                min_num-=1 if min_num != 1else 0
                matches+=1
                max_arr.append(max_num)
                min_arr.append(min_num)
            else:
                min_num+=1 if min_num != 1 or max_num > 2 else 0
                max_num-=1
                matches+=1
                max_arr.append(max_num)
                min_arr.append(min_num)

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

if (abs(A-B)==1):
    return min(A,B)
elif: abs(A-B)==2:
    return abs(A-B)-1
Problem p03470 (python)

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

x = sorted(d, reverse=True)

ans = 1
for i in range(N-1):
    if x[i] - x[i+1] >0:
        ans += 1
    else:
        continue


print(ans)

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

x = sorted(d, reverse=True)

ans = 1
for i in range(N-1):
    if x[i] - x[i+1] >0:
        ans += 1
    else:
        continue


print(ans)
Problem p03471 (python)

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

for a in range(N + 1):
    for b in range(N - a + 1):
        c = N - a - b
        if 10000*a+5000*b+1000*c == Y:
            print(a,b,c)
            exit()
                
print(-1,-1,-1)

Buggy submission (verdict: Runtime Error):
N, Y = map(int, input().split())

for a in range(n + 1):
    for b in range(n - a + 1):
        c = n - a - b
        if 10000*a+5000*b+1000*c == Y:
            print(a,b,c)
            exit()
                
print(-1,-1,-1)

Buggy submission (verdict: Runtime Error):
N, Y = map(int, input().split())

for a in range(N+1):
    for b in range(N-a+1):
        c = N-a-b
            if 10000*a+5000*b+1000*c == Y:
                print(a,b,c)
                exit()
                
print(-1,-1,-1)
Problem p03478 (python)

Fixed submission:
def sum(n):
    str_n = str(n)
    ans = 0
    for i in range(len(str_n)):
        ans += int(str_n[i])
    return ans

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

ans1 = 0
for i in range(N+1):
    if A <= sum(i) <= B:
        ans1 += i
    else:
        continue
print(ans1)

Buggy submission (verdict: Runtime Error):
def sum(n):
    str_n = str(n)
    ans = 0
    for i in range(len(str_n)):
        ans += int(str_n[i])
    return ans

N,A,B = map(int, [input() for i in range(3)])

ans1 = 0
for i in range(N+1):
    if A <= sum(i) <= B:
        ans1 += i
    else:
        pass
print(ans1)

Buggy submission (verdict: Runtime Error):
N,A,B = map(int, [input() for i in range(3)])

def sum(n):
    str_n = str(n)
    ans = 0
    for i in range(len(str_n)):
        ans += int(str_n[i])
    return ans

ans1 = 0
for i in range(N+1):
    if A <= sum(i) <= B:
        ans1 += i
    else:
        pass
print(ans1)

Buggy submission (verdict: Runtime Error):
def sum(n):
    str_n = str(n)
    ans = 0
    for i in range(len(str_n)):
        ans += int(str_n[i])
    return ans

N,A,B = map(int, [input() for i in range(3)])

ans1 = 0
for i in range(N+1):
    if A <= sum(i) <= B:
        ans1 += i
print(ans1)

Buggy submission (verdict: Runtime Error):
N,A,B = map(int, [input() for i in range(3)])

def sum(n):
    str_n = str(n)
    ans = 0
    for i in range(len(str_n)):
        ans += int(str_n[i])
    return ans

ans1 = 0
for i in range(N+1):
    if A <= sum(i) <= B:
        ans1 += i
print(ans1)

Buggy submission (verdict: Runtime Error):
N,A,B = map(int, [input() for i in range(3)])

def sum(n):
    str_n = str(n)
    ans = 0
    for i in range(len(str_n)):
        ans += int(str_n[i])
    return ans
    
ans1 = 0
for i in range(N+1):
    if A <= sum(i) <= B:
        ans1 += i
print(ans1)
Problem p02601 (python)

Fixed submission:
x=3
A,B,C=(int(x) for x in input().split())
K=int(input())
j=0
if A>=(2**K)*B :
    print('No')
else :
    while A>=(2**j)*B :
        j+=1
    if (2**j)*B>=(2**(K-j))*C :
        print('No')
    else:
        print('Yes')

Buggy submission (verdict: Runtime Error):
A=int(input())
B=int(input())
C=int(input())
K=int(input())
j=0
if A>=(2**K)*B :
    print('No')
else :
    while A>=(2**j)*B :
        j+=1
    if (2**j)*B>=(2**(K-j))*C :
        print('No')
    else:
        print('Yes')

Buggy submission (verdict: Runtime Error):
A=int(input())
B=int(input())
C=int(input())
K=int(input())
j=0
if A>=(2**K)*B :
    print('No')
else :
    while A>=(2**j)*B :
        j+=1
    if (2**j)*B>=(2**(K-j))*C :
        print('No')
    else:
        print('Yes')
        print((2**(K-j))*C)
Problem p02582 (python)

Fixed submission:
S = input()
if S.count("R") == 3:
	print("3")
elif S.count("R") == 0:
	print("0")
elif S.count("RR") == 1:
  	print("2")
else:
	print("1")

Buggy submission (verdict: Runtime Error):
s = input().split()
if s[0] == R and s[1] == R and s[2] == R 
	print("3")
elif s[0] == S and s[1] == S and s[2] == S 
	print("0")
elif s[0] == R and s[1] == R and s[2] == S 
	print("2")
elif s[0] == S and s[1] == R and s[2] == R
	print("2")
else 
	print("1")

Buggy submission (verdict: Runtime Error):
A = input()
if A == RRR
	print("3")
elif A == SSS
	print("0")
elif A == RRS
	print("2")
elif A == SRR
	print("2")
else 
	print("1")

Buggy submission (verdict: Runtime Error):
if S == RRR
	print("3")
elif S == SSS
	print("0")
elif S == RRS
	print("2")
elif S == SRR
	print("2")
else 
	print("1")

Buggy submission (verdict: Runtime Error):
S = input()
if S == RRR
	print("3")
elif S == SSS
	print("0")
elif S == RRS
	print("2")
elif S == SRR
	print("2")
else 
	print("1")
Problem p02612 (python)

Fixed submission:
N = int(input())
S = divmod(N, 1000)
if S[1] == 0:
  print (S[1])
else:
  print (1000 - S[1])

Buggy submission (verdict: Runtime Error):
N = input()
S = (N[-3])
A = int(S) - 10
print (abs(A) * 100)
Problem p02783 (python)

Fixed submission:
x,y= map(int,input().split())
s = -(-x//y)
print(s)

Buggy submission (verdict: Runtime Error):
H,A=map(int,inoput().split())
print-(-H/A)
Problem p04043 (python)

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

nana = 0
go = 0

for i in n:
    if i == 5:
        go +=1
    elif i ==7:
        nana +=1

if nana ==1 and go ==2:
    print("YES")
else:
    print("NO")

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

nana = 0
go = 0

for i in n:
    if i == 5:
        go +=1
    elif i ==7:
        nana +=1

if nana ==1 and go ==2:
    print("YES")
else:
    print("NO")
Problem p02582 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A))

S = input()

if S == 'RRR':
    print(3)
elif S[:2] == 'RR' or S[1:3] == 'RR':
    print(2)
elif S.count('R') != 0:
    print(1)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
from itertools import accumulate #list(accumulate(A))

N, K = mi()
P = li()
C = li()
ans = -float('inf')

for i in range(N):
    score = 0
    ind = i
    his = []
    while True:
        ind = P[ind] - 1
        his.append(C[ind])
        if ind == i:
            #print(his)
            his = list(accumulate(his))
            L = len(his)
            if K > L:
                if his[-1] >= 0:
                    if not K%L:
                        ans = max(ans, his[-1] * (K//L))
                    else:
                        ans = max(ans, max(his[:K%L]) + his[-1] * (K//L))
                else:
                    ans = max(ans, max(his))
            else:
                ans = max(ans, max(his))
            break

print(ans)
Problem p02585 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
from itertools import accumulate #list(accumulate(A))

N, K = mi()
P = li()
C = li()
ans = -float('inf')

for i in range(N):
    ind = i
    his = []
    while True:
        ind = P[ind] - 1
        his.append(C[ind])
        if ind == i:
            his = list(accumulate(his))
            #print(his)
            L = len(his)
            if K > L:
                if his[-1] > 0:
                    if not K%L:
                        ans = max(ans, his[-1] * (K//L), max(his) + his[-1] * max(K//L-1, 0))
                    else:
                        ans = max(ans, max(his[:K%L]) + his[-1] * (K//L), his[-1] * (K//L), max(his) + his[-1] * max(K//L-1, 0))
                else:
                    ans = max(ans, max(his))
            else:
                ans = max(ans, max(his[:K]))
            break

print(ans)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
from itertools import accumulate #list(accumulate(A))

N, K = mi()
P = li()
C = li()
ans = -float('inf')

for i in range(N):
    ind = i
    his = []
    while True:
        ind = P[ind] - 1
        his.append(C[ind])
        if ind == i:
            his = list(accumulate(his))
            print(his)
            L = len(his)
            if K > L:
                if his[-1] > 0:
                    if not K%L:
                        ans = max(ans, his[-1] * (K//L))
                    else:
                        ans = max(ans, max(his[:K%L]) + his[-1] * (K//L), his[-1] * (K//L))
                else:
                    ans = max(ans, max(his))
            else:
                ans = max(ans, max(his[:K]))
            break

print(ans)
Problem p02602 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A))

N, K = mi()
A = li()


for i in range(K, N):
    if A[i] > A[i-K]:
        print('Yes')
    else:
        print('No')

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A))

N = ii()
A = li()

yen = 1000
kabu = 0

for i in range(1, N):
    if A[i] > A[i-1]:
        kabu = (yen//A[i-1])
        yen = kabu * A[i] + (yen - kabu * A[i-1])

print(yen)
Problem p02606 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A))

L, R, d = mi()

cnt = 0

for i in range(L, R+1):
    if i % d == 0:
        cnt += 1

print(cnt)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A))

N = ii()

cnt = [0] * (10**4+1)


for i in range(1, 101):
    for j in range(1, 101):
        for k in range(1, 101):
            tmp = ((i+j)**2 + (j+k)**2 + (k+i)**2) // 2
            if tmp < 10**4 + 1:
                cnt[tmp] += 1

for i in range(1, N+1):
    print(cnt[i])
Problem p02645 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A))

S = input()

print(S[:3])

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
from itertools import accumulate #list(accumulate(A))
import math
    
N, K = mi()
A = li()
 
#light = [0] * (N+2)
#A = [0] + A + [0]
#print(math.log(N, 2))
'''
thre = 0
for i in range(N):
    if A[i] < i:
        thre = max(thre, i-A[i])
'''
if K > pow(N, 0.5) + 1:
        for i in range(N):
            print(N, '', end='')
        print()
        exit()
 
 
for i in range(K):
    new = [0] * (N+1)
    for j in range(N):
        new[max(j-A[j], 0)] += 1
        new[min(j+A[j]+1, N)] += -1
        #print(new)
    new = list(accumulate(new))
    A = new[:N]
 
for i in range(N):
    print(A[i], '', end='')
print()
Problem p02658 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A))

N = ii()
A = li()
ans = 1
for num in A:
    ans *= num
    if ans > 10**18:
        if 0 in A:
            print(0)
        else:
            print(-1)
        exit()

print(ans)

Buggy submission (verdict: Runtime Error):
N = ii()
A = li()
ans = 1
for num in A:
    if ans < 10**18 / num:
        #print(ans, 10**18 / num)
        ans *= num
    else:
        if 0 in A:
            print(0)
        else:
            print(-1)
        exit()

print(ans)