Language: C++

#include <iostream>

#define SIZE 100000

struct HASH{
	int value[SIZE];
  	int MAX;
  	int nextMAX;
  	HASH(){
    	for(int i = 0; i < SIZE; i++){
        	value[SIZE] = 0;
        }
      	MAX = 0;
      	nextMAX = 0;
    }
  	inline void CountingValue(int x){
      	++this->value[x-1];
    }
  	void CountingHindou(){
    	int max_count = 0;
      	for(int i = 0; i < SIZE; i++){
        	int tmp = value[i];
          	if(tmp > max_count){
            	max_count = tmp;
              	this->MAX = i+1;
            }
        }
      	max_count = 0;
      	for(int i = 0; i < SIZE; i++){
          	if(i == this->MAX-1){
            	continue;
            }
          
        	int tmp = value[i];
          	if(tmp > max_count){
            	max_count = tmp;
              	this->nextMAX = i+1;
            }          	
        }
    }
};

int main(void){
	int n;
  	std::cin >> n;
  	HASH odd, even;
  	for(int i = 0; i < n; i++){
      	int tmp;
      	std::cin >> tmp;
    	i%2 == 0 ? even.CountingValue(tmp) : odd.CountingValue(tmp);
    }
  	odd.CountingHindou();
  	even.CountingHindou();
  	if(odd.MAX == even.MAX){
    	if(odd.value[odd.MAX-1] > even.value[even.MAX-1]){
        	std::cout << n - odd.value[odd.MAX-1] - even.value[even.NextMAX-1];
        }
      	else if(odd.value[odd.MAX-1] < even.value[even.MAX-1]){
          	std::cout << n - even.value[even.MAX-1] - odd.value[odd.NextMAX-1];
        }
      	else{
        	int res = n - odd.value[odd.MAX-1];
          	odd.value[odd.nexMAX-1] > even.value[even.nexMAX-1] ?
              std::cout << res - odd.value[odd.nexMAX-1] :
          	  std::cout << res - even.value[even.nextMAX-1];
        }
    }
    else{
		std::cout << n - even.value[even.MAX-1] - odd.value[odd.MAX-1];    
    }
  	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:56:73: error: 'struct HASH' has no member named 'NextMAX'; did you mean 'nextMAX'?
   56 |                 std::cout << n - odd.value[odd.MAX-1] - even.value[even.NextMAX-1];
      |                                                                         ^~~~~~~
      |                                                                         nextMAX
a.cc:59:73: error: 'struct HASH' has no member named 'NextMAX'; did you mean 'nextMAX'?
   59 |                 std::cout << n - even.value[even.MAX-1] - odd.value[odd.NextMAX-1];
      |                                                                         ^~~~~~~
      |                                                                         nextMAX
a.cc:63:31: error: 'struct HASH' has no member named 'nexMAX'; did you mean 'nextMAX'?
   63 |                 odd.value[odd.nexMAX-1] > even.value[even.nexMAX-1] ?
      |                               ^~~~~~
      |                               nextMAX
a.cc:63:59: error: 'struct HASH' has no member named 'nexMAX'; did you mean 'nextMAX'?
   63 |                 odd.value[odd.nexMAX-1] > even.value[even.nexMAX-1] ?
      |                                                           ^~~~~~
      |                                                           nextMAX
a.cc:64:48: error: 'struct HASH' has no member named 'nexMAX'; did you mean 'nextMAX'?
   64 |               std::cout << res - odd.value[odd.nexMAX-1] :
      |                                                ^~~~~~
      |                                                nextMAX