Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())

count = -1
n = 7
for i in range(K):
    if n % K == 0:
        count = i+1
        break
    n = int(str(n)+'7')

print(count)

Fixed submission:
K = int(input())

count = -1
n = 7
for i in range(K):
    if n % K == 0:
        count = i+1
        break
    n = int(str(n)+'7')
    n %= K
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())
if K % 2 == 0:
    print(-1)

else:
    c = 7
    count = 0
    while True :
        if c % K == 0:
            print(count+1)
            break

        c = int(str(c)+'7')
        count+=1


Fixed submission:
K = int(input())

count = -1
n = 7
for i in range(K):
    if n % K == 0:
        count = i+1
        break
    n = int(str(n)+'7')
    n %= K
print(count)
Buggy python submission (verdict: Runtime Error):
A = input()
b = A.count("RRR")
C = A.count("RR")
D = A.count("R")
if b == 1: 
   print(3)
elif C ==1:
   print(2)
else:
   if D >0:
      print(1)
   else:

Fixed submission:
A = input()
b = A.count("RRR")
C = A.count("RR")
if b == 1: 
   print(3)
elif C ==1:
   print(2)
else:
   if A.count("R")>0:
      print(1)
   else:
      print(0)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
if 0 in A:
    print(0)
    quit()
for i in range(N):
    output = 1
    output *= a[i]
    if output> 10**18:
        print(-1)
        quit()
print(output)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
output = 1
if 0 in A:
    print(0)
else:
    for i in range(N):
        output *= A[i]
        if output> 10**18:
            print(-1)
            quit()
    print(output)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
if (0 in A):
    print(0)
for i in range(N):
    output = 1
    output *= a[i]
    if output> 10**18:
        print(-1)
        quit()
print(output)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
output = 1
if 0 in A:
    print(0)
else:
    for i in range(N):
        output *= A[i]
        if output> 10**18:
            print(-1)
            quit()
    print(output)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
for i in range(N):
    output = 1
    output *= a[i]

    if output> 10**18:
        print(-1)
        quit()
print(output)


Fixed submission:
N = int(input())
A = list(map(int,input().split()))
output = 1
if 0 in A:
    print(0)
else:
    for i in range(N):
        output *= A[i]
        if output> 10**18:
            print(-1)
            quit()
    print(output)
Buggy python submission (verdict: Runtime Error):
T = str(input()).upper()
for i in T:
    if i == 'P' or 'D' and i== '?':
        if i + 'D':
            print(T.replace('?','P'))
        else:
            print(T.replace('?','D'))
    else:
        break

Fixed submission:
t = input()
s = [i for i in t]
if s[0] == "?":
    s[0] = "D"
for i in range(1, len(t) - 1):
    if s[i] == "?":
        if s[i-1] == "D" and s[i+1] == "D":
            s[i] = "P"
        elif s[i-1] == "D" and s[i+1] == "?":
            s[i] = "P"
        else:
            s[i] = "D"
if s[-1] == "?":
    s[-1] = "D"
print("".join(s))

Buggy python submission (verdict: Runtime Error):
a = input()
b = [i for i in a]
if b[0] == "?":
    bin[0] = "D"
for i in range(1, len(t) - 1):
    if b[i] == "?":
        if b[i-1] == "D" and b[i+1] == "D":
            b[i] = "P"
        elif b[i-1] == "D" and b[i+1] == "?":
            b[i] = "P"
        else:
            b[i] = "D"
if b[-1] == "?":
    b[-1] = "D"
print("".join(b))

Fixed submission:
t = input()
s = [i for i in t]
if s[0] == "?":
    s[0] = "D"
for i in range(1, len(t) - 1):
    if s[i] == "?":
        if s[i-1] == "D" and s[i+1] == "D":
            s[i] = "P"
        elif s[i-1] == "D" and s[i+1] == "?":
            s[i] = "P"
        else:
            s[i] = "D"
if s[-1] == "?":
    s[-1] = "D"
print("".join(s))
Buggy python submission (verdict: Runtime Error):
U = int(input())
b = str(U)
c = int(b[-1])
if c in [2,4,5,7,9]:
    print("hon")
elif c in [0,1,6,8]:
    print("pon")
else:
    print("bon")S

Fixed submission:
a = int(input())
b = str(a)
c = int(b[-1])
if c in [2,4,5,7,9]:
    print("hon")
elif c in [0,1,6,8]:
    print("pon")
else:
    print("bon")
Buggy python submission (verdict: Time Limit Exceeded):
a = int(input())
for i in range(-1000, 1000):
    for j in range(-1000, 1000):
        if i**5 - j**5 == a:
            print(i,j)
            break


Fixed submission:
a = int(input())
for i in range(-1000, 1000):
    for j in range(-1000, 1000):
        if i**5 - j**5 == a:
            print(i,j)
            quit()
Buggy python submission (verdict: Runtime Error):
a = input()
b = input()
if b>=a:
    print("unsafe")
else:
    print("safe")

Fixed submission:
a,b = map(int,input().split())
if b>=a:
    print("unsafe")
else:
    print("safe")
Buggy python submission (verdict: Runtime Error):
b = []
for i in range(3): 
    a= int(input())
    b.append(a)
print(b[::-1])

Fixed submission:
x , y, z = map(int,input().split())
print('{} {} {}'.format(z,x,y))
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = abs(a - b)
d = abs(c-b)
print(d)

Fixed submission:
n,k = map(int,input().split())
if n % k ==0:
    print(0)
else:
    l = [n]
    p = n//k
    c = n-(p*k)
    half = k//2
    while c > half:
        c = abs(c-k)
    l.append(c)
    print(min(l))
Buggy python submission (verdict: Runtime Error):
list = [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]
a = int(input())
print(list[a+1])

Fixed submission:
a = [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]
b = int(input())
print(a[b-1])
Buggy python submission (verdict: Runtime Error):
userinput = input("")
userlist = userinput.split(" ")
H = int(user[0])
A = int(user[1])
numberkill = 0
if H <= 10000 and A <= 1000:
  while H > 0:
    H = H - A
    numberkill = +1
  if H < 0:
    numberkill = +1
    print(numberkill)
  else:
    print(numberkill)
else:
  print("")

Fixed submission:
firstinput = input("")
firstinputsplit = firstinput.split(" ")
H = int(firstinputsplit[0])
N = int(firstinputsplit[1])
kill = 0
if H <= 10000 and N <= 10000:
    while H > 0:
        H = H - N
        kill = kill + 1
    print(kill)
else:
    print(H)
Buggy python submission (verdict: Time Limit Exceeded):
# 入力は二行でそれぞれ[数値]

input_nums = int(input())
input_line = input()

result = 0

for k in range(input_nums):
    for j in range(k):
        for i in range(j):
            if(j-i == k-j):
                pass
            elif(input_line[i] == input_line[j]):
                pass
            elif(input_line[i] == input_line[k]):
                pass
            elif(input_line[j] == input_line[k]):
                pass
            else:
                result = result + 1

print(result)


Fixed submission:
N = int(input())
S = input()

ans = S.count("R")*S.count("G")*S.count("B")

for i in range(N-2):
    for j in range(i+1, N-1):
        k = j-i + j
        if k < N and S[i] != S[j] and S[j] != S[k] and S[i] != S[k]:
            ans -= 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
# 入力は二行でそれぞれ[数値]

input_nums = int(input())
input_line = input()

result = 0

for k in range(input_nums):
    for j in range(k):
        for i in range(j):
            if(j-i == k-j):
                pass
            elif(input_line[i] != input_line[j] and input_line[i] != input_line[k] and input_line[j] != input_line[k]):
                    result = result + 1

print(result)


Fixed submission:
N = int(input())
S = input()

ans = S.count("R")*S.count("G")*S.count("B")

for i in range(N-2):
    for j in range(i+1, N-1):
        k = j-i + j
        if k < N and S[i] != S[j] and S[j] != S[k] and S[i] != S[k]:
            ans -= 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
# 入力は二行でそれぞれ[数値]

input_nums = int(input())
input_line = input()

result = 0

for k in range(input_nums):
    for j in range(k):
        for i in range(j):
            if(j-i != k-j):
                if(input_line[i] != input_line[j] and input_line[i] != input_line[k] and input_line[j] != input_line[k]):
                    result = result + 1

print(result)


Fixed submission:
N = int(input())
S = input()

ans = S.count("R")*S.count("G")*S.count("B")

for i in range(N-2):
    for j in range(i+1, N-1):
        k = j-i + j
        if k < N and S[i] != S[j] and S[j] != S[k] and S[i] != S[k]:
            ans -= 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(k) for k in input().split()]

result = True

# for char in A:
#     if(A.count(char) != 1):
#         result = False
#         break
for i in range(N):
    for j in range(i+1, N):
        # print("A[i]= "+str(A[i])+", A[j]= "+str(A[j]))
        if A[i] == A[j]:
            result = False

if (result == True):
    print("YES")
else:
    print("NO")


Fixed submission:
N = int(input())
A = [int(k) for k in input().split()]

result = True

# for char in A:
#     if(A.count(char) != 1):
#         result = False
#         break
# for i in range(N):
#     for j in range(i+1, N):
#         # print("A[i]= "+str(A[i])+", A[j]= "+str(A[j]))
#         if A[i] == A[j]:
#             result = False
A.sort()

for i in range(N-1):
    if (A[i] == A[i+1]):
        result = False
        break

if (result == True):
    print("YES")
else:
    print("NO")

Buggy python submission (verdict: Time Limit Exceeded):
N = input()
A = [int(k) for k in input().split()]

result = True

for char in A:
    if(A.count(char) != 1):
        result = False
        break

if (result == True):
    print("YES")
else:
    print("NO")


Fixed submission:
N = int(input())
A = [int(k) for k in input().split()]

result = True

# for char in A:
#     if(A.count(char) != 1):
#         result = False
#         break
# for i in range(N):
#     for j in range(i+1, N):
#         # print("A[i]= "+str(A[i])+", A[j]= "+str(A[j]))
#         if A[i] == A[j]:
#             result = False
A.sort()

for i in range(N-1):
    if (A[i] == A[i+1]):
        result = False
        break

if (result == True):
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = [int(k) for k in input().split()]

result = 0
for i in range(N):
    for j in range(0,i):
        # j < i
        if P[i] > P[j]:
            result = result - 1
            break

print(N+result)


Fixed submission:
N = int(input())
P = [int(k) for k in input().split()]

maxes = []
mins  = []

max = 0
min = 0
result = 0

for i in range(N):
    if i == 0:
        max = P[i]
        min = P[i]
    else:
        if(max < P[i]):
            max = P[i]
        if(min > P[i]):
            min = P[i]

    maxes.append(max)
    mins.append(min)

for i in range(N):
    if mins[i] == P[i]:
        result = result + 1

print(result)
Buggy python submission (verdict: Time Limit Exceeded):
il1 = [int(k) for k in input().split()]
N = il1[0]
M = il1[1]
answered = []
result = [0, 0]
was = [0]
was = was * (N+1)

for i in range(M):
    il = input().split()
    p = int(il[0])
    s = il[1]
    if (p in answered):
        pass
    else:
        if (s == 'AC'):
            result[0] = result[0]+1
            answered.append(p)
            result[1] = result[1]+was[p]
        else:
            was[p] = was[p] + 1

print(str(result[0])+" "+str(result[1]))


Fixed submission:
il1 = [int(k) for k in input().split()]
N = il1[0]
M = il1[1]
answered = ['WA']
answered = answered * (N+1)
result = [0, 0]
was = [0]
was = was * (N+1)

for i in range(M):
    il = input().split()
    p = int(il[0])
    s = il[1]
    if (answered[p] == 'AC'):
        pass
    else:
        if (s == 'AC'):
            result[0] = result[0]+1
            answered[p] = s
            result[1] = result[1]+was[p]
        else:
            was[p] = was[p] + 1

print(str(result[0])+" "+str(result[1]))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

from itertools import combinations

num = 10**9 + 7
ans = 0
for ai, aj in combinations(A, 2):
    ans += ai*aj
    ans %= num
    
print(ans)


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

from itertools import combinations

num = 10**9 + 7
ans = 0

B = []
b = 0
for i in reversed(A[1:]):
    b += i
    B.append(b)
B.reverse()
for x, y in zip(A[:-1], B):
    ans += x*y
    ans %= num
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = list(map(int, input().split()))
P = list(map(int, input().split()))
C = list(map(int, input().split()))

P = list(map(lambda x:x-1, P))

ans = -float('inf')
for si in range(N):
    s = []
    tot = 0
    x = si
    while True:
        x = P[x]
        s.append(C[x])
        tot += C[x]
        if x==si:
            break
    l = len(s)
    now = 0
    t = 0
    for i in range(l):
        if i+1 > K: break
        t += s[i]
        now = t
        if tot >0:
            e = (K-(i+1))//l
            now += tot * e
        ans = max(ans, now)


print(ans)




Fixed submission:
N, K = list(map(int, input().split()))
P = list(map(int, input().split()))
C = list(map(int, input().split()))

P = list(map(lambda x:x-1, P))

ans = -float('inf')
for si in range(N):
    s = []
    tot = 0
    x = si
    while True:
        x = P[x]
        s.append(C[x])
        tot += C[x]
        if x==si:
            break
    l = len(s)
    now = 0
    t = 0
    for i in range(l):
        if i+1 > K: break
        t += s[i]
        now = t
        if tot >0:
            e = (K-(i+1))//l
            now += tot * e
        ans = max(ans, now)


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

A.sort()

pot = [A.pop()]
com = 0
while A:
    com += pot.pop()
    new = A.pop()
    pot.append(new)
    pot.append(new)
    pot.sort()

print(com)


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

A.sort()
from collections import deque

pot = deque([A.pop()])
com = 0
while A:
    com += pot.pop()
    new = A.pop()
    pot.appendleft(new)
    pot.appendleft(new)

print(com)
Buggy python submission (verdict: Time Limit Exceeded):
def func(x):
    return int(x)-1
N, K = list(map(int, input().split()))
A = list(map(func, input().split()))


now = 0
past = []

for i in range(N):
    if now in past:
        break
    past.append(now)
    now = A[now]



i_loop = past.index(now)
loop = past[i_loop:]
if K >= i_loop:
    print(loop[(K-i_loop) % len(loop)] +1)
else:
    print(past[K] +1)



Fixed submission:
def func(x):
    return int(x)-1
N, K = list(map(int, input().split()))
A = list(map(func, input().split()))



now = 0
past = []
past_set = set()

for i in range(N):
    if now in past_set:
        break
    past.append(now)
    past_set.add(now)
    now = A[now]


i_loop = past.index(now)
loop = past[i_loop:]
if K >= i_loop:
    print(loop[(K-i_loop) % len(loop)] +1)
else:
    print(past[K] +1)

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

A = [a-1 for a in A]


now = 0
past = []
while not (now in past):
    past.append(now)
    now = A[now]

i_loop = past.index(now)
loop = past[i_loop:]
if K >= i_loop:
    print(loop[(K-i_loop) % len(loop)] +1)
else:
    print(past[K] +1)



Fixed submission:
def func(x):
    return int(x)-1
N, K = list(map(int, input().split()))
A = list(map(func, input().split()))



now = 0
past = []
past_set = set()

for i in range(N):
    if now in past_set:
        break
    past.append(now)
    past_set.add(now)
    now = A[now]


i_loop = past.index(now)
loop = past[i_loop:]
if K >= i_loop:
    print(loop[(K-i_loop) % len(loop)] +1)
else:
    print(past[K] +1)
Buggy python submission (verdict: Runtime Error):
A = -119
while A<= 120:
    B = -119
    while B<= 120:
        if A**5 - B**5 == X:
            break
        B += 1
    A+= 1

print('%d %d'%(A, B))

Fixed submission:
X = int(input())

A = -119
while A<= 120:
    B = -119
    while B<= 120:
        if A**5 - B**5 == X:
            print('%d %d'%(A, B))
            break
        B += 1
    else:
        A+= 1
        continue
    break
Buggy python submission (verdict: Runtime Error):
s_in = S
if s_in[2]==s_in[3] and s_in[4]==s_in[5]:
    print('yes')
else:
    print('no')

Fixed submission:
s_in = input()
if s_in[2]==s_in[3] and s_in[4]==s_in[5]:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
s = []
r.extend( [0 for i in range(x+y)])
p.sort()
q.sort()
r.sort()


for i in range(x):
    if  p[-1]>= r[-1]:
        s.append(p.pop())
    else:
        s.append(r.pop())
    
for i in range(y):
    if  q[-1]>= r[-1]:
        s.append(q.pop())
    else:
        s.append(r.pop())
        
print(sum(s))

Fixed submission:
x, y, a, b, c = [int(t) for t in input().split()]
p = [int(t) for t in input().split()]
q = [int(t) for t in input().split()]
r = [int(t) for t in input().split()]

s = []
p.sort(reverse=True)
p = p[:x]

q.sort(reverse=True)
q = q[:y]

s = p + q + r
s.sort(reverse=True)
s = s[:x+y]
print(sum(s))

Buggy python submission (verdict: Time Limit Exceeded):
x, y, a, b, c = [int(t) for t in input().split()]
p = [int(t) for t in input().split()]
q = [int(t) for t in input().split()]
r = [int(t) for t in input().split()]
s = []
for i in range(x):
    p_max = max(p)
    if r:
        r_max = max(r)
    else:
        r_max = 0
    if p_max >= r_max:
        s.append(p.pop(p.index(p_max)))
    else:
        s.append(r.pop(r.index(r_max)))
for i in range(y):
    q_max = max(q)
    if r:
        r_max = max(r)
    else:
        r_max = 0
    if q_max >= r_max:
        s.append(q.pop(q.index(q_max)))
    else:
        s.append(r.pop(r.index(r_max)))
        
print(sum(s))

Fixed submission:
x, y, a, b, c = [int(t) for t in input().split()]
p = [int(t) for t in input().split()]
q = [int(t) for t in input().split()]
r = [int(t) for t in input().split()]

s = []
p.sort(reverse=True)
p = p[:x]

q.sort(reverse=True)
q = q[:y]

s = p + q + r
s.sort(reverse=True)
s = s[:x+y]
print(sum(s))
Buggy python submission (verdict: Runtime Error):
n = int(input())
l = []
while n:
    N -= 1
    l.append(chr(97+(n % 26)))
    n //= 26

print("".join(l[::-1]))


Fixed submission:
N = int(input())
l = []
while N:
    N -= 1
    l.append(chr(97+(N % 26)))
    N //= 26

print("".join(l[::-1]))
Buggy python submission (verdict: Runtime Error):

def method():
  a, v = input().split()
  b, w = input().split()
  t = int(input())

  a = int(a) # Oni cordinate
  v = int(v) # Oni Speed
  b = int(b) # Nige Cordinate
  w = int(w) # Nige Speed

  if a < b:
    distance = b - a
    relative_speed = v - w
    if relative_speed <= 0:
      return 'NO'
    else:
      if (distance / relative_speed) > t:
        return 'NO'
      else:
        return 'YES'
  else: # b < a
    distance = a - b
    relative_speed = v - m
    if relative_speed <= 0:
      return 'NO'
    else:
      if (distance / relative_speed) > t:
        return 'NO'
      else:
        return 'YES'

print(method())


  

  



Fixed submission:

def method():
  a, v = input().split()
  b, w = input().split()
  t = int(input())

  a = int(a) # Oni cordinate
  v = int(v) # Oni Speed
  b = int(b) # Nige Cordinate
  w = int(w) # Nige Speed

  if a < b:
    distance = b - a
    relative_speed = v - w
    if relative_speed <= 0:
      return 'NO'
    else:
      if (distance / relative_speed) > t:
        return 'NO'
      else:
        return 'YES'
  else: # b < a
    distance = a - b
    relative_speed = v - w
    if relative_speed <= 0:
      return 'NO'
    else:
      if (distance / relative_speed) > t:
        return 'NO'
      else:
        return 'YES'

print(method())
Buggy python submission (verdict: Runtime Error):
count = int(input())
if count == 0:
  result = 0
else:
  nums_str = input().split()
  nums_int = []
  for strn in nums_str:
    nums_int.append(int(strn))
 
    result = 1

    if 0 in nums_int:
      result = 0
    else:
      for intn in nums_int:
        result *= intn
        if result > 1000000000000000000:
          result = -1
          break
    
print(result)

Fixed submission:
nums = input()
num1 = int(nums.split()[0])
num2 = int(nums.split()[1])

print(num1 * num2)
Buggy python submission (verdict: Time Limit Exceeded):
count = int(input())
if count == 0:
  result = 0
else:
  nums_str = input().split()
  nums_int = []
  for strn in nums_str:
    nums_int.append(int(strn))

    if 0 in nums_int:
      result = 0
    else:
      result = 1
      for intn in nums_int:
        result *= intn
        if result > 1000000000000000000:
          result = -1
          break
    
print(result)

Fixed submission:
def process():
  count = int(input())
  nums_str = input().split()
  nums_int = []
  for strn in nums_str:
    nums_int.append(int(strn))

  if 0 in nums_int:
    result = 0
    return result
  else:
    result = 1
    for intn in nums_int:
      result *= intn
      if result > 1000000000000000000:
        result = -1
        return result
    return result
    
print(process())

Buggy python submission (verdict: Time Limit Exceeded):
count = int(input())
if count == 0:
  result = 0
else:
  nums_str = input().split()
  nums_int = []
  for strn in nums_str:
    nums_int.append(int(strn))
 
    result = 1

    if 0 in nums_int:
      result = 0
    else:
      for intn in nums_int:
        result *= intn
        if result > 10**18:
          result = -1
          break
    
print(result)

Fixed submission:
def process():
  count = int(input())
  nums_str = input().split()
  nums_int = []
  for strn in nums_str:
    nums_int.append(int(strn))

  if 0 in nums_int:
    result = 0
    return result
  else:
    result = 1
    for intn in nums_int:
      result *= intn
      if result > 1000000000000000000:
        result = -1
        return result
    return result
    
print(process())

Buggy python submission (verdict: Runtime Error):
if int(count) == 0:
  result = 0
else:
  nums_str = input().split()
  nums_int = []
  for strn in nums_str:
    nums_int.append(int(strn))
 
    result = 1

  else:
    for intn in nums_int:
      result *= intn
      if result > 10**18:
        result = -1
        break
    
print(result)

Fixed submission:
def process():
  count = int(input())
  nums_str = input().split()
  nums_int = []
  for strn in nums_str:
    nums_int.append(int(strn))

  if 0 in nums_int:
    result = 0
    return result
  else:
    result = 1
    for intn in nums_int:
      result *= intn
      if result > 1000000000000000000:
        result = -1
        return result
    return result
    
print(process())

Buggy python submission (verdict: Runtime Error):
count = input()
nums_str = input().split()
nums_int = []
for strn in nums_str:
  nums_int.append(int(strn))

result = 1
if count == 0:
  result = 0
elif:
  for intn in nums_int:
    result *= intn
    if result > 10**18:
      result = -1
      break
    
print(result)

Fixed submission:
def process():
  count = int(input())
  nums_str = input().split()
  nums_int = []
  for strn in nums_str:
    nums_int.append(int(strn))

  if 0 in nums_int:
    result = 0
    return result
  else:
    result = 1
    for intn in nums_int:
      result *= intn
      if result > 1000000000000000000:
        result = -1
        return result
    return result
    
print(process())