Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
if m=0:
  print(0)
else:
  sc= [list(map(int,input().split())) for i in range(m)]
  ans = -1
  s=[[0 for i in range(2)] for i in range(n)]
  for j in range(10**n):
    k=str(j)
    for l in range(len(k)):
      s[l][0]=l+1
      s[l][1]=int(k[l])
    if all(elm in s for elm in sc) == 1:
      ans=j
      break
  print(ans)

Fixed submission:
n,m=map(int,input().split())
if m==0:
  if n ==1:
    print(0)
  else:
    print(10**(n-1))
else:
  sc= [list(map(int,input().split())) for i in range(m)]
  ans = -1
  for j in range(10**(n-1)-1,10**n):
    k=str(j)
    s=[[0 for i in range(2)] for i in range(len(k))]
    for l in range(len(k)):
      s[l][0]=l+1
      s[l][1]=int(k[l])
      if all(elm in s for elm in sc) == 1:
        ans=j
        break
    if ans==j:
      break
  print(ans)

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
if m=0:
  print(0)
else:
  sc= [list(map(int,input().split())) for i in range(m)]
  ans = -1
  s=[[0 for i in range(2)] for i in range(n)]
  for j in range(10**n):
  k=str(j)
    for l in range(len(k)):
      s[l][0]=l+1
      s[l][1]=int(k[l])
    if all(elm in s for elm in sc) == 1:
      ans=j
      break
  print(ans)

Fixed submission:
n,m=map(int,input().split())
if m==0:
  if n ==1:
    print(0)
  else:
    print(10**(n-1))
else:
  sc= [list(map(int,input().split())) for i in range(m)]
  ans = -1
  for j in range(10**(n-1)-1,10**n):
    k=str(j)
    s=[[0 for i in range(2)] for i in range(len(k))]
    for l in range(len(k)):
      s[l][0]=l+1
      s[l][1]=int(k[l])
      if all(elm in s for elm in sc) == 1:
        ans=j
        break
    if ans==j:
      break
  print(ans)
Buggy python submission (verdict: Runtime Error):
R = input()
print (R*3.1415926)


Fixed submission:
R=int(input())
print(R*2*3.1415926)
Buggy python submission (verdict: Runtime Error):
import math
print(math.ceil(int(input()/2)))

Fixed submission:
import math
print(math.ceil(int(input())/2))
Buggy python submission (verdict: Runtime Error):
m1,d1 =map(int,input().split())
m2,d2 =map(int,input().split())
if m1 == m2 :
    return 0 :
else :
    return 1:


Fixed submission:
m1,d1 =map(int,input().split())
m2,d2 =map(int,input().split())
if m1 == m2 :
    print (0)
else :
    print (1)
Buggy python submission (verdict: Runtime Error):
n=input()
p=list(map(int,input().split()))
m=0
for i in range(n):
    print(p[p[i]-1])
    if p[i]==i+1 :
        continue
    elif p[p[i]-1]==i+1 and m<2 :
        m+=1
        continue
    else :
        print ("NO")
        exit()
print("YES")


Fixed submission:
n=input()
p=list(map(int,input().split()))
def func(i,j):
    if i == len(p) :
        return "YES"
    elif p[i]==i+1 :
        return func(i+1,j)
    elif p[p[i]-1]==i+1 and j<2 :
        j+=1
        return func(i+1,j)
    else :
        return "NO"
print(func(0,0))
Buggy python submission (verdict: Runtime Error):
list = list(map(int, input().split())) 
hajime=list[0]
kaisuu=list[1]
hohaba=list[2]
if hajime>=0:
  ayumi=hajime//hohaba
  nokori=kaisuu-ayumi
  kouho_1=hajime-hohaba*kaisuu
  kouho_2=hajime-hohaba*ayumi
  kouho_3=-hajime+hohaba*(ayumi+1)
  if kaisuu=<ayumi:
    print(kouho_1)
  else:
    if nokori%2==0:
      print(kouho_2)
    else:
      print(kouho_3)
      
if hajime<0:  
  ayumi=-hajime//hohaba
  nokori=kaisuu-ayumi
  kouho_1=hajime+hohaba*kaisuu
  kouho_2=hajime+hohaba*ayumi
  kouho_3=-hajime-hohaba*(ayumi+1)
  if kaisuu=<hohaba:
    
    print(kouho_1)  else:
    if nokori%2==0:
      print(kouho_2)
    else:
      print(-kouho_3)

Fixed submission:
list = list(map(int, input().split())) 
hajime=list[0]
kaisuu=list[1]
hohaba=list[2]
if hajime>=0:
  ayumi=hajime//hohaba
  nokori=kaisuu-ayumi
  kouho_1=hajime-hohaba*kaisuu
  kouho_2=hajime-hohaba*ayumi
  kouho_3=hajime-hohaba*(ayumi+1)
 
  
  
  if kaisuu <= ayumi:
    print(kouho_1)
  else:
    if nokori%2==0:
      print(kouho_2)
    else:
      print(-kouho_3)
      
if hajime<0:  
  ayumi=-hajime//hohaba
  nokori=kaisuu-ayumi
  kouho_1=hajime+hohaba*kaisuu
  kouho_2=hajime+hohaba*ayumi
  kouho_3=hajime+hohaba*(ayumi+1)
  if kaisuu<=ayumi:
    
    print(-kouho_1)  
  else:
    if nokori%2==0:
      print(-kouho_2)
    else:
      print(kouho_3)
Buggy python submission (verdict: Runtime Error):
temp = int(input())
if temp>=30:
  print("Yes")
else:
  print("No)    

Fixed submission:
temp = int(input())
if temp>=30:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
list = input().split()
s = list[0]
t = list[1]
lens = len(s)
lent = len(t)
if s in t and lent-lens==1 and lens<=10:
  print("Yes")
else:
  print("No")

Fixed submission:
list = [input() for i in range(2)]

s = list[0]
t = list[1]
lens = len(s)
lent = len(t)
if t.startswith(s)==True and lent-lens==1 and 1<=lens<=10:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
k = int(input())
list = list(map(int, input().split()))
if list[1] > list[0]+k:
  print("OK")
elif list[0] % k == 0 or list[1] % k == 0:
else:
  print("NG")

Fixed submission:
k = int(input())
list = list(map(int, input().split()))
a = list[0]
b = list[1]
for i in range(a,b+1):
  if i % k ==0:
    print("OK")
    break
  if i==b:
    print("NG")
Buggy python submission (verdict: Runtime Error):
print(R*3.1415926535)

Fixed submission:
r = int(input())
print(2*r*3.1415926535)
Buggy python submission (verdict: Runtime Error):
a = 1
b = 2
c = 3
d = 4
e = 5
a,b,c,d,e = map(int,input().split())
if a != 1:
print("1")

if b != 2:
print("2")

if c != 3:
print("3")

if d != 4:
print("4")

if e != 5:
print("5")

Fixed submission:
a = 1
b = 2
c = 3
d = 4
e = 5
a,b,c,d,e = map(int,input().split())

if a != 1:
    print("1")

if b != 2:
    print("2")

if c != 3:
    print("3")

if d != 4:
    print("4")

if e != 5:
    print("5")

Buggy python submission (verdict: Runtime Error):
a = 1
b = 2
c = 3
d = 4
e = 5
a,b,c,d,e = map(int,input().split())
if a != 1:
print(1)

if b != 2:
print(2)

if c != 3:
print(3)

if d != 4:
print(4)

if e != 5:
print(5)

Fixed submission:
a = 1
b = 2
c = 3
d = 4
e = 5
a,b,c,d,e = map(int,input().split())

if a != 1:
    print("1")

if b != 2:
    print("2")

if c != 3:
    print("3")

if d != 4:
    print("4")

if e != 5:
    print("5")

Buggy python submission (verdict: Runtime Error):
a = 1
b = 2
c = 3
d = 4
e = 5
a,b,c,d,e = map(int,input().split())
if a != 1
print(1)

if b != 2
print(2)

if c != 3
print(3)

if d != 4
print(4)

if e != 5
print(5)

Fixed submission:
a = 1
b = 2
c = 3
d = 4
e = 5
a,b,c,d,e = map(int,input().split())

if a != 1:
    print("1")

if b != 2:
    print("2")

if c != 3:
    print("3")

if d != 4:
    print("4")

if e != 5:
    print("5")
Buggy python submission (verdict: Runtime Error):
import numpy as np
n,m,x=map(int,input().split())
text=[]
cost=[]
for i in range(n):
    text.append(list(map(int,input().split())))
text=np.array(text)

#ビット全探索。bin(i)の各桁を要素に対応させる。
for i in range(2**n):
    flag=0
    bought_text=np.array([0 for j in range(m+1)])
    for j in range(n):
        #0bxxx1と0b0001の比較(＆は論理積)
        if((i>>j)&1):
            bought_text+=text[j]
    for k in range(m):
        if bought_text[k+1]<x:
            flag=1
            break
    if flag==0:
        cost.append(bought_text[0])
print(min(cost) if cost else "-1")

Fixed submission:
import numpy as np
n,m,x=map(int,input().split())
text=[]
cost=[]
for i in range(n):
    text.append(list(map(int,input().split())))
text=np.array(text)

#ビット全探索。bin(i)の各桁を要素に対応させる。
for i in range(2**n):
    flag=0
    bought_text=np.array([0 for j in range(m+1)])
    for j in range(n):
        #0bxxx1と0b0001の比較(＆は論理積)
        if((i>>j)&1):
            bought_text+=text[j]
    for k in range(m):
        if bought_text[k+1]<x:
            flag=1
            break
    if flag==0:
        cost.append(bought_text[0])
print(min(cost) if cost else "-1")

Buggy python submission (verdict: Runtime Error):
import itertools
n,m,x=map(int,input().split())
lists=[]
array=[0,0,0,0]
ans=[]
for i in range(n):
    lists.append(list(map(int,input().split())))
for i in range(n):
    for pair in itertools.combinations(lists,i+1):
        for j in range(len(pair)):
            array=list(map(lambda x,y: x+y,array,list(pair[j])))
        for k in range(m):
            if array[k+1]<x:
                break
            else:
                ans.append(array[0])
        array=[0,0,0,0]
print(min(ans) if ans else "-1")

Fixed submission:
import numpy as np
n,m,x=map(int,input().split())
text=[]
cost=[]
for i in range(n):
    text.append(list(map(int,input().split())))
text=np.array(text)

#ビット全探索。bin(i)の各桁を要素に対応させる。
for i in range(2**n):
    flag=0
    bought_text=np.array([0 for j in range(m+1)])
    for j in range(n):
        #0bxxx1と0b0001の比較(＆は論理積)
        if((i>>j)&1):
            bought_text+=text[j]
    for k in range(m):
        if bought_text[k+1]<x:
            flag=1
            break
    if flag==0:
        cost.append(bought_text[0])
print(min(cost) if cost else "-1")
Buggy python submission (verdict: Runtime Error):
s=input()
if s=="ARC":
:
    print("ABC")
else:
    print("ARC")

Fixed submission:
s=input()
if s=="ARC":
    print("ABC")
else:
    print("ARC")
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
for i in range(n):
    print(a.count(i+1))

Fixed submission:
from collections import Counter
n=int(input())
a=Counter(list(map(int,input().split())))
for i in range(n):
    if i+1 in a.keys():
        print(a[i+1])
    else:
        print(0)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
for i in range(n):
    print(a.count(i+1))

Fixed submission:
from collections import Counter
n=int(input())
a=Counter(list(map(int,input().split())))
for i in range(n):
    if i+1 in a.keys():
        print(a[i+1])
    else:
        print(0)
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
n=c-a-b
if n**2 > 4*a*b:
    print("Yes")
else:
    print("No")

Fixed submission:
a=[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(a[n-1])

Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
n=c-a-b
if　n**2 > 4*a*b:
    print("Yes")
else:
    print("No")

Fixed submission:
a=[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(a[n-1])

Buggy python submission (verdict: Runtime Error):
import math
a,b,c=map(int,input().split())
print("Yes" if math.sqrt(a)+math.sqrt(b)<math.sqrt(c) else "No")

Fixed submission:
a=[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(a[n-1])

Buggy python submission (verdict: Runtime Error):
a=[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(a[n+1])

Fixed submission:
a=[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(a[n-1])
Buggy python submission (verdict: Runtime Error):
A=[list(map(int,input().split())) for i in range(3)]
n=int(input())
for i in range(n):
    b=int(input())
    for Row in range(3):
        for Col in range(3):
            if b==A[Row][Col]:
                A[Row][Col]=0  

print(A)

Fixed submission:
n=int(input())
print(-(-n//2))
Buggy python submission (verdict: Runtime Error):
a,b=map(str,input().split())
l=tuple("A","B","C","D","E","F")
if l.index(a)<l.index(b):
    print("<")
elif l.index(a)==l.index(b):
    print("=")
else:
    print(">")

Fixed submission:
a,b=map(str,input().split())
l=["A","B","C","D","E","F"]
if l.index(a)<l.index(b):
    print("<")
elif l.index(a)==l.index(b):
    print("=")
else:
    print(">")

Buggy python submission (verdict: Runtime Error):
a,b=map(str,input().split())
l=["A","B","C","D","E","F"]
l=list(map(str,s))
if l.index(a)<l.index(b):
    print("<")
elif l.index(a)==l.index(b):
    print("=")
else:
    print(">")

Fixed submission:
a,b=map(str,input().split())
l=["A","B","C","D","E","F"]
if l.index(a)<l.index(b):
    print("<")
elif l.index(a)==l.index(b):
    print("=")
else:
    print(">")

Buggy python submission (verdict: Runtime Error):
a,b=map(str,input())
l=["A","B","C","D","E"",F"]
if l.index(a)<l.index(b):
    print("<")
elif l.index(a)==l.index(b):
    print("=")
else:
    print(">")

Fixed submission:
a,b=map(str,input().split())
l=["A","B","C","D","E","F"]
if l.index(a)<l.index(b):
    print("<")
elif l.index(a)==l.index(b):
    print("=")
else:
    print(">")
Buggy python submission (verdict: Runtime Error):
n = int(input())


queueList = []
oldList = []
for i in range(1,10):
	queueList.append(i)
# print(queueList)
if n < len(queueList):
	print(queueList[n-1])
	exit()
while(True):
	headElement = queueList[0]
	queueList.pop(0)
	oldList.append(headElement)
	for i in range(-1,2):
		newElement = headElement % 10 + i
		if newElement < 0 or 9 < newElement:
			continue
		if not (headElement*10 + newElement in oldList or headElement*10 + newElement in queueList):
			queueList.append(headElement*10 + newElement)
	if len(oldList) == n:
		break
print(oldList[-1])
# print(queueList[0])





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

print("{} {} {}".format(c,a,b))
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
aList = list(map(int, input().split()))
aList.sort(reverse=True)



total = sum(aList)
flag = "Yes"
for i in range(m):
    if aList[m] <= total/(4*m):
        flag = "No"
print(flag)

Fixed submission:
n, m = map(int, input().split())
aList = list(map(int, input().split()))
aList.sort(reverse=True)



total = sum(aList)

if aList[m-1] >= total/(4*m):
    print("Yes")
else:
    print("No")
flag = "Yes"
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
currAbsValue = abs(n-k)
while currAbsValue < n:
    n = currAbsValue
    currAbsValue = abs(n-k)
    if n == currAbsValue:
        break
print(n)

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


minV = (n%k) if (n%k) < (k-n%k) else (k-n%k)
print(minV)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
b = 100
ans = 0
while  b<=n :
    b *= int(b*0.01)
    ans += 1
print(ans)

Fixed submission:
n = int(input())
b = 100
ans = 0
while  b<n :
    b = int(b*1.01)
    ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b,n = map(int, input().split())
x = (b-1,n)
print(int(a*x/b))

Fixed submission:
a,b,n = map(int, input().split())
x = min(b-1,n)
print(int(a*x/b))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
a,b,n=map(int, input().split())
c = np.array([])
for x in range(n+1) :
     c = np.append(c,int(a*x/b)-a* int(x/b))
    
print(int(np.max(c)))

Fixed submission:
a,b,n = map(int, input().split())
x = min(b-1,n)
print(int(a*x/b))

Buggy python submission (verdict: Time Limit Exceeded):
a,b,n=map(int, input().split())
print(max([int(a*x/b)-a* int(x/b) for x in range(n+1)]))

Fixed submission:
a,b,n = map(int, input().split())
x = min(b-1,n)
print(int(a*x/b))

Buggy python submission (verdict: Time Limit Exceeded):
a,b,n=map(int, input().split())
list =[]
for x in range(n+1) :
    list.append(int(a*x/b) - a* int(x/b))
print(max(list))

Fixed submission:
a,b,n = map(int, input().split())
x = min(b-1,n)
print(int(a*x/b))

Buggy python submission (verdict: Time Limit Exceeded):
a,b,n=map(int, input().split())
list =[int(a*x/b)-a* int(x/b) for x in range(n+1)]
print(max(list))

Fixed submission:
a,b,n = map(int, input().split())
x = min(b-1,n)
print(int(a*x/b))

Buggy python submission (verdict: Time Limit Exceeded):
a,b,n=map(int, input().split())
list =[]
for x in range(n+1) :
    list.append(int(a*x/b) - a* int(x/b))
print(max(list))

Fixed submission:
a,b,n = map(int, input().split())
x = min(b-1,n)
print(int(a*x/b))

Buggy python submission (verdict: Runtime Error):
,b,n=map(int, input().split())
list =[]
for x in range(n+1) :
    list.append(int(a*x/b) - a* int(x/b))
print(max(list))


Fixed submission:
a,b,n = map(int, input().split())
x = min(b-1,n)
print(int(a*x/b))

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

list =[]
for x in range(n+1) :
    k = int(a*x/b) - a* int(x/b)
    list.append(k)
print(max(list))

Fixed submission:
a,b,n = map(int, input().split())
x = min(b-1,n)
print(int(a*x/b))

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

list =[]
for x in range(n+1) :
    k = int(a*x/b) - a* int(x/b)
    list.append(k)
    x += 1
print(max(list))

Fixed submission:
a,b,n = map(int, input().split())
x = min(b-1,n)
print(int(a*x/b))

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

x=0
list =[]
while  0<= x <= n :
    k = int(a*x/b) - a* int(x/b)
    list.append(k)
    x += 1
print(max(list))

Fixed submission:
a,b,n = map(int, input().split())
x = min(b-1,n)
print(int(a*x/b))
Buggy python submission (verdict: Runtime Error):
N,M =map(int,input().split())
a =list( map(int,input().split()) )
if N-sum(a) >=0:
    print(N-sum(a))
else :
    print('-1')    

Fixed submission:
import math
R = int(input())
print(2*R*math.pi)

Buggy python submission (verdict: Runtime Error):
N,M =map(int,input().split())
a =list( map(int,input().split()) )
if N-sum(a) >=0:
    print(N-sum(a))
else :
    print(-1)    

Fixed submission:
import math
R = int(input())
print(2*R*math.pi)

Buggy python submission (verdict: Runtime Error):
N,M =map(int,input().split())
a =list( map(int,input().split()) )
if N-sum(a) >=0:
    print(N-sum(a))
else :
    print('-1') 

Fixed submission:
import math
R = int(input())
print(2*R*math.pi)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

A_sum = [0]
B_sum = [0]
for i in range(N):
    A_sum.append(A_sum[-1] + A[i])
for i in range(M):
    B_sum.append(B_sum[-1] + B[i])

ans = 0
for i in range(N+1):
    for j in range(M, -1, -1):
        time = A_sum[i] + B_sum[j]
        if time > K:
            continue
        ans = max(i + j, ans)
        break
print(ans)

Fixed submission:
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

A_sum = [0]
B_sum = [0]
for i in range(N):
    A_sum.append(A_sum[-1] + A[i])
for i in range(M):
    B_sum.append(B_sum[-1] + B[i])

ans = 0
j_max = M
for i in range(N+1):
    for j in range(j_max, -1, -1):
        time = A_sum[i] + B_sum[j]
        if time > K:
            continue
        j_max = j
        ans = max(i + j, ans)
        break
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

A_sum = [0]
B_sum = [0]
for i in range(N):
    A_sum.append(A_sum[-1] + A[i])
for i in range(M):
    B_sum.append(B_sum[-1] + B[i])

ans = 0
for i in range(N+1):
    for j in range(M+1):
        time = A_sum[i] + B_sum[j]
        if time > K:
            break
        ans = max(i + j, ans)
print(ans)

Fixed submission:
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

A_sum = [0]
B_sum = [0]
for i in range(N):
    A_sum.append(A_sum[-1] + A[i])
for i in range(M):
    B_sum.append(B_sum[-1] + B[i])

ans = 0
j_max = M
for i in range(N+1):
    for j in range(j_max, -1, -1):
        time = A_sum[i] + B_sum[j]
        if time > K:
            continue
        j_max = j
        ans = max(i + j, ans)
        break
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

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

ans = 1
LIM = 10 ** 18
for a in A:
    ans *= a

if ans > LIM:
    ans = -1
print(ans)

Fixed submission:
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

LIM = 10 ** 18

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

ans = 1
for a in A:
    ans *= a
    if ans > LIM:
        ans = -1
        break
print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

N, M = map(int, input().split())
graph = [[] for _ in range(M)]

for _ in range(M):
    A, B = map(int, input().split())
    graph[A-1].append(B-1)
    graph[B-1].append(A-1)

from collections import deque
def bfs(start):
    dist = [INF] * N
    dist[start] = 0
    seen = [0] * N
    shirube = [None] * N
    shirube[0] = 'Yes'
    q = deque([start])
    while q:
        v = q.popleft()
        dv = dist[v]
        for next_room in graph[v]:
            if seen[next_room]:
                continue
            if dv + 1 < dist[next_room]:
                dist[next_room] = dv + 1
                shirube[next_room] = v + 1
            seen[next_room] = 1
            q.append(next_room)
    if all(shirube):
        for x in shirube:
            print(x)
    else:
        # print(shirube)
        print('No')
bfs(0)

Fixed submission:
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

N, M = map(int, input().split())
graph = [[] for _ in range(N)]

for _ in range(M):
    A, B = map(int, input().split())
    # print(A, B)
    graph[A-1].append(B-1)
    graph[B-1].append(A-1)

from collections import deque
def bfs(start):
    dist = [INF] * N
    dist[start] = 0
    seen = [0] * N
    shirube = [None] * N
    shirube[0] = 'Yes'
    q = deque([start])
    while q:
        v = q.popleft()
        dv = dist[v]
        for next_room in graph[v]:
            if seen[next_room]:
                continue
            if dv + 1 < dist[next_room]:
                dist[next_room] = dv + 1
                shirube[next_room] = v + 1
            seen[next_room] = 1
            q.append(next_room)
    if all(shirube):
        for x in shirube:
            print(x)
    else:
        # print(shirube)
        print('No')
bfs(0)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)

N = int(readline().rstrip())
A = list(map(int, readline().split()))

import itertools
pairs = list(itertools.combinations(range(0, N), 2))

ans = 0
for pair in pairs:
    x1, x2 = pair
    if abs(x1 - x2) == A[x1] + A[x2]:
        ans += 1

print(ans)

Fixed submission:
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)

N = int(readline().rstrip())
A = list(map(int, readline().split()))

d1 = {}
d2 = {}
for n in range(1, N+1):
    x1 = n + A[n-1]
    if x1 in d1:
        d1[x1] += 1
    else:
        d1[x1] = 1
    
    x2 = n - A[n-1]
    if x2 in d2:
        d2[x2] += 1
    else:
        d2[x2] = 1

ans = 0
for d in d1:
    if d in d2:
        ans += (d1[d] * d2[d])
print(ans)