Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N = int(input())
H = list(map(int, input().split()))

cnt = 0
for i in range(len(H)):
    if (max(H[0:i]) <= H[i]):
        cnt += 1

print(cnt)


Fixed submission:
N = int(input())
H = list(map(int, input().split()))
ans = 1
for i in range(1,N):
  if H[i]>=max(H[:i]):
    ans += 1
print(ans)

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

cnt = 0
for i in range(len(H)):
    if (max(H[0:i]) == H[i]):
        cnt += 1

print(cnt)


Fixed submission:
N = int(input())
H = list(map(int, input().split()))
ans = 1
for i in range(1,N):
  if H[i]>=max(H[:i]):
    ans += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
H = list(map(int, input().split()))
ans = 1
for i in range(1,N+1):
  if H[i]>=max(H[:i]):
    ans += 1
print(ans)


Fixed submission:
N = int(input())
H = list(map(int, input().split()))
ans = 1
for i in range(1,N):
  if H[i]>=max(H[:i]):
    ans += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
H = list(map(int, input().split())
ans = 1
for i in range(1,N):
  if H[i]>=max(H[:i]):
    ans += 1
print(ans)


Fixed submission:
N = int(input())
H = list(map(int, input().split()))
ans = 1
for i in range(1,N):
  if H[i]>=max(H[:i]):
    ans += 1
print(ans)

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

cnt = 0
for i in range(len(H)):
    if (max(H[0:i+1]) == H[i]):
        cnt += 1

print(cnt)


Fixed submission:
N = int(input())
H = list(map(int, input().split()))
ans = 1
for i in range(1,N):
  if H[i]>=max(H[:i]):
    ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
x = list(map(int, input().split()))

from operator import mul
from functools import reduce

a = reduce(mul, x)

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

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

a = 1
if 0 in x:
  print(0)
else:
  for i in x:
    a *= i
    if a > pow(10,18):
      print(-1)
      break
  else:
    print(a)

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

a = 1
for i in x:
  a *= i

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

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

a = 1
if 0 in x:
  print(0)
else:
  for i in x:
    a *= i
    if a > pow(10,18):
      print(-1)
      break
  else:
    print(a)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans = int(1)
a = input().split(" ")

for i in range(n):
  ans *= int(a[i])
  
if ans > 10**18:
  print("-1")
else:
  print(ans)

Fixed submission:
n = int(input())
ans = int(1)
a = input().split(" ")

if "0" in a:
  ans = 0
else:
  for i in range(n):
    ans *= int(a[i])
    if ans > 10**18:
      print("-1")
      break
    
if ans <= 10**18:
  print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans = 1
a = []
a = input().split(" ")

for i in range(n):
  ans *= int(a[i])
  
if ans > 10**18:
  print("-1")
else:
  print(ans)

Fixed submission:
n = int(input())
ans = int(1)
a = input().split(" ")

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

ans=1
for i in range(N):
    ans *= num[i]
    if ans > 10**18:
        ans=-1
print(ans)

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

print(L*R)
Buggy python submission (verdict: Runtime Error):
import fractions
N=int(input())
a = list(map(int, input().split()))

#------------最小公倍数---------------------
lcm = a[0]
for i in range(1, N):
    lcm = lcm * a[i] // fractions.gcd(lcm, a[i])
#------------------------------------------
ans=0

for j in a:
    ans += lcm // j
ans %= 1000000007
print(ans)

Fixed submission:
n,m = map(int,input().split())

if n==m:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
from scipy.special import comb
n = int(input())
if n/2==0:
    print(math.factorial(n)-1)
    
else:
  	print(math.factorial(n))

Fixed submission:
import math
n = int(input())
if n%2==0:

    print(round(((n-2)/2)))


else:
    print(round(((n+1)/2)-1))
Buggy python submission (verdict: Runtime Error):
N = int(input()) 
result = 1

for n in range(N):
  A = int(input())
  if A == 0:
    result = 0
    break
  result = result*A
  if result>1000000000000000000:
    result = -1
    break

print(result)
    

Fixed submission:
A,B = map(int,input().split())
print(A*B)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
finish = 0
result = 1

if 0 in A:
    print(0)
    finish = 1
else:
    
    for n in range(N):
        result = result*A[n]
        if result > 1000000000000000000:
            print(-1)
            finish = 1

if finish = 0:
    print(result)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
finish = 0
result = 1

if 0 in A:
    print(0)
    finish = 1
else:
    for n in range(N):
        result = result*A[n]
        if result > 10**18:
            print(-1)
            finish = 1
            break

    if finish == 0:
        print(result)

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

for n in range(N):
    if A[n] == 0:
        result = 0
        break
    else:
        result = result*A[n]

if result >= 1000000000000000001:
    print(-1)
else:
    print(result)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
finish = 0
result = 1

if 0 in A:
    print(0)
    finish = 1
else:
    for n in range(N):
        result = result*A[n]
        if result > 10**18:
            print(-1)
            finish = 1
            break

    if finish == 0:
        print(result)

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

for n in range(N):
  result = result*A[n]

if result >= 1000000000000000001:
    print(-1)
else:
    print(result)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
finish = 0
result = 1

if 0 in A:
    print(0)
    finish = 1
else:
    for n in range(N):
        result = result*A[n]
        if result > 10**18:
            print(-1)
            finish = 1
            break

    if finish == 0:
        print(result)

Buggy python submission (verdict: Runtime Error):
N = int(input()) 
result = 1

for n in range(N):
  A = int(input())
  if A == 0:
    result = 0
    break
  result = result*A
  if result>1000000000000000000:
    result = -1
    break

print(result)
    

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
finish = 0
result = 1

if 0 in A:
    print(0)
    finish = 1
else:
    for n in range(N):
        result = result*A[n]
        if result > 10**18:
            print(-1)
            finish = 1
            break

    if finish == 0:
        print(result)

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

if 0 in A:
  print(0)
elif:
  result = 1
  for n in range(N):
    result = result*A[n]
  if result>1000000000000000000:
    print(-1)
  else:
    print(result)
    

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
finish = 0
result = 1

if 0 in A:
    print(0)
    finish = 1
else:
    for n in range(N):
        result = result*A[n]
        if result > 10**18:
            print(-1)
            finish = 1
            break

    if finish == 0:
        print(result)
Buggy python submission (verdict: Runtime Error):
import math

A,B,H,M = map(int,input().split())
s = 60*H+M
a = s*0.5
b = M*6
theta = 0

if abs(a-b)<=180:
    theta = abs(a-b)
else:
    theta = 360- abs(a-b)

C=A*A+B*B−2*A*B*math.cos(math.radians(abs(a-b)))
print(math.sqrt(C))


Fixed submission:
import math
 
A,B,H,M = map(int,input().split())
s = 60*H+M
a = s*0.5
b = M*6
theta = 0
 
if abs(a-b)<=180:
    theta = abs(a-b)
else:
    theta = 360- abs(a-b)

C=(A*A)+(B*B)-(2*A*B)*math.cos(math.radians(abs(a-b)))
print(math.sqrt(C))
Buggy python submission (verdict: Runtime Error):
A,B,C,K = map(int,input().split())
if K<=A:
    print(K)
elif A<K and K<=A+B:
    print(A)
else:
    print(A-(K-A-B))

Fixed submission:
S = input()
T = input()
if len(T)==1:
    print("No")
elif S==T[0:-1]:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
k = int(input()) 
a,b= map(int,input().split())
ans = "NG"
L = [i in i for range(1,1001) if i%k==0]
for j in range(a,b+1):
    if j in L:
        ans="OK"
print(ans)

Fixed submission:
k = int(input()) 
a,b= map(int,input().split())
ans = "NG"
L = []
for l in range(1,1001):
    if l%k == 0:
        L.append(l)
for j in range(a,b+1):
    if j in L:
        ans="OK"
print(ans)
Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
A = map(int,input().split())
new_A = []
for i in range(N):
  if A[a] >= 1/(4*M):
    new_A.append(a)
 
if len(new_A)>=M:
  print("Yes")
else:
  print("No")

Fixed submission:
N,M = map(int,input().split())
A = list(map(int,input().split()))
new_A = []
for i in range(N):
  if A[i] >= sum(A)/(4*M):
    new_A.append(A[i])

if len(new_A)>=M:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
A = []
for i in range(N):
  a = int(input()) 
  if a >= 1/(4*M):
    A.append(a)

if len(A)>=M:
  print("Yes")
else:
  print("No")
    

Fixed submission:
N,M = map(int,input().split())
A = list(map(int,input().split()))
new_A = []
for i in range(N):
  if A[i] >= sum(A)/(4*M):
    new_A.append(A[i])

if len(new_A)>=M:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
import math
a,b,c = map(int,input().split())
if c*c - (a + b + 2*math.sqrt(a*b))**2>0:
  print("Yes")
else:
  print("No")


Fixed submission:
l = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
n = int(input())
print(l[n-1])

Buggy python submission (verdict: Runtime Error):
H,W = map(int,input().split())
if H%2 != 0:
  H= H+1
if W%2 != 0:
  W=W+1
print(int(H*W/2))

Fixed submission:
l = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
n = int(input())
print(l[n-1])
Buggy python submission (verdict: Runtime Error):
S = input()
if S="AAA" or S="BBB":
  print("No")
else:
  print("Yes")

Fixed submission:
S = input()

if S=="AAA" or S=="BBB":
  print("No")
else:
  print("Yes")
Buggy python submission (verdict: Runtime Error):
s=input()
t=input()
print(t+s)

Fixed submission:
S,T = input().split()
print(T+S)

Buggy python submission (verdict: Runtime Error):
s = input()
t = input()
print(t+s)

Fixed submission:
S,T = input().split()
print(T+S)
Buggy python submission (verdict: Runtime Error):
a,b,k = map(int, input().split())
if a => k:
  print(a-k," ",b)
elif b > (k-a):
  print(0," ",b-(k-a)):
else:
  print(0," ",0)

Fixed submission:
a,b,k = map(int, input().split())
if a >= k:
  print(a-k,"",b)
elif b > (k-a):
  print(0,"",b-(k-a))
else:
  print(0,"",0)
Buggy python submission (verdict: Runtime Error):
s=input()
  
if s =  "Sunny":
	print("Cloudy")
elif s = "Cloudy":
	print("Rainy")
else:
	print("Sunny")

Fixed submission:
s=input()

if s ==  "Sunny":
	print("Cloudy")
elif s == "Cloudy":
	print("Rainy")
else:
	print("Sunny")
Buggy python submission (verdict: Runtime Error):
L = set([int(x) for x in stdin.readline().rstrip().split()])
print(sum(L)-max(L))

Fixed submission:
l = list(map(int, input().split()))
print(sum(l)-max(l))
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
A.sort()
D = [A[i+1]-A[i] for i in range(len(A)-1)]
 
if N == 2:
  print(max(A))
elif len(set(A))==1:
  print(A[0])
else:
  for d in D:
    cnt = 0
    for a in A:
      if a%d != 0:
        cnt = cnt+1
    if cnt <=1:
      print(i)
      break
    

Fixed submission:
A,B,T =  map(int,input().split())
print((T//A)*B)
Buggy python submission (verdict: Runtime Error):
N = int(input())
V = list(map(int,input().split()))
C = list(map(int,input().split()))

anc = 0
for i in range(N):
  if V[i] > C[i]:
    anc = anc + (V[i]-C[i])

print(ans)

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

ans = 0
for i in range(N):
  if V[i] > C[i]:
    ans = ans + (V[i]-C[i])

print(ans)
Buggy python submission (verdict: Runtime Error):
output_word = "YES"
set_1974 = (1,9,7,4)

for i in range(4):
  if int(input()) not in set_1974:
	output_word = "NO"
    
print(output_word)

Fixed submission:
l = set([int(e) for e in input().split()])
set_1974 = set([1,9,7,4])

if l == set_1974:
  print("YES")
else:
  print("NO")

Buggy python submission (verdict: Runtime Error):
l = map(int, raw_input().split())
set_1974 = (1,9,7,4)

output_word = "YES"
for i in l:
  if i not in set_1974:
    output_word = "NO"
print(output_word)

Fixed submission:
l = set([int(e) for e in input().split()])
set_1974 = set([1,9,7,4])

if l == set_1974:
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
#B
N = int(input())
A = input().split()
multi= 1
for i in range(N):
    multi *= int(A[i])
if multi > 10**18:
        print(-1)
else:
    print(multi)

Fixed submission:
N = int(input())
A = input().split()
multi= 1
if('0' in A):
    print(0)
else:
    for i in range(N):
        multi *= int(A[i])
        if multi > 10**18:
            print(-1)
            break
    else:
        print(multi)

Buggy python submission (verdict: Time Limit Exceeded):
#B
N = int(input())
A = input().split()
multi= 1
for i in range(N):
    A[i] = int(A[i])
for i in range(N):
    multi *= A[i]
if multi > 10**18:
        print(-1)
else:
    print(multi)

Fixed submission:
N = int(input())
A = input().split()
multi= 1
if('0' in A):
    print(0)
else:
    for i in range(N):
        multi *= int(A[i])
        if multi > 10**18:
            print(-1)
            break
    else:
        print(multi)
Buggy python submission (verdict: Runtime Error):
N,K = map(int,input().split())
A = input().split()
F = input().split()
for i in range(0,N):
    A[i] = int(A[i])
    F[i] = int(F[i])
A.sort()
F.sort(reverse=True)

B = [A[i] *F[i] for i in range(0,N)]
d = max(B)

def nex(x):
    count = 0
    for i in range(0,N):
        if x < B[i]:
            count += A[i] - int(x/F[i])
    return count

def target(l,r):
    if r - l == 1:
        if nex(l) <= K:
            return l
        else:
            return r
    elif nex(int((l+r)/2)) <= K:
         return target(l,int((l+r)/2))
    else:
        return target(int((l+r)/2),r)
    
ans = target(0,d)
print(ans)

Fixed submission:
A,B = map(int,input().split())
if(A >= 10 or B >= 10):
    print(-1)
else:
    print(A * B)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
L = input().split()
tri = 0
for i in range(0,N):
    L[i] = int(L[i])
for i in range(0,N):
    for j in range(i+1, N):
        for k in range(j+1, N):
            if L[i] < L[j] + L[k] and L[j] < L[i] + L[k] and L[k] < L[j] + L[i]:
                tri += 1
print(tri)

Fixed submission:
N = int(input())
L = input().split()
tri = 0
for i in range(0,N):
    L[i] = int(L[i])
L.sort()
for i in range(0,N):
    k = i
    for j in range(i+1,N):
        while(k < N and L[k] < L[i] + L[j]):
            k += 1
        tri += k-j-1
print(tri)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = input().split()
B = []
for i in range(1, N+1):
    I = str(i)
    B.append(str(A.index(I)+1))
B = " ".join(B)
print(B)

Fixed submission:
N = int(input())
A = input().split()
B = ["0" for i in range(0,N)]
for i in range(1, N+1):
    I = str(i)
    B[int(A[i-1])-1] = I
B = " ".join(B)
print(B)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N,K,Q = map(int,input().split())
point = np.array([K] * N)
minus = np.array([-1] * N)
for i in range(0,Q):
    A = int(input())
    point += minus
    point[A-1] += 1
for i in range(0,N):
    if point[i] > 0:
        print("Yes")
    else:
        print("No")

Fixed submission:
N,K,Q = map(int,input().split())
point = [0 for i in range(0,N)]
for i in range(0,Q):
    A = int(input())
    point[A-1] += 1
for i in range(0,N):
    if Q - point[i] < K:
        print("Yes")
    else:
        print("No")

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N,K,Q = map(int,input().split())
point = np.array([K for i in range(0,N)])
minus = np.array([-1 for i in range(0,N)])
for i in range(0,Q):
    A = int(input())
    point += minus
    point[A-1] += 1
for i in range(0,N):
    if point[i] > 0:
        print("Yes")
    else:
        print("No")

Fixed submission:
N,K,Q = map(int,input().split())
point = [0 for i in range(0,N)]
for i in range(0,Q):
    A = int(input())
    point[A-1] += 1
for i in range(0,N):
    if Q - point[i] < K:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
data = [[int(x) for x in input().split()] for _ in range(n)]

pats = [(x,y,z) for x in [-1,1] for y in [-1,1] for z in [-1,1]] # +++,++-,...,---
score = lambda sgns, vals: sum([s * x for(s, x) in zip(sgns, vals)])  # i.e.x+y-z
result = max(sum(sorted(score(pat, row) for row in data)[-m:]) for pat in pats)
print(result)

Fixed submission:
xs = map(int, input().split())
test = all(x <= 8 for x in xs)
print ("Yay!" if test else ":(")
Buggy python submission (verdict: Runtime Error):
from itertools import *
d, n = map(int, input().split())
delta = 100 ** d
ite = (x for x in count(delta, delta) if x % (delta * 100) != 0)
print(list(islice(ite, n - 1, 1))[0])

Fixed submission:
from itertools import *

def nth(iterable, n, default=None):
    "Returns the nth item or a default value"
    return next(islice(iterable, n, None), default)

D, N = map(int, input().split())
delta = 100 ** D
ite = (x for x in count(delta, delta) if x % (delta * 100) != 0)
print(nth(ite, N - 1))
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import combinations

def score (cids):
    x = abs(sum(data[cid][0] for cid in cids))
    y = abs(sum(data[cid][1] for cid in cids))
    z = abs(sum(data[cid][2] for cid in cids))
    return x + y + z

n, m = map(int, input().split())
data = list([int(x) for x in input().split()] for _ in range(n))
print(max(score(x) for x in combinations(range(n), m)))

Fixed submission:
n, m = map(int, input().split())
data = [[int(x) for x in input().split()] for _ in range(n)]

pats = [(x,y,z) for x in [-1,1] for y in [-1,1] for z in [-1,1]] # +++,++-,...,---
score = lambda sgns, vals: sum([s * x for(s, x) in zip(sgns, vals)])  # i.e.x+y-z
result = max(sum(sorted((score(pat, row) for row in data), reverse=True )[:m]) for pat in pats)
print(result)

Buggy python submission (verdict: Runtime Error):
from itertools import combinations

def score (cids):
    x = abs(sum(data[cid][0] for cid in cids))
    y = abs(sum(data[cid][1] for cid in cids))
    z = abs(sum(data[cid][2] for cid in cids))
    return x + y + z

n, m = map(int, input().split())
data = list([int(x) for x in input().split()] for _ in range(n))
print(max(score(x) for x in combinations(range(n), m)))
~

Fixed submission:
n, m = map(int, input().split())
data = [[int(x) for x in input().split()] for _ in range(n)]

pats = [(x,y,z) for x in [-1,1] for y in [-1,1] for z in [-1,1]] # +++,++-,...,---
score = lambda sgns, vals: sum([s * x for(s, x) in zip(sgns, vals)])  # i.e.x+y-z
result = max(sum(sorted((score(pat, row) for row in data), reverse=True )[:m]) for pat in pats)
print(result)
Buggy python submission (verdict: Runtime Error):
N = input()
A = [int(a) for a in input().split()]

ans = 1

if 0 in A:
    print(0)
    exit():

for i in range(len(A)):
    if ans > 10 ** 18:
        print(-1)
        exit()
    ans *= A[i]


if ans > 10 ** 18:
    print(-1)
    exit()
print(ans)

Fixed submission:
N = input()
A = [int(a) for a in input().split()]

ans = 1

if 0 in A:
    print(0)
    exit()

for i in range(len(A)):
    if ans > 10 ** 18:
        print(-1)
        exit()
    ans *= A[i]


if ans > 10 ** 18:
    print(-1)
    exit()
print(ans)

Buggy python submission (verdict: Runtime Error):
N = input()
A = [int(a) for a in input().split()]

ans = 1

if 0 in A:
    print(0)
    exit:

for i in range(len(A)):
    if ans > 10 ** 18:
        print(-1)
        exit()
    ans *= A[i]


if ans > 10 ** 18:
    print(-1)
    exit()
print(ans)

Fixed submission:
N = input()
A = [int(a) for a in input().split()]

ans = 1

if 0 in A:
    print(0)
    exit()

for i in range(len(A)):
    if ans > 10 ** 18:
        print(-1)
        exit()
    ans *= A[i]


if ans > 10 ** 18:
    print(-1)
    exit()
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = input()
A = [int(a) for a in input().split()]

ans = 1

for i in range(len(A)):
    ans *= A[i]


if ans > 10 ** 18:
    print(-1)
    exit()
print(ans)

Fixed submission:
N = input()
A = [int(a) for a in input().split()]

ans = 1

if 0 in A:
    print(0)
    exit()

for i in range(len(A)):
    if ans > 10 ** 18:
        print(-1)
        exit()
    ans *= A[i]


if ans > 10 ** 18:
    print(-1)
    exit()
print(ans)

Buggy python submission (verdict: Runtime Error):
N = input()
A = [a for a in input().split()]

ans = 1

for i in range(len(A)):
    if ans > 10 ** 18:
        print(-1)
        exit()
    ans *= A[i]

print(ans)

Fixed submission:
N = input()
A = [int(a) for a in input().split()]

ans = 1

if 0 in A:
    print(0)
    exit()

for i in range(len(A)):
    if ans > 10 ** 18:
        print(-1)
        exit()
    ans *= A[i]


if ans > 10 ** 18:
    print(-1)
    exit()
print(ans)
Buggy python submission (verdict: Runtime Error):
import copy
import heapq
H, W = map(int, input().split())
S = []
cnt_list = []
min_cnt = 10**100
for _ in range(H):
    S.append(list(input()))

def move(i,j,cnt,frag):
    global min_cnt
    if cnt > min_cnt:
        return
    c_cnt = copy.deepcopy(cnt)
    c_frag = copy.deepcopy(frag)
    if frag != S[i][j]:
        c_cnt = cnt + 1
    c_frag = S[i][j]
    if i != H-1:
        move(i+1,j,c_cnt,c_frag)
    if j != W-1:
        move(i,j+1,c_cnt,c_frag)
    if i == H-1 and j == W-1:
        if c_cnt < min_cnt:
            min_cnt = c_cnt


if S[0][0] == '#' and S[H][W] == '#':
    a = 1
else :
    a = 0

move(0,0,0,S[0][0])

print(min_cnt//2 + a)

Fixed submission:
import copy
import heapq
H, W = map(int, input().split())
S = [['.'] * (W+1)]
for _ in range(H):
    s = list(input())
    s.insert(0,'.')
    S.append(s)

inf = float('inf')

dp = []
for _ in range(H+1):
    dp.append([inf] * (W+1))

if S[1][1] == '.':
    dp[1][1] = 0
else:
    dp[1][1] = 1

for i in range(1,H+1):
    for j in range(1,W+1):
        right = dp[i][j-1]
        down = dp[i-1][j]
        if S[i][j] == '#':
            if S[i-1][j] == '.':
                down += 1
            if S[i][j-1] == '.':
                right += 1

        dp[i][j] = min(dp[i][j],right,down)

print(dp[H][W])
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
A = list(input().split())
A = [int(i) for i in A]
A.sort(reverse=True)

for _ in range(M):
    A[A.index(max(A))] = max(A)//2

print(sum(A))

Fixed submission:
import heapq

N, M = map(int, input().split())
A = list(input().split())
A = [int(i) * (-1) for i in A]

heapq.heapify(A)

for _ in range(M):
    val = heapq.heappop(A)
    heapq.heappush(A, val*(-1)//2*(-1))

print(sum(A) * (-1))

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
A = list(input().split())
A = [int(i) for i in A]
A.sort(reverse=True)

for _ in range(M):
    A[0] = A[0]//2
    if len(A) > 1 and A[0] < A[1]:
        A.sort(reverse=True)

print(sum(A))

Fixed submission:
import heapq

N, M = map(int, input().split())
A = list(input().split())
A = [int(i) * (-1) for i in A]

heapq.heapify(A)

for _ in range(M):
    val = heapq.heappop(A)
    heapq.heappush(A, val*(-1)//2*(-1))

print(sum(A) * (-1))