Buggy python submission (verdict: Time Limit Exceeded):


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

ans=1
v=True
for i in arr:
    ans=ans*i

if ans>1000000000000000000:
    print(-1)
else:
    print(ans)
    


Fixed submission:


n=int(input())
arr=list(map(int,input().split()))
arr.sort()
ans=1
v=True
for i in arr:
    ans=ans*i
    if ans==0:
        v=False
        print(0)
        break
        
    if ans>1000000000000000000:
        v=False
        print(-1)
        break

if v:
    print(ans)

Buggy python submission (verdict: Runtime Error):
inputs = input().split(" ")
decimal = int(float(inputs[1])*100)
product = int(inputs[0])*(decimal)
print(product//100)

Fixed submission:
count = int(input())
nums = input().split(" ")

product = 1

if ("0" in nums):
    print(0)
else:
    for i in nums:
        product *= int(i)
        if (product > 10**18):
            print(-1)
            exit()
    print(product)

Buggy python submission (verdict: Time Limit Exceeded):
count = int(input())
nums = input().split(" ")

product = 1

if ("0" in nums):
    print(0)
else:
    for i in nums:
        product *= int(i)
    if (product > 10**18):
        print(-1)
    else:
        print(product)

Fixed submission:
count = int(input())
nums = input().split(" ")

product = 1

if ("0" in nums):
    print(0)
else:
    for i in nums:
        product *= int(i)
        if (product > 10**18):
            print(-1)
            exit()
    print(product)

Buggy python submission (verdict: Time Limit Exceeded):
count = int(input())
nums = input().split(" ")

product = 1

if ("0" in nums):
    print(0)
else:
    for i in range(count):
        product *= int(nums[i])
    if (product > 10**18):
        print(-1)
    else:
        print(product)

Fixed submission:
count = int(input())
nums = input().split(" ")

product = 1

if ("0" in nums):
    print(0)
else:
    for i in nums:
        product *= int(i)
        if (product > 10**18):
            print(-1)
            exit()
    print(product)

Buggy python submission (verdict: Time Limit Exceeded):
count = int(input())
nums = input().split(" ")

product = 1

for i in range(count):
    product *= int(nums[i])

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

Fixed submission:
count = int(input())
nums = input().split(" ")

product = 1

if ("0" in nums):
    print(0)
else:
    for i in nums:
        product *= int(i)
        if (product > 10**18):
            print(-1)
            exit()
    print(product)

Buggy python submission (verdict: Time Limit Exceeded):
count = int(input())
nums = input().split(" ")

product = 1

for i in range(count):
    product *= int(nums[i])

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

Fixed submission:
count = int(input())
nums = input().split(" ")

product = 1

if ("0" in nums):
    print(0)
else:
    for i in nums:
        product *= int(i)
        if (product > 10**18):
            print(-1)
            exit()
    print(product)

Buggy python submission (verdict: Time Limit Exceeded):
count = int(input())
nums = input().split(" ")

product = 1

for i in range(count):
    product *= int(nums[i])

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

Fixed submission:
count = int(input())
nums = input().split(" ")

product = 1

if ("0" in nums):
    print(0)
else:
    for i in nums:
        product *= int(i)
        if (product > 10**18):
            print(-1)
            exit()
    print(product)

Buggy python submission (verdict: Time Limit Exceeded):
count = int(input())
nums = input().split(" ")

product = 1

for i in range(count):
    product *= int(nums[i])

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

Fixed submission:
count = int(input())
nums = input().split(" ")

product = 1

if ("0" in nums):
    print(0)
else:
    for i in nums:
        product *= int(i)
        if (product > 10**18):
            print(-1)
            exit()
    print(product)