Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

h,w = map(int,input().split())
m = [input() for _ in range(h)]
vm  = [[-1] * w for _ in range(h) ]

q = deque()

for i in range(h):
    for j in range(w):
        if m[i][j] == '#':
            q.append((i,j))
            vm[i][j]=0

while q:
    y,x = q.popleft()
    d = vm[y][x]

    for i,j in ([1, 0], [-1, 0], [0, 1], [0, -1]):
        yi , xj = y + i , x + j
        if yi >= 0 and xj >= 0 and yi < h and xj < w and vm[yi][xj] == -1 :
            vm[yi][xj] = d +  1
            q.append([yi,xj])
            

print(d)


Fixed submission:
from collections import deque

h,w = map(int,input().split())
m = [input() for _ in range(h)]
vm  = [[-1] * w for _ in range(h) ]

q = deque()

for i in range(h):
    for j in range(w):
        if m[i][j] == '#':
            q.append((i,j))
            vm[i][j]=0

while q:
    y,x = q.popleft()
    d = vm[y][x]

    for i,j in ([1, 0], [-1, 0], [0, 1], [0, -1]):
        yi , xj = y + i , x + j
        if yi >= 0 and xj >= 0 and yi < h and xj < w and vm[yi][xj] == -1 :
            vm[yi][xj] = d +  1
            q.append([yi,xj])
            

print(d)

Buggy python submission (verdict: Runtime Error):
from collections import deque

h,w = map(int,input().split())
m = [input() for _ in range(h)]
vm  = [[-1] * w for _ in range(h) ]

q = deque()

for i in range(h):
    for j in range(w):
        if m[i][j] == '#':
            q.append((i,j))
            vm[i][j]=0

while q:
    y,x = q.popleft()
    d = vm[y][x]

    for i,j in ([1, 0], [-1, 0], [0, 1], [0, -1]):
        yi , xj = y + i , x + j
        if yi >= 0 and xj >= 0 and yi < h and xj < w and vm[yi][xj] == -1 :
            vm[yi][xj] = d +  1
            q.append([yi,xj])a

print(d)

Fixed submission:
from collections import deque

h,w = map(int,input().split())
m = [input() for _ in range(h)]
vm  = [[-1] * w for _ in range(h) ]

q = deque()

for i in range(h):
    for j in range(w):
        if m[i][j] == '#':
            q.append((i,j))
            vm[i][j]=0

while q:
    y,x = q.popleft()
    d = vm[y][x]

    for i,j in ([1, 0], [-1, 0], [0, 1], [0, -1]):
        yi , xj = y + i , x + j
        if yi >= 0 and xj >= 0 and yi < h and xj < w and vm[yi][xj] == -1 :
            vm[yi][xj] = d +  1
            q.append([yi,xj])
            

print(d)
Buggy python submission (verdict: Runtime Error):
N =int(input())
Nans = N
ans = ""

while True:
    if N <= 26:
        matsubi = chr(96+N)
        ans += matsubi
        break
    else:
        if N % 26==0:
            matsubi = "z"
        else:
            a = int(N%26)
            matsubi = chr(96+a)
        ans += matsubi
        if N>26:
            N /= 26
    # if N<26:
    #     last = chr(96+N)
    #     ans += last
    #     break


ans2 = ans[::-1]
print(ans2)


Fixed submission:
N =int(input())
ans = ""

while True:
  N-=1
  matsubi = N%26
  matsubi = chr(96+matsubi+1)
  ans += matsubi

  if N//26 == 0:
      break
  else:
      N//=26

ans = ans[::-1]
print(ans)
Buggy python submission (verdict: Runtime Error):
N, M, X = map(int, input().split())

nums = []

for i in range(N):
    a = list(map(int,input().split()))
    nums.append(a)

ans = 10000000000


for i in range(2**N):

    money = 0
    skill_point = [0]*M
    goal = [0]*M
    buy = []
    
    for k in range(N):
        if i>>k & 1:
            buy.append(nums[k])

    for d in buy:
        money += d[0]
        for e in range(M):
            skill_point[e] += d[e+1]

    for f in range(M):
        if skill_point[f] >= X:
            goal[f] = 1

    
    if (0 not in goal) and (money < ans) :
        ans = money

    

if ans != 10000000000:
    print(ans)
else:
    print(-1)


Fixed submission:
S = str(input())
T = str(input())

len_T = len(T)

if S == T[0:len_T-1]:
      print('Yes')
else:
      print('No')
Buggy python submission (verdict: Runtime Error):
A,B,C,K = map(int,input().split())

ans = 0
if K-A>0:
    ans += A*1
    K -= A
    judge = 1
elif K-A==0:
    #ここで終わり
    ans += A*1
    judge = 0



judgeB=1
if judge==1 and K-B>0:
    K -= B
    
elif judge==1 and K-B<=0:
    K-=B
    judgeB = 0
    


if judgeB==1:
    ans += -1*K

print(ans)

Fixed submission:
A,B,C,K = map(float,input().split())
 
a = min(A, K)
if K-A>=0:
    b = min(abs(K-A), B)
else:
    b = 0
    c = 0

if K-A-B>=0:
    c = min(abs(K-A-B), C)
else:
    c = 0

ans = 1*a + 0*b - 1*c

print(int(ans))

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


num_list = []

for a in range(A):
    num_list.append(1)

for b in range(B):
    num_list.append(0)

for c in range(C):
    num_list.append(-1)

ans_list = num_list[0:K]

ans = sum(ans_list)

print(ans)

Fixed submission:
A,B,C,K = map(float,input().split())
 
a = min(A, K)
if K-A>=0:
    b = min(abs(K-A), B)
else:
    b = 0
    c = 0

if K-A-B>=0:
    c = min(abs(K-A-B), C)
else:
    c = 0

ans = 1*a + 0*b - 1*c

print(int(ans))
Buggy python submission (verdict: Runtime Error):
N = input()
a = []
for i in range(N):
  f = input()
  a.append(f)
  
a=list(set(a))

print(len(a))

Fixed submission:
N = int(input())

a = []
for i in range(N):
    S = str(input())
    a.append(S)

count = len(list(set(a)))
print(count)
Buggy python submission (verdict: Runtime Error):
import math

R = int(input())
a = 2*R*pi.math

print(a)

Fixed submission:
import math
R = int(input())

num = 2*R*math.pi
print(f'{num:.3f}')

Buggy python submission (verdict: Runtime Error):
import math

R = input()
print(f'{2*R*math.pi}')



Fixed submission:
import math
R = int(input())

num = 2*R*math.pi
print(f'{num:.3f}')
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())

c_sum = 0
for i in range(M):
  b = int(input())
  c_sum += b

day_count = N-c_sum

if day_count>=0:
  print(day_count)
else:
  print(-1)

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

c = list(map(int,input().split()))
c_sum = sum(c)

day_count = N-c_sum

if day_count>=0:
  print(day_count)
else:
  print(-1)

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())

a = 0
for i in range(M):
  c_sum = int(input())
  a += b

day_count = N-c_sum

if day_count>=0:
  print(day_count)
else:
  print(-1)

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

c = list(map(int,input().split()))
c_sum = sum(c)

day_count = N-c_sum

if day_count>=0:
  print(day_count)
else:
  print(-1)

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
 
a = 0
for i in range(M):
  b = int(input())
  a += b

day_count = N-a

if day_count>=0:
  print(day)
else:
  print(-1)

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

c = list(map(int,input().split()))
c_sum = sum(c)

day_count = N-c_sum

if day_count>=0:
  print(day_count)
else:
  print(-1)

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())

a = 0
for i in range(M):
  b = int(input())
  a += b

day = N-a
print(day)

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

c = list(map(int,input().split()))
c_sum = sum(c)

day_count = N-c_sum

if day_count>=0:
  print(day_count)
else:
  print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

a = list(map(int, input().split()))

b_list = list(range(1, N+1))
c_list = []
for i in range(N):
    sr = b_list[i]
    g = int(a.count(sr))
    c_list.append(g)

print(*c_list, sep='\n')

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

ans = [0]*N
for i in range(len(A)):
    tmp = A[i]
    ans[tmp-1] += 1


for a in ans:
    print(a)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = list(map(int, input().split()))
 
b_list = list(range(1, N+1))
c_list = []
for i in range(N):
    sr = b_list[i]
    g = int(a.count(sr))
    c_list.append(g)

for i in c_list:
    print(i)

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

ans = [0]*N
for i in range(len(A)):
    tmp = A[i]
    ans[tmp-1] += 1


for a in ans:
    print(a)

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

b_list = list(range(1, N+1))
c_list = []
for i in range(N):
    sr = b_list[i]
    g = int(a.count(sr))
    c_list.append(g)

for i in c_list:
    print(i)

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

ans = [0]*N
for i in range(len(A)):
    tmp = A[i]
    ans[tmp-1] += 1


for a in ans:
    print(a)
Buggy python submission (verdict: Runtime Error):
N,A,B = map(int,input().split())

a = ""

blue = 'b'*A
red = 'r'*B
cnt = 0
while cnt<1000:
    a+=blue
    cnt+=1
    a+=red
    cnt+=1

target = a[0:N]
print(target)
num = target.count('b')
print(num)

Fixed submission:
N,A,B = map(int,input().split())
C = A+B

ans1 = N//C*A
if N%C > A:
    ans2 = A
else:
    ans2 = N%C

print(ans1+ans2)
Buggy python submission (verdict: Runtime Error):
N = int(input())

#リストにするとき
A_list = list(map(int,input().split()))

for i in A_list:
    if i%2==0 and (i%3!=0 and i%5!=0):
        a+=1

if a>0:
      print('DENIED')
else:
  print('APPROVED')

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

a=0
for i in num_list:
  if i%2==0 and (i%3!=0 and i%5!=0):
    a+=1

if a>0:
  print('DENIED')
else:
  print('APPROVED')
Buggy python submission (verdict: Runtime Error):
N,L = map(int, input().split())

apple = [L+i for i in range(N)]
min = 500
for k in range(len(apple)):
    if abs(apple[k])<min:
        min = abs(apple[k])

apple.remove(min)
print(sum(apple))

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

apple = [L+i for i in range(N)]
min = 500
for k in range(len(apple)):
    if abs(apple[k])<abs(min):
        min = apple[k]

apple.remove(min)
print(sum(apple))

Buggy python submission (verdict: Runtime Error):
N,L = map(int, input().split())

apple = [L+i for i in range(N)]
print(apple)
min = 500
for k in range(len(apple)):
    if abs(apple[k])<min:
        min = abs(apple[k])

apple.remove(min)
print(sum(apple))

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

apple = [L+i for i in range(N)]
min = 500
for k in range(len(apple)):
    if abs(apple[k])<abs(min):
        min = apple[k]

apple.remove(min)
print(sum(apple))
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())

if (a*b)%2 == 0:
  'Even'
else:
  'Odd'
  


Fixed submission:
a,b = map(int,input().split())

if a*b %2 == 0:
  judge = 'Even'
else:
  judge='Odd'

print(judge)
Buggy python submission (verdict: Runtime Error):
input()
nums = list(map(int, input().split()))
 
i = 0
while all(n % 2 == 0 for n in num):
  nums = [n/2 for n in nums]
  i += 1
 
print(i)



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

count = 0
while all(n % 2 == 0 for n in Nums):
  Nums = [n/2 for n in Nums]
  count += 1

print(count)

Buggy python submission (verdict: Runtime Error):
input()

nums = list(map(int, input().split()))

i = 0

while all(n % 2 == 0 for n in num):
  nums = [n / 2 for n in nums]
  i += 1

print(i)
  

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

count = 0
while all(n % 2 == 0 for n in Nums):
  Nums = [n/2 for n in Nums]
  count += 1

print(count)

Buggy python submission (verdict: Runtime Error):
input()
num = list(map(int, input().split()))

i = 0
while all(num % 2 == 0):
  num // 2
  i += 1
  
print(i)


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

count = 0
while all(n % 2 == 0 for n in Nums):
  Nums = [n/2 for n in Nums]
  count += 1

print(count)
Buggy python submission (verdict: Runtime Error):
strs = []
for i in range(N):
    n = input()
    strs.append(n)

strs = sorted(strs)
strs = ''.join(strs)

print(strs)

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

strs = []
for i in range(N):
    n = input()
    strs.append(n)

strs.sort()
print("".join(strs))
Buggy python submission (verdict: Time Limit Exceeded):
import sys

def input():
    return sys.stdin.readline().strip()

def main():
    n = int(input())
    A = list(map(int, input().split()))
    count = 0
    ans = 0
    for i in A:
        for j in A:
            if i % j == 0:
                count += 1
                if count == 2:
                    count = 0
                    break
        if count == 1:
            ans += 1
        count = 0
    print(ans)
    


main()



Fixed submission:
import sys

def input():
    return sys.stdin.readline().strip()

def main():
    n = int(input())
    A = list(map(int, input().split()))
    M = max(A)
    B = [0]*(M+1)
    ans = 0
    A.sort()
    
    for i in A:
        B[i] += 1
    
    for i in A:
        if B[i] == 1:
            ans += 1
        for j in range(i, M+1, i):
            B[j] += 1
    
    print(ans)

main()

Buggy python submission (verdict: Time Limit Exceeded):
import sys

def input():
    return sys.stdin.readline().strip()

def main():
    n = int(input())
    A = list(map(int, input().split()))
    count = 0
    ans = 0
    for i in A:
        for j in A:
            if i % j != 0:
                count += 1
        if count == n-1:
            ans += 1
        count = 0
    print(ans)
    


main()


Fixed submission:
import sys

def input():
    return sys.stdin.readline().strip()

def main():
    n = int(input())
    A = list(map(int, input().split()))
    M = max(A)
    B = [0]*(M+1)
    ans = 0
    A.sort()
    
    for i in A:
        B[i] += 1
    
    for i in A:
        if B[i] == 1:
            ans += 1
        for j in range(i, M+1, i):
            B[j] += 1
    
    print(ans)

main()

Buggy python submission (verdict: Runtime Error):
import sys

def input():
    return sys.stdin.readline().strip()

def main():
    x, n= map(int, input().split())
    if n == 0:
        print(x)
        return
    P=[]
    P = list(map(int, input().split()))
    
    for i in range(100):
        a = x-i
        b = x+i
        if a not in P:
            print(a)
            return
        elif b not in P:
            print(b)
            return
    


main()



Fixed submission:
import sys

def input():
    return sys.stdin.readline().strip()

def main():
    n = int(input())
    A = list(map(int, input().split()))
    M = max(A)
    B = [0]*(M+1)
    ans = 0
    A.sort()
    
    for i in A:
        B[i] += 1
    
    for i in A:
        if B[i] == 1:
            ans += 1
        for j in range(i, M+1, i):
            B[j] += 1
    
    print(ans)

main()
Buggy python submission (verdict: Runtime Error):
import sys
 
def input():
    return sys.stdin.readline().strip()
 
n = int(input())
A = list(map(int, input().split()))
sum = 1
for i in range(n):
    sum *= A[i]
if(sum > 10**18):
    sum = -1
print(sum)


Fixed submission:
import sys

def input():
    return sys.stdin.readline().strip()

a, b = map(int, input().split())
print(a*b)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
 
def input():
    return sys.stdin.readline().strip()
 
n = int(input())
A = list(map(int, input().split()))
sum = 1
for i in range(n):
    sum *= A[i]
if(sum > 10**18):
    sum = -1
print(sum)


Fixed submission:
import sys
def input():
    return sys.stdin.readline().strip()

def main():
    n = int(input())
    A = list(map(int, input().split()))
    if 0 in A:
        print(0)
        return
    x = 1
    for i in A:
        x *= i
        if x > pow(10,18):
            print(-1)
            return
    print(x)

main()

Buggy python submission (verdict: Runtime Error):
import sys
 
def input():
    return sys.stdin.readline().strip()
 
n = int(input())
A = list(map(int, input().split()))
sum = 1
for i in range(n):
    sum *= A[i]
if(sum > 10**18):
    sum = -1
print(sum)

main()

Fixed submission:
import sys
def input():
    return sys.stdin.readline().strip()

def main():
    n = int(input())
    A = list(map(int, input().split()))
    if 0 in A:
        print(0)
        return
    x = 1
    for i in A:
        x *= i
        if x > pow(10,18):
            print(-1)
            return
    print(x)

main()

Buggy python submission (verdict: Time Limit Exceeded):
import sys

def input():
    return sys.stdin.readline().strip()

def main():
    n = int(input())
    A = list(map(int, input().split()))
    sum = 1
    for i in range(n):
        sum *= A[i]
        if(sum > 1000000000000000000):
            sum = -1
    print(sum)
main()

Fixed submission:
import sys
def input():
    return sys.stdin.readline().strip()

def main():
    n = int(input())
    A = list(map(int, input().split()))
    if 0 in A:
        print(0)
        return
    x = 1
    for i in A:
        x *= i
        if x > pow(10,18):
            print(-1)
            return
    print(x)

main()

Buggy python submission (verdict: Time Limit Exceeded):
import sys

def input():
    return sys.stdin.readline().strip()

n = int(input())
A = list(map(int, input().split()))
sum = 1
for i in range(n):
    sum *= A[i]
if(sum > 10**18):
    sum = -1
print(sum)

Fixed submission:
import sys
def input():
    return sys.stdin.readline().strip()

def main():
    n = int(input())
    A = list(map(int, input().split()))
    if 0 in A:
        print(0)
        return
    x = 1
    for i in A:
        x *= i
        if x > pow(10,18):
            print(-1)
            return
    print(x)

main()
Buggy python submission (verdict: Runtime Error):
import sys
def input():
    return sys.stdin.readline().strip()

def main():
    A, B = input().split()
    if int(A) == 0 or int(B) == 0:
        print(0)
        return
    A = int(A)
    B = int(float(B)*100)
    print(A*B//100)


main()

Fixed submission:
import sys
import decimal
def input():
    return sys.stdin.readline().strip()
 
def main():
    A, B = input().split()
    A = decimal.Decimal(A)
    B = decimal.Decimal(B)
    print(int(A*B))
 
 
main()
Buggy python submission (verdict: Time Limit Exceeded):
import sys


def input():
    return sys.stdin.readline().strip()

def main():
    n, k = map(int, input().split())
    if k == 1:
        n = 0
        print(n)
        return
    while n > k//2:
        n = abs(n-k)
    print(n)

main()

Fixed submission:
import sys


def input():
    return sys.stdin.readline().strip()

def main():
    n, k = map(int, input().split())
    a = n % k
    print(min(a, k-a))

main()
Buggy python submission (verdict: Runtime Error):
n = int(input())
m = int(input())
sum = 0
sum = n*(n-1)/2 + m*(m-1)/2
print(sum)

Fixed submission:
n, m = map(int, input().split())
sum = n*(n-1)//2 + m*(m-1)//2
print(sum)
Buggy python submission (verdict: Runtime Error):
import sys
import decimal # 10進法に変換，正確な計算

def input():
    return sys.stdin.readline().strip()

def main():
    n = int(input())
    n = decimal.Decimal(n)
    if n % 2 == 0:
        print(1/decimal.Decimal(2))
        return
    
    print(((n-1)/2+1)/n)

    
    
main()

Fixed submission:
import sys
import decimal # 10進法に変換，正確な計算

def input():
    return sys.stdin.readline().strip()

def main():
    n, k = map(int, input().split())
    h = list(map(int, input().split()))
    count = 0
    for i in h:
        if i >= k:
            count += 1
    print(count)

    
    
main()
Buggy python submission (verdict: Runtime Error):
import sys
import decimal # 10進法に変換，正確な計算

def input():
    return sys.stdin.readline().strip()

def main():
    n, k = map(int, input().split())
    h = list(map(int, input().split()))
    count = 0
    for i in h:
        if i >= k:
            count += 1
    print(count)

    
    
main()

Fixed submission:
import sys
import decimal # 10進法に変換，正確な計算

def input():
    return sys.stdin.readline().strip()

def main():
    s = input()
    if s[0] == "S":
        print("Cloudy")
        return
    elif s[0] == "C":
        print("Rainy")
        return
    print("Sunny")
    

    
    
main()
Buggy python submission (verdict: Runtime Error):
N = int(input())
A =  list(map(int, input().split()))
Q = int(input())
B = [0]*(Q+1)
C = [0]*(Q+1)
S = [0]*(Q+1)


for i in range(1,Q+1,1):
    B[i],C[i] = map(int,input().split())

a = [0]*(10**5)

for i in range(N):
    a[A[i]] += 1
    S[0] += A[i]

for i in range(1,Q+1,1):
    S[i] = S[i-1] + a[B[i]]*(C[i]-B[i])
    a[C[i]] = a[C[i]] + a[B[i]]
    a[B[i]] = 0
    print(S[i])

Fixed submission:
N = int(input())
A =  list(map(int, input().split()))
Q = int(input())
B = [0]*(Q+1)
C = [0]*(Q+1)
S = [0]*(Q+1)


for i in range(1,Q+1,1):
    B[i],C[i] = map(int,input().split())

a = [0]*(10**5+3)

for i in range(N):
    a[A[i]] += 1
    S[0] += A[i]

for i in range(1,Q+1,1):
    S[i] = S[i-1] + a[B[i]]*(C[i]-B[i])
    a[C[i]] = a[C[i]] + a[B[i]]
    a[B[i]] = 0
    print(S[i])
Buggy python submission (verdict: Time Limit Exceeded):
A, W = map(int,input().split())
B, V = map(int,input().split())
T = int(input())
flag = "NO"
mid = T//2
i = 1
while True:
    i += 1
    a = A + W*mid
    b = B + V*mid
 
    if a == b:
        flag = "YES"
        break
    elif a > b and a + W < b + V:
        break
    elif a < b and a - W > b - V:
        break
    elif T//(2**i) == 0:
        if a > b:
            mid = mid - 1
            if mid < 1:
                mid = 1
        elif a < b:
            mid = mid + 1
            if mid > T:
                mid = T
    elif a > b:
        mid = mid - T//(2**i)
    elif a < b:
        mid = mid + T//(2**i)

print(flag)

Fixed submission:
A, W = map(int,input().split())
B, V = map(int,input().split())
T = int(input())

a = A + W*T
b = B + V*T
c = A - W*T
d = B - V*T


if A < B:
    if a >= b:
        print("YES")
    else:
        print("NO")
else:
    if c <= d:
        print("YES")
    else:
        print("NO")
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(input().split())
for i in range(N):
    A[i] = int(A[i])
sum = 1

for i in range(N):
    if sum <= 10**18:
        sum = sum * A[i]
    else:
        break:

if sum <= 10**18:
    print(sum)
else:
    print(-1)

Fixed submission:
N = int(input())
A = list(input().split())
flag = 0
for i in range(N):
    A[i] = int(A[i])
    if A[i] == 0:
        flag = -1
sum = 1

for i in range(N):
    if sum <= 10**18:
        sum = sum * A[i]
    else:
        break


if sum <= 10**18:
    print(sum)
else:
    if flag == -1:
        print(0)
    else:
        print(-1)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(input().split())
for i in range(N):
    A[i] = int(A[i])
sum = 1

for i in range(N):
    sum = sum * A[i]

if sum <= 10**18:
    print(sum)
else:
    print(-1)
    

Fixed submission:
N = int(input())
A = list(input().split())
flag = 0
for i in range(N):
    A[i] = int(A[i])
    if A[i] == 0:
        flag = -1
sum = 1

for i in range(N):
    if sum <= 10**18:
        sum = sum * A[i]
    else:
        break


if sum <= 10**18:
    print(sum)
else:
    if flag == -1:
        print(0)
    else:
        print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

N = int(input())
flag = 0
if N == 1:
    flag = -1
M = len(factorization(N))
num = [1,3,6,10,15,21,28,36]
ans = 0
for i in range(M):
    for j in range(len(num)):
        if num[j] <= factorization(N)[i][1]:
            ans += 1

if flag == -1:
    print(0) 
else:
    print(ans)

Fixed submission:
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

N = int(input())
flag = 0
if N == 1:
    flag = -1
M = len(factorization(N))
num = [1,3,6,10,15,21,28,36]
ans = 0
for i in range(M):
    for j in range(len(num)):
        if num[j] <= factorization(N)[i][1]:
            ans += 1
        else:
            break

if flag == -1:
    print(0) 
else:
    print(ans)