Problem:


Score : 400 points

Problem Statement

There are N empty boxes arranged in a row from left to right.
The integer i is written on the i-th box from the left (1 \leq i \leq N).

For each of these boxes, Snuke can choose either to put a ball in it or to put nothing in it.

We say a set of choices to put a ball or not in the boxes is good when the following condition is satisfied:

For every integer i between 1 and N (inclusive), the total number of balls contained in the boxes with multiples of i written on them is congruent to a_i modulo 2.

Does there exist a good set of choices? If the answer is yes, find one good set of choices.

Constraints

All values in input are integers.

1 \leq N \leq 2 \times 10^5

a_i is 0 or 1.

Input

Input is given from Standard Input in the following format:

N
a_1 a_2 ... a_N

Output

If a good set of choices does not exist, print -1.

If a good set of choices exists, print one such set of choices in the following format:

M
b_1 b_2 ... b_M

where M denotes the number of boxes that will contain a ball, and b_1,\ b_2,\ ...,\ b_M are the integers written on these boxes, in any order.

Sample Input 1

3
1 0 0

Sample Output 1

1
1

Consider putting a ball only in the box with 1 written on it.

There are three boxes with multiples of 1 written on them: the boxes with 1, 2, and 3. The total number of balls contained in these boxes is 1.

There is only one box with a multiple of 2 written on it: the box with 2. The total number of balls contained in these boxes is 0.

There is only one box with a multiple of 3 written on it: the box with 3. The total number of balls contained in these boxes is 0.

Thus, the condition is satisfied, so this set of choices is good.

Sample Input 2

5
0 0 0 0 0

Sample Output 2

0

Putting nothing in the boxes can be a good set of choices.



Sample input:
3
1 0 0


Sample output:
1
1

Submission status: Wrong Answer

Solution code:
N=int(input())
a=list(map(int,input().split()))
B=[]
for i in range(N//2,N):
    if a[i]==1:
        B.append(i+1)
for i in range(N//2)[::-1]:
    asum=0 
    x=i+1
    for j in range(i,N,x):
        asum=asum+a[j]
    if asum%2!=a[i]:
        a[i]=1
        B.append(i+1)
count=sum(a)
print(count)
if count!=0:
    print(*B)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [0] + list(map(int, input().split()))
b = [0] * (n+1)
for i in range(n, 0, -1):
  x = 0
  for k in range(1, n//i + 1):
    x += b[i*k]
    #print(i, k, i*k)
  b[i] = 0 if x%2 == a[i] else 1
#print(b)
ans = [i for i in range(n+1) if b[i] == 1]
#print(ans)
print(len(ans))
if len(ans) > 0:
  print(''.join([str(a) for a in ans]))

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [0] + list(map(int, input().split()))
b = [0] * (n+1)
for i in range(n, 0, -1):
  x = 0
  for k in range(i, n//i + 1):
    x += b[k]
  b[i] = 0 if x%2 == a[i] else 1
#print(b)
ans = [i for i in range(n+1) if b[i] == 1]
#print(ans)
print(len(ans))
if len(ans) > 0:
  print(''.join([str(a) for a in ans]))

Submission status: Wrong Answer

Solution code:
n = int(input())
A = list(map(int, input().split()))
n_half = n // 2
B = [0] * n
for i in range(n_half, n):
  B[n_half:] = A[n_half:]
for i in range(n_half):
  j = n_half - i - 1
  k_sum = 0
  for k in range(j, n, j+1):
    k_sum += B[k]
    if k_sum % 2 != A[j]:
      B[j] = 1
if B == [0]*n:
  print(0)
else:
  B = [i+1 for i, x in enumerate(B) if x == 1]
  print(len(B))
  print(*B)

Submission status: Wrong Answer

Solution code:
n = int(input())
A = list(map(int, input().split()))
n_half = n // 2
B = [0] * n
for i in range(n_half, n):
  B[n_half:] = A[n_half:]
for i in range(n_half):
  j = n_half - i - 1
  k_sum = 0
  for k in range(j, n, j+1):
    k_sum += B[k]
    if k_sum % 2 != A[j]:
      B[j] = 1
if B == [0]*n:
  print(0)
else:
  B = [i+1 for i, x in enumerate(B) if x == 1]
  print(*B)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))

b = [0]*n
for i in list(range(n))[::-1]:
    b[i] = sum([a[j] for j in range(n) if j%(i+1)==0])%2

if sum(b) == 0:
    print(0)
else:
    print(' '.join(map(str, [i+1 for i in range(n) if b[i]==1])))

Submission status: Wrong Answer

Solution code:
N = int(input())
a = list(map(int,input().split()))
a = [None] + a

b = [None for _ in range(N+1)]

for i in range(N//2+1,N+1):
    b[i] = a[i]

possible = True
for i in reversed(range(1,N//2+1)):
    s = 0
    for j in range(2,int(N/i)+1):
        s = (s+a[i*j]) % 2
    if b[i] == None:
        b[i] = (a[i] + s) % 2
    elif b[i] != (a[i] + s) % 2:
        possible = False
        break

if possible:
    Ans = []
    for i in range(1,N+1):
        if b[i] == 1:
            Ans.append(str(i))
    print(len(Ans))
    ans = " ".join(Ans)
    print(ans)
else:
    print(-1)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))
B = [0]*N
C = list()
for i in range(N):
  cnt = N - i
  ans = 0
  while(cnt <= N):
    ans += A[cnt-1]
    cnt += N - i
  y = (cnt%2) - A[N-i-1]
  B[N-i-1] = y%2
print(sum(B))
for i in range(N):
  if(B[i] == 1):
    C.append(i+1)
print(*C)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))
B = [0]*N
for i in range(N):
  cnt = N - i
  ans = 0
  while(cnt <= N):
    ans += A[cnt-1]
    cnt += N - i
  B[N-i-1] = ((cnt%2) - A[N-i-1])%2
  
print(*B)

Submission status: Wrong Answer

Solution code:
n = int(input())
A = list(map(int,input().split()))
cnt = [0]*(n+1)
ans = []
for i in range(n,0,-1):
    a = A[i-1]
    s = 0
    for j in range(n//i):
        idx = i*j
        s+=cnt[idx]

    if s%2==0:
        cnt[i] = a
    else:
        cnt[i] = 1-a

    if cnt[i] ==1:
        ans.append(i)
m = sum(cnt)

print(m)
print(*ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
ans=[0]*n
res=[]
for i in range(1,n+1):
    t=sum(ans[0:n:n-i+1])%2
    if (t-a[n-i])%2==1:
      ans[n-i]=1
      res.append(n-i+1)
print(sum(ans))
print(*res)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
ans=[0]*n
res=[]
for i in range(1,n+1):
    t=sum(ans[0:n:i])%2
    if (t-a[n-i])%2==1:
      ans[n-i]=1
      res.append(n-i+1)
print(sum(ans))
print(*res)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))

m = 0
b = []

for i in range(n-1, -1, -1):
    t = sum(a[i::i+1]) % 2
    if sum(a[i::i+1]) % 2 == 1:
        m += 1
        a[i] += 1
        b.append(i+1)

print(m)
print(*b)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))

m = 0
b = []

for i in range(n-1, -1, -1):
    t = sum(a[i::i+1])
    if t != a[i]:
        a[i] = (a[i] + 1) % 2
        m += 1
        b.append(i+1)

print(m)
print(*b)

Submission status: Wrong Answer

Solution code:
def main():
    N = int(raw_input())
    a = map(int, raw_input().split())

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

    M = sum(ans)
    ans2 = []
    for i in range(N):
        if ans[i] !=0:
            ans2.append(ans[i])

    print M
    if M !=0:
	    print(' '.join(map(str, ans2)))

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
N = int(raw_input())
a = map(int, raw_input().split())

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

M = sum(ans)
ans2 = []
for i in range(N):
    if ans[i] !=0:
        ans2.append(ans[i])

print M
print(' '.join(map(str, ans2)))

Submission status: Wrong Answer

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

cond = [0] * (N+1)
ans = [0]* (N+1)


def yakusu(x):
    yakusu = [1]
    for i in range(2, int(x**0.5)+1):
        if x%i == 0:
            yakusu.append(i)
            if i != x//i:
                yakusu.append(x//i)
    
    return yakusu

for i in range(N, 0, -1):
    tmp = cond[i]
    if tmp != a[i-1]:
        ans[i] = 1
        cond[i] = 1 - tmp
        if i > 1:
            for j in yakusu(i):
                cond[j] = 1 - cond[j]

print(' '.join(map(str, ans[1:])))

Submission status: Wrong Answer

Solution code:
mod = 10**9 + 7
from collections import deque

def main():
    N = iip(False)
    A = iip(True)

    result = [0] * (N+2)
    ans = []

    for i in range(N, 0, -1):
        #s = sum(result[i::i])
        s = 0
        for j in range(10000):
            if i*j > N+1:
                break
            s += result[i*j]

        if s % 2 != A[i-1]:
            result[i] = 1


    print(sum(result))

    #print(result)
    for i, res in enumerate(result):
        if res == 1:
            ans.append(i)
    split_print_space(ans)


#####################################################ライブラリ集ここから

def split_print_space(s):
    print(" ".join([str(i) for i in s]))

def split_print_enter(s):
    print("\n".join([str(i) for i in s]))


def searchsorted(sorted_list, n, side):
    if side not in ["right", "left"]:
        raise Exception("sideはrightかleftで指定してください")

    l = 0
    r = len(sorted_list)

    if n > sorted_list[-1]:
        #print(sorted_list)
        return len(sorted_list)
    if n < sorted_list[0]:
        return 0

    while r-l > 1:
        x = (l+r)//2
        if sorted_list[x] > n:
            r = x
        elif sorted_list[x] < n:
            l = x
        else:
            if side == "left":
                r = x
            elif side == "right":
                l = x

    if side == "left":
        if sorted_list[l] == n:
            return r - 1
        else:
            return r

    if side == "right":
        if sorted_list[l] == n:
            return l + 1
        else:
            return l


def iip(listed):
    ret = [int(i) for i in input().split()]
    if len(ret) == 1 and not listed:
        return ret[0]
    return ret

def soinsuu_bunkai(n):
    ret = []
    for i in range(2, int(n**0.5)+1):
        while n % i == 0:
            n //= i
            ret.append(i)
        if i > n:
            break
    if n != 1:
        ret.append(n)
    return ret


def conbination(n, r, mod, test=False):
    if n <=0:
        return 0
    if r == 0:
        return 1
    if r < 0:
        return 0
    if r == 1:
        return n
    ret = 1
    for i in range(n-r+1, n+1):
        ret *= i
        ret = ret % mod

    bunbo = 1
    for i in range(1, r+1):
        bunbo *= i
        bunbo = bunbo % mod

    ret = (ret * inv(bunbo, mod)) % mod
    if test:
        #print(f"{n}C{r} = {ret}")
        pass
    return ret


def inv(n, mod):
    return power(n, mod-2)

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


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
mod = 10**9 + 7
from collections import deque

def main():
    N = iip(False)
    A = iip(True)

    result = [0] * (N+2)
    ans = []

    for i in range(N, 0, -1):
        cur = 0
        for j in range(1, 10000):
            if i*j >= N+2:
                break
            cur += result[i*j]
        if cur % 2 != A[i-1]:
            result[i] = 1

    result[1] = (sum(result[2:]) + A[0]) % 2

    print(sum(result))

    #print(result)
    for i, res in enumerate(result):
        if res == 1:
            ans.append(i)
    split_print_space(ans)


#####################################################ライブラリ集ここから

def split_print_space(s):
    print(" ".join([str(i) for i in s]))

def split_print_enter(s):
    print("\n".join([str(i) for i in s]))


def searchsorted(sorted_list, n, side):
    if side not in ["right", "left"]:
        raise Exception("sideはrightかleftで指定してください")

    l = 0
    r = len(sorted_list)

    if n > sorted_list[-1]:
        #print(sorted_list)
        return len(sorted_list)
    if n < sorted_list[0]:
        return 0

    while r-l > 1:
        x = (l+r)//2
        if sorted_list[x] > n:
            r = x
        elif sorted_list[x] < n:
            l = x
        else:
            if side == "left":
                r = x
            elif side == "right":
                l = x

    if side == "left":
        if sorted_list[l] == n:
            return r - 1
        else:
            return r

    if side == "right":
        if sorted_list[l] == n:
            return l + 1
        else:
            return l


def iip(listed):
    ret = [int(i) for i in input().split()]
    if len(ret) == 1 and not listed:
        return ret[0]
    return ret

def soinsuu_bunkai(n):
    ret = []
    for i in range(2, int(n**0.5)+1):
        while n % i == 0:
            n //= i
            ret.append(i)
        if i > n:
            break
    if n != 1:
        ret.append(n)
    return ret


def conbination(n, r, mod, test=False):
    if n <=0:
        return 0
    if r == 0:
        return 1
    if r < 0:
        return 0
    if r == 1:
        return n
    ret = 1
    for i in range(n-r+1, n+1):
        ret *= i
        ret = ret % mod

    bunbo = 1
    for i in range(1, r+1):
        bunbo *= i
        bunbo = bunbo % mod

    ret = (ret * inv(bunbo, mod)) % mod
    if test:
        #print(f"{n}C{r} = {ret}")
        pass
    return ret


def inv(n, mod):
    return power(n, mod-2)

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


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
mod = 10**9 + 7
from collections import deque

def main():
    N = iip(False)
    A = iip(True)

    result = [0] * (N+2)
    ans = []

    for i in range(N, 0, -1):
        cur = 0
        for j in range(1, 10000):
            if i*j >= N+2:
                break
            cur += result[i*j]
        if cur % 2 != A[i-1]:
            result[i] = 1

    result[1] = (sum(result[2:]) + A[0]) % 2

    #print(sum(result))

    print(result)
    for i, res in enumerate(result):
        if res == 1:
            ans.append(i)
    split_print_space(ans)


#####################################################ライブラリ集ここから

def split_print_space(s):
    print(" ".join([str(i) for i in s]))

def split_print_enter(s):
    print("\n".join([str(i) for i in s]))


def searchsorted(sorted_list, n, side):
    if side not in ["right", "left"]:
        raise Exception("sideはrightかleftで指定してください")

    l = 0
    r = len(sorted_list)

    if n > sorted_list[-1]:
        #print(sorted_list)
        return len(sorted_list)
    if n < sorted_list[0]:
        return 0

    while r-l > 1:
        x = (l+r)//2
        if sorted_list[x] > n:
            r = x
        elif sorted_list[x] < n:
            l = x
        else:
            if side == "left":
                r = x
            elif side == "right":
                l = x

    if side == "left":
        if sorted_list[l] == n:
            return r - 1
        else:
            return r

    if side == "right":
        if sorted_list[l] == n:
            return l + 1
        else:
            return l


def iip(listed):
    ret = [int(i) for i in input().split()]
    if len(ret) == 1 and not listed:
        return ret[0]
    return ret

def soinsuu_bunkai(n):
    ret = []
    for i in range(2, int(n**0.5)+1):
        while n % i == 0:
            n //= i
            ret.append(i)
        if i > n:
            break
    if n != 1:
        ret.append(n)
    return ret


def conbination(n, r, mod, test=False):
    if n <=0:
        return 0
    if r == 0:
        return 1
    if r < 0:
        return 0
    if r == 1:
        return n
    ret = 1
    for i in range(n-r+1, n+1):
        ret *= i
        ret = ret % mod

    bunbo = 1
    for i in range(1, r+1):
        bunbo *= i
        bunbo = bunbo % mod

    ret = (ret * inv(bunbo, mod)) % mod
    if test:
        #print(f"{n}C{r} = {ret}")
        pass
    return ret


def inv(n, mod):
    return power(n, mod-2)

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


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
mod = 10**9 + 7
from collections import deque

def main():
    N = iip(False)
    A = iip(True)

    result = [0] * (N+1)
    ans = []

    for i in range(N, 0, -1):
        cur = 0
        for j in range(1, 10000):
            if i*j >= N+1:
                break
            cur += result[i*j]
        if cur % 2 != A[i-1]:
            result[i] = 1

    print(sum(result))

    for i, res in enumerate(result):
        if res == 1:
            ans.append(i)
    split_print_space(ans)


#####################################################ライブラリ集ここから

def split_print_space(s):
    print(" ".join([str(i) for i in s]))

def split_print_enter(s):
    print("\n".join([str(i) for i in s]))


def searchsorted(sorted_list, n, side):
    if side not in ["right", "left"]:
        raise Exception("sideはrightかleftで指定してください")

    l = 0
    r = len(sorted_list)

    if n > sorted_list[-1]:
        #print(sorted_list)
        return len(sorted_list)
    if n < sorted_list[0]:
        return 0

    while r-l > 1:
        x = (l+r)//2
        if sorted_list[x] > n:
            r = x
        elif sorted_list[x] < n:
            l = x
        else:
            if side == "left":
                r = x
            elif side == "right":
                l = x

    if side == "left":
        if sorted_list[l] == n:
            return r - 1
        else:
            return r

    if side == "right":
        if sorted_list[l] == n:
            return l + 1
        else:
            return l


def iip(listed):
    ret = [int(i) for i in input().split()]
    if len(ret) == 1 and not listed:
        return ret[0]
    return ret

def soinsuu_bunkai(n):
    ret = []
    for i in range(2, int(n**0.5)+1):
        while n % i == 0:
            n //= i
            ret.append(i)
        if i > n:
            break
    if n != 1:
        ret.append(n)
    return ret


def conbination(n, r, mod, test=False):
    if n <=0:
        return 0
    if r == 0:
        return 1
    if r < 0:
        return 0
    if r == 1:
        return n
    ret = 1
    for i in range(n-r+1, n+1):
        ret *= i
        ret = ret % mod

    bunbo = 1
    for i in range(1, r+1):
        bunbo *= i
        bunbo = bunbo % mod

    ret = (ret * inv(bunbo, mod)) % mod
    if test:
        #print(f"{n}C{r} = {ret}")
        pass
    return ret


def inv(n, mod):
    return power(n, mod-2)

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


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
mod = 10**9 + 7
from collections import deque

def main():
    N = iip(False)
    A = iip(True)

    result = [0] * (N+1)
    ans = []

    for i in range(N, 0, -1):
        cur = 0
        for j in range(2, 10000):
            if i*j >= N+1:
                break
            cur += result[i*j]
        if cur % 2 != A[i-1]:
            result[i] = 1

    print(sum(result))

    for i, res in enumerate(result):
        if res == 1:
            ans.append(i)
    split_print_space(ans)




#####################################################ライブラリ集ここから

def split_print_space(s):
    print(" ".join([str(i) for i in s]))

def split_print_enter(s):
    print("\n".join([str(i) for i in s]))


def searchsorted(sorted_list, n, side):
    if side not in ["right", "left"]:
        raise Exception("sideはrightかleftで指定してください")

    l = 0
    r = len(sorted_list)

    if n > sorted_list[-1]:
        #print(sorted_list)
        return len(sorted_list)
    if n < sorted_list[0]:
        return 0

    while r-l > 1:
        x = (l+r)//2
        if sorted_list[x] > n:
            r = x
        elif sorted_list[x] < n:
            l = x
        else:
            if side == "left":
                r = x
            elif side == "right":
                l = x

    if side == "left":
        if sorted_list[l] == n:
            return r - 1
        else:
            return r

    if side == "right":
        if sorted_list[l] == n:
            return l + 1
        else:
            return l


def iip(listed):
    ret = [int(i) for i in input().split()]
    if len(ret) == 1 and not listed:
        return ret[0]
    return ret

def soinsuu_bunkai(n):
    ret = []
    for i in range(2, int(n**0.5)+1):
        while n % i == 0:
            n //= i
            ret.append(i)
        if i > n:
            break
    if n != 1:
        ret.append(n)
    return ret


def conbination(n, r, mod, test=False):
    if n <=0:
        return 0
    if r == 0:
        return 1
    if r < 0:
        return 0
    if r == 1:
        return n
    ret = 1
    for i in range(n-r+1, n+1):
        ret *= i
        ret = ret % mod

    bunbo = 1
    for i in range(1, r+1):
        bunbo *= i
        bunbo = bunbo % mod

    ret = (ret * inv(bunbo, mod)) % mod
    if test:
        #print(f"{n}C{r} = {ret}")
        pass
    return ret


def inv(n, mod):
    return power(n, mod-2)

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


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
mod = 10**9 + 7
from collections import deque

def main():
    N = iip(False)
    A = iip(True)

    result = [0 for i in range(N)]
    ans = []
    for i, need in reversed(list(enumerate(A))):
        i += 1
        #print(i, need)

        cur = need
        #print(i, need)
        for j in range(2, 10000):
            ij = i * j
            if ij-1 > N-1:
                break
            cur += result[ij-1]

        if cur % 2 == 0:
            continue
        else:
            result[i-1] = 1
            ans.append(i)
            continue

    print(len(ans))
    split_print_space(ans)

#####################################################ライブラリ集ここから

def split_print_space(s):
    print(" ".join([str(i) for i in s]))

def split_print_enter(s):
    print("\n".join([str(i) for i in s]))


def searchsorted(sorted_list, n, side):
    if side not in ["right", "left"]:
        raise Exception("sideはrightかleftで指定してください")

    l = 0
    r = len(sorted_list)

    if n > sorted_list[-1]:
        #print(sorted_list)
        return len(sorted_list)
    if n < sorted_list[0]:
        return 0

    while r-l > 1:
        x = (l+r)//2
        if sorted_list[x] > n:
            r = x
        elif sorted_list[x] < n:
            l = x
        else:
            if side == "left":
                r = x
            elif side == "right":
                l = x

    if side == "left":
        if sorted_list[l] == n:
            return r - 1
        else:
            return r

    if side == "right":
        if sorted_list[l] == n:
            return l + 1
        else:
            return l


def iip(listed):
    ret = [int(i) for i in input().split()]
    if len(ret) == 1 and not listed:
        return ret[0]
    return ret

def soinsuu_bunkai(n):
    ret = []
    for i in range(2, int(n**0.5)+1):
        while n % i == 0:
            n //= i
            ret.append(i)
        if i > n:
            break
    if n != 1:
        ret.append(n)
    return ret


def conbination(n, r, mod, test=False):
    if n <=0:
        return 0
    if r == 0:
        return 1
    if r < 0:
        return 0
    if r == 1:
        return n
    ret = 1
    for i in range(n-r+1, n+1):
        ret *= i
        ret = ret % mod

    bunbo = 1
    for i in range(1, r+1):
        bunbo *= i
        bunbo = bunbo % mod

    ret = (ret * inv(bunbo, mod)) % mod
    if test:
        #print(f"{n}C{r} = {ret}")
        pass
    return ret


def inv(n, mod):
    return power(n, mod-2)

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


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
mod = 10**9 + 7
from collections import deque

def main():
    N = iip(False)
    A = iip(True)

    result = [0 for i in range(N)]
    ans = []
    for i, need in reversed(list(enumerate(A))):
        #print(i, need)
        i += 1

        cur = need
        #print(i, need)
        for j in range(2, 10000):
            ij = i * j
            if ij-1 > N-1:
                break
            cur += result[ij-1]

        if cur % 2 == 0:
            continue
        else:
            result[i-1] = 1
            ans.append(i)
            continue

    print(len(ans))
    split_print_space(ans)

#####################################################ライブラリ集ここから

def split_print_space(s):
    print(" ".join([str(i) for i in s]))

def split_print_enter(s):
    print("\n".join([str(i) for i in s]))


def searchsorted(sorted_list, n, side):
    if side not in ["right", "left"]:
        raise Exception("sideはrightかleftで指定してください")

    l = 0
    r = len(sorted_list)

    if n > sorted_list[-1]:
        #print(sorted_list)
        return len(sorted_list)
    if n < sorted_list[0]:
        return 0

    while r-l > 1:
        x = (l+r)//2
        if sorted_list[x] > n:
            r = x
        elif sorted_list[x] < n:
            l = x
        else:
            if side == "left":
                r = x
            elif side == "right":
                l = x

    if side == "left":
        if sorted_list[l] == n:
            return r - 1
        else:
            return r

    if side == "right":
        if sorted_list[l] == n:
            return l + 1
        else:
            return l


def iip(listed):
    ret = [int(i) for i in input().split()]
    if len(ret) == 1 and not listed:
        return ret[0]
    return ret

def soinsuu_bunkai(n):
    ret = []
    for i in range(2, int(n**0.5)+1):
        while n % i == 0:
            n //= i
            ret.append(i)
        if i > n:
            break
    if n != 1:
        ret.append(n)
    return ret


def conbination(n, r, mod, test=False):
    if n <=0:
        return 0
    if r == 0:
        return 1
    if r < 0:
        return 0
    if r == 1:
        return n
    ret = 1
    for i in range(n-r+1, n+1):
        ret *= i
        ret = ret % mod

    bunbo = 1
    for i in range(1, r+1):
        bunbo *= i
        bunbo = bunbo % mod

    ret = (ret * inv(bunbo, mod)) % mod
    if test:
        #print(f"{n}C{r} = {ret}")
        pass
    return ret


def inv(n, mod):
    return power(n, mod-2)

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


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
mod = 10**9 + 7
from collections import deque

def main():
    N = iip(False)
    A = iip(True)

    result = [0 for i in range(N)]
    ans = []
    for i, need in reversed(list(enumerate(A))):
        #print(i, need)

        cur = need
        #print(i, need)
        for j in range(2, 10000):
            ij = (i+1) * j
            if ij-1 > N-1:
                break
            cur += result[ij-1]
        if cur % 2 == 0:
            continue
        else:
            result[i-1] = 1
            ans.append(i+1)
            continue

    print(len(ans))
    split_print_space(ans)

#####################################################ライブラリ集ここから

def split_print_space(s):
    print(" ".join([str(i) for i in s]))

def split_print_enter(s):
    print("\n".join([str(i) for i in s]))


def searchsorted(sorted_list, n, side):
    if side not in ["right", "left"]:
        raise Exception("sideはrightかleftで指定してください")

    l = 0
    r = len(sorted_list)

    if n > sorted_list[-1]:
        #print(sorted_list)
        return len(sorted_list)
    if n < sorted_list[0]:
        return 0

    while r-l > 1:
        x = (l+r)//2
        if sorted_list[x] > n:
            r = x
        elif sorted_list[x] < n:
            l = x
        else:
            if side == "left":
                r = x
            elif side == "right":
                l = x

    if side == "left":
        if sorted_list[l] == n:
            return r - 1
        else:
            return r

    if side == "right":
        if sorted_list[l] == n:
            return l + 1
        else:
            return l


def iip(listed):
    ret = [int(i) for i in input().split()]
    if len(ret) == 1 and not listed:
        return ret[0]
    return ret

def soinsuu_bunkai(n):
    ret = []
    for i in range(2, int(n**0.5)+1):
        while n % i == 0:
            n //= i
            ret.append(i)
        if i > n:
            break
    if n != 1:
        ret.append(n)
    return ret


def conbination(n, r, mod, test=False):
    if n <=0:
        return 0
    if r == 0:
        return 1
    if r < 0:
        return 0
    if r == 1:
        return n
    ret = 1
    for i in range(n-r+1, n+1):
        ret *= i
        ret = ret % mod

    bunbo = 1
    for i in range(1, r+1):
        bunbo *= i
        bunbo = bunbo % mod

    ret = (ret * inv(bunbo, mod)) % mod
    if test:
        #print(f"{n}C{r} = {ret}")
        pass
    return ret


def inv(n, mod):
    return power(n, mod-2)

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


if __name__ == "__main__":
    main()