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

for index, clause in enumerate(clause_list):
  if clause = 5:
    clause_list.pop(index)
    break

for index, clause in enumerate(clause_list):
  if clause = 7:
    clause_list.pop(index)
    break

for index, clause in enumerate(clause_list):
  if clause = 5:
    clause_list.pop(index)
    break

print('YES' if len(clause_list) == 0 else 'NO')


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

for index, clause in enumerate(clause_list):
  if clause == 5:
    clause_list.pop(index)
    break

for index, clause in enumerate(clause_list):
  if clause == 7:
    clause_list.pop(index)
    break

for index, clause in enumerate(clause_list):
  if clause == 5:
    clause_list.pop(index)
    break

print('YES' if len(clause_list) == 0 else 'NO')

Buggy python submission (verdict: Runtime Error):
clause_list = list(map(int, input()))

for index, clause in enumerate(clause_list):
  if clause = 5:
    clause_list.pop(index)
    break
    
for index, clause in enumerate(clause_list):
  if clause = 7:
    clause_list.pop(index)
    break
    
for index, clause in enumerate(clause_list):
  if clause = 5:
    clause_list.pop(index)
    break
    
print('YES' if len(clause_list) == 0 else 'NO')

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

for index, clause in enumerate(clause_list):
  if clause == 5:
    clause_list.pop(index)
    break

for index, clause in enumerate(clause_list):
  if clause == 7:
    clause_list.pop(index)
    break

for index, clause in enumerate(clause_list):
  if clause == 5:
    clause_list.pop(index)
    break

print('YES' if len(clause_list) == 0 else 'NO')
Buggy python submission (verdict: Time Limit Exceeded):
N,Q=map(int,input().split())
S=list(input())

for i in range(Q) :
  l,r=map(int,input().split())
  s=S[l-1:r]
  #print(s)
  c=0
  for j in range(len(s)-1) :
    if s[j]=='A'  and s[j+1]=='C' :
      c+=1
  print(c)

Fixed submission:
N,Q=map(int,input().split())
S=input()
s=[0]
for i in range(N) :
  s.append(s[-1]+(1 if S[i:i+2]=='AC' else 0))
for i in range(Q) :
  l,r=map(int,input().split())
  print(s[r-1]-s[l-1])

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

for i in range(Q) :
  l,r=map(int,input().split())
  s=S[l-1:r]
  c=0
  for j in range(len(s)-1) :
    if s[j]=='A' :
      if s[j+1]=='C' :
        c+=1
  print(c)

Fixed submission:
N,Q=map(int,input().split())
S=input()
s=[0]
for i in range(N) :
  s.append(s[-1]+(1 if S[i:i+2]=='AC' else 0))
for i in range(Q) :
  l,r=map(int,input().split())
  print(s[r-1]-s[l-1])
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
p=[]
for i in range(n):
  x=int(input())
  p.append(x)
p.sort()
y=0
for i in range(k):
  y=y+p[i]
print(y)

Fixed submission:
n,k=map(int,input().split())
p=[]
a,*b=map(int,input().split())
p.append(a)
for i in range(len(b)):
    p.append(b[i])
p.sort()
y=0
for i in range(k):
    y=y+p[i]
print(y)
Buggy python submission (verdict: Runtime Error):
a=map(int,input().split())
for i in range(len(a)):
  if a[i]!=i:
    print(a[i])

Fixed submission:
a=list(map(int,input().split()))
for i in range(5):
  if a[i]!=i+1:
    print(i+1)
Buggy python submission (verdict: Runtime Error):
X,N=map(int,input().split())
l=[]
for i in range(100):
  l.append(i+1)
if N>0:
  p=list(map(int,input().split()))
  l1=[x for x in l if x not in p]
  d=abs(X-l1[0])
if N>0:
  for i in range(N):
    d=min(abs(X-l1[i]),d)
  print(l1[i])
else:
  print(X)

Fixed submission:
x, n = map(int, input().split())
a = [int(x) for x in input().split()]
b = [i for i in range(0,102) if i not in a] 
b_tmp = list(map(lambda s:abs(s-x), b)) #b_tmpはbとxの差分のリストをさくせい
address = b_tmp.index(min(b_tmp))
print(b[address])
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    num = int(input())
    num_list = list(map(int, input().split()))

    ans = 1
    for i in num_list:
        ans = ans * i
        if ans == 0:
            break

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


if __name__ == '__main__':
    main()


Fixed submission:
def main():
    num = int(input())
    num_list = list(map(int, input().split()))

    if 0 in num_list:
        print(0)
    else:
        ans = 1
        for i in num_list:
            ans = ans * i
            if ans > 1000000000000000000:
                print(-1)
                break
        else:
            print(ans)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
s = list(input())

for i in s:
    sum += int(i)

print(sum)


Fixed submission:
s = list(input())
ball = 0
for i in s:
    ball = ball + int(i)

print(ball)

Buggy python submission (verdict: Runtime Error):
s = input().split()

for i in range(2):
    sum += int(s[i])

print(sum)


Fixed submission:
s = list(input())
ball = 0
for i in s:
    ball = ball + int(i)

print(ball)

Buggy python submission (verdict: Runtime Error):
s = input().split()

for i in s:
    sum += int(i)

print(sum)


Fixed submission:
s = list(input())
ball = 0
for i in s:
    ball = ball + int(i)

print(ball)

Buggy python submission (verdict: Runtime Error):
s = input().split()

for i in s:
    sum += int(s[i])

print(sum)


Fixed submission:
s = list(input())
ball = 0
for i in s:
    ball = ball + int(i)

print(ball)
Buggy python submission (verdict: Runtime Error):
n = int(input())
for i in range(11):
  p = 0
  q = 0
  p = n%26
  if n==0 and p==0:
    l2[i]=""
  else:
    l2[i]=l[p]
    if p ==0:
      q = n - 26
    else:
      q = n - p
    n = q//26
print(l2[10]+l2[9]+l2[8]+l2[7]+l2[6]+l2[5]+l2[4]+l2[3]+l2[2]+l2[1]+l2[0])

Fixed submission:
l = ["z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y"]
l2 = [0]*11

n = int(input())
for i in range(11):
  p = 0
  q = 0
  p = n%26
  if n==0 and p==0:
    l2[i]=""
  else:
    l2[i]=l[p]
    if p ==0:
      q = n - 26
    else:
      q = n - p
    n = q//26
print(l2[10]+l2[9]+l2[8]+l2[7]+l2[6]+l2[5]+l2[4]+l2[3]+l2[2]+l2[1]+l2[0])
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
a = list(map(int,input().split()))
z = 0
b = [1]
c = [0]*n
for i in range(n*3):
  j = [a[b[i]-1]]
  b.extend(j)
  c[a[b[i]-1]-1] = c[a[b[i]-1]-1]+1
  if c[a[b[i]-1]-1] == 2:
    z = z + 1
if k <= n:
  y = b[k]
else:
  l = (k-n)%z
  y = b[n+l]
print(y)

Fixed submission:
s = input()
t = input()

n = len(s)
if s+t[n] == t:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
a = list(map(int,input().split()))
z = 0
b = [1]
c = [0]*n
for i in range(n*3):
  j = [a[b[i]-1]]
  b.extend(j)
  c[a[b[i]-1]-1] = c[a[b[i]-1]-1]+1
  if c[a[b[i]-1]-1] == 2:
    z = z + 1

if k <= n:
  y = b[k]
else:
  l = (k-n)%z
  y = b[n+l]
print(y)

Fixed submission:
n,k = map(int,input().split())
a = list(map(int,input().split()))
z = 0
b = [1]
c = [0]*n
for i in range(n*3):
  j = [a[b[i]-1]]
  b.extend(j)
  c[a[b[i]-1]-1] = c[a[b[i]-1]-1]+1
  if c[a[b[i]-1]-1] == 2:
    z = z + 1
if k <= n:
  y = b[k]
else:
  l = (k-n)%z
  y = b[n+l]
print(y)

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
a = list(map(int,input().split()))
z = 0
b = [1]
for i in range(n*3):
  j = [a[b[i]-1]]
  b.extend(j)
for i in range(n):
  if b.count(i+1)>=3:
    z = z + 1
if k <= n:
  y = b[k]
else:
  l = (k-n)%z
  y = b[n+l]
print(y)

Fixed submission:
n,k = map(int,input().split())
a = list(map(int,input().split()))
z = 0
b = [1]
c = [0]*n
for i in range(n*3):
  j = [a[b[i]-1]]
  b.extend(j)
  c[a[b[i]-1]-1] = c[a[b[i]-1]-1]+1
  if c[a[b[i]-1]-1] == 2:
    z = z + 1
if k <= n:
  y = b[k]
else:
  l = (k-n)%z
  y = b[n+l]
print(y)

Buggy python submission (verdict: Runtime Error):
z = 0

b = [1]
for i in range(1000000):
  j = [a[b[i]-1]]
  b.extend(j)

for i in range(n):
  if b.count(i+1)>=3:
    z = z + 1

if k <= n:
  y = b[k]
else:
  l = (k-n)%z
  y = b[n+l]
print(y)

Fixed submission:
n,k = map(int,input().split())
a = list(map(int,input().split()))
z = 0
b = [1]
c = [0]*n
for i in range(n*3):
  j = [a[b[i]-1]]
  b.extend(j)
  c[a[b[i]-1]-1] = c[a[b[i]-1]-1]+1
  if c[a[b[i]-1]-1] == 2:
    z = z + 1
if k <= n:
  y = b[k]
else:
  l = (k-n)%z
  y = b[n+l]
print(y)
Buggy python submission (verdict: Time Limit Exceeded):
from operator import mul
from functools import reduce

border = 10 ** 18

N = int(input())
nums = list(map(int, input().split()))
result = reduce(mul, nums)

if result > border:
    print(-1)
    exit()
print(result)

Fixed submission:
border = 1000000000000000000

N = int(input())
nums = list(map(int, input().split()))
if 0 in nums:
    print(0)
    exit()

result = 1
for n in nums:
    result = result * n
    if result > border:
        print(-1)
        exit()
print(result)
Buggy python submission (verdict: Runtime Error):
N = input()
T, A = map(int, input().split())
temperatures = list(map(int, input().split()))
 
r = 50000000
results = ''
 
list = [T - t * 0.006 for t in temperatures]
for index, avg_temp in enumerate(list):      

    if r > abs(ondo_sa):
        r = ondo_sa
        results = index + 1
print(results)

Fixed submission:
N = input()
T, A = map(int, input().split())
temperatures = list(map(int, input().split()))
 
r = 50000000000000
results = ''
 
list = [T - t * 0.006 for t in temperatures]
for index, avg_temp in enumerate(list):
    ondo_sa = avg_temp - A
 
    if ondo_sa < 0:
        ondo_sa = - ondo_sa
 
    if r > abs(ondo_sa):
        r = ondo_sa
        results = index + 1
print(results)

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

r = 50000000
results = ''

list = [T - t * 0.006 for t in temperatures]
for index, avg_temp in enumerate(list):
  	if avg_temp < 0:
      	avg_temp = avg_temp * -1
      
    ondo_sa = A - avg_temp
    if r > ondo_sa:
        r = ondo_sa
        results = index + 1
print(results)

Fixed submission:
N = input()
T, A = map(int, input().split())
temperatures = list(map(int, input().split()))
 
r = 50000000000000
results = ''
 
list = [T - t * 0.006 for t in temperatures]
for index, avg_temp in enumerate(list):
    ondo_sa = avg_temp - A
 
    if ondo_sa < 0:
        ondo_sa = - ondo_sa
 
    if r > abs(ondo_sa):
        r = ondo_sa
        results = index + 1
print(results)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
r = 999999999
for n in range(N):
    result = S[:n].count('W') + S[n + 1:].count('E')
    if result < r:
        r = result
print(r)

Fixed submission:
N = int(input())
S = input()

i = S[1:].count('E')
ans = [i]

for n in range(N):
    if n == 0:
        continue

    if S[n] == 'E':
        i -= 1

    if S[n - 1] == 'W':
        i += 1
    ans.append(i)

print(min(ans))
Buggy python submission (verdict: Runtime Error):
N, Y = list(map(int, input().split()))
results = [-1, -1, -1]
for x in range(N + 1):
    for y in range(N - x + 1):
        z = (N - x - y)
        if 0 <= z <= 2000 and Y == 10000 * x + 5000 * y + 1000 * z:
            results = [x, y, z]
            print(results)
            exit()
print(results)

Fixed submission:
s = input()
print(s.replace('2017', '2018'))

Buggy python submission (verdict: Runtime Error):
N, Y = list(map(int, input().split()))
results = [-1, -1, -1]
for x in range(N + 1):
    for y in range(N - x + 1):
        z = (N - x - y)
        if 0 <= z <= 2000 and Y == 10000 * x + 5000 * y + 1000 * z:
            results = [x, y, z]
            print(results)
            exit()
print(results)

Fixed submission:
s = input()
print(s.replace('2017', '2018'))
Buggy python submission (verdict: Runtime Error):
results = [-1, -1, -1]
for x in range(N + 1):
    for y in range(N - x + 1):
        if Y == 10000 * x + 5000 * y + 1000 * (N - x - y):
            results = [x, y, (N - x - y)]
            print(results)
            exit()

Fixed submission:
N, Y = map(int, input().split())
for x in range(N+1):
    for y in range(N-x+1):
        z = N-x-y
        if 0 <= z <= 2000 and 10000*x+5000*y+1000*z == Y:
            print(x, y, z)
            exit()
print(-1, -1, -1)
Buggy python submission (verdict: Runtime Error):
r, g, b = input()
a = int(r + g + b)
if a % 4 == 0:
    print('YES')
else:
    print('NO')

Fixed submission:
r, g, b = input().split()
a = int(r + g + b)
if a % 4 == 0:
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
r = 1

for n in range(1, N + 1):
    r *= n
print(r % ((10 ** 9) + 7))

Fixed submission:
N = int(input())
r = 1

for n in range(1, N + 1):
    r = (r * n) % ((10 ** 9) + 7)
print(r)
Buggy python submission (verdict: Time Limit Exceeded):
K, S = map(int, input().split())
count = 0
for x in range(K + 1):
    for y in range(K + 1):
        for z in range(K + 1):
            if S == x + y + z:
                count += 1
print(count)

Fixed submission:
K, S = map(int, input().split())
count = 0
for x in range(K + 1):
    for y in range(K + 1):
        z = S - (x + y)
        if 0 <= z <= K:
            count += 1
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
while 1:
    for key_word in ["erase", "eraser", "dream", "dreamer"]:
        if S.endswith(key_word):
            S = S[:-len(key_word)]
            break
        else:
            print("NO")
            break
        if not query:
            print("YES")
            break

Fixed submission:
s = input()
s = s.replace('eraser', '')
s = s.replace('erase', '')
s = s.replace('dreamer', '')
s = s.replace('dream', '')
if s:
  print('NO')
else:
  print('YES')
Buggy python submission (verdict: Runtime Error):
n = int(input())
print(n - (-n // 1000) * 1000

Fixed submission:
n = int(input())
print(- n - (-n // 1000) * 1000)
Buggy python submission (verdict: Time Limit Exceeded):
n, a, b = map(int,input().split())
mod7 = 10 ** 9 + 7
def power(a,b,mod):
    p = 1
    q = a
    while b != 0:
        if b % 2 == 1:
            p = (p * q) % mod
        q = (q * q) % mod
        b = b // 2
    return p

def fact(n, mod):
    p = 1
    for i in range(1,n+1):
        p = (p * i) % mod
    return p

def divi(a,b,mod):
    p = (power(b, mod-2, mod) * a) % mod
    return p

def combi(n,a,mod):
    nf = fact(n,mod)
    af = fact(a,mod)
    bf = fact(n-a,mod)
    return divi(divi(nf,af,mod),bf,mod)

Answer = power(2, n, mod7) - combi(n, a, mod7) - combi(n, b , mod7) - 1
print(Answer)

Fixed submission:
n, a, b = map(int,input().split())
mod7 = 10 ** 9 + 7
def power(a,b,mod):
    p = 1
    q = a
    while b != 0:
        if b % 2 == 1:
            p = (p * q) % mod
        q = (q * q) % mod
        b = b // 2
    return p

def fact(n, mod):
    p = 1
    for i in range(1,n+1):
        p = (p * i) % mod
    return p


def combi(n,a,mod):
    inv_af = power(fact(a,mod),mod-2,mod)
    p = 1
    for i in range(a):
        p = (p * (n-i)) % mod
    return inv_af * p % mod

Answer = (power(2, n, mod7) - combi(n, a, mod7) - combi(n, b, mod7) - 1) % mod7
print(Answer)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = list(map(int,input().split()))
l.sort()
d = [0]*(n-1)
for i in range(n-1):
    d[i]=l[i+1]-l[i]
p = 1
for j in d:
    p = p * j
if p == 0:
    print('NO')
else:
    print('YES')

Fixed submission:
n = int(input())
l = list(map(int,input().split()))
l.sort()
s = 'YES'
for i in range(n-1):
    if l[i] == l[i+1]:
        s = 'NO'
print(s)
Buggy python submission (verdict: Runtime Error):
a = int.input()
l = list(map(int,input().split()))
m = l[0]
M = l[0]
for i in range(1,a):
  if l[i]<m:
    m = l[i]
  else:
    if l[i]>M:
      M = l[i]
    else:
      pass
print(M-m)

Fixed submission:
a = int(input())
l = list(map(int,input().split()))
m = l[0]
M = l[0]
for i in range(1,a):
  if l[i]<m:
    m = l[i]
  else:
    if l[i]>M:
      M = l[i]
    else:
      pass
print(M-m)

Buggy python submission (verdict: Runtime Error):
a = int.input()
l = list(map(int,input().split()))
m = l[0]
M = l[0]
for i in range(1,a):
  if l[i]<m:
    m = l[i]
  else:
    if l[i]>M:
      M=l[i]
    else:
      pass
  
print(M-m)

Fixed submission:
a = int(input())
l = list(map(int,input().split()))
m = l[0]
M = l[0]
for i in range(1,a):
  if l[i]<m:
    m = l[i]
  else:
    if l[i]>M:
      M = l[i]
    else:
      pass
print(M-m)

Buggy python submission (verdict: Runtime Error):
a = int.input()
l = list(map(int,input().split()))
m = l[0]
M = l[0]
for i in range(1,a):
  if l[i]<m:
    m = l[i]
  if l[i]>M:
    M=l[i]
print(M-m)

Fixed submission:
a = int(input())
l = list(map(int,input().split()))
m = l[0]
M = l[0]
for i in range(1,a):
  if l[i]<m:
    m = l[i]
  else:
    if l[i]>M:
      M = l[i]
    else:
      pass
print(M-m)

Buggy python submission (verdict: Runtime Error):
a = int.input()
l = list(map(int,input().split()))
m = l[0]
M = l[0]
for i in range(1,a):
  if l[i]<m:
    m = i[i]
  if l[i]>M:
    M=l[i]
print(M-m)

Fixed submission:
a = int(input())
l = list(map(int,input().split()))
m = l[0]
M = l[0]
for i in range(1,a):
  if l[i]<m:
    m = l[i]
  else:
    if l[i]>M:
      M = l[i]
    else:
      pass
print(M-m)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()
Alphabet = [q,w,e,r,t,y,u,i,o,p,a,s,d,f,g,h,j,k,l,z,x,c,v,b,n,m]
for j in range(1,n):
  r = 0
  StringL = s[0:j]
  StringR = s[j:n]
  for i in Alphabet:
    if StringL.count(i) == 0:
      pass
    else:
      if StringR.count(i) == 0:
        pass
      else: r = r + 1
print(r)

Fixed submission:
n = int(input())
s = input()
Alphabet = ["q","w","e","r","t","y","u","i","o","p","a","s","d","f","g","h","j","k","l","z","x","c","v","b","n","m"]
h = 0
for j in range(1,n):
    StringL = s[0:j]
    StringR = s[j:n]
    r = 0
    for i in Alphabet:
        if StringL.count(i) == 0:
            pass
        else:
            if StringR.count(i) == 0:
                pass
            else: r = r + 1
        if r > h:
            h = r
print(h)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
b = list(a)
c = int(n/2)
for j in range(1,c):
    b.remove(max(b))
    b.remove(min(b))
ML = min(b)
MR = max(b)
for i in range(0,n):
    if a[i] >= MR:
        print(ML)
    else:
        print(MR)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
b = list(a)
b.sort()
c = int(n/2)
ML=b[c-1]
MR=b[c]
for i in range(0,n):
    if a[i] >= MR:
        print(ML)
    else:
        print(MR)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
b = list(a)
c = int(n/2)
for j in range(1,c):
    b.remove(max(b))
    b.remove(min(b))
ML = min(b)
MR = max(b)
for i in range(0,n):
    if a[i] >= MR:
        print(ML)
    else:
        print(MR)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
b = list(a)
b.sort()
c = int(n/2)
ML=b[c-1]
MR=b[c]
for i in range(0,n):
    if a[i] >= MR:
        print(ML)
    else:
        print(MR)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
b = list(a)
c = int(n/2)
for j in range(1,c):
    M = max(b)
    m= min(b)
    b.remove(M)
    b.remove(m)
ML = min(b)
MR = max(b)
for i in range(0,n):
    if a[i] >= MR:
        print(ML)
    else:
        print(MR)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
b = list(a)
b.sort()
c = int(n/2)
ML=b[c-1]
MR=b[c]
for i in range(0,n):
    if a[i] >= MR:
        print(ML)
    else:
        print(MR)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map((int,input.split())))
c = int(n / 2)
b = list(a)
for j in range(1,c):
    M = max(b)
    m= min(b)
    b.remove(M)
    b.remove(m)
ML = min(b)
MR = max(b)
for i in range(0,n):
    if a[i] > MR:
        print(ML)
    else:
        print(MR)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
b = list(a)
b.sort()
c = int(n/2)
ML=b[c-1]
MR=b[c]
for i in range(0,n):
    if a[i] >= MR:
        print(ML)
    else:
        print(MR)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map((int,input.split()))
c = int(n / 2)
b = list(a)
for j in range(1,c):
    M = max(b)
    m= min(b)
    b.remove(M)
    b.remove(m)
ML = min(b)
MR = max(b)
for i in range(0,n):
    if a[i] > MR:
        print(ML)
    else:
        print(MR)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
b = list(a)
b.sort()
c = int(n/2)
ML=b[c-1]
MR=b[c]
for i in range(0,n):
    if a[i] >= MR:
        print(ML)
    else:
        print(MR)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
ans = 1
for i in A:
    ans = ans * i

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

Fixed submission:
n=int(input())
array=list(map(int,input().split()))
ans=array[0]
for i in range(1,n):
    ans*=array[i]
    if ans>10**18:
        ans=-1
        break
if 0 in array:
    ans=0
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import collections
X = int(input())

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

c = collections.Counter(prime_factorize(X))
cl = list(c.keys())
cl.append(1)
for insu in cl:
    for i in range(-1000000, 1000000):
        if i**5 - (i-insu)**5 == X:
            print(i, (i-insu))
            break


Fixed submission:
import collections
X = int(input())

for i in range(1000):
    for j in range(-1000,1000):
        if i**5 - j**5 == X:
            print(i,j)
            exit()
Buggy python submission (verdict: Runtime Error):
import macpath

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

Fixed submission:
import math

R = int(input())
print(R*2*math.pi)
Buggy python submission (verdict: Runtime Error):
N,M = int(input().split())
A = list(map(int, input().split()))

if N-sum(A) < 0:
    print("-1")
else:
    print(N-sum(A))


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

if N-sum(A) < 0:
    print("-1")
else:
    print(N-sum(A))

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

print(N-sum(A))

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

if N-sum(A) < 0:
    print("-1")
else:
    print(N-sum(A))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
count = 0

for i in range(N-2):
    for j in range(i+1, N-1):
        if S[i] != S[j]:
            for k in range(j+1, N):
                if j - i != k - j and S[i] != S[k] and S[j] != S[k]:
                    count += 1

print(count)


Fixed submission:
N = int(input())
S = input()
count = 0
R = S.count("R")
G = S.count("G")
B = S.count("B")
count = R*G*B

for i in range(N-2):
    for j in range(i+1, N-1):
        if j +(j-i) <= N-1 and S[i] != S[j]:
            if S[i] != S[j+(j-i)] and S[j] != S[j+(j-i)]:
                count -= 1

print(count)