Language: C++

# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
using namespace std;
using lint = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } }
 
int main()
{
  int count;
  cin >> count;
  vector<int> v(count);
  vector<int> vodd(count/2);
  vector<int> voddCount(count);
  vector<int> veven(count/2);
  vector<int> vevenCount(count);
  
  int oddMax;
  int evenMax;

  rep(i, count) {
    cin >> v.at(i);
  }
  
  rep(i, count) {
    if(i%2 == 0){
      veven.at(i/2) = v.at(i);
    } else {
      vodd.at(i/2) = v.at(i);
    }
  }
  
  rep(i, count/2) {
    vevenCount.at(veven.at(i))++;
    voddCount.at(vodd.at(i))++;
  }
  
  evenMax = *max_element(vevenCount.begin(), vevenCount.end());
  oddMax = *max_element(voddCount.begin(), voddCount.end());
  
  int e = veven.size() - evenMax;
  int o = vodd.size() - oddMax;

  cout <<  e + o << endl;
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:3: error: 'cin' was not declared in this scope
   15 |   cin >> count;
      |   ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | # define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
a.cc:16:3: error: 'vector' was not declared in this scope
   16 |   vector<int> v(count);
      |   ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
  +++ |+#include <vector>
    1 | # define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
a.cc:16:10: error: expected primary-expression before 'int'
   16 |   vector<int> v(count);
      |          ^~~
a.cc:17:10: error: expected primary-expression before 'int'
   17 |   vector<int> vodd(count/2);
      |          ^~~
a.cc:18:10: error: expected primary-expression before 'int'
   18 |   vector<int> voddCount(count);
      |          ^~~
a.cc:19:10: error: expected primary-expression before 'int'
   19 |   vector<int> veven(count/2);
      |          ^~~
a.cc:20:10: error: expected primary-expression before 'int'
   20 |   vector<int> vevenCount(count);
      |          ^~~
a.cc:25:7: error: 'i' was not declared in this scope
   25 |   rep(i, count) {
      |       ^
a.cc:25:3: error: 'rep' was not declared in this scope; did you mean 'rrep'?
   25 |   rep(i, count) {
      |   ^~~
      |   rrep
a.cc:42:26: error: 'vevenCount' was not declared in this scope
   42 |   evenMax = *max_element(vevenCount.begin(), vevenCount.end());
      |                          ^~~~~~~~~~
a.cc:42:14: error: 'max_element' was not declared in this scope
   42 |   evenMax = *max_element(vevenCount.begin(), vevenCount.end());
      |              ^~~~~~~~~~~
a.cc:43:25: error: 'voddCount' was not declared in this scope
   43 |   oddMax = *max_element(voddCount.begin(), voddCount.end());
      |                         ^~~~~~~~~
a.cc:45:11: error: 'veven' was not declared in this scope
   45 |   int e = veven.size() - evenMax;
      |           ^~~~~
a.cc:46:11: error: 'vodd' was not declared in this scope; did you mean 'void'?
   46 |   int o = vodd.size() - oddMax;
      |           ^~~~
      |           void
a.cc:48:3: error: 'cout' was not declared in this scope
   48 |   cout <<  e + o << endl;
      |   ^~~~
a.cc:48:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:48:21: error: 'endl' was not declared in this scope
   48 |   cout <<  e + o << endl;
      |                     ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | # define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)