criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
int64_t MOD=1000000007;

vector<pair<int,int>> CU(vector<int> S){
  vector<pair<int,int>> SS;
  sort(S.begin(),S.end());
  int temp=S.at(0);
  SS.push_back(1,temp);
  for(int i=1;i<(int)S.size();i++){
    int s=S.size();
    temp=S.at(i);
    if(S.at(i)==S.at(i-1)) SS.at(s-1).first++;
    else SS.push_back(make_pair(1,temp);
  }
  sort(SS.begin(),SS.end());
  reverse(SS.begin(),SS.end());
  return SS
}


int main() {
  int N,o,e;
  e=N/2;
  o=(N+1)/2;
  vector<int> O(o);
  vector<int> E(e);
  for(int i=0;i<e;i++){
    cin>>O.at(i)>>E.at(i);
  }
  if(o!=e)cin>>o.at(o-1);
  vector<pair<int,int>> OO;
  vector<pair<int,int>> EE;
  OO=CU(O);
  EE=CU(E);
  if(OO.at(0).second!=EE.at(i).second) cout<< N-(OO.at(0).second+EE.at(0).second)<<endl;
  else cout<<N-max(OO.at(1).second+EE.at(0).second,OO.at(0).second+EE.at(1).second)<<endl;
}


Compiler output:
a.cc: In function 'std::vector<std::pair<int, int> > CU(std::vector<int>)':
a.cc:10:15: error: no matching function for call to 'std::vector<std::pair<int, int> >::push_back(int, int&)'
   10 |   SS.push_back(1,temp);
      |   ~~~~~~~~~~~~^~~~~~~~
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; value_type = std::pair<int, int>]'
 1283 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; value_type = std::pair<int, int>]'
 1300 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note:   candidate expects 1 argument, 2 provided
a.cc:15:40: error: expected ')' before ';' token
   15 |     else SS.push_back(make_pair(1,temp);
      |                      ~                 ^
      |                                        )
a.cc:19:12: error: expected ';' before '}' token
   19 |   return SS
      |            ^
      |            ;
   20 | }
      | ~           
a.cc: In function 'int main()':
a.cc:32:18: error: request for member 'at' in 'o', which is of non-class type 'int'
   32 |   if(o!=e)cin>>o.at(o-1);
      |                  ^~
a.cc:37:29: error: 'i' was not declared in this scope
   37 |   if(OO.at(0).second!=EE.at(i).second) cout<< N-(OO.at(0).second+EE.at(0).second)<<endl;
      |                             ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
int64_t MOD=1000000007;

vector<pair<int,int>> CU(vector<int> S){
  vector<pair<int,int>> SS;
  sort(S.begin(),S.end());
  SS.push_back(1,S.at(0));
  for(int i=1;i<(int)S.size();i++){
    int s=S.size();
    if(S.at(i)==S.at(i-1)) SS.at(s-1).first++;
    else SS.push_back(make_pair(1,S.at(i)));
  }
  sort(SS.begin(),SS.end());
  reverse(SS.begin(),SS.end());
  return SS
}


int main() {
  int N,o,e;
  e=N/2;
  o=(N+1)/2;
  vector<int> O(o);
  vector<int> E(e);
  for(int i=0;i<e;i++){
    cin>>O.at(i)>>E.at(i);
  }
  if(o!=e)cin>>o.at(o-1);
  vector<pair<int,int>> OO;
  vector<pair<int,int>> EE;
  OO=CU(O);
  EE=CU(E);
  if(OO.at(0).second!=EE.at(i).second) cout<< N-(OO.at(0).second+EE.at(0).second)<<endl;
  else cout<<N-max(OO.at(1).second+EE.at(0).second,OO.at(0).second+EE.at(1).second)<<endl;
}


Compiler output:
a.cc: In function 'std::vector<std::pair<int, int> > CU(std::vector<int>)':
a.cc:9:15: error: no matching function for call to 'std::vector<std::pair<int, int> >::push_back(int, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
    9 |   SS.push_back(1,S.at(0));
      |   ~~~~~~~~~~~~^~~~~~~~~~~
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; value_type = std::pair<int, int>]'
 1283 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; value_type = std::pair<int, int>]'
 1300 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note:   candidate expects 1 argument, 2 provided
a.cc:17:12: error: expected ';' before '}' token
   17 |   return SS
      |            ^
      |            ;
   18 | }
      | ~           
a.cc: In function 'int main()':
a.cc:30:18: error: request for member 'at' in 'o', which is of non-class type 'int'
   30 |   if(o!=e)cin>>o.at(o-1);
      |                  ^~
a.cc:35:29: error: 'i' was not declared in this scope
   35 |   if(OO.at(0).second!=EE.at(i).second) cout<< N-(OO.at(0).second+EE.at(0).second)<<endl;
      |                             ^
Language: C++

#include <iostream>
#include <cmath>
#include <string.h>
#include <iomanip>
#include <math.h>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;

#define INF 100000000;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
typedef long long ll;
int main(){
    int n;
    int v[100007];
    cin >> n;
    rep(i,n) cin >> v[i];
    
    map<int,int> cnt[2];
    rep(i,n) cnt[i%2][v[i]]++;

    vector<pair<int, int>> pairs[2];
    for(int i = 0; i < 2; i++){
        cnt[i][0] = 0;
        for(auto&& p : cnt[i]) pairs[i].push_back({p.second, p.first});
        sort(pairs[i].rbegin(), pairs[i].rend());
    }

    int ans;
    if (pairs[0][0].second != pairs[1][0].second){
        ans = N - pairs[0][0].first - pairs[1][0].first;
    }else {
        ans = N - max(pairs[0][1].first + pairs[1][0].first, pairs[0][0].first + pairs[1][1].first);
    }

    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:15: error: 'N' was not declared in this scope
   32 |         ans = N - pairs[0][0].first - pairs[1][0].first;
      |               ^
a.cc:34:15: error: 'N' was not declared in this scope
   34 |         ans = N - max(pairs[0][1].first + pairs[1][0].first, pairs[0][0].first + pairs[1][1].first);
      |               ^
Language: C++

#include <iostream>
#include <cmath>
#include <string.h>
#include <iomanip>
#include <math.h>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;

#define INF 100000000;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
typedef long long ll;
int main(){
    int n;
    int v[100007];
    cin >> n;
    rep(i,n) cin >> v[i];
    
    map<int,int> cnt[2];
    rep(i,n) cnt[i%2][v[i]]++;

    vector<pair<int, int>> pairs[2];
    for(int i = 0; i < 2; i++){
        cnt[i][0] = 0;
        for(auto&& p : cnt[i]) pairs[i].push_back({p.second.p.first});
        sort(pairs[i].rbegin(), pairs[i].rend());
    }

    int ans;
    if (pairs[0][0].second != pairs[1][0].second){
        ans = N - pairs[0][0].first - pairs[1][0].first;
    }else {
        ans = N - max(pairs[0][1].first + pairs[1][0].first, pairs[0][0].first + pairs[1][1].first);
    }

    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:61: error: request for member 'p' in 'p.std::pair<const int, int>::second', which is of non-class type 'int'
   26 |         for(auto&& p : cnt[i]) pairs[i].push_back({p.second.p.first});
      |                                                             ^
a.cc:26:50: error: no matching function for call to 'std::vector<std::pair<int, int> >::push_back(<brace-enclosed initializer list>)'
   26 |         for(auto&& p : cnt[i]) pairs[i].push_back({p.second.p.first});
      |                                ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:7:
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; value_type = std::pair<int, int>]'
 1283 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:35: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const std::vector<std::pair<int, int> >::value_type&' {aka 'const std::pair<int, int>&'}
 1283 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; value_type = std::pair<int, int>]'
 1300 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<std::pair<int, int> >::value_type&&' {aka 'std::pair<int, int>&&'}
 1300 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
a.cc:32:15: error: 'N' was not declared in this scope
   32 |         ans = N - pairs[0][0].first - pairs[1][0].first;
      |               ^
a.cc:34:15: error: 'N' was not declared in this scope
   34 |         ans = N - max(pairs[0][1].first + pairs[1][0].first, pairs[0][0].first + pairs[1][1].first);
      |               ^
Language: Java

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.StringTokenizer;

public class c {
    public static void main(String[] args) throws IOException {
        BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(f.readLine());
        int[] ar = new int[n];
        StringTokenizer tokenizer = new StringTokenizer(f.readLine());
        for (int i = 0; i < n; i++) {
            ar[i] = Integer.parseInt(tokenizer.nextToken());
        }

        int toReplace = 0;
        HashMap<Integer, Integer> occurence = new HashMap<Integer, Integer>();
        int mostOccured = 0;
        int mostOccuredNum = -1;
        int secondMostOccured = 0;
        for (int i = 0; i < n; i += 2) {
            int num = ar[i];
            if (!occurence.containsKey(num)) {
                occurence.put(num, 1);
            } else {
                occurence.put(num, occurence.get(num) + 1);
            }

            if (occurence.get(num) > mostOccured) {
                mostOccured = occurence.get(num);
                mostOccuredNum = num;
            }
            if (num != mostOccuredNum) {
                if (occurence.get(num) > secondMostOccured) {
                    secondMostOccured = occurence.get(num);

                }
            }
        }

        occurence = new HashMap<Integer, Integer>();
        int mostOccured2 = 0;
        int mostOccuredNum2 = -1;
        int secondMostOccured2 = 0;
        for (int i = 1; i < n; i += 2) {
            int num = ar[i];
            if (!occurence.containsKey(num)) {
                occurence.put(num, 1);
            } else {
                occurence.put(num, occurence.get(num) + 1);
            }

            if (occurence.get(num) > mostOccured2) {
                mostOccured2 = occurence.get(num);
                mostOccuredNum2 = num;
            }
            if (num != mostOccuredNum2) {
                if (occurence.get(num) > secondMostOccured2) {
                    secondMostOccured2 = occurence.get(num);
                }
            }
        }
        
        if (mostOccuredNum != mostOccuredNum2) {
            System.out.println(n - mostOccured - mostOccured2);
        } else {
            System.out.println(Math.min(n - mostOccured - secondMostOccured2, n - mostOccured2 - secondMostOccured));
        }
    }
}


Compiler output:
Main.java:7: error: class c is public, should be declared in a file named c.java
public class c {
       ^
1 error
Language: C++


#include <iostream>
#include <cstdio>
#include <bits/stdc++.h>
#include <algorithm>
#include <iomanip>
#include <cstring>
#include <cmath>
//#include <minmax.h>
#define DETERMINATION main
#define lldin(a) scanf("%lld",&a)
#define din(a) scanf("%d",&a)
#define reset(a,b) memset(a,b,sizeof(a))
const int INF=0x3f3f3f3f;
const int LIM=1e5+75;
using namespace std;
typedef long long ll;
/**you can feel the pulse of your destiny...
The nervous feeling fills you with determination.**/
int n;
int a[LIM];
struct nu
{
   int value,mx;
}hhhhhh[LIM],qqqqqq[LIM];
bool cmp(nu a,nu b)
{
    return a.mx>b.mx;
}
int DETERMINATION()
{
    cin>>n;
    for(int i=1; i<=n; i++)
        cin>>a[i];
    for(int i=1; i<=n; i+=2)//找出奇数位上出现次数最多的数字
        {
          hhhhhh[a[i]].mx++;
          hhhhhh[a[i]].value=a[i];
        }
    for(int i=2; i<=n; i+=2)//找出偶数位上出现次数最多的数字
        {
          qqqqqq[a[i]].mx++;
          qqqqqq[a[i]].value=a[i];
        }
    ll ans=0;
    sort(qqqqqq+1,qqqqqq+LIM+1,cmp);//通过排序找出最大值，由于只有1e5个元素，排序不会造成什么时间上的浪费。
    sort(hhhhhh+1,hhhhhh+LIM+1,cmp);
    //cout<<qqqqqq[1].value<<" "<<hhhhhh[1].value<<endl;
    if(qqqqqq[1].value==hhhhhh[1].value)//如果奇数位和偶数位都是同一个数字出现次数最多。
    {
       ans=min((n-hhhhhh[2].mx-qqqqqq[1].mx),(n-hhhhhh[1].mx-qqqqqq[2].mx));
       //那么枚举两种情况来求最小值。
    }
    else
      ans=n-hhhhhh[1].mx-qqqqqq[1].mx;//不然照常计算即可。
    cout<<ans<<endl;
    return 0;
}
 

Compiler output:
a.cc:59:1: error: extended character   is not valid in an identifier
   59 |  
      | ^
a.cc:59:1: error: '\U000000a0' does not name a type
   59 |  
      | ^
Language: C++

35	34	C:\Users\juuu\Desktop\2.cpp	[Error] no match for 'operator<' (operand types are 'std::basic_ostream<char>' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}')

Compiler output:
a.cc:1:19: error: stray '\' in program
    1 | 35      34      C:\Users\juuu\Desktop\2.cpp     [Error] no match for 'operator<' (operand types are 'std::basic_ostream<char>' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}')
      |                   ^
a.cc:1:25: error: stray '\' in program
    1 | 35      34      C:\Users\juuu\Desktop\2.cpp     [Error] no match for 'operator<' (operand types are 'std::basic_ostream<char>' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}')
      |                         ^
a.cc:1:30: error: stray '\' in program
    1 | 35      34      C:\Users\juuu\Desktop\2.cpp     [Error] no match for 'operator<' (operand types are 'std::basic_ostream<char>' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}')
      |                              ^
a.cc:1:38: error: stray '\' in program
    1 | 35      34      C:\Users\juuu\Desktop\2.cpp     [Error] no match for 'operator<' (operand types are 'std::basic_ostream<char>' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}')
      |                                      ^
a.cc:1:70: warning: multi-character literal with 9 characters exceeds 'int' size of 4 bytes
    1 | 35      34      C:\Users\juuu\Desktop\2.cpp     [Error] no match for 'operator<' (operand types are 'std::basic_ostream<char>' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}')
      |                                                                      ^~~~~~~~~~~
a.cc:1:101: warning: multi-character literal with 24 characters exceeds 'int' size of 4 bytes
    1 | 35      34      C:\Users\juuu\Desktop\2.cpp     [Error] no match for 'operator<' (operand types are 'std::basic_ostream<char>' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}')
      |                                                                                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:1:132: warning: multi-character literal with 69 characters exceeds 'int' size of 4 bytes
    1 | 35      34      C:\Users\juuu\Desktop\2.cpp     [Error] no match for 'operator<' (operand types are 'std::basic_ostream<char>' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}')
      |                                                                                                                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:1:1: error: expected unqualified-id before numeric constant
    1 | 35      34      C:\Users\juuu\Desktop\2.cpp     [Error] no match for 'operator<' (operand types are 'std::basic_ostream<char>' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}')
      | ^~
Language: C++

#include <iostream>
#include <utility>
#include <map>
#include <algorithm>
using namespace std;
int main(){
  int n;
  cin >> n;
  map<int,int> c[2];
  for(int i = 0; n > i; i++){
  	int a;
    cin >> a;
    c[i%2][a]++;
  }
  int ans = 0;
  
  for(int i = 0; 2 > i; i++){
  	pair<int,int> Max = {-1, 0}; 
    for(auot itr : c[i])
      Max = max(Max, {itr.second, itr.first});
    
    ans += n/2 - Max.first;
  }
  cout << ans << endl;
  
  return 0;  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:9: error: 'auot' was not declared in this scope; did you mean 'auto'?
   19 |     for(auot itr : c[i])
      |         ^~~~
      |         auto
a.cc:20:45: error: expected primary-expression before ')' token
   20 |       Max = max(Max, {itr.second, itr.first});
      |                                             ^
a.cc:20:45: error: expected ';' before ')' token
   20 |       Max = max(Max, {itr.second, itr.first});
      |                                             ^
      |                                             ;
Language: C++

#include <iostream>
#include <cstring>
#include <vector>
#include <map>
using namespace std;
const int N=100000+10;
int n,a[N];
vector< pair<int,int> > v[2];
map<int,int> mp;
int main(){
    scanf("%d",&n);
    for(int i=1;i<=n;i++)scanf("%d",&a[i]);
    for(int i=1;i<=n;i+=2) mp[a[i]]++;
    for(auto p: mp) v[0].push_back(make_pair(n/2-p.second,p.first));
    mp.clear();
    for(int i=2;i<=n;i+=2) mp[a[i]]++;
    for(auto p: mp) v[1].push_back(make_pair(n/2-p.second,p.first));
    sort(v[0].begin(),v[0].end());
    sort(v[1].begin(),v[1].end());
    if(v[0][0].second != v[1][0].second) {
        printf("%d\n", v[0][0].first + v[1][0].first);
    } else {
        int ans=1e9;
        if(v[1].size()>=2) ans=min(ans, v[0][0].first+v[1][1].first);
        else ans=min(ans, v[0][0].first + n/2);

        if(v[0].size()>=2) ans=min(ans, v[0][1].first+v[1][0].first);
        else ans=min(ans, v[1][0].first + n/2);
        printf("%d\n", ans);
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   18 |     sort(v[0].begin(),v[0].end());
      |     ^~~~
      |     short
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
int main(){
  ll n;
  cin>>n;
  vll aa(100001,0);
  vll bb(100001,0);
  for (int i = 0, a, b; i < n / 2; i++){
    int a,b;
    cin>>a>>b;
    aa[a]++;
    bb[b]++;
  }
  int am=0;
  int bm=0;
  int ao=0;
  int bo=0;
  for(int i=0;i<1000001;i++){
    if(am<aa[i]){
      am=aa[i];
      ao=i;
    }
    if(bm<bb[i]){
      bm=bb[i];
      bo=i;
    }
  }
  sort(rall(aa));
  sort(rall(bb));
  if(ao!=bo) COUT(n-aa[0]-bb[0]);
  else{
    COUT(min(n-am-bb[1],n-aa[1]-bm));
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:37:9: error: redeclaration of 'int a'
   37 |     int a,b;
      |         ^
a.cc:36:19: note: 'int a' previously declared here
   36 |   for (int i = 0, a, b; i < n / 2; i++){
      |                   ^
a.cc:37:11: error: redeclaration of 'int b'
   37 |     int a,b;
      |           ^
a.cc:36:22: note: 'int b' previously declared here
   36 |   for (int i = 0, a, b; i < n / 2; i++){
      |                      ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
int main(){
  ll n;
  cin>>n;
  vll aa(100001,0);
  vll bb(100001,0);
  rep(i,n/2){
    int a,b;
    cin>>a>>b;
    aa[a]++;
    bb[b]++;
  }
  int am=0;
  int bm=0;
  int ao=0;
  int bo=0;
  for(int i=0;i<1000001:i++){
    if(am<aa[i]){
      am=aa[i];
      ao=i;
    }
    if(bm<bb[i]){
      bm=bb[i];
      bo=i;
    }
  }
  sort(all(aa));
  sort(all(bb));
  if(ao!=bo) COUT(n-am-bm);
  else{
    COUT(min(n-am-bb[bb.size()-2],n-aa[aa.size()-2]-bm));
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:46:15: warning: range-based 'for' loops with initializer only available with '-std=c++20' or '-std=gnu++20' [-Wc++20-extensions]
   46 |   for(int i=0;i<1000001:i++){
      |               ^
a.cc:46:24: error: expected ';' before ':' token
   46 |   for(int i=0;i<1000001:i++){
      |                        ^
      |                        ;
a.cc:56:7: error: could not convert 'std::sort<__gnu_cxx::__normal_iterator<long long int*, vector<long long int> > >(aa.std::vector<long long int>::begin(), aa.std::vector<long long int>::end())' from 'void' to 'bool'
   56 |   sort(all(aa));
      |   ~~~~^~~~~~~~~
      |       |
      |       void
a.cc:57:16: error: expected ')' before ';' token
   57 |   sort(all(bb));
      |                ^
      |                )
a.cc:46:6: note: to match this '('
   46 |   for(int i=0;i<1000001:i++){
      |      ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
signed main(){
  int N;
  cin>>N;
  map<int,int> A1,A2;
  rep(i,0,N){
    int X;
    cin>>X;
    if(i%2==0){
      if(A1.count(X))
        A1.at(X)++;
      else
        A1[X]=1;
      }
    else{
      if(A2.count(X))
        A2.at(X)++;
      else
        A2[X]=1;
      }
    }
  pii top1,second1(-1,0),top2,second2(-2,0);
  for(auto p:A1){
    int key=p.first,value=p.second;
    if(value>=top1.second){
      second1=top1;
      top=make_pair(key,value);
      }
    }
  for(auto p:A2){
    int key=p.first,value=p.second;
    if(value>=top2.second){
      second1=top2;
      top=make_pair(key,value);
      }
    }
  int ans=N-top1.second-top2.second;
  if(top1.first==top2.second){
    ans=N-max(top1.second+second2.second,top2.second+second1.second);
    }
  cout<<ans<<endl;
  }


Compiler output:
a.cc: In function 'int main()':
a.cc:39:7: error: 'top' was not declared in this scope; did you mean 'top2'?
   39 |       top=make_pair(key,value);
      |       ^~~
      |       top2
a.cc:46:7: error: 'top' was not declared in this scope; did you mean 'top2'?
   46 |       top=make_pair(key,value);
      |       ^~~
      |       top2
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main(){
 long long  int n;
  cin>>n;
  
long long int b[100010]={0},c[100010]={0};
  
  for(int i=0;i<n;i++){
    int a; cin>>a;
    if(i%2==0){
      b[a]++;
    }else{
      c[a]++;
    }
  }
  
  int bi=0,ci=0,ans=0,ant=0,f=0;
  for(int i=0;i<100001;i++){
    if(b[bi]<b[i]){
      bi =i;
    }if(c[ci]<c[i]){
      ci =i;
    }
  }
  if(bi==ci){
    int si=0,ti=0;
    for(int i=0;i<100001;i++){
      if(b[si]< b[i] && i!=bi){
        si =i;
      }if(c[ti]<c[i] && i!=c2){
        ti =i;
      }
    }
    cout<<n-max(b[bi]+c[ti],b[si]+c[ci])<<endl;
  }else{
    cout<<n-b[bi]-c[ci]<<endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:28: error: 'c2' was not declared in this scope; did you mean 'ci'?
   32 |       }if(c[ti]<c[i] && i!=c2){
      |                            ^~
      |                            ci
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main(){
 long long  int n;
  cin>>n;
  
long long int b[100010]={0},c[100010]={0};
  
  for(int i=0;i<n;i++){
    int a; cin>>a;
    if(i%2==0){
      b[a]++;
    }else{
      c[a]++;
    }
  }
  
  int bi=0,ci=0,ans=0,ant=0,f=0;
  for(int i=0;i<100001;i++){
    if(b[bi]<b[i]){
      bi =i;
    }if(c[ci]<c[i]){
      ci =i;
    }
  }
  if(bi==c2){
    int si=0,ti=0;
    for(int i=0;i<100001;i++){
      if(b[si]< b[i] && i!=bi){
        si =i;
      }if(c[ti]<c[i] && i!=c2){
        ti =i;
      }
    }
    cout<<n-max(b[bi]+c[ti],b[si]+c[ci])<<endl;
  }else{
    cout<<n-b[bi]-c[ci]<<endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:10: error: 'c2' was not declared in this scope; did you mean 'ci'?
   27 |   if(bi==c2){
      |          ^~
      |          ci
Language: C++

#include<bits/stdc++.h>

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;
#define rep(i,s,e) for(int i = (int)(s); i < (int)(e); ++i)
#define per(i,s,e) for(int i = (int)(s)-1; i >= (int)(e); --i)

using ll = long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;

template<class T>
bool ChangeMax(T&a,const T&b){
  if(a >= b) return false;
  a = b;    return true;
}

template<class T>
bool ChangeMin(T&a,const T&b){
  if(a <= b) return false;
  a = b;    return true;  
}

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}

int main(){
  int n;cin >> n;
  vector<int> a(100001,0),b(100001,0);
  bool eq = true;
  rep(i,0,n){
    int x=0;int p = x;
    cin >> x;
    if(i&&p!=k)eq=false;
    if(i%2)b[x]++;
    else a[x]++;
    debug(x);
    debug(a[x]);
    debug(b[x]);
  }
  if(eq){cout << n/2 << endl; return 0;}
  int amax=0, bmax=0;
  rep(i,0,100001){    
    bmax=max(bmax,b[i]);
    amax=max(amax,a[i]);
  }
  cout << max(n/2-amax,n/2-bmax) << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:45:14: error: 'k' was not declared in this scope
   45 |     if(i&&p!=k)eq=false;
      |              ^
Language: C++

#include<bits/stdc++.h>

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;
#define rep(i,s,e) for(int i = (int)(s); i < (int)(e); ++i)
#define per(i,s,e) for(int i = (int)(s)-1; i >= (int)(e); --i)

using ll = long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;

template<class T>
bool ChangeMax(T&a,const T&b){
  if(a >= b) return false;
  a = b;    return true;
}

template<class T>
bool ChangeMin(T&a,const T&b){
  if(a <= b) return false;
  a = b;    return true;  
}

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}

int main(){
  int n;cin >> n;
  vector<int> a(100001,0),b(100001,0);
  bool eq = true;
  rep(i,0,n){
    int x=0;int p = k;
    cin >> x;
    if(i&&p!=k)eq=false;
    if(i%2)b[x]++;
    else a[x]++;
    debug(x);
    debug(a[x]);
    debug(b[x]);
  }
  if(eq){cout << n/2 << endl; return 0;}
  int amax=0, bmax=0;
  rep(i,0,100001){    
    bmax=max(bmax,b[i]);
    amax=max(amax,a[i]);
  }
  cout << max(n/2-amax,n/2-bmax) << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:43:21: error: 'k' was not declared in this scope
   43 |     int x=0;int p = k;
      |                     ^
Language: Java

import java.util.*;
import java.lang.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		int[] vOdd = new int[100001];
		int[] vEven = new int[100001];
		int maxOdd=0,maxEven=0,maxNumOdd=0,maxNumEven=0;
		for( int i=1; i<=N/2; i++ ){
			vOdd[sc.nextInt()]++;
			vEven[sc.nextInt()]++;
		}
		for( int i=1; i<=100000; i++ ){
			if( vOdd[i]>maxOdd ){
				maxOdd = vOdd[i];
				maxNumOdd = i;
			}
			if( vEven[i]>maxEven ){
				maxEven = vEven[i];
				maxNumEven = i;
			}
		}
		Arrays.sort(vOdd);
		Arrays.sort(vEven);
		int ans = 0;
		if( maxNumOdd!=maxNumEven ){
			ans = N - maxOdd - maxEven;
		}else{
			int a = N - maxOdd - maxEven[N-1];
			int b = N - maxEven - maxOdd[N-1];
			ans = Math.min(a,b);          
		} 
		System.out.println(ans);     
	}
}


Compiler output:
Main.java:31: error: array required, but int found
			int a = N - maxOdd - maxEven[N-1];
			                            ^
Main.java:32: error: array required, but int found
			int b = N - maxEven - maxOdd[N-1];
			                            ^
2 errors
Language: Java

import java.util.*;
import java.lang.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		int[] vOdd = new int[100001];
		int[] vEven = new int[100001];
		int maxOdd=0,maxEven=0,maxNumOdd=0,maxNumEven=0;
		for( int i=1; i<=N/2; i++ ){
			vOdd[sc.nextInt()]++;
			vEven[sc.nextInt()]++;
		}
		for( int i=1; i<=100000; i++ ){
			if( vOdd[i]>maxOdd ){
				maxOdd = vOdd[i];
				maxNumOdd = i;
			}
			if( vEven[i]>maxEven ){
				maxEven = vEven[i];
				maxNumEven = i;
			}
		}
		Arrays.sort(vOdd);
		Arrays.sort(vEven);
		int ans = 0;
		if( maxNumOdd!=maxNumEven ){
			ans = N - maxOdd - maxEven;
		}else{
			if( maxOdd==maxEven ){
				ans = N - maxOdd - Math.max(vOdd[N-1],vEven[N-1]);
			}else{
				if( maxOdd > maxEven ){
					if( maxOdd==vOdd[N-1] ){
						ans = N - maxOdd - maxEven;
					}
					if( maxOdd > vOdd[N-1] ){
						ans = N - maxOdd - vOdd[N-1];
					}
				}
				if( maxEven > maxOdd ){
					if( maxEven==vEven[N-1] ){
						ans = N - maxOdd - maxEven;
					}
					if( maxEven > vEven[N-1] ){
						ans = N - maxEven - vEven[N-1]
					}
				}
			}
		} 
		System.out.println(ans);     
	}
}


Compiler output:
Main.java:47: error: ';' expected
						ans = N - maxEven - vEven[N-1]
						                              ^
1 error
Language: Java

import java.util.*;
import java.lang.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		int[] vOdd = new int[100001];
		int[] vEven = new int[100001];
		int maxOdd=0,maxEven=0,maxNumOdd=0,maxNumEven=0;
		for( int i=1; i<=N/2; i++ ){
			vOdd[sc.nextInt()]++;
			vEven[sc.nextInt()]++;
		}
		for( int i=1; i<=100000; i++ ){
			if( vOdd[i]>maxOdd ){
				maxOdd = vOdd[i];
				maxNumOdd = i;
			}
			if( vEven[i]>maxEven ){
				maxEven = vEven[i];
				maxNumEven = i;
			}
		}
		int ans1 = 0,ans2 = 0,ans3 = 0;
		Arrays.sort(vOdd);
		Arrays.sort(vEven);      
		ans1 = N - vOdd[N] - vEven[N];
		ans2 = N - vOdd[N] - vEven[N-1];
		ans3 = N - vOdd[N-1] - vEven[N];
		System.out.println(Math,min(ans1,Math,min(ans2,ans3)));
	}
}


Compiler output:
Main.java:31: error: cannot find symbol
		System.out.println(Math,min(ans1,Math,min(ans2,ans3)));
		                   ^
  symbol:   variable Math
  location: class Main
Main.java:31: error: cannot find symbol
		System.out.println(Math,min(ans1,Math,min(ans2,ans3)));
		                                 ^
  symbol:   variable Math
  location: class Main
Main.java:31: error: cannot find symbol
		System.out.println(Math,min(ans1,Math,min(ans2,ans3)));
		                                      ^
  symbol:   method min(int,int)
  location: class Main
3 errors
Language: C

#include <stdio.h>

int main(void) {
	int n,i,j;
	int cnt_a=0,cnt_b=0,tmp=0;
	scanf("%d",&n);
	int A[n];
	for(i=0;i<n;i++){
	scanf("%d",&A[i]);
	}
	for(i=0;i<n;i++){
		tmp=0;
		if(i%2==0){
    		for(j=i;j<n;j=j+2){
				if(A[i]==A[j]){
					tmp++;
				}
			}
			if(i==0){
      			cnt_a=tmp;
    		}else if(tmp>cnt_a){
				cnt_a=tmp;
    		}
		}else{
			for(j=i;j<n;j=j+2){
			if(A[i]==A[j]){
				tmp++;
				}
			}
			if(i==1){
				cnt_b=tmp;
			}else if(tmp>cnt_b0){
			cnt_b=tmp;
			}
		}
	}
	
  
	if(cnt_b==cnt_a&&cnt_b==0){
    	if(A[0]==A[1]){
    		cnt_b=n/2;
    	}
	}
	printf("%d",(n-cnt_a)+(n-cnt_b));
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:32:38: error: 'cnt_b0' undeclared (first use in this function); did you mean 'cnt_b'?
   32 |                         }else if(tmp>cnt_b0){
      |                                      ^~~~~~
      |                                      cnt_b
main.c:32:38: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>

int main(void) {
	int n,i,j;
	int cnt_a,cnt_b,tmp;
	scanf("%d",&n);
	int A[n];
	for(i=0;i<n;i++){
	scanf("%d",&A[i]);
	}
	for(i=0;i<n;i=i+2){
		tmp=0;
      if(A[i]!=A[i+2]){
		for(j=0;j<n;j=j+2){
			if(A[i]!=A[j]){
				tmp++;
			}
		}
      }
		if(tmp<cnt_a&&tmp!=0){
			cnt_a=tmp;
		}
	}
	for(i=1;i<n;i=i+2){
		tmp=0;
      if(A[i]!=A[i+2]{
		for(j=1;j<n;j=j+2){
			if(A[i]!=A[j]){
				tmp++;
			}
		}
      }
		if(tmp<cnt_b&&tmp!=0){
			cnt_b=tmp;
		}
	}
  
  if(cnt_b==cnt_a&&cnt_b==0){
    if(A[0]==A[1]){
      cnt_b=n/2;
    }
  }
	printf("%d",cnt_a+cnt_b);
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:26:22: error: expected ')' before '{' token
   26 |       if(A[i]!=A[i+2]{
      |         ~            ^
      |                      )
main.c:36:9: error: expected expression before '}' token
   36 |         }
      |         ^
Language: Java

import java.util.Scanner;

/**
 * @Description:
 * @Author: sunyx
 * @CreateDate: 2019/10/11 13:42
 */
public class ATC {
    static int n, min = Integer.MAX_VALUE;
    static int[] nums;

    public static void main(String[] args)  {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        nums = new int[n];
        for (int i = 0; i < n; i++) {
            nums[i] = sc.nextInt();
        }
        if (n == 2) {
            min = nums[0] == nums[1] ? 1 : 0;
            System.out.println(min);
            return;
        }
        t(0, 0);
        System.out.println(min);
    }

    public static void t(int i, int pv) {
        if (i >= n) return;
        if (i == 0) {
            int cv = 0;
            for (int x = 2; x < n; x++) if (x % 2 == 0 && nums[i] != nums[x]) cv += 1;
            t(i + 1, cv);
        } else {
            int cv = 0;
            for (int x = 0; x < n; x++) {
                if((pv+cv) > min) break;
                if (i != x && i % 2 == x % 2 && nums[i] != nums[x]) cv += 1;
            }
            if (nums[i - 1] == nums[i] && pv == 0 && cv == 0) cv=n/2;
            min = Math.min(min, pv+cv);
            t(i + 1, pv + cv);
        }
    }
}


Compiler output:
Main.java:8: error: class ATC is public, should be declared in a file named ATC.java
public class ATC {
       ^
1 error
Language: Java

import java.util.Scanner;

/**
 * @Description:
 * @Author: sunyx
 * @CreateDate: 2019/10/11 13:42
 */
public class Test {
    static int n, min = Integer.MAX_VALUE;
    static int[] nums;

    public static void main(String[] args)  {
//        FileInputStream fis = new FileInputStream(new File("C:\\Users\\hdm\\Desktop\\demo\\src\\main\\java\\com\\cf\\test.txt"));
//        System.setIn(fis);

        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        nums = new int[n];
        for (int i = 0; i < n; i++) {
            nums[i] = sc.nextInt();
        }
        if (n == 2) {
            min = nums[0] == nums[1] ? 1 : 0;
            System.out.println(min);
            return;
        }
        t(0, 0);
        System.out.println(min);
    }

    public static void t(int i, int pv) {
        if (i >= n) return;
        if (i == 0) {
            int cv = 0;
            for (int x = 2; x < n; x++) if (x % 2 == 0 && nums[i] != nums[x]) cv += 1;
            t(i + 1, cv);
        } else {
            int cv = 0;
            for (int x = 0; x < n; x++) {
                if((pv+cv) > min) break;
                if (i != x && i % 2 == x % 2 && nums[i] != nums[x]) cv += 1;
            }
            if (nums[i - 1] == nums[i] && pv == 0 && cv == 0) cv=n/2;
            min = Math.min(min, pv+cv);
            t(i + 1, pv + cv);
        }
    }
}


Compiler output:
Main.java:8: error: class Test is public, should be declared in a file named Test.java
public class Test {
       ^
1 error
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,i,temp,ans,n1,n2;
    cin>>n;
    vector<ll> v(n);
    for(i=0;i<n;i++)
    {
        cin>>v[i];
    }
    n1=0;n2=0;
    for(i=0;i<n;i++)
    {
        if(i%2==0)
        {
            if(v[i]!=v[0])
            {
                n1++;
            }
        }
        else
        {
            if(v[i]!=v[1])
            {
                n2++;
            }
        }
    }

    if(v[0]==v[1])
    {
        cout<<(min(n1,n2)+n/2)<<endl;
    }
    else
    {
        cout<<n1+n2<<endl;
    }


}
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,i,temp,ans,n1,n2;
    cin>>n;
    vector<ll> v(n);
    for(i=0;i<n;i++)
    {
        cin>>v[i];
    }
    n1=0;n2=0;
    for(i=0;i<n;i++)
    {
        if(i%2==0)
        {
            if(v[i]!=v[0])
            {
                n1++;
            }
        }
        else
        {
            if(v[i]!=v[1])
            {
                n2++;
            }
        }
    }

    if(v[0]==v[1])
    {
        cout<<(min(n1,n2)+n/2)<<endl;
    }
    else
    {
        cout<<n1+n2<<endl;
    }


}


Compiler output:
a.cc:48:5: error: redefinition of 'int main()'
   48 | int main()
      |     ^~~~
a.cc:4:5: note: 'int main()' previously defined here
    4 | int main()
      |     ^~~~
Language: Java

package AtCoder_Regular;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class main {

	public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int c =0;



		String n =br.readLine();
		int number = Integer.parseInt(n);
		String []str =new String[number];
		int []v=new int [number];
		//int []check = new int [number];

		for(int i = 0;i<number;i++){
			str[i]=br.readLine();
			v[i]= Integer.parseInt(str[i]);
			//check[i]=0;
		}
		int odd[]=Split(v,0);
		int even[]=Split(v,1);
		int max1=Max(Check(odd));
		int max2=Max(Check(even));

		if(c(Check(even))==0&&(c(Check(odd)))==0&&even[0]==odd[0]){
			c=2;
		}



		System.out.println(max1+max2+c);



		//奇数行目と偶数行目で分けて考える
		//配列を入力ると各成分がa_i=a_(i+2)を満たさないものの総数を返すメソッド
	}






	//偶数番目, 奇数番目を取り出して配列に格納するメソッド
	//違うか判定して配列に格納（この違いの個数の最小が, 最低限入れ替えなければいけない配列の総数）
	//配列の最小値を返すメソッド
	public static int []Split(int []a, int s){
		int split,t;
		boolean bool;

		if(a.length%2==0){
			t=a.length/2;
		}else{
			t =a.length/2+1;
		}
		int[]odd=new int[t];
		int []even=new int[a.length/2];
		for(int i=0;i<a.length;i++){
			if(i%2==0){
				even[i/2]=a[i];
			}else{
				odd[i/2]=a[i];
			}
		}
		if(s==1){
			return even;
		}else{
			return odd;
		}
	}
	public static int Max(int []max){
		int m = max[0];

		for(int i=0;i<max.length;i+=2){
			if(m<max[i]){
				m=max[i];
			}
		}
		return m;
	}
	public static int []Check(int []v){
		int []check =new int[v.length];
		for(int i=0;i<v.length;i++){
			check[i]=0;
			for(int j=0;j<v.length;j++){
				if(v[i]!=v[j]){
					check[i]++;
				}
			}
		}
		return check;
	}


	public static int c(int[]x){

		int a=0;
		for(int i=0;i<x.length;i++){
			if(x[i]!=0){
				a++;
			}
		}
		if(a==0){
			return 2;
		}else{
			return 0;
		}

	}




}




Compiler output:
Main.java:7: error: class main is public, should be declared in a file named main.java
public class main {
       ^
1 error
Language: C++


// C++t.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//

#include "stdafx.h"
#include "stdc++.h"
#include <cstdio>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)

// #include<bits/stdc++.h>

#define ALL(v) v.begin(), v.end()
typedef long long ll;



using namespace std;
int main() {
	int n;
	cin >> n;

	vector<int> V(n);

	int j[100009] = { 0 };
	int k[100009] = { 0 };


	for (int i = 0; i < n; i++)
	{
		cin >> V[i];
	}

	for (int i = 0; i < n; i += 2)
	{
		j[V[i]]++;
	}
	for (int i = 1; i < n; i += 2)
	{
		k[V[i]]++;

	}

	sort(j, j + 100009, greater<>());
	sort(k, k + 100009, greater<>());

	int ans = 0;
	ans += n/2 - j[1];
	ans += n/2 - k[1];
	


	/*for (int i = 0; i < 100009 ;i++)
	{
		n - j[i]
	}
	for (int i = 0; i < 100009; i++)
	{

	}*/

	cout << ans;
}

Compiler output:
a.cc:5:10: fatal error: stdafx.h: No such file or directory
    5 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1000000007;

int main(){
  int n;
  cin >> n;
  int v[n];
  for(int i = 0; i < n; i++) cin >> v[i];

  int countEven[100005],countOdd[100005];

  for(int i = 0; i < 100005; i++){
      countEven[i] = 0;
      countOdd[i] = 0;
  }
  for(int i = 0; i < n; i++){
    if(i%2 == 0)  countEven[v[i]]++;
    else  countOdd[v[i]]++;
  }

  int mostFrequentEven = 0, mostFrequentOdd = 0, secondFrequentEven = 0, secondFrequentOdd = 0;
  int valueEven = 0, valueOdd = 0;

  for(int i = 0; i < 100005; i++){
    if(mostFrequentEven <= countEven[i]){
      secondFrequentEven = mostFrequentEven;
      mostFrequentEven = countEven[i];
      valueEven = i;
    }
    if(mostFrequentOdd <= countOdd[i]){
      secondFrequentOdd = mostFrequentOdd;
      mostFrequentOdd = countOdd[i];
      valueOdd = i;
    }
  }
  int ans;
  if(valueOdd != valueEven){
    ans = (n - (mostFrequentOdd + mostFrequentEven));
  }else{
    ans = min((n - (mostFrequentOdd + secondFrequentEven)), (n - (secondFrequentOdd + mostFrequentEven)));
    ans = min(ans, (n - (secondFrequentOdd + secondFrequentEven)))
  }
  cout << ans << "\n";
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:43:67: error: expected ';' before '}' token
   43 |     ans = min(ans, (n - (secondFrequentOdd + secondFrequentEven)))
      |                                                                   ^
      |                                                                   ;
   44 |   }
      |   ~
Language: C++

#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
using namespace std;

int main(){
    int n;
    cin >> n;
    vector<int> data(n);
    for (int i=0;i<n;i++){
        cin >> data[i];
    }

    vector<int> even_data(data.size()/2);
    vector<int> odd_data(data.size()/2);
    for (int i=0;i<data.size();i++){
        if (i % 2 == 0){
            even_data[i/2] = data[i];
        } else {
            odd_data[i/2 - 1] = data[i]);
        }
    }
    vector <int> even_unique;
    vector <int> odd_unique;

    even_unique = even_data;
    odd_unique = odd_data;
    sort(even_unique.begin(), even_unique.end());
    even_unique.erase(unique(even_unique.begin(), even_unique.end()), even_unique.end());

    sort(odd_unique.begin(), odd_unique.end());
    odd_unique.erase(unique(odd_unique.begin(), odd_unique.end()), odd_unique.end());

    if (even_unique.size() == 1 && odd_unique.size() == 1 && even_unique[0] == odd_unique[0]){
        cout << even_data.size() << endl;
    } else {

        int max_even = 0;
        for (auto &e : even_unique){
            int c = count(even_data.begin(), even_data.end(), e);
            if (c > max_even){
                max_even = c;
            }
        }
        int max_odd = 0;
        for (auto &e : odd_unique){
            int c = count(odd_data.begin(), odd_data.end(), e);
            if (c > max_odd){
                max_odd = c;
            }
        }

        cout << data.size() - (max_even + max_odd) <<endl;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:40: error: expected ';' before ')' token
   21 |             odd_data[i/2 - 1] = data[i]);
      |                                        ^
      |                                        ;
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
 int wari(int a,int b) {
   if(a%b==0)
     return a/b;
   else
     return a/b+1;
 }
 int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
 }
 int souwa(int a){
  return a*(a+1)/2;
 }
 int lcm(int a,int b){
  int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return d*e/f;
    }
  int gcm(int a,int b){
      int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return f;
  }
signed main(){
  int a;
  cin>>a;
  vector<int> b(a/2),c(a/2);
  fo(i,a/2)
    cin>>b[i]>>c[i];
  Sort(b);
  Sort(c);
  

Compiler output:
a.cc: In function 'int main()':
a.cc:64:11: error: expected '}' at end of input
   64 |   Sort(c);
      |           ^
a.cc:57:14: note: to match this '{'
   57 | signed main(){
      |              ^