Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read
input=lambda :sys.stdin.readline().rstrip()
inputs= sys.stdin.buffer.readlines
INF=float("inf")
MOD=10**9+7
#input = sys.stdin.buffer.readline
sys.setrecursionlimit(2147483647)
#rstrip().decode('utf-8')
#import math
#import numpy as np
#import operator
#import bisect
#from heapq import heapify,heappop,heappush
#from math import gcd
#from fractions import gcd
#from collections import deque
#from collections import defaultdict
#from collections import Counter
#from itertools import accumulate
#from itertools import groupby
#from itertools import permutations
#from itertools import combinations
#from scipy.sparse import csr_matrix
#from scipy.sparse.csgraph import floyd_warshall
#from scipy.sparse.csgraph import csgraph_from_dense
#from scipy.sparse.csgraph import dijkstra
#map(int,input().split())
#from scipy.special import comb

def calc(a,b,p):
	if b == 0:
		return 1
	elif b % 2 == 0:
		d = calc(a, b / 2, p)
		return (d * d) % p
	else:
		return (a * calc(a, b - 1, p)) % p





def main():
	X,Y=map(int,input().split())
	
	a=max(X,Y)
	b=min(X,Y)
	
	ans=0
	
	t=2*a-b
	
	
	if t%3==0 and t>0 and a<=b*2:
		c1=t//3
		c2=a-2*t//3
		
		n=c1+c2
		r=min(c1,c2)
		
		mod = 10 ** 9 + 7  # 出力の制限
		N = n
		g1 = [1, 1]  # 元テーブル
		g2 =1  # 逆元テーブル
		inv = [0, 1]  # 逆元テーブル計算用テーブル
		
		for i in range(2,r+1):
			inv.append(calc(i,mod-2,mod))
		
		for i in range(2,r):
			g2=g2*inv[i]%mod
			
			
		
		for i in range(2, 100):
			g1.append((g1[-1] * i) % mod)
			print(g1[n]*g2)
		
		
	print(ans)
		
	
	
	
	
if __name__ == '__main__':
	main()

Fixed submission:
import sys
read = sys.stdin.buffer.read
input=lambda :sys.stdin.readline().rstrip()
inputs= sys.stdin.buffer.readlines
INF=float("inf")
MOD=10**9+7
#input = sys.stdin.buffer.readline
sys.setrecursionlimit(2147483647)
#rstrip().decode('utf-8')
#import math
#import numpy as np
#import operator
#import bisect
#from heapq import heapify,heappop,heappush
#from math import gcd
#from fractions import gcd
#from collections import deque
#from collections import defaultdict
#from collections import Counter
#from itertools import accumulate
#from itertools import groupby
#from itertools import permutations
#from itertools import combinations
#from scipy.sparse import csr_matrix
#from scipy.sparse.csgraph import floyd_warshall
#from scipy.sparse.csgraph import csgraph_from_dense
#from scipy.sparse.csgraph import dijkstra
#map(int,input().split())
#from scipy.special import comb

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


def power(n, r, mod):
	if r == 0: return 1
	if r % 2 == 0:
		return power(n * n % mod, r // 2, mod) % mod
	if r % 2 == 1:
		return n * power(n, r - 1, mod) % mod


def comb(n, k, mod):
	a = framod(n, mod)
	b = framod(k, mod)
	c = framod(n - k, mod)
	return (a * power(b, mod - 2, mod) * power(c, mod - 2, mod)) % mod


def main():
	X,Y=map(int,input().split())
	
	a=max(X,Y)
	b=min(X,Y)
	
	ans=0
	
	t=2*a-b
	
	
	if t%3==0 and t>0 and a<=b*2:
		c1=t//3
		c2=a-2*t//3
		ans=comb(c1+c2,c1,MOD)
		
	print(ans)
		
	
	
	
	
if __name__ == '__main__':
	main()
Buggy python submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs= sys.stdin.buffer.readlines
#rstrip().decode('utf-8')

import numpy as np
#import operator
#import bisect
#from heapq import heapify,heappop,heappush
#from math import gcd
#from fractions import gcd
#from collections import deque
#from collections import defaultdict
#from collections import Counter
#from itertools import accumulate
#from itertools import groupby
#from itertools import permutations
#from itertools import combinations
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import floyd_warshall
#from scipy.sparse.csgraph import csgraph_from_dense
#from scipy.sparse.csgraph import dijkstra
#sys.setrecursionlimit(10**7)

#map(int,input().split())

def main():
    N,M,L=map(int,input().split())
    ABCQST=np.array(read().split(),np.int64)
    ABC=ABCQST[:3*M]
    A=ABC[::3]
    B=ABC[1::3]
    C=ABC[2::3]
    ST=ABCQST[3*M+1:]
    S=ST[::2]
    T=ST[1::2]

    graph1=csr_matrix((C,(A,B)),(N+1,N+1))
    graph1_dist=floyd_warshall(graph1,directed=False)

    graph2=np.full(((N+1),(N+1)),np.inf)
    np.fill_diagonal(graph2,0)
    graph2[graph1_dist<=L+0.5]=1

    graph2_dist=floyd_warshall(graph2,directed=False)
    graph2_dist[graph2_dist==np.inf]=0
    graph2_dist=(graph2_dist+0.5).astype(int)
    ans=graph2_dist[S,T]-1
    print("\n".join(ans.astype(str)))


if __name__ == '__main__':
    main()

Fixed submission:
import sys
read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs= sys.stdin.buffer.readlines
#rstrip().decode('utf-8')

import numpy as np
#import operator
#import bisect
#from heapq import heapify,heappop,heappush
#from math import gcd
#from fractions import gcd
#from collections import deque
#from collections import defaultdict
#from collections import Counter
#from itertools import accumulate
#from itertools import groupby
#from itertools import permutations
#from itertools import combinations
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import floyd_warshall
#from scipy.sparse.csgraph import csgraph_from_dense
#from scipy.sparse.csgraph import dijkstra
#sys.setrecursionlimit(10**7)

#map(int,input().split())

def main():
    N,M,L=map(int,input().split())
    ABCQST=np.array(read().split(),np.int64)
    ABC=ABCQST[:3*M]
    A=ABC[::3]
    B=ABC[1::3]
    C=ABC[2::3]
    ST=ABCQST[3*M+1:]
    S=ST[::2]
    T=ST[1::2]

    graph1=csr_matrix((C,(A,B)),(N+1,N+1))
    graph1_dist=floyd_warshall(graph1,directed=False)

    graph2=np.full(((N+1),(N+1)),np.inf)
    np.fill_diagonal(graph2,0)
    graph2[graph1_dist<=L+0.5]=1

    graph2_dist=floyd_warshall(graph2,directed=False)
    graph2_dist[graph2_dist==np.inf]=0
    graph2_dist=(graph2_dist+0.5).astype(int)
    ans=graph2_dist[S,T]-1
    print("\n".join(ans.astype(str)))


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

inf=10**8

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

A=[]
C=[]
dp=[inf]*(1<<n)
dp[0]=0

for _ in range(m):
  a,_=map(int,input().split())
  c=list(map(int,input().split()))
  A.append(a)
  tmp=0
  for i in c:
    tmp+=1<<(i-1)
  C.append(tmp)

for i in range(1<<n):
  for index,j in enumerate(C):
    dp[i|j]=min(dp[i|j],dp[i]+A[index])
ans=dp[-1]
if ans==inf:ans=-1
print(ans)

Fixed submission:
inf=10**8

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

A=[]
C=[]
dp=[inf]*(1<<n)
dp[0]=0

for _ in range(m):
  a,_=map(int,input().split())
  c=list(map(int,input().split()))
  A.append(a)
  tmp=0
  for i in c:
    tmp+=1<<(i-1)
  C.append(tmp)

for i in range(1<<n):
  for index,j in enumerate(C):
    dp[i|j]=min(dp[i|j],dp[i]+A[index])
ans=dp[-1]
if ans==inf:ans=-1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
inf=10**8

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

A=[]
C=[]
dp=[inf]*(1<<n)
dp[0]=0

for _ in range(m):
  a,_=map(int,input().split())
  c=list(map(int,input().split()))
  A.append(a)
  tmp=0
  for i in c:
    tmp+=1<<(i-1)
  C.append(tmp)

for i in range(1<<n):
  for index,j in enumerate(C):
    dp[i|j]=min(dp[i|j],dp[i]+A[index])
ans=dp[-1]
if ans==inf:ans=-1
print(ans)

Fixed submission:
inf=10**8

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

A=[]
C=[]
dp=[inf]*(1<<n)
dp[0]=0

for _ in range(m):
  a,_=map(int,input().split())
  c=list(map(int,input().split()))
  A.append(a)
  tmp=0
  for i in c:
    tmp+=1<<(i-1)
  C.append(tmp)

for i in range(1<<n):
  for index,j in enumerate(C):
    dp[i|j]=min(dp[i|j],dp[i]+A[index])
ans=dp[-1]
if ans==inf:ans=-1
print(ans)

Buggy python submission (verdict: Runtime Error):
from collections import defaultdict

d=defaultdict(list)
cost=[]

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

for i in range(m):
  a,b=map(int,input().split())
  cost.append(a)
  c=list(map(int,input().split()))
  for j in range(b):
    d[c[j]]+=[(a,i+1)]


if len(d)!=n:
  print(-1)
  exit(0)

ans=0
key=set()

for k,li in d.items():
  li.sort(key=lambda x:x[0])
  if li[0][1] in key:
    pass
  else:
    ans+=li[0][0]
    key.add(li[0][1])
    for i in li:
      for j in range(1,k):
        if i in d[j]:
          if ans>ans-li[0][0]-cost(i[1])+i[0]:
            ans=ans-li[0][0]-cost(i[1])+i[0]
            key.discard(li[0][1])
            key.add(i[1])
  
print(ans)

Fixed submission:
inf=10**8

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

A=[]
C=[]
dp=[inf]*(1<<n)
dp[0]=0

for _ in range(m):
  a,_=map(int,input().split())
  c=list(map(int,input().split()))
  A.append(a)
  tmp=0
  for i in c:
    tmp+=1<<(i-1)
  C.append(tmp)

for i in range(1<<n):
  for index,j in enumerate(C):
    dp[i|j]=min(dp[i|j],dp[i]+A[index])
ans=dp[-1]
if ans==inf:ans=-1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())

A=[list(map(int,input().split()))[::-1] for i in range(n)]

day=0
zan=[n-1]*n
zann=sum(zan)

while True:
  day+=1
  sumi=set(range(n))
  kouho=list(sumi)
  sumi=set()
  
  for i in kouho:
    try:
      if A[A[i][-1]-1][-1]-1==i:
        sumi.add(i)
        sumi.add(A[i][-1]-1)
    except:
      pass

  for k in sumi:
    A[k].pop()
    zan[k]-=1

  if zann==sum(zan):
    print(-1)
    exit(0)
  
  zann=sum(zan)
  
  if zann==0:
    print(day)
    exit(0)
    


Fixed submission:
n=int(input())

A=[list(map(int,input().split()))[::-1] for i in range(n)]

day=0
zan=[n-1]*n
zann=sum(zan)
sumi=set(range(n))

while True:
  day+=1

  kouho=list(sumi)
  sumi=set()
  
  for i in kouho:
    try:
      if A[A[i][-1]-1][-1]-1==i:
        sumi.add(i)
        sumi.add(A[i][-1]-1)
    except:
      pass

  for k in sumi:
    A[k].pop()
    zan[k]-=1

  if zann==sum(zan):
    print(-1)
    exit(0)
  
  zann=sum(zan)
  
  if zann==0:
    print(day)
    exit(0)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())

A=[list(map(int,input().split()))[::-1] for i in range(n)]

day=0
zan=[n-1]*n
zann=sum(zan)

while day<10**6:
  day+=1
  kouho=list(range(n))
  sumi=set()
  
  for i in range(n):
    try:
      if A[A[i][-1]-1][-1]-1==i:
        sumi.add(i)
        sumi.add(A[i][-1]-1)
    except:
      pass

  for k in sumi:
    A[k].pop()
    zan[k]-=1

  if zann==sum(zan):
    print(-1)
    exit(0)
  
  zann=sum(zan)
  
  if zann==0:
    print(day)
    exit(0)
    
print(-1)

Fixed submission:
n=int(input())

A=[list(map(int,input().split()))[::-1] for i in range(n)]

day=0
zan=[n-1]*n
zann=sum(zan)
sumi=set(range(n))

while True:
  day+=1

  kouho=list(sumi)
  sumi=set()
  
  for i in kouho:
    try:
      if A[A[i][-1]-1][-1]-1==i:
        sumi.add(i)
        sumi.add(A[i][-1]-1)
    except:
      pass

  for k in sumi:
    A[k].pop()
    zan[k]-=1

  if zann==sum(zan):
    print(-1)
    exit(0)
  
  zann=sum(zan)
  
  if zann==0:
    print(day)
    exit(0)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())

A=[list(map(int,input().split()))[::-1] for i in range(n)]

day=0
zan=[n-1]*n
zann=sum(zan)

while True:
  day+=1
  kouho=list(range(n))
  sumi=set()
  
  for i in range(n):
    try:
      if A[A[i][-1]-1][-1]-1==i:
        sumi.add(i)
        sumi.add(A[i][-1]-1)
    except:
      pass

  for k in sumi:
    A[k].pop()
    zan[k]-=1

  if zann==sum(zan):
    print(-1)
    exit(0)
  
  zann=sum(zan)
  
  if zann==0:
    print(day)
    exit(0)

Fixed submission:
n=int(input())

A=[list(map(int,input().split()))[::-1] for i in range(n)]

day=0
zan=[n-1]*n
zann=sum(zan)
sumi=set(range(n))

while True:
  day+=1

  kouho=list(sumi)
  sumi=set()
  
  for i in kouho:
    try:
      if A[A[i][-1]-1][-1]-1==i:
        sumi.add(i)
        sumi.add(A[i][-1]-1)
    except:
      pass

  for k in sumi:
    A[k].pop()
    zan[k]-=1

  if zann==sum(zan):
    print(-1)
    exit(0)
  
  zann=sum(zan)
  
  if zann==0:
    print(day)
    exit(0)
Buggy python submission (verdict: Runtime Error):
s=input()
t=input()
ans=0
ti=0
si=0
f=0
for ti in range(len(t)):
  while t[ti]!=s[si]:
    ans+=1
    si+=1
    si=si%len(s)
    f+=1
    if f>len(s)+2:
      print("-1")
      exit()
  si+=1
  ti+=1
  ans+=1
  f=0
print(ans)

Fixed submission:
from collections import defaultdict
import bisect

d=defaultdict(list)

s=input()
t=input()

ns=len(s)
nt=len(t)

for i in range(ns):
  d[s[i]].append(i)

for k,v in d.items():
  d[k].append(ns)
#print(d)

ans=0
cnt=-1

for i in range(nt):
  tt=d[t[i]]
#  print(t[i],tt,ans,cnt)
  if tt==[]:
    print(-1)
    exit(0)
  else:
    a=bisect.bisect_right(tt,cnt)
#    print("ind",a)
    if tt[a]==ns:
      ans+=ns+tt[0]-cnt
      cnt=tt[0]
    else:
      ans+=tt[a]-cnt
      cnt=tt[a]
      
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys

input=sys.stdin.buffer.readline


#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return sys.stdin.read()


def II(): return int(input())


def MI(): return map(int,input().split())


def MF(): return map(float,input().split())


def LI(): return list(map(int,input().split()))


def LF(): return list(map(float,input().split()))


def TI(): return tuple(map(int,input().split()))


# rstrip().decode('utf-8')


def main():
	n,m,p=MI()
	G=[[] for _ in range(n+1)]
	
	for _ in range(m):
		a,b,c=MI()
		G[a].append([b,c-p])
	#print(G)
	
	coin=[-10**18]*(n+1)
	coin[1]=0
	
	for _ in range(n):
		for i in range(1,n+1):
			for b,c in G[i]:
				coin[b]=max(coin[b],coin[i]+c)
	#print(coin)
	ans=coin[-1]
	
	check=[False]*(n+1)
	for i in range(1,n+1):
		for b,c in G[i]:
			if coin[b]<coin[i]+c and coin[b]>-10**10:
				check[b]=True
	
	for _ in range(n):
		for i in range(1,n+1):
			for b,c in G[i]:
				check[b]=check[i] or check[b]
	#print(check)
	
	if check[n]==True:
		ans=-1
	else:
		ans=max(ans,0)
	
	print(ans)
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	

if __name__=="__main__":
	main()


Fixed submission:
import sys

input=sys.stdin.buffer.readline


#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return sys.stdin.read()


def II(): return int(input())


def MI(): return map(int,input().split())


def MF(): return map(float,input().split())


def LI(): return list(map(int,input().split()))


def LF(): return list(map(float,input().split()))


def TI(): return tuple(map(int,input().split()))


# rstrip().decode('utf-8')


def main():
	n,m,p=MI()
	G=[[] for _ in range(n+1)]
	
	for _ in range(m):
		a,b,c=MI()
		G[a].append([b,c-p])
	#print(G)
	
	coin=[-10**18]*(n+1)
	coin[1]=0
	
	for _ in range(n):
		for i in range(1,n+1):
			for b,c in G[i]:
				coin[b]=max(coin[b],coin[i]+c)
	#print(coin)
	ans=coin[-1]
	
	check=[False]*(n+1)
	for i in range(1,n+1):
		for b,c in G[i]:
			if coin[b]<coin[i]+c and coin[b]>-10**10:
				check[b]=True
	
	for _ in range(n):
		for i in range(1,n+1):
			for b,c in G[i]:
				check[b]=check[i] or check[b]
	#print(check)
	
	if check[n]==True:
		ans=-1
	else:
		ans=max(ans,0)
	
	print(ans)
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	

if __name__=="__main__":
	main()
Buggy python submission (verdict: Runtime Error):
N=int(input())
a=0
for i in range(N):
  if i//10==0:
    a+=1
  elif i//100:
  elif i//1000:
    a+=1
  elif i//10000:
  else:
    a+=1
print(a)
  

Fixed submission:
N=int(input())
a=0
for i in range(N):
  if (i+1)//10==0:
    a+=1
  elif (i+1)//100==0:
    a+=0
  elif (i+1)//1000==0:
    a+=1
  elif (i+1)//10000==0:
    a+=0
  elif (i+1)//100000==0:
    a+=1
  else:
    a+=0
print(a)
Buggy python submission (verdict: Runtime Error):
A,B=map(int,input().split())
if (A*B)%2==1:
  print(IMPOSSIBLE)
  else
  	print((A+B)/2)


Fixed submission:
A,B=map(int,input().split())
if (A-B)%2==1:
    print("IMPOSSIBLE")
else:
  	print(int((A+B)/2))
Buggy python submission (verdict: Time Limit Exceeded):
import sys

read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs = sys.stdin.buffer.readlines


# rstrip().decode('utf-8')
# INF=float("inf")
MOD=10**9+7
# sys.setrecursionlimit(2147483647)
# import math
#import numpy as np
# import operator
# import bisect
# from heapq import heapify,heappop,heappush
#from math import gcd
# from fractions import gcd
# from collections import deque
# from collections import defaultdict
# from collections import Counter
# from itertools import accumulate
# from itertools import groupby
# from itertools import permutations
# from itertools import combinations
# from scipy.sparse import csr_matrix
# from scipy.sparse.csgraph import floyd_warshall
# from scipy.sparse.csgraph import csgraph_from_dense
# from scipy.sparse.csgraph import dijkstra
# map(int,input().split())


def main():
	s=input().rstrip().decode('utf-8')
	n=len(s)
	
	dp=[[0]*13 for _ in range(n+1)]
	dp[0][0]=1
	
	for i in range(1,n+1):
		now=s[i-1]
		if now=="?":
			for j in range(13):
				for k in range(10):
					dp[i][(10*j+k)%13]+=dp[i-1][j]
		else:
			k=int(now)
			for j in range(13):
				dp[i][(10*j+k)%13]+=dp[i-1][j]
		
		for j in range(13):
			dp[i][j]%=MOD
	
	print(dp[n][5])
	
	
	
	
if __name__ == '__main__':
	main()


Fixed submission:
import sys

read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs = sys.stdin.buffer.readlines


# rstrip().decode('utf-8')
# INF=float("inf")
MOD=10**9+7
# sys.setrecursionlimit(2147483647)
# import math
#import numpy as np
# import operator
# import bisect
# from heapq import heapify,heappop,heappush
#from math import gcd
# from fractions import gcd
# from collections import deque
# from collections import defaultdict
# from collections import Counter
# from itertools import accumulate
# from itertools import groupby
# from itertools import permutations
# from itertools import combinations
# from scipy.sparse import csr_matrix
# from scipy.sparse.csgraph import floyd_warshall
# from scipy.sparse.csgraph import csgraph_from_dense
# from scipy.sparse.csgraph import dijkstra
# map(int,input().split())


def main():
	s=input().rstrip().decode('utf-8')
	n=len(s)
	
	dp=[[0]*13 for _ in range(n+1)]
	dp[0][0]=1
	
	for i in range(1,n+1):
		now=s[i-1]
		if now=="?":
			for j in range(13):
				for k in range(10):
					dp[i][(10*j+k)%13]+=dp[i-1][j]
		else:
			k=int(now)
			for j in range(13):
				dp[i][(10*j+k)%13]+=dp[i-1][j]
		
		for j in range(13):
			dp[i][j]%=MOD
	
	print(dp[n][5])
	
	
	
	
if __name__ == '__main__':
	main()
Buggy python submission (verdict: Runtime Error):
n,d=map(int,input().split())
print(int(n//(2*d+1))


Fixed submission:
n,d=map(int,input().split())
if n%(2*d+1)==0:
  print(int(n//(2*d+1)))
else:
  print(int(n//(2*d+1))+1)

Buggy python submission (verdict: Runtime Error):
n,d=map(int,input())
print(int(n//(2*d+1))

Fixed submission:
n,d=map(int,input().split())
if n%(2*d+1)==0:
  print(int(n//(2*d+1)))
else:
  print(int(n//(2*d+1))+1)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
arr=[]

for i in range(n):
  arr.append(int(input()))
a=max(arr)

for i in range(n):
  if arr[i]!=a:
    print(a)
  else:
    print(max(arr[:i]+arr[i+1:]))

Fixed submission:
n=int(input())
arr=[]

for i in range(n):
  arr.append(int(input()))
a=max(arr)

for i in range(n):
  if arr[i]==a:
    b=max(arr[:i]+arr[i+1:])
    break
    
for i in range(n):
  if arr[i]!=a:
    print(a)
  else:
    print(b)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
arr=[]

for i in range(n):
  arr.append(int(input()))
a=max(arr)

for i in range(n):
  if arr[i]!=a:
    print(a)
  else:
    print(max(arr[:i]+arr[i+1:]))

Fixed submission:
n=int(input())
arr=[]

for i in range(n):
  arr.append(int(input()))
a=max(arr)

for i in range(n):
  if arr[i]==a:
    b=max(arr[:i]+arr[i+1:])
    break
    
for i in range(n):
  if arr[i]!=a:
    print(a)
  else:
    print(b)
Buggy python submission (verdict: Time Limit Exceeded):
import sys

read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs = sys.stdin.buffer.readlines


# rstrip().decode('utf-8')
# INF=float("inf")
#MOD=10**9+7
# sys.setrecursionlimit(2147483647)
# import math
import numpy as np
# import operator
# import bisect
# from heapq import heapify,heappop,heappush
#from math import gcd
# from fractions import gcd
# from collections import deque
# from collections import defaultdict
# from collections import Counter
# from itertools import accumulate
# from itertools import groupby
# from itertools import permutations
# from itertools import combinations
# from scipy.sparse import csr_matrix
# from scipy.sparse.csgraph import floyd_warshall
# from scipy.sparse.csgraph import csgraph_from_dense
# from scipy.sparse.csgraph import dijkstra
# map(int,input().split())


def main():
	n=int(input())
	A=np.array(read().split(),np.int64)
	ans=np.zeros(n+1,np.int64)
	
	for i in range(n,0,-1):
		ans[i]=(np.sum(ans[::i])%2) ^ A[i-1]
	
	print(np.sum(ans))
	print(*(np.where(ans==1))[0])
	
	
if __name__ == '__main__':
	main()


Fixed submission:
import sys

read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs = sys.stdin.buffer.readlines


# rstrip().decode('utf-8')
# INF=float("inf")
#MOD=10**9+7
# sys.setrecursionlimit(2147483647)
# import math
#import numpy as np
# import operator
# import bisect
# from heapq import heapify,heappop,heappush
#from math import gcd
# from fractions import gcd
# from collections import deque
# from collections import defaultdict
# from collections import Counter
# from itertools import accumulate
# from itertools import groupby
# from itertools import permutations
# from itertools import combinations
# from scipy.sparse import csr_matrix
# from scipy.sparse.csgraph import floyd_warshall
# from scipy.sparse.csgraph import csgraph_from_dense
# from scipy.sparse.csgraph import dijkstra
# map(int,input().split())


def main():
	n=int(input())
	A=list(map(int,input().split()))
	ans=[0]*(n+1)
	
	for i in range(n,0,-1):
		ans[i]=(sum(ans[::i])%2) ^ A[i-1]
	
	print(sum(ans))
	print(*[i for i,x in enumerate(ans) if x==1])
	
	
if __name__ == '__main__':
	main()
Buggy python submission (verdict: Runtime Error):
N,A,B=map(int.input().split())
sum=min(N*A,B)
print(sum)

Fixed submission:
N,A,B=map(int,input().split())
sum=min(N*A,B)
print(sum)
Buggy python submission (verdict: Runtime Error):
S=sorted(list(input()))
if S[0]==S[1] and S[1]!=S[2] and S[2]=S[3]:
    print("YES")
else:
    print("NO")


Fixed submission:
S=sorted(list(input()))
if S[0]==S[1] and S[1]!=S[2] and S[2]==S[3]:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
a=sorted(list(input()))
print(int(a[0])+int(a[1]))

Fixed submission:
a=sorted(list(input().split()))
print(int(a[0])+int(a[1]))

Buggy python submission (verdict: Runtime Error):
a=sorted(list(input()))
print(int(a[0])+int(a[1])

Fixed submission:
a=sorted(list(input().split()))
print(int(a[0])+int(a[1]))
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
mod=10**9+7
if n==1:
  print(1)

if n>1:
  a=[1]*n
  for i in range(m):
    a[int(input())-1]=0
  a[1]=a[0]+1
  for i in range(2,n):
    if a[i]==0:continue
    else:a[i]=a[i-1]+a[i-2]
print(a[n-1]%mod)

Fixed submission:
n,m=map(int,input().split())
mod=10**9+7

a=set([int(input()) for i in range(m)])

dp=[0]*(n+1)
dp[0]=1

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

Buggy python submission (verdict: Runtime Error):
mod=1000000007
n,m=map(int,input().split())
a=[1]*n
for i in range(m):
  a[int(input())-1]=0
a[1]=a[0]+1
for i in range(2,n):
  if a[i]==0:continue
  else:a[i]=(a[i-1]+a[i-2])%mod
print(a[n-1])

Fixed submission:
n,m=map(int,input().split())
mod=10**9+7

a=set([int(input()) for i in range(m)])

dp=[0]*(n+1)
dp[0]=1

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