Language: C++

//-------------------------------------------------------------//---------------------------------------------------------------
#include <bits/stdc++.h>
using namespace std;
#include <iostream>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <math.h>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#include <cassert>
#include<algorithm>
//---------------------------------------------------------------
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define SIZE 100005
#define INF 1e18
#define all(x) x.begin(),x.end()
#define fi first
#define se second
#define vec vector
using pint = pair<int,int>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
//---------------------------------------------------------------
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const double pi = acos(-1);
const int mod = 1000000007;
struct mint {
    int64_t x;
    mint(int64_t x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {if ((x += a.x) >= mod) x -= mod;return *this;}
    mint& operator-=(const mint a) {if ((x += mod-a.x) >= mod) x -= mod;return *this;}
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
    mint operator+(const mint a) const { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(int64_t t) const {if (!t) return 1;mint a = pow(t>>1);a *= a;if (t&1) a *= *this;return a;}
    mint inv() const { return pow(mod-2);}
    mint& operator/=(const mint a) { return *this *= a.inv();}
    mint operator/(const mint a) {return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
//---------------------------------------------------------------

//↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    vll num(100005,0);
    ll n;
    cin>>n;
    vll v1(n/2),v2(n/2);
    ll g=0, m=0;
    rep(i,n){
        if(i%2==1){cin>>v1[g];g++;}
        if(i%2==0) {cin>>v2[m];m++;}
    }

    ll mode_v1;
    ll mode_v2;

    ll max = 0;
    rep(i,v1.size()){
        num[v1[i]]++;
        if(max <= num[v1[i]]){
            max = num[v1[i]];
            mode_v1 = v1[i];
        }
    }

    ll max = 0;
    rep(i,v2.size()){
        num[v2[i]]++;
        if(max <= num[v2[i]]){
            max = num[v2[i]];
            mode_v2 = v2[i];
        }
    }
    

    ll cnt = 0;
    if(mode_v1==mode_v2){
        if(num[mode_v1]>=num[mode_v2]) mode_v2 = -1;
        else mode_v1 = -1;
    }
    
    ll gg =0, mm =0;

    rep(i,n){
        if(i%2==1){
            if(v1[gg] != mode_v1) {cnt++;}
            gg++;
        }
        if(i%2==0){
            if(v2[mm] != mode_v2) {cnt++;}
            mm++;
        }
    }

    cout<<cnt<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:83:8: error: redeclaration of 'll max'
   83 |     ll max = 0;
      |        ^~~
a.cc:74:8: note: 'll max' previously declared here
   74 |     ll max = 0;
      |        ^~~