ZhenlongDai/ACPR huggingface dataset:
Problem: p02383
Buggy submission (Python3, verdict: Wrong Answer):
def move_dice(d, dir):
    if(dir == 'N'):
        d[0], d[1], d[4], d[5] = d[4], d[0], d[5], d[1]
    if(dir == 'S'):
        d[0], d[1], d[4], d[5] = d[1], d[5], d[0], d[4]
    if(dir == 'E'):
        d[0], d[2], d[3], d[5] = d[3], d[0], d[5], d[2]
    if(dir == 'W'):
        d[0], d[2], d[3], d[5] = d[2], d[5], d[0], d[3]


dice = list(map(int, input().split()))
command = input()
for c in command:
    move_dice(dice, c)
print(dice[0])

Failing test case input:
1 2 4 8 18 32
ES

Expected output:
18


Actual output:
2


Fixed submission (verdict: Accepted):
def move_dice(d, dir):
    if(dir == 'N'):
        d[0], d[1], d[4], d[5] = d[1], d[5], d[0], d[4]
    if(dir == 'S'):
        d[0], d[1], d[4], d[5] = d[4], d[0], d[5], d[1]
    if(dir == 'E'):
        d[0], d[2], d[3], d[5] = d[3], d[0], d[5], d[2]
    if(dir == 'W'):
        d[0], d[2], d[3], d[5] = d[2], d[5], d[0], d[3]


dice = list(map(int, input().split()))
command = input()
for c in command:
    move_dice(dice, c)
print(dice[0])

Problem: p02383
Buggy submission (Python3, verdict: Wrong Answer):
labels = input().split()
indexs = [0, 1, 2, 3, 4, 5]
copy = [0, 0, 0, 0, 0, 0]
order = input()
rolls = {'N':[2, 1, 5, 0, 4, 3], 
         'E':[1, 5, 2, 3, 0, 4], 
         'S':[3, 1, 0, 5, 4, 2], 
         'W':[4, 0, 2, 3, 5, 1]
        }
for d in order:
    for i in range(6):
        copy[i] = rolls[d][indexs[i]]
    indexs = copy
    
print(labels[indexs[0]])


Failing test case input:
0 2 0 1 52 2
ES

Expected output:
52


Actual output:
2


Fixed submission (verdict: Accepted):
labels = input().split()
copy = [0, 0, 0, 0, 0, 0]
order = input()
rolls = {'W':[2, 1, 5, 0, 4, 3], 
         'N':[1, 5, 2, 3, 0, 4], 
         'E':[3, 1, 0, 5, 4, 2], 
         'S':[4, 0, 2, 3, 5, 1]
        }
for d in order:
    roll = rolls[d]
    labels = [labels[i] for i in roll]
print(labels[0])

Problem: p02383
Buggy submission (Python3, verdict: Wrong Answer):
l = list(map(int, input().split()))
s = input()
for c in s:
  if c == "S":
    l = [l[4], l[0], l[2], l[3], l[1], l[5]]
  elif c == "N":
    l = [l[1], l[5], l[2], l[3], l[4], l[0]]
  elif c == "E":
    l = [l[3], l[1], l[0], l[5], l[4], l[2]]
  else:
    l = [l[2], l[1], l[5], l[0], l[4], l[3]]
print(l[0])


Failing test case input:
1 -1 0 8 38 23
NESWE

Expected output:
1


Actual output:
38


Fixed submission (verdict: Accepted):
l = list(map(int, input().split()))
s = input()
for c in s:
  if c == "S":
    l = [l[4], l[0], l[2], l[3], l[5], l[1]]
  elif c == "N":
    l = [l[1], l[5], l[2], l[3], l[0], l[4]]
  elif c == "E":
    l = [l[3], l[1], l[0], l[5], l[4], l[2]]
  else:
    l = [l[2], l[1], l[5], l[0], l[4], l[3]]
print(l[0])
Problem: p02383
Buggy submission (Python3, verdict: Wrong Answer):
def dice():
	dice = list(map(str, input().split()))
	direction = input()
	for i in range(len(direction)):
		if direction[i] == "N":
			dice[0],dice[1],dice[4],dice[5] = dice[1],dice[5],dice[0],dice[4]
		elif direction[i] == "S":
			dice[0],dice[1],dice[4],dice[5] = dice[4],dice[0],dice[5],dice[1]
		elif direction[i] == "W":
			dice[0],dice[2],dice[3],dice[5] = dice[2],dice[5],dice[0],dice[3]
		else :
			dice[0],dice[2],dice[3],dice[5] = dice[3],dice[0],dice[5],dice[2]
	print(dice[0])


Failing test case input:
1 2 3 0 21 32
ES

Expected output:
21


Actual output:

Fixed submission (verdict: Accepted):
dice = list(map(str, input().split()))
direction = input()
for i in range(len(direction)):
	if direction[i] == "N":
		dice[0],dice[1],dice[4],dice[5] = dice[1],dice[5],dice[0],dice[4]
	elif direction[i] == "S":
		dice[0],dice[1],dice[4],dice[5] = dice[4],dice[0],dice[5],dice[1]
	elif direction[i] == "W":
		dice[0],dice[2],dice[3],dice[5] = dice[2],dice[5],dice[0],dice[3]
	else :
		dice[0],dice[2],dice[3],dice[5] = dice[3],dice[0],dice[5],dice[2]
print(dice[0])

Problem: p02383
Buggy submission (Python3, verdict: Wrong Answer):
dice = [1,2,3,4,5,6]
number = list(map(int,input().split()))
direction = str(input())

rotate_n =[2,6,4,3,1,5]
rotate_s =[5,1,3,4,6,2]
rotate_e =[4,2,1,6,5,3]
rotate_w =[3,2,6,1,5,4]

for i in direction:
    result = []
    if i == "N":
        for j in range(6):
            dice[j] = rotate_n[j]
    elif i == "S":
        for j in range(6):
            dice[j] = rotate_s[j]
    elif i == "E":
        for j in range(6):
            dice[j] = rotate_e[j]
    else:
        for j in range(6):
            dice[j] = rotate_w[j]
    for k in dice:
        result.append(number[k-1])
    number = result

print(number[1])

Failing test case input:
0 2 0 16 25 35
EESWN

Expected output:
35


Actual output:
0


Fixed submission (verdict: Accepted):
dice = [1,2,3,4,5,6]
number = list(map(int,input().split()))
direction = str(input())

rotate_n =[2,6,3,4,1,5]
rotate_s =[5,1,3,4,6,2]
rotate_e =[4,2,1,6,5,3]
rotate_w =[3,2,6,1,5,4]

for i in direction:
    result = []
    if i == "N":
        for j in range(6):
            dice[j] = rotate_n[j]
    elif i == "S":
        for j in range(6):
            dice[j] = rotate_s[j]
    elif i == "E":
        for j in range(6):
            dice[j] = rotate_e[j]
    else:
        for j in range(6):
            dice[j] = rotate_w[j]
    for k in dice:
        result.append(number[k-1])
    number = result

print(number[0])
Problem: p00010
Buggy submission (Python3, verdict: Wrong Answer):
for _ in[0]*int(input()):
 a,b,c,d,e,f=map(float,input().split())
 x=((a*a+b*b)*(d-f)+(c*c+d*d)*(f-b)+(e*e+f*f)*(b-d))/2/(a*(d-f)+c*(f-b)+e*(b-d))
 y=((a*a+b*b)*(c-e)+(c*c+d*d)*(e-a)+(e*e+f*f)*(a-c))/2/(b*(c-e)+d*(e-a)+f*(a-c))
 print(f"{x:.4} {y:.4} {(x*x+y*y)**.5:.4}")


Failing test case input:
1
1.3738821478294245 1.6454027344731756 3.9806105506290774 1.516536609294049 2.0 3.07386900865471

Expected output:
2.694 1.918 1.348


Actual output:
2.694 1.918 3.307


Fixed submission (verdict: Accepted):
for _ in[0]*int(input()):
 a,b,c,d,e,f=map(float,input().split())
 x=((a*a+b*b)*(d-f)+(c*c+d*d)*(f-b)+(e*e+f*f)*(b-d))/2/(a*(d-f)+c*(f-b)+e*(b-d))
 y=((a*a+b*b)*(c-e)+(c*c+d*d)*(e-a)+(e*e+f*f)*(a-c))/2/(b*(c-e)+d*(e-a)+f*(a-c))
 print(f"{x:.3f} {y:.3f} {((x-a)**2+(y-b)**2)**.5:.3f}")

Problem: p00010
Buggy submission (Python3, verdict: Wrong Answer):
for _ in[0]*int(input()):
 a,b,c,d,e,f=map(float,input().split())
 x=((a*a+b*b)*(d-f)+(c*c+d*d)*(f-b)+(e*e+f*f)*(b-d))/2/(a*(d-f)+c*(f-b)+e*(b-d))
 y=((a*a+b*b)*(c-d)+(c*c+d*d)*(e-a)+(e*e+f*f)*(a-c))/2/(b*(c-e)+d*(e-a)+f*(a-c))
 print(f"{x:.4} {y:.4} {(x*x+y*y)**.5:.4}")


Failing test case input:
1
4.963432158015666 4.645021280602924 8.279544064835067 5.563773465479473 4.0054742052604535 4.490764028924242

Expected output:
1.312 24.267 19.959


Actual output:
1.312 122.0 122.0


Fixed submission (verdict: Accepted):
for _ in[0]*int(input()):
 a,b,c,d,e,f=map(float,input().split())
 x=((a*a+b*b)*(d-f)+(c*c+d*d)*(f-b)+(e*e+f*f)*(b-d))/2/(a*(d-f)+c*(f-b)+e*(b-d))
 y=((a*a+b*b)*(c-e)+(c*c+d*d)*(e-a)+(e*e+f*f)*(a-c))/2/(b*(c-e)+d*(e-a)+f*(a-c))
 print(f"{x:.3f} {y:.3f} {((x-a)**2+(y-b)**2)**.5:.3f}")

Problem: p00010
Buggy submission (Python3, verdict: Wrong Answer):
for _ in[0]*int(input()):
 a,b,c,d,e,f=map(float,input().split())
 x=((a*a+b*b)*(d-f)+(c*c+d*d)*(f-b)+(e*e+f*f)*(b-d))/2/(a*(d-f)+c*(f-b)+e*(b-d))
 y=((a*a+b*b)*(c-e)+(c*c+d*d)*(e-a)+(e*e+f*f)*(a-c))/2/(b*(c-e)+d*(e-a)+f*(a-c))
 print(f"{x:.3f} {y:.3f} {(x*x+y*y)**.5:.3f}")


Failing test case input:
1
7.851491124819711 10.453842038101037 10.270151050527312 8.996723068441463 6.112746486397345 7.006940799538526

Expected output:
8.117 8.158 2.311


Actual output:
8.117 8.158 11.508


Fixed submission (verdict: Accepted):
for _ in[0]*int(input()):
 a,b,c,d,e,f=map(float,input().split())
 x=((a*a+b*b)*(d-f)+(c*c+d*d)*(f-b)+(e*e+f*f)*(b-d))/2/(a*(d-f)+c*(f-b)+e*(b-d))
 y=((a*a+b*b)*(c-e)+(c*c+d*d)*(e-a)+(e*e+f*f)*(a-c))/2/(b*(c-e)+d*(e-a)+f*(a-c))
 print(f"{x:.3f} {y:.3f} {((x-a)**2+(y-b)**2)**.5:.3f}")
Problem: p00010
Buggy submission (Python3, verdict: Wrong Answer):
import math
for _ in range(int(input())):
    x1, y1, x2, y2, x3, y3 = map(float, input().split())
    p = ((y1-y3)*(y1**2 -y2**2 +x1**2 -x2**2) -(y1-y2)*(y1**2 -y3**2 +x1**2 -x3**2)) / 2/ ((y1-y3)*(x1-x2)-(y1-y2)*(x1-x3))
    q = ((x1-x3)*(x1**2 -x2**2 +y1**2 -y2**2) -(x1-x2)*(x1**2 -x3**2 +y1**2 -y3**2)) / 2/ ((x1-x3)*(y1-y2)-(x1-x2)*(y1-y3))
    r = math.sqrt((x1 - p) ** 2 + (y1 - q) ** 2)
    print("{:.4f} {:.4f} {:.4f}".format(p, q, r))


Failing test case input:
1
0.0 0.0 2.0 0.5127281311709682 2.0 2.0

Expected output:
0.744 1.256 1.460


Actual output:
0.7436 1.2564 1.4599


Fixed submission (verdict: Accepted):
import math
for _ in range(int(input())):
    x1, y1, x2, y2, x3, y3 = map(float, input().split())
    p = ((y1-y3)*(y1**2 -y2**2 +x1**2 -x2**2) -(y1-y2)*(y1**2 -y3**2 +x1**2 -x3**2)) / 2/ ((y1-y3)*(x1-x2)-(y1-y2)*(x1-x3))
    q = ((x1-x3)*(x1**2 -x2**2 +y1**2 -y2**2) -(x1-x2)*(x1**2 -x3**2 +y1**2 -y3**2)) / 2/ ((x1-x3)*(y1-y2)-(x1-x2)*(y1-y3))
    r = math.sqrt((x1 - p) ** 2 + (y1 - q) ** 2)
    p = abs(p) if abs(p) < 10e-5 else p
    q = abs(q) if abs(q) < 10e-5 else q
    print("{:.3f} {:.3f} {:.3f}".format(p, q, r))

Problem: p00010
Buggy submission (Python3, verdict: Wrong Answer):
import math

n = int(input())
for i in range(n):
    x1, y1, x2, y2, x3, y3 = map(float, input().split())
    a1 = x1 ** 2 - x2 ** 2 + y1 ** 2 - y2 ** 2
    a2 = y1 ** 2 - y3 ** 2 + x1 ** 2 - x3 ** 2
    px = ((y1 - y3) * a1 - (y1 - y2) * a2) / \
        (2 * (y1 - y3) * (x1 - x2) - 2 * (y1 - y2) * (x1 - x3))
    py = ((x1 - x3) * a1 - (x1 - x2) * a2) / \
        (2 * (x1 - x3) * (y1 - y2) - 2 * (x1 - x2) * (y1 - y3))
    r = math.sqrt(px ** 2 + py ** 2)
    print("{0:.3f} {1:.3f} {2:.3f}".format(px, py, r))

Failing test case input:
1
2.8556561587971867 4.098709639034822 7.687936304434296 4.393976471211937 4.0054742052604535 3.91920391890877

Expected output:
4.764 12.552 8.666


Actual output:
4.764 12.552 13.426


Fixed submission (verdict: Accepted):
import math

n = int(input())
for i in range(n):
    x1, y1, x2, y2, x3, y3 = map(float, input().split())
    a1 = x1 ** 2 - x2 ** 2 + y1 ** 2 - y2 ** 2
    a2 = y1 ** 2 - y3 ** 2 + x1 ** 2 - x3 ** 2
    px = ((y1 - y3) * a1 - (y1 - y2) * a2) / \
        (2 * (y1 - y3) * (x1 - x2) - 2 * (y1 - y2) * (x1 - x3))
    py = ((x1 - x3) * a1 - (x1 - x2) * a2) / \
        (2 * (x1 - x3) * (y1 - y2) - 2 * (x1 - x2) * (y1 - y3))
    r = math.hypot(x1 - px, y1 - py)
    print("{0:.3f} {1:.3f} {2:.3f}".format(px, py, r))
Problem: p00010
Buggy submission (Python3, verdict: Wrong Answer):
import math

n = int(input())
for i in range(n):
    x1, y1, x2, y2, x3, y3 = map(float, input().split())
    a1 = x1 ** 2 - x2 ** 2 + y1 ** 2 - y2 ** 2
    a2 = y1 ** 2 - y3 ** 2 + x1 ** 2 - x3 ** 2
    px = ((y1 - y3) * a1 - (y1 - y2) * a2) / (2 * (y1 - y3) * (x1 - x2) - 2 * (y1 - y2) * (x1 - x3))
    py = ((x1 - x3) * a1 - (x1 - x2) * a2) / (2 * (x1 - x3) * (y1 - y2) - 2 * (x1 - x2) * (y1 - y3))
    r = math.sqrt(px ** 2 + py ** 2)
    print("{0:.3f} {1:.3f} {2:.3f}".format(px, py, r))

Failing test case input:
1
9.30701458099894 10.453842038101037 10.999628594168511 9.249324861113335 7.390093130794225 7.345949029785508

Expected output:
9.132 8.417 2.045


Actual output:
9.132 8.417 12.419


Fixed submission (verdict: Accepted):
import math

n = int(input())
for i in range(n):
    x1, y1, x2, y2, x3, y3 = map(float, input().split())
    a1 = x1 ** 2 - x2 ** 2 + y1 ** 2 - y2 ** 2
    a2 = y1 ** 2 - y3 ** 2 + x1 ** 2 - x3 ** 2
    px = ((y1 - y3) * a1 - (y1 - y2) * a2) / \
        (2 * (y1 - y3) * (x1 - x2) - 2 * (y1 - y2) * (x1 - x3))
    py = ((x1 - x3) * a1 - (x1 - x2) * a2) / \
        (2 * (x1 - x3) * (y1 - y2) - 2 * (x1 - x2) * (y1 - y3))
    r = math.hypot(x1 - px, y1 - py)
    print("{0:.3f} {1:.3f} {2:.3f}".format(px, py, r))
Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    n = int(input())
    a = list(map(int, input().split()))
    ls = [None] * n
    ans = []

    for i in range(n-1, -1, -1):
        if sum(ls[i+1:n:i+1]) != a[i]:
            ls[i] = 1
            ans.append(i+1)
        else:
            ls[i] = 0
    print(sum(ls))
    if ans:
        print(*ans)


if __name__ == '__main__':
    main()


Failing test case input:
5
1 0 1 0 0

Expected output:
1
3


Actual output:
3
3 2 1


Fixed submission (verdict: Accepted):
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    n = int(input())
    n_half = n 
    a = list(map(int, input().split()))
    ls = [0] * n
    ans = []

    for i in range(n-1, -1, -1):
        if (sum(ls[i::i+1]) % 2) != a[i]:
            ls[i] = 1
            ans.append(i+1)
    print(sum(ls))
    if ans:
        print(*ans[::-1])


if __name__ == '__main__':
    main()

Problem: p02972
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n = int(input())
a = list( map(int, input().split()) )
a.insert(0,0)
count = [0]*(n+1)
res = 0
ary = []

for i in range(n, 0, -1):
    for j in range( 2*i, n+1, i+1 ):
        count[i] += count[j]
    if count[i]%2 != a[i]:
        res += 1
        ary.append(i)
        count[i] = ( count[i] % 2 + 1 ) % 2
print(res)
if res != 0:
    print(*ary)

Failing test case input:
5
1 1 0 1 0

Expected output:
1
4


Actual output:
2
4 1


Fixed submission (verdict: Accepted):
n = int(input())
a = [-1]+list( map(int, input().split()) )
b = [0]*(n+1)
res = 0
ary = []

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]:
        res += 1
        b[i] = 1
for i in range(1, n+1):
    if b[i] == 1:
        ary.append(i)
print(res)
if res != 0:
    print(*ary)

Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
a=list(map(int,input().split()))
ans=[0]*n
for i in range(n-1,0,-1):
    temp=0
    for j in range(2*i,n,i): temp+=ans[j]
    if a[i]!=temp%2: ans[i]=1
if a[0]!=sum(ans)%2:
    ans[0]=1
print(sum(ans))                                 
for i in range(n):
    if ans[i]==1: print(i+1,end=" ")

Failing test case input:
5
1 0 1 0 0

Expected output:
1
3


Actual output:
3
1 2 3 

Fixed submission (verdict: Accepted):
n=int(input())
a=list(map(int,input().split()))
ans=[0]*(n+1)
for i in range(n,0,-1):
    temp=0
    for j in range(i,n+1,i): temp+=ans[j]
    if a[i-1]!=temp%2: ans[i]=1
print(sum(ans))           
for i in range(n+1):
    if ans[i]==1: print(i,end=" ")
Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

N = int(input())
A = list(map(int, input().split()))
A.reverse()
B = [0 for i in range(N)]
for i in range(N):
    tmp = 0
    for j in range(0, i+1, i+1):
        tmp += B[j]
    if A[i] % 2 != tmp % 2:
        B[i] = 1
B.reverse()
ans = []
M = sum(B)
for i in range(N):
    if B[i] == 1:
        ans.append(i+1)
print(M)
print(*ans)

Failing test case input:
5
1 1 0 0 0

Expected output:
1
2


Actual output:
2
1 2


Fixed submission (verdict: Accepted):

N = int(input())
A = [0] + list(map(int, input().split()))
B = [0 for _ in range(N+1)]
ans = []
for i in range(N, 0, -1):
    v = 0
    j = i
    while j <= N:
        v += B[j]
        j += i
    if A[i] != v % 2:
        ans.append(i)
        B[i] = 1

ans.sort()
print(len(ans))
if len(ans) != 0:
    print(*ans)

Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
a=list(map(int, input().split()))
a=[0]+a
b=[0]*(n+1)

for i in range(n,0,-1):
  sum=0
  for j in range(i+i,n,i):
    sum^=b[j]
  b[i]=sum^a[i]
ans=[]
for i in range(1,len(b)):
  if b[i]:
    ans.append(i)
print(len(ans))
print(*ans)

Failing test case input:
5
1 0 0 0 1

Expected output:
1
5


Actual output:
2
1 5


Fixed submission (verdict: Accepted):
n=int(input())
a=list(map(int, input().split()))
a=[0]+a
b=[0]*(n+1)

for i in range(n,0,-1):
  sum=0
  for j in range(i+i,n+1,i):
    sum^=b[j]
  b[i]=sum^a[i]
ans=[]
for i in range(1,len(b)):
  if b[i]:
    ans.append(i)
print(len(ans))
print(*ans)

Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = list(map(int,input().split()))

for i in range(N-1,0,-1):
    A[i] = sum(A[i::i+1]) % 2

s = sum(A[0:N])
print(s)

n = 1
for i in range(N):
    if s == 0:
        print('')
        break
    if A[i] == 1:
        if n == s:
            print(i+1)
            break
        else:
            print(i+1,end=' ')
            n += 1


Failing test case input:
5
1 1 0 1 0

Expected output:
1
4


Actual output:
2
1 4


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

for i in range(N-1,-1,-1):
    A[i] = sum(A[i::i+1]) % 2

s = sum(A[0:N])
print(s)

n = 1
for i in range(N):
    if A[i] == 1:
        if n == s:
            print(i+1)
            break
        else:
            print(i+1,end=' ')
            n += 1

Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
num_line = [0] + list(map(int, input().split()))
for i in range(N, 1, -1):
    if sum(num_line[i::i]) != num_line[i]:
        num_line[i] = 1
print(num_line.count(1))
print(" ".join(map(str, list(i for i in range(1, N) if num_line[i] == 1))))
print()

Failing test case input:
5
1 0 1 0 0

Expected output:
1
3


Actual output:
2
1 3



Fixed submission (verdict: Accepted):
N = int(input())
num_line = [0] + list(map(int, input().split()))
for i in range(N
    num_line[i] = sum(num_line[i::i]) % 2
    
        
print(num_line.count(1))
print(" ".join(map(str, list(i for i in range(1, N+1) if num_line[i] == 1))))
Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = list(map(int,input().split()))
b = [0]*n

for i in range(n)[::-1]:
    cnt = sum(a[i::i+1])
    b[i] = cnt%2

c = 0
for i in b:
    if i != 0:
        c += 1

print(c)
str_b = []
for i in reversed(b):
    if i != 0:
        str_b.append(str(i))
print(' '.join(str_b))

Failing test case input:
5
1 0 1 0 0

Expected output:
1
3


Actual output:
1
1


Fixed submission (verdict: Accepted):
n = int(input())
a = list(map(int,input().split()))
b = [0]*n

for i in range(n)[::-1]:
    cnt = sum(b[i::i+1])
    if (cnt %2) != a[i]:
        b[i] = 1
    

print(sum(b))

for i, j in enumerate(b):
    if j == 1:
        print(i+1)

Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
a = [0] + list(map(int, input().split()))

ans = [-1] * (N+1)
count = 0
for i in range(N, 0, -1):
    tmp = 0
    p = i
    p += p
    
    while p < N:
        tmp += ans[p]
        p += p
    ans[i] = a[i] - (tmp%2)
    if ans[i] == 1:
        count += 1

print (count)
for i in range(1, N + 1):
    if ans[i] == 1:
        print (i)



Failing test case input:
5
1 0 1 0 0

Expected output:
1
3


Actual output:
2
1
3


Fixed submission (verdict: Accepted):
N = int(input())
a = [0] + list(map(int, input().split()))

ans = [-1] * (N+1)
count = 0
for i in range(N, 0, -1):
    tmp = 0
    p = i
    p += p
    
    while p <= N: 
        tmp += ans[p]
        p += i
    ans[i] = abs(a[i] - (tmp%2))
    if ans[i] == 1:
        count += 1
    
    

print (count)
for i in range(1, N + 1):
    if ans[i] == 1:
        print (i)

Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

N = int(input())
A = [0] + list(map(int, input().split()))
B = [0 for _ in range(N+1)]
ans = []
for i in range(N, 0, -1):
    v = -A[i]
    j = i
    while j <= N:
        
        v += A[j]
        j += i+1
    if A[i] != v % 2:
        ans.append(i)
        B[i] = 1

ans.sort()
print(len(ans))
if len(ans) != 0:
    print(*ans)

Failing test case input:
5
1 0 0 0 1

Expected output:
1
5


Actual output:
2
2 5


Fixed submission (verdict: Accepted):

N = int(input())
A = [0] + list(map(int, input().split()))
B = [0 for _ in range(N+1)]
ans = []
for i in range(N, 0, -1):
    v = 0
    j = i
    while j <= N:
        v += B[j]
        j += i
    if A[i] != v % 2:
        ans.append(i)
        B[i] = 1

ans.sort()
print(len(ans))
if len(ans) != 0:
    print(*ans)
Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from sys import stdin

n = int(stdin.readline().rstrip())
li = [0] + list(map(int,stdin.readline().rstrip().split()))
lin = []
point = 0

for i in range(n,0,-1):
    goukei = sum(li[i*2::i])
    if goukei != li[i]:
        li[i] = 1
        point += 1
        lin.append(i)
print(point)
lin.sort()
for i in lin:
    print(i)

Failing test case input:
5
1 1 0 1 0

Expected output:
1
4


Actual output:
2
1
4


Fixed submission (verdict: Accepted):
from sys import stdin

n = int(stdin.readline().rstrip())
li = [0] + list(map(int,stdin.readline().rstrip().split()))
lin = [0]*(n+1)
point = 0
lis = []

for i in range(n,0,-1):
    su = sum(lin[i::i])%2
    if li[i] != su:
        lin[i] = 1
        point += 1
        lis.append(i)
    
print(point)
lis.sort()

for i in lis:
    print(i)

Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
a = [int(i) for i in input().split()]

ans = [-1 for i in range(N)]

for i in reversed(range(1, N+1)):
    tmp = 0
    for j in reversed(range(i, N+1)):
        if j == i:
            if tmp % 2 == 0:
                ans[j-1] = 1
            else:
                ans[j-1] = 0
        elif j % i == 0:
            tmp += ans[j-1]

print(len(ans))
print(ans)

Failing test case input:
5
1 0 0 0 0

Expected output:
1
1


Actual output:
5
[0, 0, 1, 1, 1]


Fixed submission (verdict: Accepted):
N = int(input())
a = [int(i) for i in input().split()]

ans = [0 for i in range(N)]

for i in reversed(range(1, N+1)):
    tmp = 0
    for j in range(i, N+1, i):
        tmp += ans[j-1]
    if tmp % 2 != a[i-1]:
        ans[i-1] = 1

anslist = []
for i in range(N):
    if ans[i] == 1:
        anslist.append(i+1)

print(len(anslist))
print(*anslist)

Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
a=list(map(int,input().split()))
ans=[0]*(n+1)
for i in range(n,0,-1):
    temp=0
    for j in range(i,n+1,i): temp+=ans[j]
    if a[i-1]!=temp%2: ans[i]=1
print(sum(ans))           
for i in range(n):
    if ans[i]==1: print(i,end=" ")

Failing test case input:
5
1 0 0 0 1

Expected output:
1
5


Actual output:
1


Fixed submission (verdict: Accepted):
n=int(input())
a=list(map(int,input().split()))
ans=[0]*(n+1)
for i in range(n,0,-1):
    temp=0
    for j in range(i,n+1,i): temp+=ans[j]
    if a[i-1]!=temp%2: ans[i]=1
print(sum(ans))           
for i in range(n+1):
    if ans[i]==1: print(i,end=" ")

Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = input()
r = [None] * (n + 1)
for i in range(n, 0, -1):
    r[i] = (ord(a[2 * i - 2]) + sum(r[i * 2::i])) % 2



Failing test case input:
5
1 1 0 0 0

Expected output:
1
2


Actual output:

Fixed submission (verdict: Accepted):
n = int(input())
a = input()
r = [None] * (n + 1)
for i in range(n, 0, -1):
    r[i] = (ord(a[2 * i - 2]) + sum(r[i * 2::i])) % 2
print(r.count(1))
print(*(i for i, x in enumerate(r) if x))
Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,a,d,l=int(input()),list(map(int,input().split())),set(),0;b=[0]*n
for i in range(n-1,-1,-1):
  c=0
  for j in range(2*i+1,n,i+1):c=(c+b[j])%2
  if a[i]!=c:b[i]+=1;d.add(i+1);l+=1
print(*[d.pop()for _ in range(l)])

Failing test case input:
5
1 0 0 0 0

Expected output:
1
1


Actual output:
1


Fixed submission (verdict: Accepted):
n,a,d,l=int(input()),list(map(int,input().split())),set(),0;b=[0]*n
for i in range(n-1,-1,-1):
  c=0
  for j in range(2*i+1,n,i+1):c=(c+b[j])%2
  if a[i]!=c:b[i]+=1;d.add(i+1);l+=1
print(l)
print(*[d.pop()for _ in range(l)])

Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
a=list(map(int,input().split()))
b=[0 for i in range(n)]
c=0
d=0
for i in range(n-1,-1,-1):
  j=2
  c=b[i]
  while((i+1)*j<=n):
    c=c^b[(i+1)*j-1]
    j+=1
  if (c!=a[i]):
    b[i]=1
  j=2
print('{0}'.format(sum(b)))
e=list(map(str,b))
e=[i for i in e if i=='1']
f=' '.join(e)
print('{0}'.format(f))

Failing test case input:
5
1 0 1 0 0

Expected output:
1
3


Actual output:
1
1


Fixed submission (verdict: Accepted):
n=int(input())
a=list(map(int,input().split()))
b=[0 for i in range(n)]
c=0
d=[]
for i in range(n-1,-1,-1):
  j=2
  c=b[i]
  while((i+1)*j<=n):
    c=c^b[(i+1)*j-1]
    j+=1
  if (c!=a[i]):
    b[i]=1
  c=0
  j=2
print('{0}'.format(sum(b)))
for i in range(n):
  if(b[i]==1):
    d.append(i+1)
e=list(map(str,d))
f=' '.join(e)
print('{0}'.format(f))

Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
a=list(map(int,input().split()))
b=[0]*(n+1)
for i in reversed(range(1,n+1)):
    tmp_num=i
    tmp=0
    while tmp_num<=n:
        tmp+=a[tmp_num-1]
        tmp_num+=i
    b[i]=tmp%2
cnt=0
c=[]
for i in range(len(b)):
    if b[i]==1:
        cnt+=1
        c.append(str(i))
print(cnt)
if cnt!=0:
    print(" ".join(c))


Failing test case input:
5
1 1 0 1 0

Expected output:
1
4


Actual output:
2
1 4


Fixed submission (verdict: Accepted):
n=int(input())
a=list(map(int,input().split()))
b=[0]*(n+1)
for i in reversed(range(1,n+1)):
    tmp_num=i
    tmp=0
    while tmp_num<=n:
        tmp+=b[tmp_num]
        tmp_num+=i
    b[i]=(a[i-1]+tmp)%2
cnt=0
c=[]
for i in range(len(b)):
    if b[i]==1:
        cnt+=1
        c.append(str(i))
print(cnt)
if cnt!=0:
    print(" ".join(c))
Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
*a, = map(int,input().split())
box = [0]*n
cnt=0
ans=[]
for i in range(n,0,-1):
    sum = 0
    for j in range(i,n+1,i):
        sum+=box[j-1]
    if sum%2!=a[i-1]:
        ans.insert(0,i)
        cnt+=1
        a[i-1]+=1

if cnt!=0:
    print(cnt)
    print(*ans)
else:
    print(0)

Failing test case input:
5
1 0 0 0 1

Expected output:
1
5


Actual output:
2
1 5


Fixed submission (verdict: Accepted):
n = int(input())
*a, = map(int,input().split())
box = [0]*n
for i in range(n,0,-1):
    sum_box = 0
    for j in range(i,n+1,i):
        sum_box+=box[j-1]
    if sum_box%2!=a[i-1]:
        box[i-1]+=1

print(sum(box))
if sum(box):
    ans = []
    for i, x in enumerate(box):
        if x:
            ans.append(i+1)
    print(*ans)

Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = list(map(int, input().split()))
box = [0] * n
ans = []

for i in range(n-1, -1, -1):
    ms = sum(box[::i+1])
    if ms % 2 != a[i]:
        box[i] = 1
        ans.append(i+1)

print(len(ans))
print(*ans)


Failing test case input:
5
1 0 1 0 0

Expected output:
1
3


Actual output:
3
3 2 1


Fixed submission (verdict: Accepted):
n = int(input())
a = list(map(int, input().split()))
box = [0] * n
ans = []

for i in range(n-1, -1, -1):
    ms = sum(box[i::i+1])
    if ms % 2 != a[i]:
        box[i] = 1
        ans.append(i+1)

print(len(ans))
print(*ans)

Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
a = [int(i) for i in input().split()]

b = [0] * N
M = 0
ans = []
for i in range(N, 0, -1):
    count = a[i-1]
    x = 2
    while x * i <= N:
        count += b[i-1]
        x += 1
    if count % 2 == 1:
        b[i-1] = 1
        M += 1
        ans.append(i)


print(M)
print(*ans)



Failing test case input:
5
1 0 1 0 0

Expected output:
1
3


Actual output:
2
3 1


Fixed submission (verdict: Accepted):
N = int(input())
a = [int(i) for i in input().split()]

b = [0] * N
M = 0
ans = []
for i in range(N, 0, -1):
    count = a[i-1]
    x = 2
    while x * i <= N:
        count += b[x*i-1]
        x += 1
    if count % 2 == 1:
        b[i-1] = 1
        M += 1
        ans.append(i)


print(M)
print(*ans)

Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = [0] + list(map(int, input().split()))
balls = [0 for i in range(n+1)]

for i in range(1,n+1)[::-1]:
    ball_sum = sum(a[2*i::i]) % 2
    if ball_sum ^ a[i]:
        balls[i] = 1
    else:
        balls[i] = 0

print(sum(balls))
ball_list = [str(k) for k, v in enumerate(balls) if v == 1 ]
print(" ".join(ball_list))

Failing test case input:
5
1 1 0 1 0

Expected output:
1
4


Actual output:
2
1 4


Fixed submission (verdict: Accepted):
n = int(input())
a = [0] + list(map(int, input().split()))
balls = [0 for i in range(n+1)]

for i in range(1,n+1)[::-1]:
    ball_sum = sum(balls[i::i]) % 2
    if ball_sum ^ a[i]:
        balls[i] = 1

print(sum(balls))
ball_list = [str(k) for k, v in enumerate(balls) if v == 1 ]
print(" ".join(ball_list))
Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = [int(i) for i in input().split()]
A.reverse()

nums = []
memo = [0] * N
for i in range(N - 1, -1, -1):
    if sum(A[i : :i + 1]) % 2 != sum(memo[i :: i + 1]) % 2:
        memo[i] = 1
        nums.append(A[i])
        
print(sum(memo))
print(' '.join(map(str, nums)))

Failing test case input:
5
1 1 0 1 0

Expected output:
1
4


Actual output:
3
1 1 1


Fixed submission (verdict: Accepted):
N = int(input())
A = [int(i) for i in input().split()]

nums = []
memo = [0] * N
for i in range(N - 1, -1, -1):
    if A[i] != sum(memo[i :: i + 1]) % 2:
        memo[i] = 1
        nums.append(i + 1)
        
print(sum(memo))
print(' '.join(map(str, nums)))

Problem: p02972
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n = int(input())



a = list(map(int, input().split()))
box = [0]*n
for i in range(n,0,-1):
    sum_box = 0
    for j in range(i,n+1,i):
        sum_box+=box[j-1]
    if sum_box%2!=a[i-1]:
        box[i-1]+=1

if sum(box):
    ans = []
    for i, x in enumerate(box):
        if x:
            ans.append(i+1)
    print(*ans)

Failing test case input:
5
1 1 0 0 0

Expected output:
1
2


Actual output:
2


Fixed submission (verdict: Accepted):
n = int(input())

a = list(map(int, input().split()))
box = [0]*n
for i in range(n,0,-1):
    sum_box = 0
    for j in range(i,n+1,i):
        sum_box+=box[j-1]
    if sum_box%2!=a[i-1]:
        box[i-1]+=1
 
print(sum(box))
if sum(box):
    ans = []
    for i, x in enumerate(box):
        if x:
            ans.append(i+1)
    print(*ans)

Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = [None] + list(map(int, input().split()))
r = [None] * n
for i in range(n, 0, -1):
    r[i - 1] = (a[i] + sum(r[i * 2::i])) % 2
print(r.count(1))
print(*(i for i, x in enumerate(r, 1) if x))


Failing test case input:
5
1 0 0 0 1

Expected output:
1
5


Actual output:
2
2 5


Fixed submission (verdict: Accepted):
n = int(input())
a = list(map(int, input().split()))
r = [None] * (n + 1)
for i in range(n, 0, -1):
    r[i] = (a[i - 1] + sum(r[i * 2::i])) % 2
print(r.count(1))
print(*(i for i, x in enumerate(r) if x))

Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
ai = [int(x) for x in input().split()]
bn = [0] * n

for i in range(0,n):
    j = n - 1 - i
    c = 0
    for k in range(1, n):
        idx = k * (j + 1) - 1
        if  idx >= n-1:
            break
        c += bn[idx]
    
    bn[j] = (c + ai[j]) & 1


m = sum(bn)
print(m)
for i in range(0,n):
    if bn[i] == 1:
        print(i+1, end=" ")



Failing test case input:
5
1 0 0 0 1

Expected output:
1
5


Actual output:
2
1 5 

Fixed submission (verdict: Accepted):
n = int(input())
ai = [int(x) for x in input().split()]
bn = [0] * n

for i in range(0,n):
    j = n - 1 - i
    c = 0
    for k in range(2, n+1):
        idx = k * (j + 1) - 1
        if  idx > n-1:
            break
        c += bn[idx]
    
    bn[j] = (c + ai[j]) % 2


m = sum(bn)
print(m)
for i in range(0,n):
    if bn[i] == 1:
        print(i+1, end=" ")
Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = list(map(int, input().split()))
B = [0 for i in range(N)]
i = N

j = 0
while i>0:
    sum1=0
    j = i + i
    while j<=N:
        sum1 += B[j-1]
        j=j+i
    B[i-1]+=(((A[i-1]+sum1)+2)%2)
    i=i-1
count=0
for s in B:
  if s == 1 :
    count+=1
print(count)
for s in B:
  if s==1:
    print(s,end=" ")

Failing test case input:
5
1 0 0 0 1

Expected output:
1
5


Actual output:
1
1 

Fixed submission (verdict: Accepted):
N = int(input())
A = list(map(int, input().split()))
B = [0 for i in range(N)]
i = N

j = 0
while i>0:
    sum1=0
    j = i + i
    while j<=N:
        sum1 += B[j-1]
        sum1=(sum1+2)%2
        j=j+i
    B[i-1]+=(A[i-1]+sum1)
    B[i-1]=(B[i-1]+2)%2
    i=i-1
count=0
for s in B:
  if s == 1 :
    count+=1
print(count)
for i in range(N):
  if B[i]==1:
    print(i+1,end=" ")

Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = input()
r = [None] * (n + 1)
for i in range(n, 0, -1):
    r[i] = (ord(a[2 * i - 2]) + sum(r[i * 2::i])) % 2
ans = []
for i, x in enumerate(r):
    if x:
        ans.append(i)
print(r.count(1))
print(ans)

Failing test case input:
5
0 0 0 0 0

Expected output:
0

Actual output:
0
[]


Fixed submission (verdict: Accepted):
n = int(input())
a = input()
r = [None] * (n + 1)
for i in range(n, 0, -1):
    r[i] = (ord(a[2 * i - 2]) + sum(r[i * 2::i])) % 2
print(r.count(1))
print(*(i for i, x in enumerate(r) if x))

Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from sys import stdin

N = int(stdin.readline())
a = list(map(int, stdin.readline().split()))
A = [0] + a
B = [0]*(N+1)
putBall = []

for i in range(N, 0, -1):
    cnt = 1
    multiple = i
    tmp = 0
    while multiple <= N:
        tmp += B[multiple]
        cnt += 1
        multiple *= cnt
    if tmp%2 != A[i]:
        B[i] = 1
        putBall.append("%d" % i)

print(sum(B))
print(" ".join(putBall))

Failing test case input:
5
1 1 0 1 0

Expected output:
1
4


Actual output:
2
4 1


Fixed submission (verdict: Accepted):
from sys import stdin

N = int(stdin.readline())
a = list(map(int, stdin.readline().split()))
A = [0] + a
B = [0]*(N+1)
putBall = []

for i in range(N, 0, -1):
    cnt = 1
    multiple = i
    tmp = 0
    if sum(B[i::i])%2 != A[i]:
        B[i] = 1
        putBall.append("%d" % i)

print(sum(B))
print(*putBall)

Problem: p02972
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
n = int(input())
a = [0] + list(map(int, input().split()))

c = [0] * (n+1)
d = []

for i in reversed(range(1, n-1)):
    s = sum(c[::i])
    if s % 2 != a[i]:
        c[i] += 1
        d.append(str(i))

print(sum(c))
if sum(c) > 0:
    print(" ".join(d))

Failing test case input:
5
1 0 0 0 1

Expected output:
1
5


Actual output:
1
1


Fixed submission (verdict: Accepted):
n = int(input())
a = [0] + list(map(int, input().split()))

c = [0] * (n+1)
d = []

for i in reversed(range(1, n+1)):
    s = sum(c[::i])
    if s % 2 != a[i]:
        c[i] += 1
        d.append(str(i))

print(sum(c))
if sum(c) > 0:
    print(" ".join(d))
Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
*a, = map(int,input().split())
box = [0]*n
cnt=0
ans=[]
for i in range(n,0,-1):
    sum = 0
    for j in range(i,n+1,i):
        sum+=box[j-1]
    if sum%2!=a[i-1]:
        ans.append(a[i-1])
        cnt+=1
        a[i-1]+=1

if cnt!=0:
    print(cnt)
    print(*ans)
else:
    print(0)

Failing test case input:
5
1 0 1 0 0

Expected output:
1
3


Actual output:
2
1 1


Fixed submission (verdict: Accepted):
n = int(input())
*a, = map(int,input().split())
box = [0]*n
for i in range(n,0,-1):
    sum_box = 0
    for j in range(i,n+1,i):
        sum_box+=box[j-1]
    if sum_box%2!=a[i-1]:
        box[i-1]+=1

print(sum(box))
if sum(box):
    ans = []
    for i, x in enumerate(box):
        if x:
            ans.append(i+1)
    print(*ans)

Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
a = list(map(int,input().split()))
b = []
bina = 0
M = 0
for i in reversed(range(N)):
    j = 1
    while((i+1)*j < N):
        bina ^= a[(i+1)*j-1]
        j += 1
    if(bina == 1):
        M += 1
        b.append((i+1))
print(M)
print(" ".join(map(str,b)))

Failing test case input:
5
1 1 0 0 0

Expected output:
1
2


Actual output:
2
2 1


Fixed submission (verdict: Accepted):
N = int(input())
a = list(map(int,input().split()))
b = [0]*N
bina = 0
M = 0
for i in reversed(range(1,N+1)):
    next_num = i+i
    while(next_num <= N):
        bina ^= b[next_num-1]
        next_num += i
    b[i-1] = bina^a[i-1]
    bina = 0
M = sum(b)
print(M)
for i in range(N):
    if(b[i] == 1):
        print(i+1)

Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

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



if N == 1:
    if A[0] == 1:
        print(1)
        print(1)
    else:
        print(0)
    exit()




B = [0]*N

for n in range(N,0,-1):
    B[n-1] = (sum(B[2*n-1:N:n]) + A[n-1])%2

a = sum(B)
print(a)
for _ in range(a):
    print(1)


Failing test case input:
5
1 0 0 0 1

Expected output:
1
5


Actual output:
1
1


Fixed submission (verdict: Accepted):

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



if N == 1:
    if A[0] == 1:
        print(1)
        print(1)
    else:
        print(0)
    exit()




B = [0]*N

for n in range(N,0,-1):
    B[n-1] = (sum(B[2*n-1:N:n]) + A[n-1])%2

a = sum(B)
print(a)
for i in range(N):
    if B[i]:
        print(i+1)
Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

N = int(input())
A = list(map(int, input().split()))
B = []
for i in range(N-1, -1, -1):
    v = 0
    for j in range(2*i-1, N, i+1):
        if A[i] == 1:
            v += 1
    if A[i] == 1 and v % 2 == 0:
        B.append(i+1)
    elif A[i] == 0 and v % 2 == 1:
        B.append(i+1)
B.sort()
print(len(B))
if len(B) != 0:
    print(*B)

Failing test case input:
5
1 1 0 1 0

Expected output:
1
4


Actual output:
3
1 2 4


Fixed submission (verdict: Accepted):

N = int(input())
A = [0] + list(map(int, input().split()))
B = [0 for _ in range(N+1)]
ans = []
for i in range(N, 0, -1):
    v = 0
    j = i
    while j <= N:
        v += B[j]
        j += i
    if A[i] != v % 2:
        ans.append(i)
        B[i] = 1

ans.sort()
print(len(ans))
if len(ans) != 0:
    print(*ans)

Problem: p02972
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys,math,collections,itertools
input = sys.stdin.readline

N = int(input())
a = list(map(int,input().split()))
a.insert(0,0)
b = []
for i in range(N,0,-1):
    cnt = 0
    for j in range(2*i,N,i):
        if a[j] == 1:
            cnt +=1
    if (cnt%2==1 and a[i] == 0) or (cnt%2==0 and a[i] == 1):
        b.append(i)
print(len(b))
print(*b)
        


Failing test case input:
5
1 1 0 1 0

Expected output:
1
4


Actual output:
2
4 1


Fixed submission (verdict: Accepted):
import sys,math,collections,itertools
input = sys.stdin.readline

N = int(input())
a = list(map(int,input().split()))
a.insert(0,0)
b = []
c = [0 for _ in range(N+1)]
for i in range(N,0,-1):
    cnt = 0
    for j in range(2*i,N+1,i):
        if c[j] == 1:
            cnt +=1
    if (cnt%2==1 and a[i] == 0) or (cnt%2==0 and a[i] == 1):
        b.append(i)
        c[i] = 1
print(len(b))
print(*b)

Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
a = [int(x) for x in input().split()]

b = [0 for x in range(N)]

for i in reversed(range(N)):
    j = i + 1
    tmp = 0
    while j <= N:
        tmp += b[j - 1]
        j += j
    if (tmp + a[i]) % 2 == 1:
        b[i] = 1

M = sum(b)
print(M)
if M != 0:
    for i in range(N):
        if b[i] == 1:
            print(i + 1, end=' ')
    print('\n')

Failing test case input:
5
1 0 1 0 0

Expected output:
1
3


Actual output:
2
1 3 



Fixed submission (verdict: Accepted):
N = int(input())
a = [int(x) for x in input().split()]

b = [0 for x in range(N)]

for i in reversed(range(N)):
    j = i + 1
    tmp = 0
    while j <= N:
        tmp += b[j - 1]
        j += i + 1
    if (tmp + a[i]) % 2 == 1:
        b[i] = 1

M = sum(b)
print(M)
if M != 0:
    for i in range(N):
        if b[i] == 1:
            print(i + 1, end=' ')
    print('\n')
Problem: p02972
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N = int(input())
a = list(map(int,input().split()))

b = []
for n in range(N,0,-1):
  
  total = a[n-1]
  for i in range(n+n,N,n):
    total += a[i-1]
  if total!=0:
    b.append(n)

print(len(b))
for bm in b:
  print('{} '.format(bm))


Failing test case input:
5
1 0 0 0 1

Expected output:
1
5


Actual output:
2
5 
1 


Fixed submission (verdict: Accepted):
N = int(input())
a = [0]+list(map(int,input().split()))


b = []
c = [0]*(N+1)
for i in range(N,0,-1):
  
  total = 0
  for m in range(i+i,N+1,i):
    total += c[m]
  if total%2!=a[i]:
    c[i] += 1
    b.append(i)

print(len(b))
for bm in b:
  print('{} '.format(bm))

Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
a = list(map(int,input().split()))
b = [0]*N
bina = 0
M = 0
for i in reversed(range(1,N+1)):
    next_num = i+i
    while(next_num <= N):
        bina ^= b[next_num-1]
        next_num += i
    b[i-1] = bina*a[i-1]
    bina = 0
M = sum(b)
print(M)
for i in range(N):
    if(b[i] == 1):
        print(i+1)

Failing test case input:
5
1 0 1 0 0

Expected output:
1
3


Actual output:
0


Fixed submission (verdict: Accepted):
N = int(input())
a = list(map(int,input().split()))
b = [0]*N
bina = 0
M = 0
for i in reversed(range(1,N+1)):
    next_num = i+i
    while(next_num <= N):
        bina ^= b[next_num-1]
        next_num += i
    b[i-1] = bina^a[i-1]
    bina = 0
M = sum(b)
print(M)
for i in range(N):
    if(b[i] == 1):
        print(i+1)

Problem: p02972
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
aaa = list(map(int, input().split()))
M = 0
for i in range(1, N + 1):
    if sum(aaa[i - 1::i]) % 2 == 1:
        M += 1
print(M)
if M > 0:
    bbb = [1] * M
    print(*bbb)


Failing test case input:
5
1 1 0 1 0

Expected output:
1
4


Actual output:
2
1 1


Fixed submission (verdict: Accepted):
N = int(input())
aaa = list(map(int, input().split()))
M = 0
bbb = [0] * (N + 1)
for i in range(N, 0, -1):
    if (aaa[i-1] + sum(bbb[i::i])) % 2 == 1:
        M += 1
        bbb[i] = 1
print(M)
if M > 0:
    ans = [i for i, b in enumerate(bbb) if b]
    print(*ans)

Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

n = int(input())
a = list(map(int, input().split()))
ans = [0]*len(a)
for i in range(len(a),0,-1):
    if sum(ans[i-1::i])%2 != a[i-1]:
        ans[i-1] = 1
print(sum(ans))
if sum(ans) > 0:
    ans=[str(a) for a in ans]
    ans=" ".join(ans)
    print(ans)

Failing test case input:
5
1 1 0 0 0

Expected output:
1
2


Actual output:
1
0 1 0 0 0


Fixed submission (verdict: Accepted):

n = int(input())
a = list(map(int, input().split()))
ans = [0]*len(a)
for i in range(len(a),0,-1):
    if sum(ans[i-1::i])%2 != a[i-1]:
        ans[i-1] = 1
print(sum(ans))
if sum(ans) > 0:
    ans_n = [str(i+1) for i, x in enumerate(ans)  if x==1]
    ans_n=" ".join(ans_n)
    print(ans_n)
Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
A = list(map(int,input().split()))

ans = []
cur = 0
for i in range(n,0,-1):
	
	j = i
	cur = A[i-1]
	k = 1
	while j*k <= n:
		
		cur += A[j*k-1]
		k += 1
	if cur % 2 != A[i-1]:
		ans.append(i)
		A[i-1] = 1
	
print(len(ans))
if ans:
	print(*ans[::-1])

Failing test case input:
5
1 1 0 1 0

Expected output:
1
4


Actual output:
2
1 4


Fixed submission (verdict: Accepted):
n = int(input())
A = list(map(int,input().split()))
B = [0]*n
ans = []
cur = 0
for i in range(n,0,-1):
	
	j = i
	cur = 0
	k = 1
	while j*k <= n:
		
		cur += B[j*k-1]
		k += 1
	if cur % 2 != A[i-1]:
		ans.append(i)
		B[i-1] = 1
	
print(len(ans))
if ans:
	print(*ans[::-1])

Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
As = list(map(int, input().split()))
Bs = [-1] * N
for i in reversed(range(N)):
  a = As[i]
  r = 0
  for j in range(2,N):
    j2 = j*(i+1)-1
    if j2 >= N:
      break
    r += Bs[j2]
  b = (r+a)%2
  
  Bs[i] = b

Cs = []
for i in range(N):
  if Bs[i] == 1:
    Cs.append(str(Bs[i]))
print(len(Cs))
print(" ".join(Cs))


Failing test case input:
5
1 1 0 1 0

Expected output:
1
4


Actual output:
1
1


Fixed submission (verdict: Accepted):
N = int(input())
As = list(map(int, input().split()))
Bs = [-1] * N
for i in reversed(range(N)):
  a = As[i]
  r = 0
  for j in range(2,N+1):
    j2 = j*(i+1)-1
    if j2 >= N:
      break
    r += Bs[j2]
  b = (r+a)%2
  
  Bs[i] = b

Cs = []
for i in range(N):
  if Bs[i] == 1:
    Cs.append(str(i+1))
print(len(Cs))
if len(Cs) > 0:
  print(" ".join(Cs))

Problem: p02972
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n = int(input())
a = list(map(int, input().split()))
ans = [0] * (n+1)

i = n
while i > 0:
    cnt = 0
    for j in range(1, n):
        if i * j  >= n:
            break
        cnt += ans[i*j]
    if cnt % 2 != a[i-1]:
        ans[i] = 1
    i -= 1
    
print(ans.count(1))
for i in range(n):
    if ans[i] == 1:
        print(i)

Failing test case input:
5
1 0 0 0 1

Expected output:
1
5


Actual output:
2
1


Fixed submission (verdict: Accepted):
n = int(input())
a = list(map(int, input().split()))
ans = [0] * (n+1)

i = n
while i > 0:
    cnt = 0
    for j in range(1, n+1):
        if i * j  > n:
            break
        cnt += ans[i*j]
    if cnt % 2 != a[i-1]:
        ans[i] = 1
    i -= 1
    
print(ans.count(1))
for i in range(1,n+1):
    if ans[i] == 1:
        print(i)
Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from sys import stdin

N = int(stdin.readline())
a = list(map(int, stdin.readline().split()))
A = [0] + a
B = [0]*(N+1)
putBall = []

for i in range(N, 2, -1):
    cnt = 1
    multiple = i
    tmp = 0
    while multiple <= N:
        tmp += B[multiple]
        cnt += 1
        multiple *= cnt
    if tmp%2 != A[i]:
        B[i] = 1
        putBall.append("%d" % i)
print(sum(B))
print(" ".join(putBall))

Failing test case input:
5
1 1 0 0 0

Expected output:
1
2


Actual output:
0



Fixed submission (verdict: Accepted):
from sys import stdin

N = int(stdin.readline())
a = list(map(int, stdin.readline().split()))
A = [0] + a
B = [0]*(N+1)
putBall = []

for i in range(N, 0, -1):
    cnt = 1
    multiple = i
    tmp = 0
    if sum(B[i::i])%2 != A[i]:
        B[i] = 1
        putBall.append("%d" % i)

print(sum(B))
print(*putBall)

Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
n = int(input())
a = list(map(int, input().split()))
ans = [0] * (n+1)
ans_index = set([])
for i in reversed(range(1, n)):
    sum_i = sum(ans[i * 2:n:i])
    if a[i-1] == (sum_i + 1) % 2:
        ans[i] = 1
        ans_index.add(i)
    elif a[i-1] == sum_i % 2:
        ans[i] = 0
    else:
        print(-1)
        sys.exit()
print(sum(ans))
if ans_index:
    print(*ans_index)


Failing test case input:
5
1 0 0 0 1

Expected output:
1
5


Actual output:
1
1


Fixed submission (verdict: Accepted):
import sys
n = int(input())
a = list(map(int, input().split()))
ans = [0] * (n+1)
ans_index = set([])
for i in reversed(range(1, n + 1)):
    sum_i = sum(ans[i * 2:n + 1:i])
    if a[i-1] == (sum_i + 1) % 2:
        ans[i] = 1
        ans_index.add(i)
    elif a[i-1] == sum_i % 2:
        ans[i] = 0
    else:
        print(-1)
        sys.exit()
print(sum(ans))
if ans_index:
    print(*ans_index)

Problem: p02972
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = list(map(int,input().split()))

boxes = [-1]*N
for i in range(N)[::-1]:
  s = sum(A[i::i+1])
  boxes[i] = s % 2

M = sum(boxes)
print(M)
if M != 0:
  print(*boxes, sep=" ")

Failing test case input:
5
1 0 0 0 1

Expected output:
1
5


Actual output:
1
0 0 0 0 1


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

boxes = [0]*N
for i in range(N)[::-1]:
  s = sum(boxes[i::i+1])
  if s % 2 != A[i]:
    boxes[i] = 1

M = sum(boxes)
print(M)
if M != 0:
  print(*[i + 1 for i, j in enumerate(boxes) if j == 1])