Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

aa = [0 for i in range(2*10**5)]
for i in range(n):
  aa[a[i]] += 1
 
for i in range(n):
  ans = 0
  aa[a[i]] -= 1
  for key in range(2*10**5):
    if aa[key] > 1:
      ans += aa[key]*(aa[key]-1)//2
  aa[a[i]] += 1
  print(ans)
  



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

aa = [0 for i in range(2*10**5)]
for i in range(n):
  aa[a[i]] += 1
 
ans = 0
for key in range(2*10**5):
  ans += aa[key]*(aa[key]-1)//2
    
for i in range(n):
  tmp1 = aa[a[i]]*(aa[a[i]]-1)//2
  aa[a[i]] -= 1
  tmp2 = aa[a[i]]*(aa[a[i]]-1)//2
  aa[a[i]] += 1
  print(ans-tmp1 + tmp2)

Buggy python submission (verdict: Time Limit Exceeded):
from operator import mul
from functools import reduce

def comb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under
  
n = int(input())
a = list(map(int, input().split()))

aa = [0 for i in range(2*10**5)]
for i in range(n):
  aa[a[i]] += 1
 
for i in range(n):
  ans = 0
  aa[a[i]] -= 1
  for key in range(2*10**5):
    if aa[key] > 1:
      ans += comb(aa[key], 2)
  aa[a[i]] += 1
  print(ans)
  



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

aa = [0 for i in range(2*10**5)]
for i in range(n):
  aa[a[i]] += 1
 
ans = 0
for key in range(2*10**5):
  ans += aa[key]*(aa[key]-1)//2
    
for i in range(n):
  tmp1 = aa[a[i]]*(aa[a[i]]-1)//2
  aa[a[i]] -= 1
  tmp2 = aa[a[i]]*(aa[a[i]]-1)//2
  aa[a[i]] += 1
  print(ans-tmp1 + tmp2)

Buggy python submission (verdict: Time Limit Exceeded):
import math
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

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

aa = [0 for i in range(2*10**5)]
for i in a:
  aa[i] += 1
 
for i in range(n):
  ans = 0
  aa[a[i]] -= 1
  for key in aa:
    if key > 1:
      ans += comb(key, 2)
  aa[a[i]] += 1
  print(ans)
  



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

aa = [0 for i in range(2*10**5)]
for i in range(n):
  aa[a[i]] += 1
 
ans = 0
for key in range(2*10**5):
  ans += aa[key]*(aa[key]-1)//2
    
for i in range(n):
  tmp1 = aa[a[i]]*(aa[a[i]]-1)//2
  aa[a[i]] -= 1
  tmp2 = aa[a[i]]*(aa[a[i]]-1)//2
  aa[a[i]] += 1
  print(ans-tmp1 + tmp2)

Buggy python submission (verdict: Time Limit Exceeded):
import math
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

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

aa = {}
for i in a:
  if i in aa:
    aa[i] += 1
  else:
    aa[i] = 1
 
for i in range(n):
  ans = 0
  aa[a[i]] -= 1
  for key in aa.keys():
    if aa[key] > 1:
      ans += comb(aa[key], 2)
  aa[a[i]] += 1
  print(ans)
  



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

aa = [0 for i in range(2*10**5)]
for i in range(n):
  aa[a[i]] += 1
 
ans = 0
for key in range(2*10**5):
  ans += aa[key]*(aa[key]-1)//2
    
for i in range(n):
  tmp1 = aa[a[i]]*(aa[a[i]]-1)//2
  aa[a[i]] -= 1
  tmp2 = aa[a[i]]*(aa[a[i]]-1)//2
  aa[a[i]] += 1
  print(ans-tmp1 + tmp2)
Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
print("Yes" ((c-a-b) > 0 and 4*a*b < (c-a-b)**2) if else "No")


Fixed submission:
from decimal import Decimal
a, b, c = map(int, input().split())

a = Decimal(a).sqrt()
b = Decimal(b).sqrt()
c = Decimal(c).sqrt()

if a + b < c:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
n, a, b = map(int, input().split())
ans = 0
count = 0
while(count < n):
  if count%(a+b) < a:
    ans+=1
  count+=1
print(ans)

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

if n%(a+b) == 0:
  print(n//(a+b)*a)
else:
  tmp = n%(a+b)
  if tmp >= a:
    print(n//(a+b)*a + a)
  elif tmp < a:
    print(n//(a+b)*a + tmp)
  else:
    print(n//(a+b)*a)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p = list(map(int, input().split()))
count = 0

for i in range(n):
  flag = True
  for j in range(i):
    if p[i] > p[j]:
      flag = False
  if flag:
    count+=1
print(count)
    

Fixed submission:
n = int(input())
p = list(map(int, input().split()))
count = 0
minP = p[0]
for i in range(n):
  minP = p[i] if minP > p[i] else minP
  if p[i] <= minP:
    count+=1
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
a, b, k = map(int, input().split())

for i in range(k):
  if a >= 1:
    a-=1
  elif b >= 1:
    b-=1
print(a,b)

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

if k-a >= 0:
  k = k-a
  a = 0
  if b-k >= 0:
    b = b-k
  else:
    b = 0
else:
  a = a-k
    
print(a, end="")
print(" ", end="")
print(b)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()

count = 0
for i in range(1000):
  tmp = format(i, '03')
  k = 0
  for j in s:
    if j == tmp[k]:
      k+=1
    if k == 3:
      count+=1
      break
print(count)
    

Fixed submission:
n = int(input())
s = input()

count = 0
for i in range(1000):
  tmp = format(i, '03')
  k = 0
  for j in s:
    if j == tmp[k]:
      k+=1
    if k == 3:
      count+=1
      break
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
import copy

N = int(input())
S = list(input())

digit = [len(set(S[i+1:])) for i in range(N-1)]
ans = [0 for i in range(100)]
for i in range(N-2):
  for j in range(i+1, N-1):
    tmp = int(S[i])*10 + int(S[j])
    ans[tmp] = max(ans[tmp], (digit[j]))

print(sum(ans))


Fixed submission:
n = int(input())
s = input()

count = 0
for i in range(1000):
  tmp = format(i, '03')
  k = 0
  for j in s:
    if j == tmp[k]:
      k+=1
    if k == 3:
      count+=1
      break
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
import copy

N = int(input())
S = list(input())

ans = set()
count = 0
for i in itertools.combinations(range(len(S)), len(S)-3):
  count = 0
  tmp = copy.copy(S)
  for j in i:
    tmp.pop(j-count)
    count+=1
  ans.add(str(tmp))
print(len(ans))



Fixed submission:
n = int(input())
s = input()

count = 0
for i in range(1000):
  tmp = format(i, '03')
  k = 0
  for j in s:
    if j == tmp[k]:
      k+=1
    if k == 3:
      count+=1
      break
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

m = 2020202020
for i in range(N):
  a = sum(A[0:i])
  b = sum(A[i:])
  ab = abs(a-b)
  if ab < m:
    m = ab
print(m)

  

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

m = 2020202020
b = sum(A)
a = 0
for i in range(N):
  a += A[i]
  b -= A[i]
  ab = abs(a-b)
  if ab < m:
    m = ab
print(m)
Buggy python submission (verdict: Runtime Error):
x, y = map(int, input().split())
mod = 10**9+7 
def check(x, y):
  if (2*y-x)/3 < 0 or (2*x -y)/3 < 0:
    return False
  if (x+y)%3 != 0:
    return False
  return True

def comb(n, r, mod):
    r = min(r, n-r)
    x, y  = 1, 1
    for i in range(1, r+1):
      y =  y* i % mod
      x =  x* (n+1-i) % mod
    return int(x * pow(y, mod-2, mod) % mod)
  
if check(x, y):
  print(comb((2*y-x)//3+(2*x -y)/3, (2*y-x)//3, mod))
else:
  print(0)

Fixed submission:
x, y = map(int, input().split())
mod = 10**9+7 
def check(x, y):
  if (2*y-x)/3 < 0 or (2*x -y)/3 < 0:
    return False
  if (x+y)%3 != 0:
    return False
  return True

def comb(n, r, mod):
    r = min(r, n-r)
    x, y  = 1, 1
    for i in range(1, r+1):
      y =  y* i % mod
      x =  x* (n+1-i) % mod
    return x * pow(y, mod-2, mod) % mod
  
if check(x, y):
  print(comb((2*y-x)//3+(2*x -y)//3, (2*y-x)//3, mod))
else:
  print(0)
Buggy python submission (verdict: Runtime Error):
A, B = map(int, input().split())
count = B - A

if(count > 0):
  if count//(A-1) == 0:
	print(1 + count//(A-1))
  else:
    print(2 + count//(A-1))
else:
	print(1)


Fixed submission:
import math
A, B = map(int, input().split())

print(math.ceil((B-1)/(A-1)))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans = 0
for i in range(n-1, 0, -1):
  ans += i
print(ans)

Fixed submission:
n = int(input())
ans = (n-1)*n//2
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
s = [sorted(input()) for i in range(N)]

ans = 0
aDict = {}
for i in s:
  if str(i) not in aDict:
    aDict[str(i)] = 1
  else
  	aDict[str(i)] += 1
    
for n in aDict.values():
    ans += (n*(n-1)//2)
print(ans)


        

      



Fixed submission:
N = int(input())
s = [sorted(input()) for i in range(N)]

ans = 0
aDict = {}
for i in s:
  if str(i) not in aDict:
    aDict[str(i)] = 1
  else:
  	aDict[str(i)] += 1
    
for n in aDict.values():
    ans += (n*(n-1)//2)
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
s = [list(input()) for i in range(N)]

ans = 0
aDict = {}
for i in s:
  i.sort()
  if str(i) not in aDict:
    aDict[str(i)] = 1
  else:
    ans += aDict[str(i)] 
    aDict[str(i)] += 1
    
print(ans)


        

      



Fixed submission:
N = int(input())
s = [sorted(input()) for i in range(N)]

ans = 0
aDict = {}
for i in s:
  if str(i) not in aDict:
    aDict[str(i)] = 1
  else:
  	aDict[str(i)] += 1
    
for n in aDict.values():
    ans += (n*(n-1)//2)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
a = [int(input())-1 for i in range(m)]
mod = 1000000007

dp = [0 for i in range(n+1)]
dp[0] = 1
for i in range(n):
  if not i in a:
    dp[i+1] = (dp[i] + dp[i-1])%mod
print(dp[len(dp)-1])
  

Fixed submission:
n, m = map(int, input().split())
a = [int(input())-1 for i in range(m)]
mod = 1000000007

dp = [0 for i in range(n+1)]
for i in a:
  dp[i+1] = -1

dp[0] = 1
for i in range(n):
  if dp[i+1] >= 0:
    dp[i+1] = (dp[i] + dp[i-1])%mod
  else:
    dp[i+1] = 0
print(dp[len(dp)-1])
Buggy python submission (verdict: Time Limit Exceeded):
r, g, b, n = map(int, input().split())
ans = 0

for i in range(3001):
  for j in range(3001):
    v = i*r + j*g
    if (n >= v and (n - v) % b == 0):
      ans+=1
print(ans)

Fixed submission:
r, g, b, n = map(int, input().split())
ans = 0

for i in range(3001):
  for j in range(3001):
    v = i*r + j*g
    if (n >= v and (n - v) % b == 0):
      ans+=1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ways = [int(input()) for i in range(5)]

town = [n, 0, 0, 0, 0, 0]
count = 0

while(town[5] < n):
  for i in range(4, -1, -1):
    if town[i] > 0:
      if town[i] < ways[i]:
        town[i+1] += town[i]
        town[i] = 0
      else:
        town[i] -= ways[i]
        town[i+1]+= ways[i]
  count+=1
print(count)
  

Fixed submission:
n = int(input())
ways = [int(input()) for i in range(5)]

ans = n//min(ways) if n%min(ways) == 0 else n//min(ways)+1
print(ans+4)
Buggy python submission (verdict: Time Limit Exceeded):
n, q = map(int, input().split())
s = input()
ans = [0 for i in range(len(s))]
for i in range(len(s)-1):
  if s[i] == "A" and s[i+1] == "C":
    ans[i] = 1
      
for i in range(q):
  l, r = map(int, input().split())
  count = 0
  for j in range(l-1, r-1):
    count += ans[j]
  print(count)
    
  
  



Fixed submission:
n, q = map(int, input().split())
s = input()
tmp = [0 for i in range(len(s))]
for i in range(len(s)-1):
  if s[i] == "A" and s[i+1] == "C":
    tmp[i] = 1
    
ans = [0 for i in range(len(s)+1)]
for i in range(1, len(ans)):
  ans[i] = ans[i-1] + tmp[i-1]
  
for i in range(q):
  l, r = map(int, input().split())
  count = 0
  print(ans[r-1] - ans[l-1])
Buggy python submission (verdict: Runtime Error):
a, b, k = map(int, input().split())

ans = []
for i in range(1, max(a,b)):
  if a % i == 0 and b % i == 0:
    ans.append(i)
    
print(ans[len(ans)- k])
  

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

ans = []
for i in range(1, max(a,b)+1):
  if a % i == 0 and b % i == 0:
    ans.append(i)
print(ans[len(ans)- k])
Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
n = int(input())
a = list(map(int, input().split()))

ans = []
for i in range(n):
  for j in range(i+1):
    ans.append(gcd(a[i], a[j]))
print(min(ans))
    

Fixed submission:
from fractions import gcd
n = int(input())
a = list(map(int, input().split()))

ans = gcd(a[0], a[1])
for i in range(2, len(a)):
  ans = gcd(ans, a[i])
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
h = [int(input()) for i in range(n)]
h.sort()
ans = max(h)
for i in range(n-k+1):
  tmp = h[i:i+k]
  if ans > (max(tmp) - min(tmp)):
    ans = max(tmp) - min(tmp)
    
print(ans)
  

Fixed submission:
n, k = map(int, input().split())
h = [int(input()) for i in range(n)]
h.sort()
ans = h[n-1]
for i in range(n-k+1):
  if ans > (h[i+k-1]-h[i]):
    ans = h[i+k-1]-h[i]
print(ans)
Buggy python submission (verdict: Runtime Error):
import math

N = int(input())
name = [input() for i in range(N)]
nameList = [0 for i in range(5)]

for n in name:
  if n[0] == 'M':
    nameList[0] += 1
  elif n[0] == 'A':
    nameList[1] += 1
  elif n[0] == 'R':
    nameList[2] += 1
  elif n[0] == 'C':
    nameList[3] += 1
  elif n[0] == 'H':
    nameList[4] += 1

ans = [i for i in nameList if i != 0]
n = len(ans)
r = 3
a = 0
if len(ans) > 0:
	a = math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

for i in ans:
  a *= i
print(a)


Fixed submission:
N = int(input())
name = [input() for i in range(N)]
nameList = [0 for i in range(5)]

P = [0 ,0 ,0 ,0 ,0 ,0 ,1 ,1 ,1 ,2]
Q = [1 ,1 ,1 ,2 ,2 ,3 ,2 ,2 ,3 ,3]
R = [2 ,3 ,4 ,3 ,4 ,4 ,3 ,4 ,4 ,4]

for n in name:
  if n[0] == 'M':
    nameList[0] += 1
  elif n[0] == 'A':
    nameList[1] += 1
  elif n[0] == 'R':
    nameList[2] += 1
  elif n[0] == 'C':
    nameList[3] += 1
  elif n[0] == 'H':
    nameList[4] += 1

ans = 0
for i in range(10):
  ans += nameList[P[i]] * nameList[Q[i]] * nameList[R[i]]
    
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))

ans = [0 for i in range(max(a))]

for i in a:
  ans[i-1]+=1
  if i <max(a):
    ans[i]+=1
  if i-2 >= 0:
    ans[i-2]+=1
print(max(ans))

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
ans = [0 for i in range(max(a)+3)]

for i in a:
  ans[i]+=1
  ans[i+1]+=1
  ans[i-1]+=1
    
print(max(ans))
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))

count = 0
flag = False

if a[0] >= a[1]:
  flag = True
else:
  flag = False
  
for i in range(1, n-1):
  if a[i] == a[i+1]:
    break
  elif a[i] > a[i+1]:
    if not flag:
      count+=1
      flag = False
  else:
    if flag:
      count+=1
      flag = True
print(count+1)



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

flag = 0
 
ans = 1
for i in range(n - 1):
  if flag == 1:
    if a[i] > a[i + 1]:
      ans += 1
      flag = 0
  elif flag == -1:
    if a[i] < a[i + 1]:
      ans += 1
      flag = 0
  else:
    if a[i] > a[i + 1]:
      flag = -1
    elif a[i] < a[i + 1]:
      flag = 1
print(ans)
Buggy python submission (verdict: Runtime Error):
x, y = map(int, input().split())
diff = abs(abs(x)-abs(y))

elif abs(x) < abs(y):
  if x < 0 and y < 0:
    diff += 2
  elif x > 0 and y < 0:
    diff += 1
  elif x < 0 and y > 0:
    diff += 1
else:
  if x > 0 and y > 0:
    diff += 2
  elif x < 0 and y > 0:
    diff += 1
  elif x > 0 and y < 0:
    diff += 1
  

print(diff)

Fixed submission:
x, y = map(int, input().split())
diff = abs(abs(x)-abs(y))

if abs(x) < abs(y):
  if x < 0:
    diff += 1
  if y < 0:
    diff += 1
else:
  if x > 0:
    diff += 1
  if y > 0:
    diff += 1
print(diff)
Buggy python submission (verdict: Runtime Error):
def nextTurn(a):
  if a == "a":
    return 0
  elif a == "b":
    return 1
  else:
    return 2
    
hand = [list(input()) for i in range(3)]
turn = nextTurn(hand[0].pop(0))
while(True):
  turn = nextTurn(hand[turn].pop(0))
  if len(hand[turn]) == 0:
    if turn == 0:
      print("A")
    elif turn == 1:
      print("B")
    else:
      print("C")
    break
  

Fixed submission:
def nextTurn(a):
  if a == "a":
    return 0
  elif a == "b":
    return 1
  else:
    return 2
    
hand = [list(input()) for i in range(3)]
turn = nextTurn(hand[0].pop(0))
while(True):
  if len(hand[turn]) == 0:
    if turn == 0:
      print("A")
    elif turn == 1:
      print("B")
    else:
      print("C")
    break
  turn = nextTurn(hand[turn].pop(0))

Buggy python submission (verdict: Runtime Error):
def nextTurn(a):
  if a == "a":
    return 0
  elif a == "b":
    return 1
  else:
    return 2
    
hand = [list(input()) for i in range(3)]
turn = nextTurn(hand[0].pop(0))
while(True):
  tmp = turn
  turn = nextTurn(hand[turn].pop(0))
  if len(hand[tmp]) == 0:
    if tmp == 0:
      print("A")
    elif tmp == 1:
      print("B")
    else:
      print("C")
    break
  

Fixed submission:
def nextTurn(a):
  if a == "a":
    return 0
  elif a == "b":
    return 1
  else:
    return 2
    
hand = [list(input()) for i in range(3)]
turn = nextTurn(hand[0].pop(0))
while(True):
  if len(hand[turn]) == 0:
    if turn == 0:
      print("A")
    elif turn == 1:
      print("B")
    else:
      print("C")
    break
  turn = nextTurn(hand[turn].pop(0))

Buggy python submission (verdict: Runtime Error):
def nextTurn(a):
  if a == "a":
    return 0
  elif a == "b":
    return 1
  else:
    return 2
    
hand = [list(input()) for i in range(3)]
turn = nextTurn(hand[0].pop(0))
while(True):
  tmp = turn
  turn = nextTurn(hand[turn].pop(0))
  if len(hand[turn]) == 0:
    if tmp == 0:
      print("A")
    elif tmp == 1:
      print("B")
    else:
      print("C")
    break
  

Fixed submission:
def nextTurn(a):
  if a == "a":
    return 0
  elif a == "b":
    return 1
  else:
    return 2
    
hand = [list(input()) for i in range(3)]
turn = nextTurn(hand[0].pop(0))
while(True):
  if len(hand[turn]) == 0:
    if turn == 0:
      print("A")
    elif turn == 1:
      print("B")
    else:
      print("C")
    break
  turn = nextTurn(hand[turn].pop(0))
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
d = list(map(int, input().split()))
digit = [str(i) for i in range(10) if not i in d]
ans = []
stack = [i for i in digit]
while stack:
  s = stack.pop()
  if int(s) >= n:
    ans.append(s)
  else:
    for i in digit:
      if len(i+s) <= len(str(n)+1):
        stack.append(i+s)

print(min(ans))

      


Fixed submission:
n, k = map(int, input().split())
d = list(map(int, input().split()))
digit = [str(i) for i in range(10) if not i in d]
ans = []
stack = [i for i in digit]
while stack:
  s = stack.pop()
  if int(s) >= n:
    ans.append(int(s))
  else:
    for i in digit:
      if len(i+s) <= len(str(n))+1:
        stack.append(i+s)

print(min(ans))

Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
d = list(map(int, input().split()))
digit = [str(i) for i in range(10) if not i in d]
ans = []
stack = [i for i in digit]
while stack:
  s = stack.pop()
  if int(s) >= n:
    ans.append(s)
  else:
    for i in digit:
      if len(i+s) <= len(str(n)):
        stack.append(i+s)
print(min(ans))
      


Fixed submission:
n, k = map(int, input().split())
d = list(map(int, input().split()))
digit = [str(i) for i in range(10) if not i in d]
ans = []
stack = [i for i in digit]
while stack:
  s = stack.pop()
  if int(s) >= n:
    ans.append(int(s))
  else:
    for i in digit:
      if len(i+s) <= len(str(n))+1:
        stack.append(i+s)

print(min(ans))
Buggy python submission (verdict: Runtime Error):
def main ():
	N = int(input())
	A = list(map(int,input(). split ()))
    if 0 in A:
    	print(0)
    	return
    prod = 1
      for a in A:
      prod *= a
      if prod > 1000000000000000000:
      print(-1)
      return
    print(prod)
main ()

Fixed submission:
def sol():
    n=int(input())
    a=list(map(int,input().split()))
    if 0 in a:
        print(0)
        return
    prod=1 
    for i in a:
        prod*=i 
        if prod>1000000000000000000:
            print(-1)
            return
    print(prod)
    
sol()

Buggy python submission (verdict: Time Limit Exceeded):
# cook your dish here
n=int(input())
a=list(map(int,input().split()))
res=1
if 0 in a:
    print(0)
else:
    for i in a:
        res*=i
    if(res>1000000000000000000):
        print(-1)
    else:
        print(res)
        

Fixed submission:
def sol():
    n=int(input())
    a=list(map(int,input().split()))
    if 0 in a:
        print(0)
        return
    prod=1 
    for i in a:
        prod*=i 
        if prod>1000000000000000000:
            print(-1)
            return
    print(prod)
    
sol()

Buggy python submission (verdict: Time Limit Exceeded):
# cook your dish here
n=int(input())
a=list(map(int,input().split()))
res=1
if 0 in a:
    print("0")
else:
    for i in a:
        res=res*i
    if(res>1000000000000000000):
        print("-1")
    else:
        print(res)

Fixed submission:
def sol():
    n=int(input())
    a=list(map(int,input().split()))
    if 0 in a:
        print(0)
        return
    prod=1 
    for i in a:
        prod*=i 
        if prod>1000000000000000000:
            print(-1)
            return
    print(prod)
    
sol()
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

for i in range(1,n+1):
    cnt = 0
    for x in range(1,101):
        if x*x<= i:
            for y in range(1,101):
                if x*x + y*y + x*y <= i:
                    for z in range(1,101):
                        if x*x + y*y + z*z + x*y + x*z + y*z == i:
                            cnt += 1
    print(cnt)

Fixed submission:
n = int(input())

ans = [0 for i in range(10001)]

for x in range(1,101):
    for y in range(1,101):
        for z in range(1,101):
            v = x*x+y*y+z*z+x*y+y*z+z*x
            if v < 10001:
                ans[v] += 1

for i in range(n):
    print(ans[i+1])
Buggy python submission (verdict: Runtime Error):
a = int(input())

ans = a+a*a+a*a*a

return ans


Fixed submission:
a = int(input())

ans = a+a*a+a*a*a

print(ans)

Buggy python submission (verdict: Runtime Error):
a = int(input())

ans = a+a*2+a*3

return ans


Fixed submission:
a = int(input())

ans = a+a*a+a*a*a

print(ans)

Buggy python submission (verdict: Runtime Error):
a = int(input())

ans = a+a*2+a*3

print ans


Fixed submission:
a = int(input())

ans = a+a*a+a*a*a

print(ans)

Buggy python submission (verdict: Runtime Error):
a = int(input())

int ans = a+a*2+a*3

print(ans)

Fixed submission:
a = int(input())

ans = a+a*a+a*a*a

print(ans)
Buggy python submission (verdict: Runtime Error):
N = input()
M = list(map(int,input().split()))
    
mult = 1

if 0 in A:
  print(0)
  
for a in M:
    mult *= a
    if mult> 1000000000000000000:
        print(-1)
        
print(mult)

Fixed submission:
A,B = map(int,input().split())
print(A*B)
Buggy python submission (verdict: Runtime Error):
N = input()
M = list(map(int,input().split()))
    
mult = 1
 
if 0 in A:
  print(0)
  return

for a in M:
    mult *= a
    if mult> 1000000000000000000:
        print(-1)
        
print(mult)

Fixed submission:
def main():
    N = input()
    M = list(map(int,input().split()))
    
    mult = 1
    
    if 0 in M:
        print(0)
        return
    
    for a in M:
        mult *= a
        if mult>10**18:
            print(-1)
            return
        
    print(mult)
    
main()
Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
A = list(map(int,input().split()))
A.sort(reverse = True)
num = 0
for i in A:
    num += i
if A[M] >= num//4*M:
    print('Yes')
else:
    print('No')

Fixed submission:
N,M = map(int,input().split())
A = list(map(int,input().split()))
A.sort(reverse = True)
num = 0
for i in A:
    num += i
if A[M-1] >= num/(4*M):
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
S=input()
if not S[1]==S[2]and S[2]==S[3]:
	print('No')
else:
	print('Yes')

Fixed submission:
S=input()
if S[0]==S[1]and S[1]==S[2]:
	print('No')
else:
	print('Yes')

Buggy python submission (verdict: Runtime Error):
S[3]
S[1]=input()
S[2]=input()
S[3]=input()
if not S[1]==S[2]and S[2]==S[3]:
	print('No')
else:
	print('Yes')

Fixed submission:
S=input()
if S[0]==S[1]and S[1]==S[2]:
	print('No')
else:
	print('Yes')