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

MAX = max(s)
nums = [0]*(MAX+1)

for i in s:
    if i == 0:
        nums[0] += 1
        nums[1] += 1
    elif i == MAX:
        nums[-1] += 1
        if i != 0:
            nums[-2] += 1
    else:
        nums[i-1] += 1
        nums[i] += 1
        nums[i+1] += 1

print(max(nums))

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

MAX = max(s)
nums = [0]*(MAX+1)

if MAX == 0:
    print(n)
    exit()

for i in s:
    if i == 0:
        nums[0] += 1
        nums[1] += 1
    elif i == MAX:
        nums[-1] += 1
        nums[-2] += 1
    else:
        nums[i-1] += 1
        nums[i] += 1
        nums[i+1] += 1

print(max(nums))

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

MAX = max(s)
nums = [0]*(MAX+1)


for i in s:
    if i == 0:
        nums[0] += 1
        nums[1] += 1
    elif i == MAX:
        nums[-1] += 1
        nums[-2] += 1
    else:
        nums[i-1] += 1
        nums[i] += 1
        nums[i+1] += 1

print(max(nums))

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

MAX = max(s)
nums = [0]*(MAX+1)

if MAX == 0:
    print(n)
    exit()

for i in s:
    if i == 0:
        nums[0] += 1
        nums[1] += 1
    elif i == MAX:
        nums[-1] += 1
        nums[-2] += 1
    else:
        nums[i-1] += 1
        nums[i] += 1
        nums[i+1] += 1

print(max(nums))

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

nums = [0]*(max(s)+1)

for i in s:
    if i == 0:
        nums[0] += 1
        nums[1] += 1
    elif i == max(s):
        nums[-1] += 1
        nums[-2] += 1
    else:
        nums[i-1] += 1
        nums[i] += 1
        nums[i+1] += 1

print(max(nums))

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

MAX = max(s)
nums = [0]*(MAX+1)

if MAX == 0:
    print(n)
    exit()

for i in s:
    if i == 0:
        nums[0] += 1
        nums[1] += 1
    elif i == MAX:
        nums[-1] += 1
        nums[-2] += 1
    else:
        nums[i-1] += 1
        nums[i] += 1
        nums[i+1] += 1

print(max(nums))

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

nums = [0]*(max(s)+1)

for i in s:
    if i == 0:
        nums[0] += 1
        nums[1] += 1
    elif i == max(s):
        nums[-1] += 1
        nums[-2] += 1
    else:
        nums[i-1] += 1
        nums[i] += 1
        nums[i+1] += 1

print(max(nums))

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

MAX = max(s)
nums = [0]*(MAX+1)

if MAX == 0:
    print(n)
    exit()

for i in s:
    if i == 0:
        nums[0] += 1
        nums[1] += 1
    elif i == MAX:
        nums[-1] += 1
        nums[-2] += 1
    else:
        nums[i-1] += 1
        nums[i] += 1
        nums[i+1] += 1

print(max(nums))
Buggy python submission (verdict: Runtime Error):
import collections

n,m = map(int,input().split())
s = [list(map(int,input().split())) for i in range(m)]
print(s)#[[1, 2], [2, 3]]

q = collections.deque()
q.append(1)

for k in range(2):
    for j in range(len(q))
        tmp = q.pop()
        for i in s:
            if tmp in i:
                if tmp > i[0]:
                    q.append(i[0])
                else:
                    q.append(i[1])

if n in q:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")


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

s1 = set()
s2 = set()
for i in range(m):
    a,b = map(int,input().split())
    if a == 1:
        s1.add(b)
    elif b == 1:
        s1.add(a)
    elif a == n:
        s2.add(b)
    elif b == n:
        s2.add(a)

if s1.isdisjoint(s2):
    print("IMPOSSIBLE")
else:
    print("POSSIBLE")

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

n,m = map(int,input().split())
s = [list(map(int,input().split())) for i in range(m)]

q = collections.deque()
for i in range(m):
    if s[i][0] == 1:
        q.append(s[i][1])

for i in s:
    for j in q:
        if j in i and n in i:
            print("POSSIBLE")
            exit()
print("IMPOSSIBLE")




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

s1 = set()
s2 = set()
for i in range(m):
    a,b = map(int,input().split())
    if a == 1:
        s1.add(b)
    elif b == 1:
        s1.add(a)
    elif a == n:
        s2.add(b)
    elif b == n:
        s2.add(a)

if s1.isdisjoint(s2):
    print("IMPOSSIBLE")
else:
    print("POSSIBLE")

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

n,m = map(int,input().split())
s = [list(map(int,input().split())) for i in range(m)]

q = collections.deque()
for i in range(m):
    if s[i][0] == 1:
        q.append(s[i][1])

for i in  q:
    if [i,n] in s or [n,i] in s:
        print("POSSIBLE")
        exit()

print("IMPOSSIBLE")



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

s1 = set()
s2 = set()
for i in range(m):
    a,b = map(int,input().split())
    if a == 1:
        s1.add(b)
    elif b == 1:
        s1.add(a)
    elif a == n:
        s2.add(b)
    elif b == n:
        s2.add(a)

if s1.isdisjoint(s2):
    print("IMPOSSIBLE")
else:
    print("POSSIBLE")
Buggy python submission (verdict: Time Limit Exceeded):
s,c = map(int,input().split())

ans = 0
while s>=1 and c>=2:
    s -= 1
    c -= 2
    ans += 1 

print(ans + c//4)

Fixed submission:
s,c = map(int,input().split())

ans = min(s,c//2)
c -= ans*2
print(ans + c//4)
Buggy python submission (verdict: Time Limit Exceeded):
k,s = map(int,input().split())

ans = 0

for i in range(k+1):
    for j in range(i,k+1):
        for c in range(j,k+1):
            if i + j + c == s:
                if i == j and j == c:
                    ans += 1
                elif i!=j and j!=c and c!=j:
                    ans += 6
                else:
                    ans += 3
print(ans)


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

ans = 0

for i in range(k+1):
    for j in range(i,k+1):
        c = s-i-j
        if k >= c and c >=j:
            if i == j and j == c:
                ans += 1
            elif i!=j and j!=c and c!=j:
                ans += 6
            else:
                ans += 3
        
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
k,s = map(int,input().split())

ans = 0

for i in range(k+1):
    for j in range(k+1):
        for c in range(k+1):
            if i + j + c == s:
                ans += 1
print(ans)

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

ans = 0

for i in range(k+1):
    for j in range(i,k+1):
        c = s-i-j
        if k >= c and c >=j:
            if i == j and j == c:
                ans += 1
            elif i!=j and j!=c and c!=j:
                ans += 6
            else:
                ans += 3
        
print(ans)
Buggy python submission (verdict: Runtime Error):
import math

a,b,x = map(int,input().split())

for i in range(a,b+1):
    if i % x == 0:
        num = i
        break

print((b-num)//x + 1 )

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

a_ = a//x
b_ = b//x

if a%x == 0:
    print(b_ - a_ + 1)
else:
    print(b_- a_)
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
d = list(map(int,input().split()))

n_str = str(n)
l = len(n_str)
a = [i for i in range(10) if i not in d]

#同じ桁の時
ans = ""
for i in range(l):
    for j in a:
        if j == int(n_str[i]):
            ans += str(j)
            break
        elif j > int(n_str[i]):
            ans += str(j) + str(a[0])*(l-i-1)
            print(ans)
            exit()

if int(ans) >= n:
    print(ans)
    exit()

if 0 in a:
    ans = str(a[1]) + str(a[0])*l
else:
    ans = str(a[0])*(l+1)

print(ans)

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

n_str = str(n)
l = len(n_str)
a = [i for i in range(10) if i not in d]

#同じ桁の時
ans = ""
for i in range(l):
    for j in a:
        if j == int(n_str[i]):
            ans += str(j)
            break
        elif j > int(n_str[i]):
            ans += str(j) + str(a[0])*(l-i-1)
            print(ans)
            exit()

if len(ans)>0:
    if int(ans) >= n:
        print(ans)
        exit()

if 0 in a:
    ans = str(a[1]) + str(a[0])*l
else:
    ans = str(a[0])*(l+1)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
import sys


def solve(N: int, A: "List[int]"):
    p = 1
    m = pow(10, 18)
    for n in A:
        p = p * n
    if p > m:
        return -1
    return p


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    print(solve(N, A))

if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python3
import sys


def solve(N: int, A: "List[int]"):
    p = 1
    m = pow(10, 18)
    if 0 in A: return 0
    for n in A:
        p = p * n
        if p > m:
            return -1
    return p


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    print(solve(N, A))

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
x=0
for i in range(n):
    if i==0:
        continue
    else:
        for j in range(n-i+1):
            if j==0:
                continue
            else:
                if (n-i) / j == (n-i) // j:
                    x+=1
                    
print(x)

Fixed submission:
n=int(input())
x=0
for i in range(n):
    if i==0:
        continue
    elif n//i==n/i:
        x+=(n//i)-1
    else:
        x+=n//i
     
print(x)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
x=0
for i in range(n):
    if i==0:
        continue
    else:
        for j in range(n-i+1):
            if j==0:
                continue
            else:
                if (n-i) / j == (n-i) // j:
                    x+=1
                    
print(x)

Fixed submission:
n=int(input())
x=0
for i in range(n):
    if i==0:
        continue
    elif n//i==n/i:
        x+=(n//i)-1
    else:
        x+=n//i
     
print(x)
Buggy python submission (verdict: Runtime Error):
import pandas as pd

N = int(input())
S = [input() for i in range(N)]

data = pd.Series(S)

print(data.nunique())


Fixed submission:
import numpy as np

N = int(input())
S = [input() for i in range(N)]

print(len(np.unique(S)))
Buggy python submission (verdict: Runtime Error):
#coding:utf-8
from scipy.special import comb

N, M = map(int, input().split())

ans = comb(N,2,exact = True) + comb(M,2,exact = True)

print(ans)


Fixed submission:
#coding:utf-8
import itertools

N, M = map(int, input().split())

ansN = len(list(itertools.combinations(range(N), 2)))
ansM = len(list(itertools.combinations(range(M), 2)))

ans = ansN + ansM
print(ans)

Buggy python submission (verdict: Runtime Error):
#coding:utf-8
from scipy.special import perm, comb

N, M = map(int, input().split())

ansN = comb(N,2,exact = True)
ansM = comb(M,2,exact = True)

ans = ansN + ansM

print(ans)

Fixed submission:
#coding:utf-8
import itertools

N, M = map(int, input().split())

ansN = len(list(itertools.combinations(range(N), 2)))
ansM = len(list(itertools.combinations(range(M), 2)))

ans = ansN + ansM
print(ans)

Buggy python submission (verdict: Runtime Error):
#coding:utf-8
from scipy.special import perm, comb

N, M = map(int, input().split())

ansN = comb(N,2,exact = True)
ansM = comb(M,2,exact = True)

ans = ansN + ansM

print(ans)


Fixed submission:
#coding:utf-8
import itertools

N, M = map(int, input().split())

ansN = len(list(itertools.combinations(range(N), 2)))
ansM = len(list(itertools.combinations(range(M), 2)))

ans = ansN + ansM
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N,A,B = map(int,input().split())
cnt = 0
num = 0
flg = 'A'

for i in range(N):
    if flg == 'A' and num < A:
        cnt += 1
        num += 1
        if num == A:
            num = 0
            flg = 'B'
    elif flg == 'B' and num < B:
        num += 1
        if num == B:
            num = 0
            flg = 'A'
print(cnt)


Fixed submission:
N, A, B = map(int, input().split())
ans = N // (A + B) * A
rem = N % (A + B)
ans += min(rem, A)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N,A,B = map(int,input().split())
cnt = 0
num = 0

for i in range(N):
    if i < A:
        cnt += 1
        num += 1
    elif i < A + B:
        num += 1
    elif i < A + B + A:
        cnt += 1
        num += 1
print(cnt)


Fixed submission:
N, A, B = map(int, input().split())
ans = N // (A + B) * A
rem = N % (A + B)
ans += min(rem, A)
print(ans)
Buggy python submission (verdict: Runtime Error):
A,B,C = list(map(int,input().split()))

if A == B and A==C:
    print('No')
elif A<> B and B <> C :
    print('No')
elif A == B :
    print('Yes')
elif A == C :
    print('Yes')
elif B == A :
    print('Yes')
elif C == A :
    print('Yes')
else :
    print('No')


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

if A == B == C:
    print('No')
elif A == B and B != C:
    print('Yes')
elif A != B and A == C:
    print('Yes')
elif A != B and B ==C:
    print('Yes')
elif A != B and A != C:
    print('No')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
s = input().rstrip("\n")
t = input().rstrip("\n")
flg = False
#cnt = 0

if len(s)-len(t)+1<0:
	print("UNRESTOABLE")
    sys.exit(0)
 
for i in range(len(s)-len(t)+1):
    cnt = 0
    for j in range(len(t)):
        #print(s[i+j],t[j])
        if s[i+j] == t[j] or s[i+j] == '?':
            cnt+=1
        #print(cnt,len(t))
    if cnt == len(t):
        cnt=i
        flg = True
        #print(cnt)
        break
 
if not flg:
    print("UNRESTORABLE")
else:
    li = list(s.replace("?","a"))
    #print(li)
    for j in range(len(t)):
        #print(li[cnt+j], t[j])
        li[cnt+j] = t[j]
    print("".join(li))


Fixed submission:
import sys
input = sys.stdin.readline
s = input().rstrip("\n")
t = input().rstrip("\n")
flg = False

for i in range(len(s)-len(t)+1):
    cnt = 0
    for j in range(len(t)):
        #print(s[i+j],t[j])
        if s[i+j] == t[j] or s[i+j] == '?':
            cnt+=1
        #print(cnt,len(t))
    if cnt == len(t):
        temp=i
        flg = True
        #print(cnt)
 
if not flg:
    print("UNRESTORABLE")
else:
    li = list(s.replace("?","a"))
    #print(li)
    for j in range(len(t)):
        #print(li[cnt+j], t[j])
        li[temp+j] = t[j]
    print("".join(li))
Buggy python submission (verdict: Time Limit Exceeded):
import math

n,k = map(int,input().split())

ab = abs(n - k)

while n > ab:
  n = ab
  ab = abs(n - k)

print(n)

Fixed submission:
import math

n,k = map(int,input().split())

amari = n % k
n = amari

ab = abs(n - k)

while n > ab:
  n = ab
  ab = abs(n - k)

print(n)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
mod = 10**9 + 7

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

print(ans % mod)


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
mod = 10**9 + 7

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

print(ans % mod)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
mod = 10**9 + 7

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

print(ans % mod)


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
mod = 10**9 + 7

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

print(ans % mod)
Buggy python submission (verdict: Runtime Error):
N = int(input())
cs = list(input())

ans = 0
sorted = N - 1
for i in range(N):
  if cs[i] == "W":
    j = i
    for j in range(sorted, i, -1):
      if cs[j] == "R":
        cs[i], cs[j] = cs[j], cs[i]
        ans += 1
        sorted = j
        break
  if (i + 1) == j:
    break
print(str(ans))

Fixed submission:
N = int(input())
cs = list(input())

ans = 0
sorted = N - 1
for i in range(N):
  if cs[i] == "W":
    for j in range(sorted, i, -1):
      sorted = j - 1
      if cs[j] == "R":
        cs[i], cs[j] = cs[j], cs[i]
        ans += 1
        break
  if (i + 1) > sorted:
    break
print(str(ans))

Buggy python submission (verdict: Runtime Error):
N = int(input())
cs = list(input())

ans = 0
sorted = N - 1
for i in range(N):
  if cs[i] == "W":
    for j in range(sorted, i, -1):
      if cs[j] == "R":
        cs[i], cs[j] = cs[j], cs[i]
        ans += 1
        sorted = j
        break
  if (i + 1) == j:
    break
print(str(ans))

Fixed submission:
N = int(input())
cs = list(input())

ans = 0
sorted = N - 1
for i in range(N):
  if cs[i] == "W":
    for j in range(sorted, i, -1):
      sorted = j - 1
      if cs[j] == "R":
        cs[i], cs[j] = cs[j], cs[i]
        ans += 1
        break
  if (i + 1) > sorted:
    break
print(str(ans))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
cs = list(input())

ans = 0
sorted = N - 1
for i in range(N):
  if cs[i] == "W":
    for j in range(sorted, i, -1):
      if cs[j] == "R":
        cs[i], cs[j] = cs[j], cs[i]
        ans += 1
        sorted = j
        break
  if i > sorted:
    break
print(str(ans))

Fixed submission:
N = int(input())
cs = list(input())

ans = 0
sorted = N - 1
for i in range(N):
  if cs[i] == "W":
    for j in range(sorted, i, -1):
      sorted = j - 1
      if cs[j] == "R":
        cs[i], cs[j] = cs[j], cs[i]
        ans += 1
        break
  if (i + 1) > sorted:
    break
print(str(ans))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
cs = list(input())

ans = 0
sorted = N - 1
for i in range(N):
  if cs[i] == "W":
    for j in range(sorted, i, -1):
      if cs[j] == "R":
        cs[i], cs[j] = cs[j], cs[i]
        ans += 1
        sorted = j
        break

print(str(ans))

Fixed submission:
N = int(input())
cs = list(input())

ans = 0
sorted = N - 1
for i in range(N):
  if cs[i] == "W":
    for j in range(sorted, i, -1):
      sorted = j - 1
      if cs[j] == "R":
        cs[i], cs[j] = cs[j], cs[i]
        ans += 1
        break
  if (i + 1) > sorted:
    break
print(str(ans))
Buggy python submission (verdict: Time Limit Exceeded):
s = str(input())
t = str(input())

ls = list(s)
lt = list(t)

ans = 0
while True:
  rep_cnt = 0
  j = 0
  for i in range(j, len(ls)):
    j += 1
    if ls[i] != lt[i]:
      ls[i] = lt[i]
      rep_cnt += 1
      break
  if rep_cnt > 0:
    ans += rep_cnt
  else:
    break

print(str(ans))



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

ls = list(s)
lt = list(t)

ans = 0
j = 0
while True:
  rep_cnt = 0
  for i in range(j, len(ls)):
    j += 1
    if ls[i] != lt[i]:
      ls[i] = lt[i]
      rep_cnt += 1
      break
  if rep_cnt > 0:
    ans += rep_cnt
  else:
    break

print(str(ans))

Buggy python submission (verdict: Time Limit Exceeded):
s = str(input())
t = str(input())

ls = list(s)
lt = list(t)

ans = 0
while True:
  rep_cnt = 0
  for i in range(0, len(ls)):
    if ls[i] != lt[i]:
      ls[i] = lt[i]
      rep_cnt += 1
      break
  if rep_cnt > 0:
    ans += rep_cnt
  else:
    break

print(str(ans))



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

ls = list(s)
lt = list(t)

ans = 0
j = 0
while True:
  rep_cnt = 0
  for i in range(j, len(ls)):
    j += 1
    if ls[i] != lt[i]:
      ls[i] = lt[i]
      rep_cnt += 1
      break
  if rep_cnt > 0:
    ans += rep_cnt
  else:
    break

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

print(str(ans))


Fixed submission:
n = int(input())
An = list(map(int, input().split()))
An.sort(reverse=True)
ans = An[0]
for i in range(1,n):
  if An[i] == 0:
    ans = 0
    break
  if An[i] > (10 ** 18):
    ans = -1
    break;
if ans > 0:
  ans = An[0]
  for i in range(1,n):
    if An[i] > (10 ** 18):
      ans = -1
      break
    ans *= An[i]
    if ans > (10 ** 18):
      ans = -1
      break

print(str(ans))

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


Fixed submission:
n = int(input())
An = list(map(int, input().split()))
An.sort(reverse=True)
ans = An[0]
for i in range(1,n):
  if An[i] == 0:
    ans = 0
    break
  if An[i] > (10 ** 18):
    ans = -1
    break;
if ans > 0:
  ans = An[0]
  for i in range(1,n):
    if An[i] > (10 ** 18):
      ans = -1
      break
    ans *= An[i]
    if ans > (10 ** 18):
      ans = -1
      break

print(str(ans))

Buggy python submission (verdict: Time Limit Exceeded):

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


Fixed submission:
n = int(input())
An = list(map(int, input().split()))
An.sort(reverse=True)
ans = An[0]
for i in range(1,n):
  if An[i] == 0:
    ans = 0
    break
  if An[i] > (10 ** 18):
    ans = -1
    break;
if ans > 0:
  ans = An[0]
  for i in range(1,n):
    if An[i] > (10 ** 18):
      ans = -1
      break
    ans *= An[i]
    if ans > (10 ** 18):
      ans = -1
      break

print(str(ans))
Buggy python submission (verdict: Runtime Error):
N=int(input())
x = [list(map(int, input().split())) for i in range(N)]
count=0
for i in range(N-2):
  if x[i][0]==x[i][1] and x[i+1][0]==x[i+1][1] and x[i+2][0]==x[i+2][1]:
     count=count+1
  else:
     count=count
else:
  if count>0 :
    print'Yes'
  else :
    print'No'

Fixed submission:
N=int(input())
x = [list(map(int, input().split())) for i in range(N)]
count=0
for i in range(N-2):
  if x[i][0]==x[i][1] and x[i+1][0]==x[i+1][1] and x[i+2][0]==x[i+2][1]:
     count=count+1
  else:
     count=count+0
else:
  if count>0 :
    print('Yes')
  else :
    print('No')