Language: C++

#include <iostream>
#include <vector>


int N;

vector<bool> a_ary;
vector<bool> s_ary;
vector<bool> b_ary;


int main()
{
	cin >> N;
	a_ary = vector<bool>(N);
	s_ary = vector<bool>(N,false);
	b_ary = vector<bool>(N);
	int count = 0;

	for (int i=0; i < N; i++) {
		int a;
		cin >> a;
		a_ary.at(i) = a == 1;
	}

	for (int i = N-1; i >= 0; i--) {
		b_ary.at(i) = (a_ary.at(i) ^ s_ary.at(i));

		if (b_ary.at(i)) {
			count++;
			for (int j = 2; j < N; j++) {
				if ((i + 1) / j < 1) { break; }
				if ((i + 1) % j != 0) { continue; }

				int index = (i + 1) / j - 1;

				s_ary.at(index) = !s_ary.at(index);
			}
		}
	}

	cout << count << endl;
	for (int i = 0; i < N; i++) {
		if (b_ary.at(i)) {
			cout << i+1 << endl;
		}
	}

	return 0;
}




Compiler output:
a.cc:7:1: error: 'vector' does not name a type
    7 | vector<bool> a_ary;
      | ^~~~~~
a.cc:8:1: error: 'vector' does not name a type
    8 | vector<bool> s_ary;
      | ^~~~~~
a.cc:9:1: error: 'vector' does not name a type
    9 | vector<bool> b_ary;
      | ^~~~~~
a.cc: In function 'int main()':
a.cc:14:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   14 |         cin >> N;
      |         ^~~
      |         std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:15:9: error: 'a_ary' was not declared in this scope
   15 |         a_ary = vector<bool>(N);
      |         ^~~~~
a.cc:15:17: error: 'vector' was not declared in this scope
   15 |         a_ary = vector<bool>(N);
      |                 ^~~~~~
a.cc:15:17: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_vector.h:428:11: note:   'std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/14/vector:93:13: note:   'std::pmr::vector'
   93 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
a.cc:15:24: error: expected primary-expression before 'bool'
   15 |         a_ary = vector<bool>(N);
      |                        ^~~~
a.cc:16:9: error: 's_ary' was not declared in this scope
   16 |         s_ary = vector<bool>(N,false);
      |         ^~~~~
a.cc:16:24: error: expected primary-expression before 'bool'
   16 |         s_ary = vector<bool>(N,false);
      |                        ^~~~
a.cc:17:9: error: 'b_ary' was not declared in this scope
   17 |         b_ary = vector<bool>(N);
      |         ^~~~~
a.cc:17:24: error: expected primary-expression before 'bool'
   17 |         b_ary = vector<bool>(N);
      |                        ^~~~
a.cc:42:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   42 |         cout << count << endl;
      |         ^~~~
      |         std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:42:26: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   42 |         cout << count << endl;
      |                          ^~~~
      |                          std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~