Problem p02658 (python)

Fixed submission:
def resolve():
    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)
resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    N = int(input())
    A = list(map(int, input().split()))
    ans = 1
    if A in "0":
        print("0")
        exit()
    for i in A:
        ans *= i
        if ans > 10**18:
            print("-1")
            exit()
    print(ans)
resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    N = int(input())
    A = list(map(int, input().split()))
    ans = 1
    if A in "0":
        print("0")
        exit()
    else:
        for i in A:
            ans *= i
            if ans > 10**18:
                print("-1")
                exit()
        print(ans)
resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    N = int(input())
    A = list(map(int, input().split()))
    ans = 1
    if A in "0":
        print("0")
    else:
        for i in A:
            ans *= i
            if ans > 10**18:
                print("-1")
                exit()
        print(ans)
resolve()

Buggy submission (verdict: Runtime Error):
N = int(input())
list = list(map(int, input().split()))
no = 0 
ans = 1
c = 0
if list.count("0") >0:
  print("0")
  exit()
else:
  for i in range(N):
    ans = ans * list[no]
    c = c + len(str(list[no]))
    no += 1
    if c >= 25:
      pritn("-1")
      exit()
    else:
      continue
print(ans if ans <= 10**18 else "-1")

Buggy submission (verdict: Runtime Error):
N = int(input())
list = list(map(int, input().split()))
no = 0 
ans = 1
c = 0
if list.count("0") >0:
  print("0")
  exit()
else:
  for i in range(N):
    ans = ans * list[no]
    c = c + len(str(list[no]))
    no += 1
    if lens >= 19:
      exit()
    else:
      continue
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
list = list(map(int, input().split()))
no = 0 
ans = 1
lens = 0
if list.count("0") >0:
  print("0")
  exit()
else:
  for i in range(N):
    ans = ans * list[no]
    lens = lens + len(list[no])
    no += 1
    if lens >= 19:
      exit()
    else:
      continue
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
list = list(map(int, input().split()))
no = 0 
ans = 1
lens = 0
if list.count("0") >0:
  print("0")
  exit()
else:
  for i in range(N):
    ans = ans * list[no]
    lens = lens + len(list[no])
    no += 1
    if lens >= 19:
      exit()
    else:
      continue
print(ans if ans <= 10**18 else "-1")

Buggy submission (verdict: Runtime Error):
def resolve():
    N = int(input())
    list = list(map(int, input().split()))
    no = 0
    non = 0
    ans = 1
    lens = 0
    if (list.count("0") >= 1):
      print("0")
      exit()
    else:
      for i in range(N):
        lens = lens + len(list[non])
        non += 1
    if (lens >= 19):
      print("-1")
      exit()
    else:
      for j in range(N):
        ans = ans * list[no]
        no += 1
    print(ans)
resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    N = int(input())
    list = list(map(int, input().split()))
    no = 0
    ans = 1
    if (list.count("0") >= 1):
      print("0")
      exit()
    else:
      for i in range(N):
        ans = ans * list[no]
        no += 1
    print(ans if ans <= 10**18 else "-1")
resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    N = int(input())
    list = list(map(int, input().split()))
    no = 0
    non = 0
    ans = 1
    lens = 0
    if (list.count("0") >= 1):
      print("0")
      exit()
    else:
      for i in range(N):
        lens = lens + len(list[non])
        non += 1
    if (lens >= 19):
      print("-1")
      exit()
    else:
      for j in range(N):
        ans = ans * list[no]
        no += 1
        print(ans)
resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    N = int(input())
    list = list(map(int, input().split()))
    no = 0
    non = 0
    ans = 1
    lens = 0
    if (list.count("0") >= 1):
      print("0")
      exit()
    else:
      for i in range(N):
        lens = lens + len(list[non])
        non += 1
        if (lens >= 19):
          print("-1")
          exit()
        else:
          for j in range(N):
            ans = ans * list[no]
            no += 1
            print(ans)
resolve()

Buggy submission (verdict: Runtime Error):
N = int(input())
list = list(map(int, input().split()))
no = 0
non = 0
ans = 1
lens = 0
if list.count("0") >= 1:
  print("0")
  exit()
for i in range(N):
  lens = lens + len(list[non])
  non += 1
if non >= 19:
  print("-1")
  exit()
for j in range(N):
  ans = ans * list[no]
  no += 1
print(ans if ans <= 10**18 else "-1")

Buggy submission (verdict: Runtime Error):
N = int(input())
list = list(map(int, input().split()))
no = 1
ans = list[0]
for i in range(N):
  ans = ans*list[no]
  no += 1
print(ans if ans <= 10**18 else "-1")

Buggy submission (verdict: Runtime Error):
def resolve():
    N = int(input())
    list = list(map(int, input().split()))
    import numpy as np
    ans = np.prod(list)
    print(ans if ans <= 10**18 else "-1")
resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    N = int(input())
    list = list(map(int, input().split()))
    reduce(lamda x, y: x * y, (list))
    from operator import mul
    ans = reduce(mul, (list))
    print(ans if ans <= 10**18 else "-1")
resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    from operator import add
    N = int(input())
    list = list(map(int, input().split()))
    ans = reduce(add, (list))
    print(ans if ans <= 10**18 else "-1")
resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    N = int(input())
    list = list(map(int, input().split()))
    lists = np.array(list)
    print(np.prod(lists) if np.prod(lists)<=10**18 else "-1")
resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    N = int(input())
    list = list(map(int, input().split()))
    print(np.prod(list) if np.prod(list)<=10**18 else "-1")
resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    import numpy as np
    N = int(input())
    list = list(map(int, input().split()))
    print(numpy.prod(list) if numpy.prod(list)<=10**18 else "-1")
resolve()