Language: C++

using namespace std;

int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  vector<int> b(N);
  int x;
  for (int i = 0; i < N; i++) {
    cin >> a.at(i);
  }
  for (int i = N - 1; i >= 0; i--) {
    int n = N / (i + 1);
    int count = 0;
    if (n > 1) {
    for (int j = 1; j < n; j++) {
     if (b.at((i + 1) * (j + 1) - 1) == 1) {
       count++;
     }
    }
    }
    count = count % 2;
    if (count != a.at(i)) {
      b.at(i) = 1;
      x++;
    }
  }
  if (x == 0) {
    cout << 0 <<endl;
  }
  else {
    cout << x <<endl;
    for (int i = 0; i < N; i++) {
      if (i != N -1 ) {
        if (b.at(i) == 1) {
        cout << i + 1 << " ";
        }
      }
      else {
        if (b.at(i) == 1) {
        cout << i + 1 <<endl;
        }
        else {
        cout <<endl;
        }
      }
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:3: error: 'cin' was not declared in this scope
    5 |   cin >> N;
      |   ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:6:3: error: 'vector' was not declared in this scope
    6 |   vector<int> a(N);
      |   ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
  +++ |+#include <vector>
    1 | using namespace std;
a.cc:6:10: error: expected primary-expression before 'int'
    6 |   vector<int> a(N);
      |          ^~~
a.cc:7:10: error: expected primary-expression before 'int'
    7 |   vector<int> b(N);
      |          ^~~
a.cc:10:12: error: 'a' was not declared in this scope
   10 |     cin >> a.at(i);
      |            ^
a.cc:17:10: error: 'b' was not declared in this scope
   17 |      if (b.at((i + 1) * (j + 1) - 1) == 1) {
      |          ^
a.cc:23:18: error: 'a' was not declared in this scope
   23 |     if (count != a.at(i)) {
      |                  ^
a.cc:24:7: error: 'b' was not declared in this scope
   24 |       b.at(i) = 1;
      |       ^
a.cc:29:5: error: 'cout' was not declared in this scope
   29 |     cout << 0 <<endl;
      |     ^~~~
a.cc:29:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:29:17: error: 'endl' was not declared in this scope
   29 |     cout << 0 <<endl;
      |                 ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | using namespace std;
a.cc:32:5: error: 'cout' was not declared in this scope
   32 |     cout << x <<endl;
      |     ^~~~
a.cc:32:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:32:17: error: 'endl' was not declared in this scope
   32 |     cout << x <<endl;
      |                 ^~~~
a.cc:32:17: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
a.cc:35:13: error: 'b' was not declared in this scope
   35 |         if (b.at(i) == 1) {
      |             ^
a.cc:40:13: error: 'b' was not declared in this scope
   40 |         if (b.at(i) == 1) {
      |             ^