Language: C++

#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <vector>

using namespace std;

int main() {
  uint32_t N;
  cin >> N;
  vector<uint32_t> A(N + 1);
  for (uint32_t i = 1; i < N + 1; ++i) cin >> A[i];

  uint32_t BallNum = 0;
  for (uint32_t i = N; i > 0; --i) {
    uint32_t tmp = (uint32_t)(N / i);
    uint32_t sum = 0;
    for (uint32_t j = 1; j <= tmp; ++j) {
      sum += B[i * j];
    }
    if ((sum & 0x01) != A[i]) {
      A[i] ^= 0x01;
    }
    BallNum += A[i];
  }
  cout << BallNum << endl;
  for (uint32_t i = 1; i < N + 1; ++i) {
    if (A[i]) cout << i << " ";
  }
  cout << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:3: error: 'uint32_t' was not declared in this scope
   13 |   uint32_t N;
      |   ^~~~~~~~
a.cc:9:1: note: 'uint32_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
    8 | #include <vector>
  +++ |+#include <cstdint>
    9 | 
a.cc:14:10: error: 'N' was not declared in this scope
   14 |   cin >> N;
      |          ^
a.cc:15:18: error: template argument 2 is invalid
   15 |   vector<uint32_t> A(N + 1);
      |                  ^
a.cc:16:16: error: expected ';' before 'i'
   16 |   for (uint32_t i = 1; i < N + 1; ++i) cin >> A[i];
      |                ^~
      |                ;
a.cc:16:24: error: 'i' was not declared in this scope
   16 |   for (uint32_t i = 1; i < N + 1; ++i) cin >> A[i];
      |                        ^
a.cc:18:11: error: expected ';' before 'BallNum'
   18 |   uint32_t BallNum = 0;
      |           ^~~~~~~~
      |           ;
a.cc:19:16: error: expected ';' before 'i'
   19 |   for (uint32_t i = N; i > 0; --i) {
      |                ^~
      |                ;
a.cc:19:24: error: 'i' was not declared in this scope
   19 |   for (uint32_t i = N; i > 0; --i) {
      |                        ^
a.cc:20:13: error: expected ';' before 'tmp'
   20 |     uint32_t tmp = (uint32_t)(N / i);
      |             ^~~~
      |             ;
a.cc:21:13: error: expected ';' before 'sum'
   21 |     uint32_t sum = 0;
      |             ^~~~
      |             ;
a.cc:22:18: error: expected ';' before 'j'
   22 |     for (uint32_t j = 1; j <= tmp; ++j) {
      |                  ^~
      |                  ;
a.cc:22:26: error: 'j' was not declared in this scope
   22 |     for (uint32_t j = 1; j <= tmp; ++j) {
      |                          ^
a.cc:22:31: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   22 |     for (uint32_t j = 1; j <= tmp; ++j) {
      |                               ^~~
      |                               tm
a.cc:23:7: error: 'sum' was not declared in this scope
   23 |       sum += B[i * j];
      |       ^~~
a.cc:23:14: error: 'B' was not declared in this scope
   23 |       sum += B[i * j];
      |              ^
a.cc:25:10: error: 'sum' was not declared in this scope
   25 |     if ((sum & 0x01) != A[i]) {
      |          ^~~
a.cc:28:5: error: 'BallNum' was not declared in this scope
   28 |     BallNum += A[i];
      |     ^~~~~~~
a.cc:30:11: error: 'BallNum' was not declared in this scope
   30 |   cout << BallNum << endl;
      |           ^~~~~~~
a.cc:31:16: error: expected ';' before 'i'
   31 |   for (uint32_t i = 1; i < N + 1; ++i) {
      |                ^~
      |                ;
a.cc:31:24: error: 'i' was not declared in this scope
   31 |   for (uint32_t i = 1; i < N + 1; ++i) {
      |                        ^