qyliang/CodeNanoFix huggingface dataset:
# Buggy code:
n, d = input().split(" ")
n = int(n)
d = int(d)
print(n / (2*d+1) + int(n % (2*d+1) != 0))

# Fixed code:
string = input()
n, d = string.split(" ")
n = int(n)
d = int(d)
print(n // (2*d+1) + int(n % (2*d+1) != 0))
# Buggy code:
n, d = map(int, input().split())
if n//(2*d+1) % 0:
    print(n/(2*d+1))
else:
    print(n//(2*d+1)+1)

# Fixed code:

n,d = map(int,input().split())
ans = 0
dis = 2*d +1

if (n % dis) == 0:
	ans = int(n / dis)
else:
	ans = int((n // dis)+1)

print(ans)
# Buggy code:
n,d=map(int,input().split())
print(math.ceil(n/(2*d+1))

# Fixed code:
import math
n,d = map(int,input().split())

print(math.ceil(n/(2*d+1)))
# Buggy code:
a,b = map(int(input().split())

print(-(a//(2*b+1)))

# Fixed code:
a,b = map(int,input().split())

print(-((-a)//(2*b+1)))
# Buggy code:
def main():
    import sys
    input = sys.stdin.readline
    
    n, d = map(int, input().split())
    print((n + d - 1) // d)
    
    return 0

main()

# Fixed code:
def main():
    import sys
    input = sys.stdin.readline
    
    n, d = map(int, input().split())
    d = 2 * d + 1
    print((n + d - 1) // d)
    
    return 0

main()
# Buggy code:
N, D = map(int, input().split())

if (N % (D * 2 + 1)) == 0:
  print(N % (D * 2 + 1))
else:
  print(N % (D * 2 + 1) + 1)

# Fixed code:
N, D = map(int, input().split())

if(N%(D*2+1)==0):
	print(N//(D*2+1))
else:
	print(N//(D*2+1)+1)
# Buggy code:
import math
n,d = map(int, input().split())
print(math.ceil((n-1-d)/(1+2*d))+1)


# Fixed code:
import math

n,d = map(int,input().split(" "))

print(math.ceil(n / (d * 2 + 1)))
# Buggy code:
n,d = map(int,input().split())
print(n // (d*2) + 1)

# Fixed code:
n, d = map(int, input().split())
print( (n + 2*d) // (2*d+1) )
# Buggy code:
N, D = map(int, input().split())
print(N//(D*2+1)+1)

# Fixed code:
N, D = map(int,input().split())
print((N-1)//(2*D+1)+1)
# Buggy code:
n = int(input())

A = []

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

maxa = max(A)

copy = A[:]
copy.remove(maxa)

maxa2 = max(copy)

for i in A:
    if i == max:
        print(maxa2)
    else:
        print(maxa)


# Fixed code:
n = int(input())

A = []

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

maxa = max(A)

copy = A[:]

copy.remove(maxa)

maxa2 = max(copy)

for i in A:
    if i == maxa:
        print(maxa2)
    else:
        print(maxa)
# Buggy code:
n = int(input())
a = []
for i in range(n):
    a.append(int(input()))
a_max = max(a)
ind_M = a.index(a_max)
tmpl = a
oth = tmpl.pop(ind_M)
for i in range(n):
    if i != ind_M:
        print(a_max)
    else:
        print(oth)

# Fixed code:
n = int(input())
a = []
for i in range(n):
    a.append(int(input()))
a_max = max(a)
ind_M = a.index(a_max)
tmpl = a
tmpl.pop(ind_M)
for i in range(n):
    if i != ind_M:
        print(a_max)
    else:
        print(max(tmpl))
# Buggy code:
n=int(input())
a=[int(input())for _ in range(n)]
b=sorted(a)

for a in b:
  if a==b[-1]:
    print(b[-2])
  else:
    print(b[-1])

# Fixed code:
n=int(input())
a=[int(input()) for i in range(n)]
b=sorted(a)
for i in a:
    if i==b[-1]:
        print(b[-2])
    else:
        print(b[-1])
# Buggy code:
import heapq

n = int(input())
a = [int(input()) for _ in range(n)]
m1, m2 = heapq.nlargest(2, a)
for ai in a:
  print(ai if ai != m1 else m2)


# Fixed code:
import heapq
 
n = int(input())
a = [int(input()) for _ in range(n)]
m1, m2 = heapq.nlargest(2, a)
for ai in a:
  print(m1 if ai != m1 else m2)
# Buggy code:
n = int(input())
a_list = [int(input()) for _ in range(n)]
if a_list[0] > a_list[1]:
    i_max = 0
    i_max2 = 1
else:
    i_max = 1
    i_max2 = 0
a_max = a_list[i_max]
a_max2 = a_list[i_max2]
for i, a in enumerate(a_list):
    if i < 2:
        continue
    if a > a_max:
        i_max2 = i_max
        a_max2 = a_max
        i_max = i
        a_max = a
    elif a > a_max2:
        i_max2 = i
        a_max2 = a
print(i_max, a_max)
print(i_max2, a_max2)
for i in range(n):
    if i == i_max:
        print(a_max2)
    else:
        print(a_max)


# Fixed code:
n = int(input())
a_list = [int(input()) for _ in range(n)]
if a_list[0] > a_list[1]:
    i_max = 0
    i_max2 = 1
else:
    i_max = 1
    i_max2 = 0
a_max = a_list[i_max]
a_max2 = a_list[i_max2]
for i, a in enumerate(a_list):
    if i < 2:
        continue
    if a > a_max:
        i_max2 = i_max
        a_max2 = a_max
        i_max = i
        a_max = a
    elif a > a_max2:
        i_max2 = i
        a_max2 = a
for i in range(n):
    if i == i_max:
        print(a_max2)
    else:
        print(a_max)
# Buggy code:
n = int(input())

li = [int(input()) for i in range(n)]
ls = sorted(li, reverse = True)

m1 = ls[0]

for i in range(1,n):
    if(ls[i] != m1):
        m2 = ls[i]
        break

for i in li:
    print(m1 if(i != m1) else m2)

# Fixed code:
n = int(input())

li = [int(input()) for i in range(n)]
ls = sorted(li, reverse = True)

m1 = ls[0]
m2 = ls[1]
"""
for i in range(0,n):
    if(ls[i] != m1):
        m2 = ls[i]
        break
"""

for i in li:
    print(m1 if(i != m1) else m2)
# Buggy code:
N = int(input())
lst = [int(input()) for _ in range(N)]

mx = max(lst)
lst = sorted(lst)
mx2 = lst[-2]

for j in range(N):
    if mx != lst[j]:
        print(mx)
    else:
        print(mx2)


# Fixed code:
N = int(input())
lst = [int(input()) for _ in range(N)]

mx = max(lst)
clst = sorted(lst)
mx2 = clst[-2]

for j in range(N):
    if mx != lst[j]:
        print(mx)
    else:
        print(mx2)
# Buggy code:
n=int(input())
a=[int(input()) for i in range(n)] 
m=a[0]

for i in range(n):
    if m<a[i]:
        m=a[i]
        k=i

for j in range(n):
    if j==k:
        print(sorted(a)[-2])
    else:
        print(m)

# Fixed code:
n=int(input())
a=[int(input()) for i in range(n)] 
m=a[0]
k=0

for i in range(n):
    if m<a[i]:
        m=a[i]
        k=i

for j in range(n):
    if j==k:
        print(sorted(a)[-2])
    else:
        print(m)
# Buggy code:
N = int(input())
A = [input() for i in range(N)]
ans = 0
Max1 = max(A)
Max2 = sorted(set(A))[-2]
indexes = [i for i, x in enumerate(A) if x == Max1]
for i in range(N):
    ans = Max2 if len(indexes) < 2 and A[i] == Max1 else Max1
    print(ans)

# Fixed code:
N = int(input())
A = [int(input()) for i in range(N)]
ans = 0
Max1 = max(A)
indexes = [i for i, x in enumerate(A) if x == Max1]
if len(A) == len(indexes):
    for i in A:
        print(i)
else:
    Max2 = sorted(set(A))[-2]
    if len(indexes) >= 2:
        for i in range(N):
            print(Max1)
    else:
        for i in range(N):
            ans = Max2 if A[i] == Max1 else Max1
            print(ans)
# Buggy code:
def main():
    N = int(input())
    A = []
    for n in range(N):
        A.append(int(input()))

    A_cp = sorted(A)
    print(id(A_cp), id(A))
    max1_A = A_cp.pop(-1)
    max2_A = max(A_cp)
    for a in A:
        if a == max1_A:
            print(max2_A)
        else:
            print(max1_A)
            
        
if __name__ == '__main__':
    main()


# Fixed code:
def main():
    N = int(input())
    A = []
    for n in range(N):
        A.append(int(input()))

    A_cp = sorted(A)
    max1_A = A_cp.pop(-1)
    max2_A = max(A_cp)
    for a in A:
        if a == max1_A:
            print(max2_A)
        else:
            print(max1_A)
            
        
if __name__ == '__main__':
    main()
# Buggy code:
N=int(input())
maxi=0
smaxi=0
flag=0
ls=[]
x=0
for i in range(N):
  x=int(input())
  ls.append(x)
  if (maxi<x):
    flag=0
    smaxi=maxi
    maxi=x
  elif (maxi==x):
    flag=1
for i in range(N):
  if (ls[i]==maxi):
    if(flag==1):
      print(maxi)
    else:
      print(smaxi)
  else:
    print(maxi)


# Fixed code:
N=int(input())
maxi=0
smaxi=0
flag=0
ls=[]
x=0
for i in range(N):
  x=int(input())
  ls.append(x)
  if (maxi<x):
    smaxi=maxi
    maxi=x
  elif (maxi==x):
    smaxi=maxi
  elif (smaxi<x):
    smaxi=x
for i in range(N):
  if (ls[i]==maxi):
    print(smaxi)
  else:
    print(maxi)
# Buggy code:
def main():
  N = int(input())

  max_left = [0] * N
  max_right = [0] * N

  ary = []

  for i in range(N):
    ary.append(int(input()))

  for i in range(0, N-1):
    max_left[i+1] = max(max_left[i], a[i])

  for i in range(N - 1, 0, -1):
    max_right[i-1] = max(max_right[i], ary[i]):

  for i in range(0, N):
	v = max(max_left[i], max_right[i])
	print(v)

main()


# Fixed code:
def main():
    N = int(input())

    max_left = [0] * N
    max_right = [0] * N

    ary = []

    for i in range(N):
        v = int(input())
        ary.append(v)

    for i in range(N - 1):
        max_left[i+1] = max(max_left[i], ary[i])

    for i in range(N - 1, 0, -1):
        max_right[i-1] = max(max_right[i], ary[i])

    for i in range(N):
        v = max(max_left[i], max_right[i])
        print(v)


main()
# Buggy code:
n = int(input())
a = []
for i in range(n):
  a.append(int(input()))
m = max(a)
b = a
b.sort()
b = b[:-1]
m2 = b[-1]
for i in range(n):
  if a[i] == m:
    print(m2)
  else:
    print(m)

# Fixed code:
n = int(input())
a = []
b = []
for i in range(n):
  s = int(input())
  a.append(s)
  b.append(s)
m = max(a)
b.sort()
b = b[:-1]
m2 = b[-1]
for i in range(n):
  if a[i] == m:
    print(m2)
  else:
    print(m)
# Buggy code:
import sys

#+++++
		
def main():
	n = int(input())
	ll=[int(input()) for _ in range(n)]
	
	mm = ll.sort()
	ma=mm[-1]
	mb=mm[-2]
	
	for i in ll:
		pp = ma if i != ma else mb:
		print(pp)
		
	
	
	
#+++++

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
	else:
		input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

# Fixed code:
import sys

#+++++
		
def main():
	n = int(input())
	ll=[int(input()) for _ in range(n)]
	
	mm = sorted(ll)
	#print(ll)
	ma=mm[-1]
	mb=mm[-2]
	
	for i in ll:
		pp = ma if i != ma else mb
		print(pp)
		
	
	
	
#+++++

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
	else:
		input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)
# Buggy code:
N = int(input())
arr = [0] * N
for i in range(N):
    arr[i] = int(input())

sorted_list = sorted(arr)
max = sorted_list[N-1]
sub_max = sorted_list[N-2]
max_count = arr.count(max)
print(max,sub_max,max_count)

if max_count == 1:
    max_index = arr.index(max)
    for i in range(N):
        if i == max_index:
            print(sub_max)
        else:
            print(max)
else:
    for _ in range(N):
        print(max)



# Fixed code:
N = int(input())
arr = [0] * N
for i in range(N):
    arr[i] = int(input())

sorted_list = sorted(arr)
max = sorted_list[N-1]
sub_max = sorted_list[N-2]
max_count = arr.count(max)

if max_count == 1:
    max_index = arr.index(max)
    for i in range(N):
        if i == max_index:
            print(sub_max)
        else:
            print(max)
else:
    for _ in range(N):
        print(max)
# Buggy code:
a_l = [ int(input()) for _ in range(n)]


l = []
r = []
l_max = 0
r_max = 0
for i in range(n):
    l_max = max(l_max, a_l[i])
    r_max = max(r_max, a_l[-i-1])
    l.append(l_max)
    r.append(r_max)
for i in range(n):
    if i == 0:
        t_l = 0
    else:
        t_l = l[i-1]
    if i == n-1:
        t_r = 0
    else:
        t_r = r[-i-2]
    print(max([t_l,t_r]))

# Fixed code:
n = int(input())
a_l = [ int(input()) for _ in range(n)]

l = []
r = []
l_max = 0
r_max = 0
for i in range(n):
    l_max = max(l_max, a_l[i])
    r_max = max(r_max, a_l[-i-1])
    l.append(l_max)
    r.append(r_max)
for i in range(n):
    if i == 0:
        t_l = 0
    else:
        t_l = l[i-1]
    if i == n-1:
        t_r = 0
    else:
        t_r = r[-i-2]
    print(max([t_l,t_r]))
# Buggy code:
n=int(input())
imax=0
amax=int(input())
amax2=amax
for i in range(1,n)
    ai=int(input())
    if amax<ai:
        amax=ai
        imax=i
        if amax2<ai:
          amax2=ai
    elif amax2<ai:
        amax2=ai
if imax==0:
    print(amax2)
    for i in range(1,n):
        print(amax)
elif imax==n-1:
    for i in range(n-1):
        print(amax)
    print(amax2)
else:
    for i in range(imax):
        print(amax)
    print(amax2)
    for i in range(n-imax-1):
    print(amax)
    

# Fixed code:
n=int(input())
imax=0
amax=0
amax2=amax
for i in range(n):
    ai=int(input())
    if amax<ai:
        adummy=amax
        amax=ai
        imax=i
        amax2=adummy
    elif amax2<ai:
        amax2=ai
if imax==0:
    print(amax2)
    for i in range(1,n):
        print(amax)
elif imax==n-1:
    for i in range(n-1):
        print(amax)
    print(amax2)
else:
    for i in range(imax):
        print(amax)
    print(amax2)
    for i in range(n-imax-1):
        print(amax)
# Buggy code:


def main():
    N = int(input())
    A_list = [int(input()) for _ in range(N)]
    tmp_list = copy(A_list)
    tmp_list.sort()
    max_num = tmp_list[-1]
    second_max_num = tmp_list[-2]
    max_index = A_list.index(max_num)
    for i in range(N):
        if i is max_index:
            print(second_max_num)
            continue
        print(max_num)


if __name__ == '__main__':
    main()


# Fixed code:
from copy import copy


def main():
    N = int(input())
    A_list = [int(input()) for _ in range(N)]
    tmp_list = copy(A_list)
    tmp_list.sort()
    max_num = tmp_list[-1]
    second_max_num = tmp_list[-2]
    max_index = A_list.index(max_num)
    for i in range(N):
        if i is max_index:
            print(second_max_num)
            continue
        print(max_num)


if __name__ == '__main__':
    main()
# Buggy code:
port copy
N=int(input())
A=[]
for i in range(N):
  A.append(int(input()))

x=max(A)
count=(A.count(x))
index=[]
if count!=1:
    for i in range(N):
        print(x)
else:
    B=copy.copy(A)
    B.remove(x)
    y=max(B)
    for i in range(N):
        if A[i]==x:
            print(y)
        else:
            print(x)

# Fixed code:
import copy
N=int(input())
A=[]
for i in range(N):
  A.append(int(input()))

x=max(A)
count=(A.count(x))
index=[]
if count!=1:
    for i in range(N):
        print(x)
else:
    B=copy.copy(A)
    B.remove(x)
    y=max(B)
    for i in range(N):
        if A[i]==x:
            print(y)
        else:
            print(x)
# Buggy code:
n=int(input())
a=[int(input()) for i in range(n)]
b=a
a.sort()
for i in range(n):
    if b[i]<a[-1]:
        print(a[-1])
    elif b[i]==a[-1]:
        print(a[-2])

# Fixed code:
n=int(input())
a=[int(input()) for i in range(n)]
b=a[:]
a.sort()
for i in range(n):
    if b[i]<a[-1]:
        print(a[-1])
    elif b[i]==a[-1]:
        print(a[-2])
# Buggy code:
n=int(input())
l=[]
for i in range(n):
    l.append(int(input()))
a=l.sorted(reverse=True)
for v in l:
    if v==a[0]:
        print(a[1])
    else:
        print(a[0])


# Fixed code:
n=int(input())
l=[]
for i in range(n):
    l.append(int(input()))
a=sorted(l)
a.reverse()
for v in l:
    if v==a[0]:
        print(a[1])
    else:
        print(a[0])
# Buggy code:
n = int(input())
a = list()
for x in range(n):
    a.append(int(input()))

copy_a = sorted(a)

a.sort(reverse=True)
A_Max = a[0]
A_Second = a[1]

for x in range(n):
    if copy_a[x] == A_Max:
        print(A_Second)
    else:
        print(A_Max)


# Fixed code:
n = int(input())
a = list()
for x in range(n):
    a.append(int(input()))

copy_a = sorted(a, reverse=True)

A_Max = copy_a[0]
A_Second = copy_a[1]

for x in range(n):
    if a[x] == A_Max:
        print(A_Second)
    else:
        print(A_Max)
# Buggy code:
N = int(input())
A = [int(input()) for i in range(N)]
B = sorted(A)

for i in range(N):
    if B[-1] == A[i-1]:
        print(B[-2])
    else:
        print(B[-1])

# Fixed code:
N = int(input())
A = [int(input()) for k in range(N)]
B = sorted(A)
for k in range(N):
    if A[k] == B[-1]:
        print(B[-2])
    else:
        print(B[-1])
# Buggy code:
n=int(input())
a=[int(input()) for _ in range(n)]
p=a[::]
m=max(a)
a.delete(m)
m2=max(a)
for i in p:
  if i==m:
    print(m2)
  else:
    print(m)

# Fixed code:
n=int(input())
a=[int(input()) for _ in range(n)]
p=a[::]
m=max(a)
a.remove(m)
m2=max(a)
for i in p:
  if i==m:
    print(m2)
  else:
    print(m)
# Buggy code:
N = int(input())
A = [int(input()) for _ in range(N)]

m1, m2 = sorted(A)[N-2:]

ans = [m1 if a!=m1 else m2 for a in A]
for a in ans:
  print(a)


# Fixed code:
N = int(input())
A = [int(input()) for _ in range(N)]

m2,m1 = sorted(A)[N-2:]

ans = [m1 if a!=m1 else m2 for a in A]
for a in ans:
  print(a)
# Buggy code:
'''ABC134 C'''
import numpy as np
n = int(input())
a = np.array([int(input()) for _ in range(n)])
a1n = a.argmax()
a_s = sorted(a)
a1 = a_s[-1]
a2 = a_s[-2]
for i in range(n):
    if i == a1n:
        print(a1)
    else:
        print(a2)

# Fixed code:
import numpy as np
n = int(input())
a = np.array([int(input()) for _ in range(n)])
a1n = a.argmax()
a_s = sorted(a)
a1 = a_s[-1]
a2 = a_s[-2]
for i in range(n):
    if i == a1n:
        print(a2)
    else:
        print(a1)
# Buggy code:
import collections


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


sorted_A = list(reversed(sorted(A)))

maxiuam = sorted_A[0]
is_there_tow_maximum = A.count(maxiuam) >= 2

if is_there_tow_maximum:
    answer = str(maxiuam * (N - 1))
    print(answer)

second = None
for Ai in sorted_A:
    if Ai < maxiuam:
        second = Ai
        break

answer = []
for Ai in A:
    if Ai == maxiuam:
        answer.append(second)
    else:
        answer.append(maxiuam)
answer = "\n".join(map(str, answer))

print(answer)


# Fixed code:
import collections


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


sorted_A = list(reversed(sorted(A)))

maxiuam = sorted_A[0]
is_there_tow_maximum = A.count(maxiuam) >= 2

second = None
for Ai in sorted_A:
    if Ai < maxiuam:
        second = Ai
        break

answer = []
for Ai in A:
    if is_there_tow_maximum:
        answer.append(maxiuam)
    elif Ai == maxiuam:
        answer.append(second)
    else:
        answer.append(maxiuam)
answer = "\n".join(map(str, answer))

print(answer)
# Buggy code:
N = int(input())
A = [0]*N

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

B = sorted(A,reverse=True)

for i in range(N):
    if A[i]==B[0]:
        print(B[0])
    else:
        print(B[1])


# Fixed code:
N = int(input())
A = [0]*N

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

B = sorted(A,reverse=True)

for i in range(N):
    if A[i]==B[0]:
        print(B[1])
    else:
        print(B[0])
# Buggy code:
N=int(input())
list=[]
for i in range(N):
  list.append(int(input()))
M=max(list)
L=[i for i, v in enumerate(list) if v == M]
n=len(L)
if n>1:
  for i in range(N):
    print(M)
elif:
  del list[L[0]]
  M2=max(list)
  for i in range(N):
    if i == L[0]:
      print(M2)
    elif:
      print(M)

# Fixed code:
N=int(input())
list=[]
for i in range(N):
  list.append(int(input()))
M=max(list)
L=[i for i, v in enumerate(list) if v == M]
n=len(L)
if n>1:
  for i in range(N):
    print(M)
else:
  del list[L[0]]
  M2=max(list)
  for i in range(N):
    if i == L[0]:
      print(M2)
    else:
      print(M)
# Buggy code:
n=int(input())
a=[int(input()) for i in range(n)]
ma=max(a)
aa=sorted(a,reverse=True)
for i in a:
    if i !=ma:
        print(a[i])
    else:
        print(aa[1])

# Fixed code:
n=int(input())
a=[int(input()) for i in range(n)]
ma=max(a)
aa=sorted(a,reverse=True)
for i in a:
    if i !=ma:
        print(ma)
    else:
        print(aa[1])
# Buggy code:
N = int(input())
a = list(map(int, input().split()))
 
b = [ 0 for _ in range(N)]
#M = 0
for i in reversed(range(1, N+1)):
    summ = 0
    #b_summ = 0
    for j in range(i, N+1, i):
        summ += b[j-1]
        #b_summ += b[j-1]
    #if summ % 2 != a[i-1]:
    #	b[i-1] = 1
    #	M += 1
    divs = summ % 2
    b[i-1] = divs
 
cnt = sum(b)
print(cnt)
not_first = False
if cnt > 0:
 
    for j in range(N):
        if b[j] == 1:
            if not_first:
                print(" ", end="")
            print(j+1, end="")
            not_first = True
    print()

# Fixed code:
N = int(input())
a = list(map(int, input().split()))
 
b = [ 0 for _ in range(N)]
#M = 0
for i in reversed(range(1, N+1)):
    summ = 0
    for j in range(i, N+1, i):
        summ += b[j-1]
    if summ % 2 != a[i-1]:
    	b[i-1] = 1
    
 
cnt = sum(b)
print(cnt)
not_first = False
if cnt > 0:
 
    for j in range(N):
        if b[j] == 1:
            if not_first:
                print(" ", end="")
            print(j+1, end="")
            not_first = True
    print()
# Buggy code:
import sys


def IN_I(): return int(sys.stdin.readline().rstrip())
def IN_LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def IN_S(): return sys.stdin.readline().rstrip()
def IN_LS(): return list(sys.stdin.readline().rstrip().split())


N = IN_I()
a = IN_LI()
b = [0] * N

for i in range(N - 1, -1, -1):
    if a[i] == 1:
        b[i] = 1 - b[i]
        if (i + 1) % 2 == 0:
            b[i // 2] = 1
ans = []
for i in range(N):
    if b[i] == 1:
        ans.append(i + 1)

if len(ans) == 0:
    print(0)
else:
    print(' '.join(map(str, ans)))


# Fixed code:
import sys


def IN_I(): return int(sys.stdin.readline().rstrip())
def IN_LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def IN_S(): return sys.stdin.readline().rstrip()
def IN_LS(): return list(sys.stdin.readline().rstrip().split())


N = IN_I()
a = [0] + IN_LI()
b = [0] * (N + 1)
ans = []

for i in range(N, 0, -1):
    tmp = 0
    for j in range(2 * i, N + 1, i):
        tmp += b[j]
    if tmp % 2 != a[i]:
        b[i] = 1
        ans.append(i)
if len(ans) == 0:
    print(0)
else:
    print(len(ans))
    print(' '.join(map(str, ans)))
# Buggy code:
# from sys import exit, stderr
# from inspect import currentframe
# def debug(*args):
#     names = {id(v):k for k,v in currentframe().f_back.f_locals.items()}
#     print(', '.join(names.get(id(arg),'???')+' = '+repr(arg) for arg in args), file=stderr)
#     return
N = int(input())
a = [int(_) for _ in input().split()]
b = set()
out = []
n = 0
for i in range(N-1, -1, -1):
    if a[i] == 1:
        out.append(i + 1)
    for f in range(int(n**0.5)):
        if (i+1)%f == 0:
            a[f-1] = 0 if a[i] else a[i]

print(n)
# print(b)
if len(out) > 0:
    for i in range(len(out)):
        print(out[i], end=" ")
    print()


# Fixed code:
# from sys import exit, stderr
# from inspect import currentframe
# def debug(*args):
#     names = {id(v):k for k,v in currentframe().f_back.f_locals.items()}
#     print(', '.join(names.get(id(arg),'???')+' = '+repr(arg) for arg in args), file=stderr)
#     return
N = int(input())
a = [int(_) for _ in input().split()]
b = set()
out = []
n = 0
for i in range(N-1, -1, -1):
    if a[i] == 1:
        out.append(i + 1)
        n += 1
        # print(i+1)
        for f in range(1, int((i+1)**0.5)+1):
            if (i+1)%f == 0:
                a[f-1] = 0 if a[f-1] == 1 else 1
                if f != (i+1)//f and f != 1:
                    a[(i+1)//f-1] = 0 if a[(i+1)//f-1] == 1 else 1
    # debug(a)
print(n)
# print(b)
if len(out) > 0:
    for i in range(len(out)):
        print(out[i], end=" ")
    print()
# Buggy code:

n = int(input())
arr = [int(x) for x in input().split()]
balls = {}
result = []
reslen = 0

for i in range(n, n // 2, -1):
  if arr[i - 1] == 1:
    balls[i - 1] = 1
    result.append(str(i))
    reslen += 1
  else:
    balls[i - 1] = 0

for i in range(n // 2, 0, -1):
  s = sum([balls[i * m - 1] for m in range(2, n // i + 1)])
  if arr[i - 1] == 1:
    if (s % 2) == 1:
      balls[i - 1] = 0
    else:
      balls[i - 1] = 1
      result.append(str(i))
      reslen += 1
  if arr[i - 1] == 0:
    if (s % 2) == 0:
      balls[i - 1] = 0
    else:
      balls[i - 1] = 1
      result.append(str(i))
      reslen += 1

print(balls)
print('---')
print(reslen)
if reslen != 0:
  print(' '.join(result))


# Fixed code:

n = int(input())
arr = [int(x) for x in input().split()]
balls = {}
result = []
reslen = 0

for i in range(n, n // 2, -1):
  if arr[i - 1] == 1:
    balls[i - 1] = 1
    result.append(str(i))
    reslen += 1
  else:
    balls[i - 1] = 0

for i in range(n // 2, 0, -1):
  s = sum([balls[i * m - 1] for m in range(2, n // i + 1)])
  if arr[i - 1] == 1:
    if (s % 2) == 1:
      balls[i - 1] = 0
    else:
      balls[i - 1] = 1
      result.append(str(i))
      reslen += 1
  if arr[i - 1] == 0:
    if (s % 2) == 0:
      balls[i - 1] = 0
    else:
      balls[i - 1] = 1
      result.append(str(i))
      reslen += 1

print(reslen)
if reslen != 0:
  print(' '.join(result))