Language: C++

#include <bits/stdc++.h>
#define pan(i,n) for(int i=0;i<n;i++)
#define ll long long int
#define vi vector<int>
#define pb push_back
#define INF 1e9+7
#define inf 1e5+1
#define PI 3.141592653
using namespace std; 

int main(){
    int n;
    cin>>n;
    vi v,p;
    pan(i,n){int x;
        cin>>x;
        if(i%2==0) v.pb(x);
        else p.pb(x);
    }
    int o=0,o1=-1,e=0,e1=-1,x[inf],y[inf];
    memset(x,0,sizeof(x));
    memset(y,0,sizeof(y));
    for(int i=0;i<v.size();i++) x[v[i]]++;
    int ce=*max_element(x,x+inf);
    e=distance(x,max_element(x,x+inf));
    x[e]=0;
    int ce1=*max_element(x,x+inf);
    e1=distance(x,max_element(x,x+inf));
    pan(i,p.size()) y[p[i]]++;
    int co=*max_element(y,y+inf);
    o=distance(y,max_element(y,y+inf));
    y[o]=0;
    int co1=*max_element(y,y+inf);
    o1=distance(y,max_element(y,y+inf));
    int ans=0;
    if(o!=e) ans=n-co-ce;
    else{
        ans=min(n-co-ce1,n-co1-ce);
    }
    cout<<ans;
} 


Compiler output:
a.cc: In function 'int main()':
a.cc:7:16: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
    7 | #define inf 1e5+1
      |             ~~~^~
a.cc:20:31: note: in expansion of macro 'inf'
   20 |     int o=0,o1=-1,e=0,e1=-1,x[inf],y[inf];
      |                               ^~~
a.cc:7:16: error: could not convert '(1.0e+5 + (double)1)' from 'double' to 'long unsigned int'
    7 | #define inf 1e5+1
      |             ~~~^~
      |                |
      |                double
a.cc:20:31: note: in expansion of macro 'inf'
   20 |     int o=0,o1=-1,e=0,e1=-1,x[inf],y[inf];
      |                               ^~~
a.cc:7:16: error: size of array 'x' has non-integral type 'double'
    7 | #define inf 1e5+1
      |             ~~~^~
a.cc:20:31: note: in expansion of macro 'inf'
   20 |     int o=0,o1=-1,e=0,e1=-1,x[inf],y[inf];
      |                               ^~~
a.cc:7:16: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
    7 | #define inf 1e5+1
      |             ~~~^~
a.cc:20:38: note: in expansion of macro 'inf'
   20 |     int o=0,o1=-1,e=0,e1=-1,x[inf],y[inf];
      |                                      ^~~
a.cc:7:16: error: could not convert '(1.0e+5 + (double)1)' from 'double' to 'long unsigned int'
    7 | #define inf 1e5+1
      |             ~~~^~
      |                |
      |                double
a.cc:20:38: note: in expansion of macro 'inf'
   20 |     int o=0,o1=-1,e=0,e1=-1,x[inf],y[inf];
      |                                      ^~~
a.cc:7:16: error: size of array 'y' has non-integral type 'double'
    7 | #define inf 1e5+1
      |             ~~~^~
a.cc:20:38: note: in expansion of macro 'inf'
   20 |     int o=0,o1=-1,e=0,e1=-1,x[inf],y[inf];
      |                                      ^~~
a.cc:24:28: error: invalid operands of types 'int [1]' and 'double' to binary 'operator+'
   24 |     int ce=*max_element(x,x+inf);
      |                           ~^
      |                           |
      |                           int [1]
a.cc:25:33: error: invalid operands of types 'int [1]' and 'double' to binary 'operator+'
   25 |     e=distance(x,max_element(x,x+inf));
      |                                ~^
      |                                |
      |                                int [1]
a.cc:27:29: error: invalid operands of types 'int [1]' and 'double' to binary 'operator+'
   27 |     int ce1=*max_element(x,x+inf);
      |                            ~^
      |                            |
      |                            int [1]
a.cc:28:34: error: invalid operands of types 'int [1]' and 'double' to binary 'operator+'
   28 |     e1=distance(x,max_element(x,x+inf));
      |                                 ~^
      |                                 |
      |                                 int [1]
a.cc:30:28: error: invalid operands of types 'int [1]' and 'double' to binary 'operator+'
   30 |     int co=*max_element(y,y+inf);
      |                           ~^
      |                           |
      |                           int [1]
a.cc:31:33: error: invalid operands of types 'int [1]' and 'double' to binary 'operator+'
   31 |     o=distance(y,max_element(y,y+inf));
      |                                ~^
      |                                |
      |                                int [1]
a.cc:33:29: error: invalid operands of types 'int [1]' and 'double' to binary 'operator+'
   33 |     int co1=*max_element(y,y+inf);
      |                            ~^
      |                            |
      |                            int [1]
a.cc:34:34: error: invalid operands of types 'int [1]' and 'double' to binary 'operator+'
   34 |     o1=distance(y,max_element(y,y+inf));
      |                                 ~^
      |                                 |
      |                                 int [1]