Problem p02658 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
A.sort()
ans = 1
for a in A:
    ans *= a
    if ans > 1000000000000000000:
            print(-1)
            quit()
print(ans)

Buggy submission (verdict: Runtime Error):
from operator import mul
from functools import reduce
import numpy as np

if __name__ == '__main__':
    try:

        N = int(input())
        A = np,array(list(map(int, input().split())))
        ans = reduce(mul, A)
        if ans > 10 ** 18:
            print(-1)
        else:
            print(ans)
    except:
        if 0 in A:
            print(0)
        else:
            print(-1

Buggy submission (verdict: Runtime Error):
import numpy as np;
from numba import jit
import warnings
from operator import mul
from functools import reduce
warnings.simplefilter('ignore')
    

if __name__ == '__main__':
    try:

        N = int(input())
        A = list(map(int, input().split()))
        ans = reduce(mul, A)
        if ans > 10 ** 18:
            print(-1)
        else:
            print(ans)
    except:
        if 0 in A:
            print(0)
        else:
            print(-1

Buggy submission (verdict: Runtime Error):
import numpy as np;
from numba import jit
import warnings
from operator import mul
from functools import reduce
warnings.simplefilter('ignore')
    

if __name__ == '__main__':
    try:

        N = int(input())
        A = list(map(int, input().split()))
        ans = reduce(mul, A)
        if ans > 10 ** 18:
            print(-1)
        else:
            print(ans)
    except:
        if 0 in A:
            print(0)
        else:
            print(-1

Buggy submission (verdict: Runtime Error):
import numpy as np;
from numba import jit
import warnings
from operator import mul
from functools import reduce
warnings.simplefilter('ignore')
    

if __name__ == '__main__':
    N = int(input())
    A = list(map(int, input().split()))
    ans = reduce(mul, A)
    if ans > 10 ** 18:
        print(-1)
    else:
        print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np;
from numba import jit
import warnings
from operator import mul
from functools import reduce
warnings.simplefilter('ignore')
    

if __name__ == '__main__':
    N = int(input())
    A = list(map(int, input().split()))
    ans = reduce(mul, A)
    if ans > 10 ** 18:
        print(-1)
        quit()
    print(ans)

Buggy submission (verdict: Runtime Error):
# import numpy as np;
# from numba import jit
# import warnings
from operator import mul
# from functools import reduce
warnings.simplefilter('ignore')
    

if __name__ == '__main__':
    N = int(input())
    A = map(int, input().split())
    ans = reduce(mul, A)
    if ans > 10 ** 18:
        print -1
        quit()
    print ans

Buggy submission (verdict: Runtime Error):
# import numpy as np;
# from numba import jit
# import warnings
from operator import mul
from functools import reduce
warnings.simplefilter('ignore')
    

if __name__ == '__main__':
    N = int(input())
    A = map(int, input().split())
    ans = reduce(mul, A)
    if ans > 10 ** 18:
        print(-1)
        quit()
    print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np;
from numba import jit
import warnings
from operator import mul
from functools import reduce
warnings.simplefilter('ignore')
    

if __name__ == '__main__':
    N = int(input())
    A = map(int, input().split())
    ans = reduce(mul, A)
    if ans > 10 ** 18:
        print(-1)
        quit()
    print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np;




if __name__ == '__main__':
    N = int(input())
    A = list(map(int, input().split()))
    ans = 1
    for a in A:
        ans *= a
    
    if ans > 10 ** 18:
        print(-1)
        quit()
    print(ans)