Language: C++

#include <iostream>
#include <stdio.h>
#include <fstream>
#include <iomanip>
#include <cmath>
#include <vector>
#include <climits>


int mode_func(std::vector<int> & input)
{
    int index=0,cnt = 0, max = 0;
    for (int j = 0; j < size; j++, cnt = 0)
    {
        for (int i = j; i < size; i++)
        {
            if (input[j] == input[i])
                cnt++;
        }
        if (max < cnt)
        {
            max = cnt;
            index = j;
        }
      
    }

    return input[j]
}

int diff_value ( std::vector<int> & input,int mode)
{
    int num = 0;
    for(int i = 0; i M input.size(), i++)
    {
        if(input[i] ! = mode)
        {
            num++
        }
    }

    return num;
}

int main(void)
{
    int N;
    std::cin >> N;
    std::vector<int> vec(N);
    for (int i = 0; i < N; i++)
    {
        std::cin >> vec[i];
    }
    
    int odd_num = N/2 +N%2;
    int even_num = N/2;
    std::vector<int> odd(odd_num);
    std::vector<int> even(even_num);

    for(int i = 0; i < odd_num ; i ++)
    {
        odd[i]=vec[2*i-1];
        
    }

    for (int i = 0; i < even_num; i++)
    {
        even[i] = vec[2 * i];
    }

    int mode; 
    int out;
    int out_even;
    int out_odd;
    mode = mode_func(odd);
    out_odd = diff_value(odd,mode);

    mode = mode_func(even);
    out_even = diff_value(even,mode);

    out = out_odd + out_even;

    std::cout<<out<<std::endl;
    
    

    



    return 0;
}

Compiler output:
a.cc: In function 'int mode_func(std::vector<int>&)':
a.cc:13:25: error: 'size' was not declared in this scope; did you mean 'std::size'?
   13 |     for (int j = 0; j < size; j++, cnt = 0)
      |                         ^~~~
      |                         std::size
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/range_access.h:272:5: note: 'std::size' declared here
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
a.cc:28:18: error: 'j' was not declared in this scope; did you mean 'jn'?
   28 |     return input[j]
      |                  ^
      |                  jn
a.cc:28:20: error: expected ';' before '}' token
   28 |     return input[j]
      |                    ^
      |                    ;
   29 | }
      | ~                   
a.cc: In function 'int diff_value(std::vector<int>&, int)':
a.cc:34:21: error: expected ';' before 'M'
   34 |     for(int i = 0; i M input.size(), i++)
      |                     ^~
      |                     ;
a.cc:34:22: error: 'M' was not declared in this scope
   34 |     for(int i = 0; i M input.size(), i++)
      |                      ^
a.cc:34:23: error: expected ')' before 'input'
   34 |     for(int i = 0; i M input.size(), i++)
      |        ~              ^~~~~~
      |                       )
a.cc:34:34: warning: ignoring return value of 'std::vector<_Tp, _Alloc>::size_type std::vector<_Tp, _Alloc>::size() const [with _Tp = int; _Alloc = std::allocator<int>; size_type = long unsigned int]', declared with attribute 'nodiscard' [-Wunused-result]
   34 |     for(int i = 0; i M input.size(), i++)
      |                        ~~~~~~~~~~^~
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:6:
/usr/include/c++/14/bits/stl_vector.h:992:7: note: declared here
  992 |       size() const _GLIBCXX_NOEXCEPT
      |       ^~~~
a.cc:34:41: error: expected ';' before ')' token
   34 |     for(int i = 0; i M input.size(), i++)
      |                                         ^
      |                                         ;