Buggy python submission (verdict: Runtime Error):
n = int(input())
str_list = input().split()

list = [int(k) for k in str_list]

list.sort(reverse=True)

result = 1

if(0 in list):
  print('0')
  return

for i in range(n):
  result = result * list[i]
  if(result >= 1000000000000000000):
    print('-1')
    return

print(result)
  


Fixed submission:
n = int(input())
str_list = input().split()

list = [int(k) for k in str_list]

list.sort(reverse=True)

result = 1

if(0 in list):
  print('0')
  exit()

for i in range(n):
  result = result * list[i]
  if(result > 1000000000000000000):
    print('-1')
    exit()

print(result)

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

list.sort(reverse=True)

result = 1

if(0 in list):
  print('0')
  return

for i in range(n):
  result = result * list[i]
  if(result >= 1000000000000000000):
    print('-1')
    return

print(result)
  


Fixed submission:
n = int(input())
str_list = input().split()

list = [int(k) for k in str_list]

list.sort(reverse=True)

result = 1

if(0 in list):
  print('0')
  exit()

for i in range(n):
  result = result * list[i]
  if(result > 1000000000000000000):
    print('-1')
    exit()

print(result)

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

result = 1

for i in range(n):
  result = result * int(str_list[i])
  
t = 1
for j in range(18):
  t = t * 10

if(result > t):
  print('-1')
else:
  print(result)
   


Fixed submission:
n = int(input())
str_list = input().split()

list = [int(k) for k in str_list]

list.sort(reverse=True)

result = 1

if(0 in list):
  print('0')
  exit()

for i in range(n):
  result = result * list[i]
  if(result > 1000000000000000000):
    print('-1')
    exit()

print(result)

Buggy python submission (verdict: Runtime Error):
n = int(input())
str_list = input().split()

result = 1

for i in range(n):
  result = result * int(str_list[i])
  
t = 1
for j in range(18)
  t = t * 10
if(result > t):
  print('-1')
else:
  print(result)
   


Fixed submission:
n = int(input())
str_list = input().split()

list = [int(k) for k in str_list]

list.sort(reverse=True)

result = 1

if(0 in list):
  print('0')
  exit()

for i in range(n):
  result = result * list[i]
  if(result > 1000000000000000000):
    print('-1')
    exit()

print(result)

Buggy python submission (verdict: Runtime Error):
n = int(input())
str_list = input().split()

result = 1

for i in range(n):
  result = result * int(str_list(i))
  
t = 1
for j in range(18)
  t = t * 10
if(result > t):
  print('-1')
else:
  print(result)
   


Fixed submission:
n = int(input())
str_list = input().split()

list = [int(k) for k in str_list]

list.sort(reverse=True)

result = 1

if(0 in list):
  print('0')
  exit()

for i in range(n):
  result = result * list[i]
  if(result > 1000000000000000000):
    print('-1')
    exit()

print(result)

Buggy python submission (verdict: Runtime Error):
n = int(input())
str_list = input().split()

result = 1

for i in range(n):
  result = result + str_list(i)
  
t = 1
for j in range(18)
  t = t * 10
if(result > t):
  print('-1')
else:
  print(result)
   

Fixed submission:
n = int(input())
str_list = input().split()

list = [int(k) for k in str_list]

list.sort(reverse=True)

result = 1

if(0 in list):
  print('0')
  exit()

for i in range(n):
  result = result * list[i]
  if(result > 1000000000000000000):
    print('-1')
    exit()

print(result)

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n = input()
    A = [int(i) for i in input().split()]
    ans = 1
    for a in A:
        ans *= a

    if ans > pow(10, 18):
        print("-1")
    else:
        print(ans)


if __name__ == "__main__":
    main()


Fixed submission:
def main():
    n = input()
    A = [int(i) for i in input().split()]
    if 0 in A:
        print("0")
        return
    ans = 1
    max_num = pow(10, 18)
    for a in A:
        ans *= a
        if ans > max_num:
            print("-1")
            return
    print(ans)


if __name__ == "__main__":
    main()