Language: C++

#include <stdio.h>
int main(){
  int j,i,n, a[100000],num[50000],max,ans;
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d",&a[i]);
  }
  ans=0;
  int tempmode, tempcnt,mode,cnt;
int s1,s2,s3,s4,w1,w2;
 mode = 0;
 cnt = 0;
 for(i = 1; i <= n/2; i++){
  tempcnt = 1;
  for(j = i + 1; j < n/2; j++){
   if( a[2i] == a[2j]){
    tempcnt++;
   }
  }
  if( tempcnt > cnt){
   cnt = tempcnt;
   mode = num[2i]; 
  }
 }
 s1=cnt;
  w1=mode;
  
   mode = 0;
 cnt = 0;
 for(i = 1; i <= n/2; i++){
  tempcnt = 1;
  for(j = i + 1; j < n/2; j++){
   if( a[2i] == a[2j] && a[2i]!=w1 ){
    tempcnt++;
   }
  }
  if( tempcnt > cnt){
   cnt = tempcnt;
   mode = num[2i]; 
  }
 }
  
  s2=cnt;
  
   mode = 0;
 cnt = 0;
 for(i = 1; i <= n/2; i++){
  tempcnt = 1;
  for(j = i + 1; j < n/2; j++){
   if( a[2i-1] == a[2j-1]){
    tempcnt++;
   }
  }
  if( tempcnt > cnt){
   cnt = tempcnt;
   mode = num[2i-1]; 
  }
 }
 
  s3=cnt;
  w2=mode;
   mode = 0;
 cnt = 0;
 for(i = 1; i <= n/2; i++){
  tempcnt = 1;
  for(j = i + 1; j < n/2; j++){
   if( a[2i-1] == a[2j-1] && a[2i-1]!=w2){
    tempcnt++;
   }
  }
  if( tempcnt > cnt){
   cnt = tempcnt;
   mode = num[2i-1]; 
  }
 }
  s4=cnt;
  
  if(w1!=w2) printf("%d",n-s1-s3);
  else if (s1+s4>s2+s3) printf("%d",n-s1-s4);
  else printf("%d",n-s2-s3);
  return 0;
}
  


Compiler output:
a.cc: In function 'int main()':
a.cc:16:9: error: invalid types 'int [100000][__complex__ int]' for array subscript
   16 |    if( a[2i] == a[2j]){
      |         ^
a.cc:16:18: error: invalid types 'int [100000][__complex__ int]' for array subscript
   16 |    if( a[2i] == a[2j]){
      |                  ^
a.cc:22:14: error: invalid types 'int [50000][__complex__ int]' for array subscript
   22 |    mode = num[2i];
      |              ^
a.cc:33:9: error: invalid types 'int [100000][__complex__ int]' for array subscript
   33 |    if( a[2i] == a[2j] && a[2i]!=w1 ){
      |         ^
a.cc:33:18: error: invalid types 'int [100000][__complex__ int]' for array subscript
   33 |    if( a[2i] == a[2j] && a[2i]!=w1 ){
      |                  ^
a.cc:33:27: error: invalid types 'int [100000][__complex__ int]' for array subscript
   33 |    if( a[2i] == a[2j] && a[2i]!=w1 ){
      |                           ^
a.cc:39:14: error: invalid types 'int [50000][__complex__ int]' for array subscript
   39 |    mode = num[2i];
      |              ^
a.cc:50:9: error: invalid types 'int [100000][__complex__ int]' for array subscript
   50 |    if( a[2i-1] == a[2j-1]){
      |         ^
a.cc:50:20: error: invalid types 'int [100000][__complex__ int]' for array subscript
   50 |    if( a[2i-1] == a[2j-1]){
      |                    ^
a.cc:56:14: error: invalid types 'int [50000][__complex__ int]' for array subscript
   56 |    mode = num[2i-1];
      |              ^
a.cc:67:9: error: invalid types 'int [100000][__complex__ int]' for array subscript
   67 |    if( a[2i-1] == a[2j-1] && a[2i-1]!=w2){
      |         ^
a.cc:67:20: error: invalid types 'int [100000][__complex__ int]' for array subscript
   67 |    if( a[2i-1] == a[2j-1] && a[2i-1]!=w2){
      |                    ^
a.cc:67:31: error: invalid types 'int [100000][__complex__ int]' for array subscript
   67 |    if( a[2i-1] == a[2j-1] && a[2i-1]!=w2){
      |                               ^
a.cc:73:14: error: invalid types 'int [50000][__complex__ int]' for array subscript
   73 |    mode = num[2i-1];
      |              ^