Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

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

b=[]
M = 0
count = [0 for _ in range(N)]
for i in reversed(range(1,N+1)):
    if count[i-1]%2 == a[i-1]: continue
    else:
        for j in range(1,int(i**0.5)+1):
            if i%j==0:
                count[j]+=1
                if j!=i//j:
                    count[i//j]+=1
        M+=1
        b.append(i)
print(M)
if M!=0:
    print(*b)


Fixed submission:
import sys
input = sys.stdin.readline

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

b=[]
M = 0
count = [0 for _ in range(N+1)]
for i in reversed(range(1,N+1)):
    if count[i]%2 == a[i-1]: continue
    else:
        for j in range(1,int(i**0.5)+1):
            if i%j==0:
                count[j]+=1
                if j!=i//j:
                    count[i//j]+=1
        M+=1
        b.append(i)
print(M)
if M!=0:
    print(*b)

Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

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

b=[]
M = 0
count = [0 for _ in range(N)]
for i in reversed(range(1,N+1)):
    if count[i-1]%2 == a[i-1]: continue
    else:
        for j in range(1,int(i**0.5)+1):
            if i%j==0:
                count[j]+=1
                if j!=i//j:
                    count[i//j]+=1
        M+=1
        b.append(i)
print(M)
if M!=0:
    print(*b)


Fixed submission:
import sys
input = sys.stdin.readline

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

b=[]
M = 0
count = [0 for _ in range(N+1)]
for i in reversed(range(1,N+1)):
    if count[i]%2 == a[i-1]: continue
    else:
        for j in range(1,int(i**0.5)+1):
            if i%j==0:
                count[j]+=1
                if j!=i//j:
                    count[i//j]+=1
        M+=1
        b.append(i)
print(M)
if M!=0:
    print(*b)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N = int(input())
a = list(map(int, input().split()))
b = []
c = np.zeros(N)
ans = 0
for i in reversed(range(1, N+1)):
    if (a[i-1] % 2 == 0 and c[i-1]%2 == 1) or (a[i-1] % 2 == 1 and c[i-1]%2 == 0):
        b.append(i)
        ans += 1
        for j in range(1,N+1):
            if i%j == 0:
                c[j-1] += 1

print(ans)
if ans != 0:
    print(*b)


Fixed submission:
import sys
input = sys.stdin.readline

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

b=[]
M = 0
count = [0 for _ in range(N+1)]
for i in reversed(range(1,N+1)):
    if count[i]%2 == a[i-1]: continue
    else:
        for j in range(1,int(i**0.5)+1):
            if i%j==0:
                count[j]+=1
                if j!=i//j:
                    count[i//j]+=1
        M+=1
        b.append(i)
print(M)
if M!=0:
    print(*b)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N = int(input())
a = list(map(int, input().split()))
b = []
c = np.zeros(N)
ans = 0
for i in reversed(range(1, N+1)):
    j = 2
    count = 0
    while True:
        if i*j <= N:
            count += c[i*j-1]
            j += 1
        else:
            break
    if (a[i-1] % 2 == 0 and count%2 == 1) or (a[i-1] % 2 == 1 and count%2 == 0):
        b.append(i)
        ans += 1
        c[i-1] = 1

print(ans)
if ans != 0:
    print(*b)


Fixed submission:
import sys
input = sys.stdin.readline

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

b=[]
M = 0
count = [0 for _ in range(N+1)]
for i in reversed(range(1,N+1)):
    if count[i]%2 == a[i-1]: continue
    else:
        for j in range(1,int(i**0.5)+1):
            if i%j==0:
                count[j]+=1
                if j!=i//j:
                    count[i//j]+=1
        M+=1
        b.append(i)
print(M)
if M!=0:
    print(*b)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N = int(input())
a = list(map(int, input().split()))
b = []
c = np.zeros(N)
ans = 0
for i in reversed(range(1, N+1)):
    j = 2
    count = 0
    while True:
        if i*j <= N:
            count += c[i*j-1]
            j += 1
        else:
            break
    if (a[i-1] % 2 == 0 and count%2 == 1) or (a[i-1] % 2 == 1 and count%2 == 0):
        b.append(i)
        c[i-1] = 1
        ans += 1
    

b.reverse()
print(ans)
if ans != 0:
    print(*b)


Fixed submission:
import sys
input = sys.stdin.readline

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

b=[]
M = 0
count = [0 for _ in range(N+1)]
for i in reversed(range(1,N+1)):
    if count[i]%2 == a[i-1]: continue
    else:
        for j in range(1,int(i**0.5)+1):
            if i%j==0:
                count[j]+=1
                if j!=i//j:
                    count[i//j]+=1
        M+=1
        b.append(i)
print(M)
if M!=0:
    print(*b)