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

#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <vector>

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

bool compare(pair<int, int> a, pair<int, int> b) { return a.second > b.second; }

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

  map<int, int> aMap;
  for (int i = 0; i < n; i += 2) {
    if (aMap.find(v[i]) != aMap.end()) {
      aMap[v[i]] += 1;
    } else {
      aMap[v[i]] = 1;
    }
  }

  vector<pair<int, int>> aVec;
  copy(aMap.begin(), aMap.end(), back_inserter(aVec));
  sort(aVec.begin(), aVec.end(), compare);

  map<int, int> bMap;
  for (int i = 1; i < n; i += 2) {
    if (bMap.find(v[i]) != bMap.end()) {
      bMap[v[i]] += 1;
    } else {
      bMap[v[i]] = 1;
    }
  }
  vector<pair<int, int>> bVec;
  copy(bMap.begin(), bMap.end(), back_inserter(bVec));
  sort(bVec.begin(), bVec.end(), compare);


  int ans;
  if (aVec[0].first != bVec[0].first) {
    ans = n - (aVec[0].second + bVec[0].second);
  } else {
    ans = n - max(aVec[0].second + (bVec.size() > 1 ? bVec[1].second : 0),
                  bVec[0].second + (aVec.size() > 1 ? aVec[1].second : 0));
  }

  cout << ans << endl;

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:3: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
   33 |   sort(aVec.begin(), aVec.end(), compare);
      |   ^~~~
      |   sqrt
Language: C

#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <inttypes.h>
#include <string.h>
#include <math.h>

int main (int argc, char const *argv[])
{
    int64_t n, v;
    int64_t oddnum[(int)1e5] = {0}, evennum[(int)1e5] = {0};
    uint64_t ans = 0, oddmax = 0, evenmax = 0, oddmax2 = 0, evenmax2 = 0, oddi = 0, eveni = 0;

    scanf("%"PRId64, &n);
    for (int i = 0; i < n; i++) {
        scanf("%"PRId64, &v);
        if (i % 2) {
            oddnum[v]++;
        } else {
            evennum[v]++;
        }
    }

    for (int i = 0; i < (int)1e5; i++) {
        if (oddmax < oddnum[i]) {
            oddmax2 = oddmax;
            oddmax = oddnum[i];
            oddi = i;
        } else if (oddmax2 < oddnum[i]) {
            oddmax2 = oddnum[i];
        }
        if (evenmax < evennum[i]) {
            evenmax2 = evenmax;
            evenmax = evennum[i];
            eveni = i;
        } else if (evenmax2 < evennum[i]) {
            evenmax2 = evennum[i];
        }
    }

    if (oddi != eveni) {
        ans = ((n / 2) - oddmax) + ((n / 2) - evenmax);
    } else {
        if ((oddmax + evenmax2) > (oddmax2 + evenmax)) {
            ans = ((n / 2) - oddmax) + ((n / 2) - evenmax2);
        } else {
            ans = ((n / 2) - oddmax2) + ((n / 2) - evenmax);
        }
    }

    printf("%"PRId64"\n", ans);
}


Compiler output:
main.c: In function 'main':
main.c:44:33: error: stray '\10' in program
   44 |         if ((oddmax + evenmax2) <U+0008>> (oddmax2 + evenmax)) {
      |                                 ^~~~~~~~
Language: C++

#include<iostream>
#include<vector>
int main(){
	int n;
  cin>>n;
   vector<int>v(n);
  for(int i=0;i<n;++i)cin>>v[i];
  cout<<n/2<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    5 |   cin>>n;
      |   ^~~
      |   std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:6:4: error: 'vector' was not declared in this scope
    6 |    vector<int>v(n);
      |    ^~~~~~
a.cc:6:4: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_vector.h:428:11: note:   'std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/14/vector:93:13: note:   'std::pmr::vector'
   93 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
a.cc:6:11: error: expected primary-expression before 'int'
    6 |    vector<int>v(n);
      |           ^~~
a.cc:7:28: error: 'v' was not declared in this scope
    7 |   for(int i=0;i<n;++i)cin>>v[i];
      |                            ^
a.cc:8:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
    8 |   cout<<n/2<<endl;
      |   ^~~~
      |   std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:8:14: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
    8 |   cout<<n/2<<endl;
      |              ^~~~
      |              std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

#include<iostream>
#include<vector>
int main(){
	int n;
   vector<int>v(n);
  for(int i=0;i<n;++i)cin>>v[i];
  cout<<n/2<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:4: error: 'vector' was not declared in this scope
    5 |    vector<int>v(n);
      |    ^~~~~~
a.cc:5:4: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_vector.h:428:11: note:   'std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/14/vector:93:13: note:   'std::pmr::vector'
   93 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
a.cc:5:11: error: expected primary-expression before 'int'
    5 |    vector<int>v(n);
      |           ^~~
a.cc:6:23: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    6 |   for(int i=0;i<n;++i)cin>>v[i];
      |                       ^~~
      |                       std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:6:28: error: 'v' was not declared in this scope
    6 |   for(int i=0;i<n;++i)cin>>v[i];
      |                            ^
a.cc:7:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
    7 |   cout<<n/2<<endl;
      |   ^~~~
      |   std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:7:14: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
    7 |   cout<<n/2<<endl;
      |              ^~~~
      |              std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

#include<iostream>
#include<vector>
int main(){
	int n;
   vector<int>v(n);
  	repp(i,0,n)cin>>v[i];
  cout<<n/2<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:4: error: 'vector' was not declared in this scope
    5 |    vector<int>v(n);
      |    ^~~~~~
a.cc:5:4: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_vector.h:428:11: note:   'std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/14/vector:93:13: note:   'std::pmr::vector'
   93 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
a.cc:5:11: error: expected primary-expression before 'int'
    5 |    vector<int>v(n);
      |           ^~~
a.cc:6:14: error: 'i' was not declared in this scope
    6 |         repp(i,0,n)cin>>v[i];
      |              ^
a.cc:6:9: error: 'repp' was not declared in this scope
    6 |         repp(i,0,n)cin>>v[i];
      |         ^~~~
a.cc:7:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
    7 |   cout<<n/2<<endl;
      |   ^~~~
      |   std::cout
In file included from a.cc:1:
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:7:14: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
    7 |   cout<<n/2<<endl;
      |              ^~~~
      |              std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

#include <bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<n;i++)
using namespace std;
const int M=100010;


int main(){
	int even[M]={},odd[M]={};
	int n; 
	
	cin >>n;
	for(int i=0;i<n;i++){
		int v;
		cin >>v;
		if(i%2==0)
			even[v]++;
		else
			odd[v]++;
	}
	int max1=0;
	int max2=0;
	for(int i=0;i<M;i++)
		if(even[max1]<even[i])
			max1=i;
	for(int i=0;i<M;i++)
		if(odd[max2]<odd[i]&&max1!=i)
			max2=i;
	int cnt1=even[max1]+odd[max2];

	max1=0;max2=0;
	for(int i=0;i<1M;i++)
		if(odd[max1]<odd[i])
			max1=i;
	for(int i=0;i<M;i++)
		if(even[max2]<even[i]&&max1!=i)
			max2 =i;
	int cnt2=odd[max1]+even[max2];
	cout << min(n-cnt1,n-cnt2)<< endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:23: error: unable to find numeric literal operator 'operator""M'
   31 |         for(int i=0;i<1M;i++)
      |                       ^~
Language: C++

#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>

int n, t;
std::vector<std::pair<int, int>> vec;

int main() {
    std::cin >> n;
    int half = n/2;
    int ans;
    std::vector<std::pair<int, int>> zero_origin(100000+1, std::pair<int, int>(0, 0));
    std::vector<std::pair<int, int>> one_origin(100000+1, std::pair<int, int>(0, 0));
    std::vector<std::pair<int, int>> vec(100000+1, std::pair<int, int>(0, 0));
    for (int i = 1; i <= n; i++) {
        std::cin >> t;
        if (i % 2 == 0) {
            zero_origin[t].first++;
            zero_origin[t].second = t;
        }
        else if (i % 2 != 0) {
            one_origin[t].first++;
            one_origin[t].second = t;
        }
        vec[t].first++;
        vec[t].second = t;
    }
    int vec_max = std::max_element(vec.begin(), vec.end())->first;
    if (vec_max == n) {
        std::cout << static_cast<int>(vec_max / 2) << std::endl;
        return 0;
    }
    std::sort(zero_origin.begin(), zero_origin.end());
    std::sort(one_origin.begin(), one_origin.end());
    auto zero_vec = zero_origin[zero_origin.size() - 1];
    auto one_vec = one_origin[one_origin.size() - 1];
    if (zero_vec.second != one_vec.second) {
        ans = (n - zero_vec.first) + (n - one_vec.first);
        std::cout << ans << std::endl;
        return 0;
    }
    else {
        zero_index = zero_origin.size() - 1;
        one_index = one_origin.size() - 1;
        while (one_origin[one_index].second == zero_origin[zero_index].second) {
            if (one_origin[one_index].first == zero_origin[zeroindex].first) {
                one_index--;
                zero_index--;
            }
            else if (one_origin[one_index].first < zero_origin[zero_index].first) {
                one_index--;
            }
            else if (one_origin[one_index].first > zero_origin[zero_index].first) {
                zero_index--;
            }
        }
        if (one_origin[one_index].first <= zero_origin[zero_index].first) {
            std::cout << (n - one_origin[one_index]) << std::endl;
            return 0;
        }
        else if (one_origin[one_index].first > zero_origin[zero_index].first) {
            std::cout << (n - zero_origin[zero_index]) << std::endl;
            return 0;
        }
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:44:9: error: 'zero_index' was not declared in this scope; did you mean 'zero_vec'?
   44 |         zero_index = zero_origin.size() - 1;
      |         ^~~~~~~~~~
      |         zero_vec
a.cc:45:9: error: 'one_index' was not declared in this scope
   45 |         one_index = one_origin.size() - 1;
      |         ^~~~~~~~~
a.cc:47:60: error: 'zeroindex' was not declared in this scope
   47 |             if (one_origin[one_index].first == zero_origin[zeroindex].first) {
      |                                                            ^~~~~~~~~
Language: C++

#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>

int n, t;
std::vector<std::pair<int, int>> vec;

int main() {
    std::cin >> n;
    std::vector<std::pair<int, int>> zero_origin(100000+1, std::pair<int, int>(0, 0));
    std::vector<std::pair<int, int>> one_origin(100000+1, std::pair<int, int>(0, 0));
    std::vector<std::pair<int, int>> vec(100000+1, std::pair<int, int>(0, 0));
    for (int i = 1; i <= n; i++) {
        std::cin >> t;
        if (i % 2 == 0) {
            zero_origin[t].first++;
            zero_origin[t].second = t;
        }
        else if (i % 2 != 0) {
            one_origin[t].first++;
            one_origin[t].second = t;
        }
        vec[t].first++;
        vec[t].second = t;
    }
    int vec_max = std::max_element(vec.begin(), vec.end())->first;
    if (vec_max == n) {
        std::cout << static_cast<int>(vec_max / 2) << std::endl;
        return 0;
    }
    auto zero_max = std::max_element(zero_origin.begin(), zero_origin.end());
    auto one_max = std::max_element(one_origin.begin(), one_origin.end());
    if (zero_max.second != one_max.second) {
        int half = n / 2;
        int ans = (half - one_max->first) + (half - zero_max->first);
        std::cout << ans << std::endl;
    }
    while (zero_max->second == one_max->second) {
        if (zero_max->first < one_max->first) {
            zero_origin.erase(zero_max);
            zero_max = std::max_element(zero_origin.begin(), zero_origin.end());
            one_max = std::max_element(one_origin.begin(), one_origin.end());
        }
        else if (one_max->first < zero_max->first) {
            one_origin.erase(one_max);
            one_max = std::max_element(one_origin.begin(), one_origin.end());
            zero_max = std::max_element(zero_origin.begin(), zero_origin.end());

        }
    }

    int half = n / 2;
    int ans = (half - one_max->first) + (half - zero_max->first);
    std::cout << ans << std::endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:18: error: 'class __gnu_cxx::__normal_iterator<std::pair<int, int>*, std::vector<std::pair<int, int> > >' has no member named 'second'
   34 |     if (zero_max.second != one_max.second) {
      |                  ^~~~~~
a.cc:34:36: error: 'class __gnu_cxx::__normal_iterator<std::pair<int, int>*, std::vector<std::pair<int, int> > >' has no member named 'second'
   34 |     if (zero_max.second != one_max.second) {
      |                                    ^~~~~~
Language: C++

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

int main(){
 int n,a,b,c,,d,i,j,u,p;
  c=0;
  d=0;
  cin>>n;
  vector<int>x(100001),y(100001);
  for (i=0;i<100001;i++){
    x[i]=0;
    y[i]=0;
  }
  for( i=0;i<n/2;i++){
    cin>>a>>b;
    x[a]++;
    y[b]++;
    }
  a=0,b=0;
  
for( j=0;j<100001;j++){
	
  if(x[j]>a){
    a=max(a,x[j]);
    p=j;
  }
  if(y[j]>b){
  b=max(b,y[j]);
  u=j;
  }
}
if(p!=u){
  cout<<n-a-b<<endl;
}
  else{
    for( j=0;j<100001;j++){
        if(x[j]>c&&j!=p){
    c=max(c,x[j]);
    p=j;
  }
  if(y[j]>d&&j!=u){
  d=max(d,y[j]);
  u=j;
  }
    }
    if(abs(a-c)>abs(b-d)){
      b=d;
    }
    else{
      a=c;
    }
    cout<<n-a-b<<endl;
}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:14: error: expected unqualified-id before ',' token
    5 |  int n,a,b,c,,d,i,j,u,p;
      |              ^
Language: C++

#include <iostream>
#include <vector>
#include <map>

using namespace std;

int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  
  map<int, int> oddm, evenm;
  int oddmax = 0, evenmax = 0;
  int maxv = 0;
  for(int i = 0; i < N; i++){
    cin >> A[i];
    maxv = max(A[i], maxv);
  }
  for(int i = 0; i < N; i += 2){
    oddm[A[i]]++;
  }
  for(int i = 1; i < N; i += 2){
    evenm[A[i]]++;
  }
  
  for(int i = 0; i <= maxv; i++){
    oddmax = max(oddm[i],oddmax);
    evenmax = max(even[i],evenmax);
  }
  cout << (N - oddmax) + (N - evenmax);
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:19: error: 'even' was not declared in this scope; did you mean 'evenm'?
   28 |     evenmax = max(even[i],evenmax);
      |                   ^~~~
      |                   evenm
Language: C++

#include <iostream>
#include <vector>
#include <map>

using namespace std;

int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  
  map<int, int> oddm, evenm;
  int odd = 0, even = 0;
  int maxv = 0;
  for(int i = 0; i < N; i++){
    cin >> A[i];
    maxv = max(A[i], maxv);
  }
  for(int i = 0; i < N; i += 2){
    oddm[A[i]]++;
  }
  for(int i = 1; i < N; i += 2){
    evenm[A[i]]++;
  }
  
  for(int i = 0; i <= maxv; i++){
    odd = max(oddm[i],odd);
    even = max(even[i],even);
  }
  cout << (N - odd) + (N - even);
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:20: error: invalid types 'int[int]' for array subscript
   28 |     even = max(even[i],even);
      |                    ^
Language: C++

#include <iostream>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;

int main(){
  int N;
  cin >> N;
  map<int, int> m;
  
  int maxind = 0;
  for(int i = 0; i < N; i++){
    int idx;
    cin >> idx;
    maxind = max(maxind, idx);
    m[idx]++;
  }
  
  vector<int> v;
  int c = 0;
  for(int i = 0; i <= maxind; i++){
    if(m.count(i) == 0) continue;
    v[c] = i;
    c++
  }
  
  sort(v.begin(), v.end());
  int ans = 0;
  for(int i = 0; i < v.size() - 2 ; i++){
    ans += v[i];
  }
  cout << ans;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:8: error: expected ';' before '}' token
   26 |     c++
      |        ^
      |        ;
   27 |   }
      |   ~
Language: C++

#include <iostream>
#include <vector>
#include <map>

using namespace std;

int main(){
  int N;
  cin >> N;
  map<int, int> m;
  
  int maxind = 0;
  for(int i = 0; i < N; i++){
    int idx;
    cin >> idx;
    maxind = max(maxind, idx);
    m[idx]++;
  }
  
  vector<int> v;
  int c = 0;
  for(int i = 0; i <= maxind; i++){
    if(m.count(i) == 0) continue;
    v[c] = i;
    c++
  }
  
  sort(v.begin(), v.end());
  int ans = 0;
  for(int i = 0; i < v.size() - 2 ; i++){
    ans += v[i];
  }
  cout << ans;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:8: error: expected ';' before '}' token
   25 |     c++
      |        ^
      |        ;
   26 |   }
      |   ~     
a.cc:28:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   28 |   sort(v.begin(), v.end());
      |   ^~~~
      |   short
Language: C++

#include <iostream>
#include <vector>
#include <map>

using namespace std;

int main(){
  int N;
  cin >> N;
  map<int, int> m;
  
  int maxind = 0;
  for(int i = 0; i < N; i++){
    int idx;
    cin >> idx;
    maxind = max(maxind, ind);
    m[idx]++;
  }
  
  vector<int> v;
  int c = 0;
  for(int i = 0; i <= maxind; i++){
    if(m.count(i) == 0) continue;
    v[c] = i;
    c++
  }
  
  sort(v.begin(), v.end());
  int ans = 0;
  for(int i = 0; i < v.size() - 2 ; i++){
    ans += v[i];
  }
  cout << ans;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:26: error: 'ind' was not declared in this scope; did you mean 'int'?
   16 |     maxind = max(maxind, ind);
      |                          ^~~
      |                          int
a.cc:25:8: error: expected ';' before '}' token
   25 |     c++
      |        ^
      |        ;
   26 |   }
      |   ~     
a.cc:28:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   28 |   sort(v.begin(), v.end());
      |   ^~~~
      |   short
Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repR(i, n) for(int i = n; i >= 0; ++i)
#define FDS(i, n) for(ll i = 0; i < n; ++i)
#define FDSR(i, n) for(int i = n; i >= 0; ++i)
#define FOR(i, m, n) for(int i = m; i < n; ++i)
#define FORR(i, m, n) for(int i = m;i >= n;--i)
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define itn int
#define ednl endl
using namespace std;
typedef long long ll;
int main(){
	int N;
	cin>>N;
	vector<int> a(N);
	rep(i,N){
		cin>>a[i];
	}
	int s,t;
	s=N/2;
	t=N/2;
	
	vector<int> kisuu(s);
	vector<int> guusuu(t);
	rep(i,s){
		kisuu[i]=a[i*2];
	}
	rep(i,t){
		guusuu[i]=a[i*2+1];
	}
	VSORT(kisuu);
	VSORT(guusuu);
	int sub=1;
	int subsub=0;
	int subsubsub=0;
	int x;
	int ans=0;
	FDS(i,s-1){
		if(kisuu[i]==kisuu[i+1]){
			sub++;
		}
		else{
			if(sub>=subsub){
				subsubsub=subsub;
				subsub=sub;
				sub=1;
				x=kisuu[i];
			}
			if(sub>=subsubsub){
			    subsubsub=sub;
			}
			sub=1;
		}
	}
	
	if(sub>=subsub){
		subsubsub=subsub;
		subsub=sub;
		sub=1;
		x=kisuu[i];
	}
	if(sub>=subsubsub){
		subsubsub=sub;
	}
	
	int sob=1;
	int sobsob=0;
	int sobsobsob=0;
	int y;
	FDS(i,s-1){
		if(guusuu[i]==guusuu[i+1]){
			sob++;
		}
		else{
			if(sob>=sobsob){
				sobsobsob=sobsob;
				sobsob=sob;
				sob=1;
				y=guusuu[i];
			}
			if(sob>=sobsobsob){
			    sobsobsob=sob;
			}
			sob=1;
		}
	}
	
	if(sob>=sobsob){
		sobsobsob=sobsob;
		sobsob=sob;
		sob=1;
		y=guusuu[i];
	}
	if(sob>=sobsobsob){
		sobsobsob=sob;
	}
	
	if(x!=y){
		ans+=(N-subsub-sobsob);
	}
	else{
		if(subsub<sobsob){
			ans+=N-sobsob-subsubsub;
		}
		if(subsub>sobsob){
			ans+=N-subsub-sobsobsob;
		}
		if(subsub==sobsob){
			ans+=N-subsub-max(subsubsub,sobsobsob);
		}
	}
	
	cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:62:25: error: 'i' was not declared in this scope
   62 |                 x=kisuu[i];
      |                         ^
a.cc:94:26: error: 'i' was not declared in this scope
   94 |                 y=guusuu[i];
      |                          ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int v_num = pow(10,5)+1;

int main()
{
	int n,v;
	cin >> n;
	vector<int> even(v_num, 0), odd(v_num + 10, 0);
	for(int i(0);i<n;++i){
		cin >> v;
		if(i%2 == 0)even[v]++;
		else odd[v]++;
	}
	bool same(false);
	vector<int>::iterator evenMaxIt = max_element(even.begin(), even.end());
	vector<int>::iterator oddMaxIt = max_element(odd.begin(), odd.end());
	if(distance(even.begin(), evenMaxIt) == distance(odd.begin(), oddMaxIt)) same = true;

	sort(even.begin(), even.end(), greater<int>() );
	sort(odd.begin(), odd.end(), greater<int>() );
	if(same){
		if(even[0] == odd[0]){
			if (even[1] < odd[1])cout << n - even[0] - odd[1] << endl;
			else cout << n - even[0] - even[1] << endl;
		else if(even[0] > odd[0]) cout << n - even[0] - odd[1] << endl;
		else cout << n - odd[0] - even[1] << endl;
	}else{
		cout << n-even[0]-odd[0] << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:17: error: expected '}' before 'else'
   27 |                 else if(even[0] > odd[0]) cout << n - even[0] - odd[1] << endl;
      |                 ^~~~
a.cc:24:38: note: to match this '{'
   24 |                 if(even[0] == odd[0]){
      |                                      ^
Language: C++

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

#define int long long
using p=pair<int,int>;

int main(){
	int n;cin>>n;
	vector<p> even(100001),odd(100001);
	for(int i=0;i<10001;i++)even[i]=odd[i]=make_pair(i,0);	
	for(int i=0;i<n;i++){
	int w;cin>>w;
	if(i%2==0)(even[w].second)++;
	else (odd[w].second)++;
	}
	sort(even.begin(),even.end(),[&](p x,p y){return x.second>y.second;});
	sort(odd.begin(),odd.end(),[&](p x,p y){return x.second>y.second;});
	int ans;
	if(even[0].first==odd[0].first)ans=min(n-odd[0].second-even[1].second,n-odd[1].second-even[0].second);
	else ans=n-odd[0].second-even[0].second;
	cout<<ans<<endl;
	
}

Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define in(x) cin >> x
#define out(str) cout << str << endl

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int odd[100010],even[100010],A[100010],n,oddmax,evenmax,oddsecond,evensecond;

int main(){
    cin>>n;
    rep(i,n){
        cin>>A[i];
        if(i%2==0){
            odd[i]++;
        }
        else{
            even[i]++;
        }
    }
    rep(i,100010){
        if(odd[i]>oddmax){
            oddsecond=oddmax;
            oddmax=odd[i];
        }
        else if(odd[i]>oddsecond){
            oddsecond=odd[i];
        }
        if(even[i]>evenmax){
            evensecond=evenmax;
            evenmax=even[i];
        }
        else if(even[i]>evensecond){
            evensecond=even[i];
        }
    }
    if(oddmax==evenmax){
        out(min((n+1)/2-oddsecond+n/2-evenmax),(n+1)/2-oddmax+n/2-evensecond);
    }
    else{
        out((n+1)/2-oddmax+n/2-evenmax);
    }
}


Compiler output:
a.cc:52:77: error: macro "out" passed 2 arguments, but takes just 1
   52 |         out(min((n+1)/2-oddsecond+n/2-evenmax),(n+1)/2-oddmax+n/2-evensecond);
      |                                                                             ^
a.cc:17:9: note: macro "out" defined here
   17 | #define out(str) cout << str << endl
      |         ^~~
a.cc: In function 'int main()':
a.cc:52:9: error: 'out' was not declared in this scope
   52 |         out(min((n+1)/2-oddsecond+n/2-evenmax),(n+1)/2-oddmax+n/2-evensecond);
      |         ^~~
Language: C++

#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

const int N = 1e6 + 5;
int n, a[N], b[N];
struct node {
    int cnt, v;
} s[N], t[N];

inline bool cmp(const node &p, const node &q) {
    return p.cnt > q.cnt;
}

int main() {
    scanf("%d", &n);
    for (int i = 1; i <= n; ++i) scanf("%d", &a[i]), s[a[i]].v = t[a[i]].v = a[i];
    for (int i = 1; i <= n; i += 2) s[a[i]].cnt++;
    for (int i = 2; i <= n; i += 2) t[a[i]].cnt++;
    sort(s + 1, s + 1 + 1e5, cmp);
    sort(t + 1, t + 1 + 1e5, cmp);
    if (s[1].v == t[1].v) printf("%d\n", std::min(n - s[2].cnt - t[1].cnt, n - s[1].cnt - t[2].cnt));
    else printf("%d\n", n - s[1].cnt - t[1].cnt);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:23: error: invalid operands of types 'node*' and 'double' to binary 'operator+'
   21 |     sort(s + 1, s + 1 + 1e5, cmp);
      |                 ~~~~~ ^ ~~~
      |                   |     |
      |                   node* double
a.cc:22:23: error: invalid operands of types 'node*' and 'double' to binary 'operator+'
   22 |     sort(t + 1, t + 1 + 1e5, cmp);
      |                 ~~~~~ ^ ~~~
      |                   |     |
      |                   node* double
Language: C++

#include <cstdio>
#include <cstring>
#include <algorithm>

const int N = 1e5 + 5;

int n, bin[N];
struct Data {
	int fir, sec, firnum, secnum;
};

Data solve(std::vector<int> v) {
	memset(bin, 0, sizeof(bin));
	for (int x: v) bin[x]++;
	int fir = 0, sec = 0;
	int firnum = 0, secnum = 0;
	for (int i = 1; i <= 100000; i++) {
		if (bin[i] > fir) {
			sec = fir, secnum = firnum;
			fir = bin[i], firnum = i;
		} else if (bin[i] == fir && bin[i] > sec) {
			sec = bin[i], secnum = i;
		}
	}
	return Data{fir, sec, firnum, secnum};
}
int main() {
	scanf("%d", &n);
	std::vector<int> v1, v2;
	for (int i = 1; i <= n; i++) {
		int x;
		scanf("%d", &x);
		if (i & 1) v1.emplace_back(x);
		else v2.emplace_back(x);
	}
	Data x = solve(v1);
	Data y = solve(v2);
	int ans;
	if (x.firnum != y.firnum) {
		ans = n - x.fir - y.fir;
	} else {
		ans = n - std::max(x.fir + y.sec, x.sec + y.fir);
	}
	printf("%d\n", ans);
	return 0;
}

Compiler output:
a.cc:12:17: error: 'vector' is not a member of 'std'
   12 | Data solve(std::vector<int> v) {
      |                 ^~~~~~
a.cc:4:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    3 | #include <algorithm>
  +++ |+#include <vector>
    4 | 
a.cc:12:24: error: expected primary-expression before 'int'
   12 | Data solve(std::vector<int> v) {
      |                        ^~~
a.cc:12:32: error: expected ',' or ';' before '{' token
   12 | Data solve(std::vector<int> v) {
      |                                ^
a.cc: In function 'int main()':
a.cc:29:14: error: 'vector' is not a member of 'std'
   29 |         std::vector<int> v1, v2;
      |              ^~~~~~
a.cc:29:14: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
a.cc:29:21: error: expected primary-expression before 'int'
   29 |         std::vector<int> v1, v2;
      |                     ^~~
a.cc:33:28: error: 'v1' was not declared in this scope; did you mean '__pstl::execution::v1'?
   33 |                 if (i & 1) v1.emplace_back(x);
      |                            ^~
      |                            __pstl::execution::v1
In file included from /usr/include/c++/14/pstl/glue_algorithm_defs.h:15,
                 from /usr/include/c++/14/algorithm:86,
                 from a.cc:3:
/usr/include/c++/14/pstl/execution_defs.h:19:18: note: '__pstl::execution::v1' declared here
   19 | inline namespace v1
      |                  ^~
a.cc:34:22: error: 'v2' was not declared in this scope
   34 |                 else v2.emplace_back(x);
      |                      ^~
a.cc:36:24: error: 'v1' was not declared in this scope; did you mean '__pstl::execution::v1'?
   36 |         Data x = solve(v1);
      |                        ^~
      |                        __pstl::execution::v1
/usr/include/c++/14/pstl/execution_defs.h:19:18: note: '__pstl::execution::v1' declared here
   19 | inline namespace v1
      |                  ^~
a.cc:37:24: error: 'v2' was not declared in this scope
   37 |         Data y = solve(v2);
      |                        ^~
Language: C

#include <stdio.h>
#define imit 100010

int odd[limit];
int even[limit];

int main(void){
  int N;
  scanf("%d",&N);

  N /= 2;

  for(int i = 0;i < limit;i++){
    odd[i] = even[i] = 0;
  }
  int a,b;
  for(int i = 0;i < N;i++){
    scanf("%d%d",&a,&b);
    odd[a-1]++;
    even[b-1]++;
  }

  int oddlen1 = 0,oddlen2 = 0;
  int evenlen1 = 0,evenlen2 = 0;
  int oddnum = a,evennum = b;

  for(int i = 0;i < limit;i++){
    if(oddlen1 <= odd[i]){
      oddlen2 = oddlen1;
      oddlen1 = odd[i];
      oddnum = i;
    }
    if(evenlen1 <= even[i]){
      evenlen2 = evenlen1;
      evenlen1 = even[i];
      evennum = i;
    }
  }

  if(oddnum != evennum){
    printf("%d\n",2*N-oddlen1-evenlen1);
  }else if(oddlen1+evenlen2 > oddlen2+evenlen1){
    printf("%d\n",2*N-oddlen1-evenlen2);
  }else{
    printf("%d\n",2*N-oddlen2-evenlen1);
  }

  return 0;
}

Compiler output:
main.c:4:9: error: 'limit' undeclared here (not in a function); did you mean 'imit'?
    4 | int odd[limit];
      |         ^~~~~
      |         imit
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <set> 
#include <bitset>
#include <cmath>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
typedef long long ll;

int main () {
    
    int n;
    cin >> n;
    vector<int> vc1(100000,0); 
    vector<int> vc2(100000,0);  

    int v;
    int mx1 = 0;
    int mx1 = 0;
    REP(i,n) {
        cin >> v;
        if(i % 2 == 0) {
            mx1 = max(mx1, v);
            vc1[v-1] += 1;
        } else {
            mx2 = max(mx2, v);
            vc2[v-1] += 1;
        } 
    } 

    int v1mx = 0;
    int v2mx = 0;
    int v1mx2 = 0; 
    int v2mx2 = 0;
    int v1amx = -1; 
    int v1amx2 = -1; 
    int v2amx = -1; 
    int v2amx2 = -1;

    REP(i, mx1) {
        if(v1mx < vc1[i]) {
            v1mx2 = v1mx;
            v1mx = vc1[i];
            v1amx = i;
        } else if(v1mx2 < vc1[i]) {
            v1mx2 = vc1[i];
        } 
    }

    REP(i, mx2) {
        if(v2mx < vc2[i]) {
            v2mx2 = v2mx;
            v2mx = vc2[i];
            v2amx = i;
        } else if(v2mx2 < vc2[i]) {
            v2mx2 = vc2[i];
        } 
    } 

    // cout << v1mx << " " << v1amx << endl;
    // cout << v1mx2 << " " << v1amx2 << endl;
    // cout << v2mx << " " << v2amx << endl;
    // cout << v2mx2 << " " << v2amx2 << endl;

    if(v1amx != v2amx) {
        cout << n - v1mx - v2mx << endl;
    } else {
        if(v2mx < v1mx) {
            cout << n - v1mx - v2mx2 << endl; 
        } else {
            cout << n - v2mx - v1mx2 << endl;
        }
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:9: error: redeclaration of 'int mx1'
   23 |     int mx1 = 0;
      |         ^~~
a.cc:22:9: note: 'int mx1' previously declared here
   22 |     int mx1 = 0;
      |         ^~~
a.cc:30:13: error: 'mx2' was not declared in this scope; did you mean 'mx1'?
   30 |             mx2 = max(mx2, v);
      |             ^~~
      |             mx1
a.cc:54:12: error: 'mx2' was not declared in this scope; did you mean 'mx1'?
   54 |     REP(i, mx2) {
      |            ^~~
a.cc:11:32: note: in definition of macro 'REP'
   11 | #define REP(i,n) for(int i=0;i<n;i++)
      |                                ^
Language: C++

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

int main(){
	long int n;
	cin >> n;
	vector<long int> v(n);
	for(int i=0;i<n;i++){
		cin >> v[i];
	}
	vector<long int> numodd(100001,0);
	vector<long int> numeven(100001,0);
	long int maxodd = 0;
	long int maxeven = 0;
	long int maxodd2 = 0;
	long int maxeven2 = 0;
	long int maxoddnum = -1;
	long int maxevennum = -1;
	long int maxoddnum2 = -1;
	long int maxevennum2 = -1;
	for(int i=0;i<n/2;i++){
		numeven[v[2 * i]]++;
		if((numeven[v[2 * i]] >= maxeven)){
			if(maxevennum != v[2 * i]){
				maxeven2 = maxeven;
				maxevennum2 = maxevennum;
			}
			maxeven = numeven[v[2 * i]];
			maxevennum = v[2 * i];
		}
		numodd[v[2 * i + 1]]++;
		if((numodd[v[2 * i + 1]] >= maxodd)){
			if(maxoddnum != v[2 * i + 1]){
				maxodd2 = maxodd;
				maxoddnum2 = maxoddnum;
			}
			maxodd = numodd[v[2 * i + 1]];
			maxoddnum = v[2 * i + 1];
		}
	}
	long int ans = n - maxodd - maxeven;
	if(maxoddnum == maxevennum){
		ans = max(n - maxodd - maxeven2, n - maxodd2 - maxeven)	
	}
	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:47:72: error: expected ';' before '}' token
   47 |                 ans = max(n - maxodd - maxeven2, n - maxodd2 - maxeven)
      |                                                                        ^
      |                                                                        ;
   48 |         }
      |         ~
Language: C++

n=int(input())
v=list(map(int, input().split()))
vad = {}
vbd = {}
for i in range(n):
	if i%2 == 0:
		if v[i] in vad:
			vad[v[i]] = vad[v[i]]+1
		else:
			vad[v[i]] = 0
	else:
		if v[i] in vbd:
			vbd[v[i]] = vbd[v[i]]+1
		else:
			vbd[v[i]] = 0

vadl = sorted(vad.items(), key=lambda x: -x[1])[0:1] # value 降順
vbdl = sorted(vbd.items(), key=lambda x: -x[1])[0:1] # value 降順

va_k, va_v = vadl[0]
vb_k, vb_v = vbdl[0]

if va_k == vb_k:
	if va_v==vb_v:
		if len(vadl)==1:
			print(va_v+1)
		else:
			vb_k, vb_v=vbdl[1]
			print(n//2-va_v+n//2-vb_v-2)
	elif va_v>vb_v:
		vb_k, vb_v=vbdl[1]
		print(n//2-va_v+n//2-vb_v-2)
	else:
		va_k, va_v=vadl[1]
		print(n//2-va_v+n//2-vb_v-2)
else:
	print(n//2-va_v+n//2-vb_v-2)


Compiler output:
a.cc:17:54: error: stray '#' in program
   17 | vadl = sorted(vad.items(), key=lambda x: -x[1])[0:1] # value 降順
      |                                                      ^
a.cc:18:54: error: stray '#' in program
   18 | vbdl = sorted(vbd.items(), key=lambda x: -x[1])[0:1] # value 降順
      |                                                      ^
a.cc:1:1: error: 'n' does not name a type
    1 | n=int(input())
      | ^
a.cc:4:1: error: 'vbd' does not name a type
    4 | vbd = {}
      | ^~~
a.cc:5:1: error: expected unqualified-id before 'for'
    5 | for i in range(n):
      | ^~~
Language: C++

from collections import Counter
N=int(input())
v=list(map(int,input().split()))

odd=v[0::2]
even=v[1::2]

o=Counter(odd).most_common(2)
e=Counter(even).most_common(2)

o.append((0,0))
e.append((0,0))

if o[0][0]==e[0][0]:
    ans=min(N-o[0][1]-e[1][1],N-e[0][1]-o[1][1])
else:
    ans=N-o[0][1]-e[0][1]
print(ans)



"""
ans=N
for o_l in o:
    for e_l in e:
        if o_l[0]!=e_l[0]:
            ans=min(ans,N-o_l[1]-e_l[1])
print(ans)
"""



Compiler output:
a.cc:22:3: warning: missing terminating " character
   22 | """
      |   ^
a.cc:22:3: error: missing terminating " character
a.cc:29:3: warning: missing terminating " character
   29 | """
      |   ^
a.cc:29:3: error: missing terminating " character
a.cc:1:1: error: 'from' does not name a type
    1 | from collections import Counter
      | ^~~~
Language: C++

from collections import Counter

n = int(input())
v = list(map(int, input().split()))

even = v[0::2]
odd = v[1::2]
count_even = Counter(even).most_common()
count_odd = Counter(odd).most_common()

if count_even[0][0] == count_odd[0][0]:
    a = 0 if len(count_odd) == 1 else count_odd[1][1]
    b = 0 if len(count_even) == 1 else count_even[1][1]
    print(n - max(count_even[0][1] + a, count_odd[0][1] + b))
else:
    print(n - count_even[0][1] - count_odd[0][1])



Compiler output:
a.cc:1:1: error: 'from' does not name a type
    1 | from collections import Counter
      | ^~~~
Language: Java

import sys
from collections import Counter

#[(105, 3), (120, 1), (106, 1), (119, 1)]
def selection(l1, l2, x ,y):
    
    #print('{}, {}'.format(x, y))
    
    #x yがlengthを超えたとき
    if x >= len(l1) or y >= len(l2):
        return x - 1, y - 1
    
    #それぞれの出現値が同じ場合
    if l1[x][0] == l2[y][0]:
            
        #出現回数が同じとき
        if l1[x][1] == l2[y][1]:
            return selection(l1, l2, x + 1 , y + 1)
    
    #出現回数を比較
    if l1[x][1] > l2[y][1]:
        return x , y - 1
        
    if l1[x][1] < l2[y][1]:
        return x - 1  , y
    
    return x, y

def main():
    input = sys.stdin.readline
    
    n = int(input())
    if n == 0 : return 0
    
    m = [int(i) for i in input().split()]
    
    even = [m[i] for i, _ in enumerate(m) if i % 2 == 0]
    odd = [m[i] for i, _ in enumerate(m) if i % 2 == 1]
    
    even_c = Counter(even).most_common()
    odd_c = Counter(odd).most_common()
    
    #print(even_c)
    #print(odd_c)
    
    e, o = selection(even_c, odd_c, 0 ,0)
    
    e = 0 if e < 0 else e
    o = 0 if o < 0 else o
    
    #print('{}, {}'.format(e, o))
    
    #全部ばらばら
    if (even_c[e][1] + odd_c[o][1] == 2):
        
        #0にならない
        ans = len(m) - 2
        ans = 1 if ans == 0 else ans
        print(ans)
        return
    
    #全部一緒
    if even_c[e][1] == odd_c[o][1] and even_c[e][0] == odd_c[o][0]:
        print(len(m) - even_c[e][1])
        return
    
    print( len(m) - (even_c[e][1] + odd_c[o][1]) )
    
    
if __name__ == '__main__':
    main()
    

Compiler output:
Main.java:1: error: '.' expected
import sys
          ^
Main.java:2: error: ';' expected
from collections import Counter
    ^
Main.java:4: error: illegal character: '#'
#[(105, 3), (120, 1), (106, 1), (119, 1)]
^
Main.java:7: error: illegal character: '#'
    #print('{}, {}'.format(x, y))
    ^
Main.java:7: error: unclosed character literal
    #print('{}, {}'.format(x, y))
           ^
Main.java:7: error: unclosed character literal
    #print('{}, {}'.format(x, y))
                  ^
Main.java:9: error: illegal character: '#'
    #x y?length??????
    ^
Main.java:13: error: illegal character: '#'
    #?????????????
    ^
Main.java:16: error: illegal character: '#'
        #?????????
        ^
Main.java:20: error: illegal character: '#'
    #???????
    ^
Main.java:43: error: illegal character: '#'
    #print(even_c)
    ^
Main.java:44: error: illegal character: '#'
    #print(odd_c)
    ^
Main.java:51: error: illegal character: '#'
    #print('{}, {}'.format(e, o))
    ^
Main.java:51: error: unclosed character literal
    #print('{}, {}'.format(e, o))
           ^
Main.java:51: error: unclosed character literal
    #print('{}, {}'.format(e, o))
                  ^
Main.java:53: error: illegal character: '#'
    #??????
    ^
Main.java:56: error: illegal character: '#'
        #0?????
        ^
Main.java:62: error: illegal character: '#'
    #????
    ^
Main.java:70: error: unclosed character literal
if __name__ == '__main__':
               ^
Main.java:70: error: unclosed character literal
if __name__ == '__main__':
                        ^
20 errors
Language: Java

import java.util.Arrays;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) throws Exception{
		Scanner stdIn=new Scanner(System.in);
		int n=stdIn.nextInt();
		int v=0;
		int v1=0;
		int v2=0;
		int odd[][]=new int[100001][2];
		int even[][]=new int[100001][2];
		int z=0,y=0,x=0,cou=0;
		while(z<n){
			v=stdIn.nextInt();
			if(z==0)
				v1=v;
			if(z==1)
				v2=v;
			if(z%2==0){
				odd[v][0]++;
				odd[v][1]=v;
				x++;
			}
			else{
				even[v][0]++;
				even[v][1]=v;
				y++;
			}
			z++;
		}z=0;
		Arrays.sort(odd, (a, b) -> Long.compare(a[0], b[0]));
		Arrays.sort(even, (a, b) -> Long.compare(a[0], b[0]));
		if(x!=odd[100000][0]){
			cou+=x-odd[100000][0];
		}
		if(y!=even[100000][0]){
			cou+=y-even[100000][0];
		}
		if(x!=odd[100000][0]&&y!=even[100000][0]){
			if(even[100000][1]==odd[100000][1])
				if(odd[100000][0]-odd[99999][0]>=even[100000][0]-even[99999][0])
					cou+=odd[100000][0]-odd[99999][0];
				else
					cou+=even[100000][0]-even[99999][0];
		}
		if(x==odd[100000][0]&&y==even[100000][0]){
			if(v1==v2)
				cou+=y;
		}
		System.out.println(cou);
	}

Compiler output:
Main.java:51: error: reached end of file while parsing
	}
	 ^
1 error
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;
 
int main() {
    long long a;
  	cin >> a;
  	long long b[a/2+1];
  	long long c[a/2+1];
  	long long mi = 100010;
  	long long ans = 0;
  	long long e = 0;
  	long long o = 0;
  	for(long long i = 0; i < a; ++i){
      if(i % 2 == 0){
		cin >> b[e];
        e++;
      }
      else{
        cin >> c[o];
        o++;
      }
    }
  	sort(b, b + a/2+1);
  	sort(c, c + a/2+1);
  	long long countb = 1;
  	long long tempb = 1;
  	long long countc = 1;
  	long long tempc = 1;
  	long long countb2 = 1;
  	long long countc2 = 1;
  	for(long long i = 0; i < a/2; ++i){
      if(b[i] == b[i+1]) {
       	tempb++;
      }
      else if(b[i] != b[i+1]) {
        if(countb2 < tempb && tempb < countb) countb2 = temp;
       	if(countb < tempb) countb = tempb;
        tempb = 1;
      }
      if(c[i] == c[i+1]) {
       	tempc++;
      }
      else if(b[i] != b[i+1]) {
        if(countc2 < tempc && tempc < countc) countc2 = temp;
       	if(countc < tempc) countc = tempc;
        tempc = 1;
      }
    }
  	ans = min(a-countb-countc2 ,a-countb2-countc);
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:57: error: 'temp' was not declared in this scope; did you mean 'tempc'?
   37 |         if(countb2 < tempb && tempb < countb) countb2 = temp;
      |                                                         ^~~~
      |                                                         tempc
a.cc:45:57: error: 'temp' was not declared in this scope; did you mean 'tempc'?
   45 |         if(countc2 < tempc && tempc < countc) countc2 = temp;
      |                                                         ^~~~
      |                                                         tempc
Language: C++

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

int main() {
  int n,count,max1,max2;
  cin>>n;
  count=max1=max2=0;
  vector<int> a(n);
  
  //Anの取得
  for(int i=0;i<n;i++)
    cin>>a.at(n);
  
  //奇数番号
  for(int i=0;i<n-2,i+=2){
    if(a(i)==a(i+2)){
      count++;
      
      if(max1<count)
        max1=count;
    }
    else{
      count*=0;
    }
  }
  
  count=0;
  
  //偶数番号
  for(int i=1;i<n-2,i+=2){
    if(a(i)==a(i+2)){
      count++;
      
      if(max2<count)
        max2=count;
    }
    else{
      count*=0;
    }
  }
  cout<<n-max1-max2-2<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:25: error: expected ';' before ')' token
   15 |   for(int i=0;i<n-2,i+=2){
      |                         ^
      |                         ;
a.cc:16:9: error: no match for call to '(std::vector<int>) (int&)'
   16 |     if(a(i)==a(i+2)){
      |        ~^~~
a.cc:16:15: error: no match for call to '(std::vector<int>) (int)'
   16 |     if(a(i)==a(i+2)){
      |              ~^~~~~
a.cc:30:25: error: expected ';' before ')' token
   30 |   for(int i=1;i<n-2,i+=2){
      |                         ^
      |                         ;
a.cc:31:9: error: no match for call to '(std::vector<int>) (int&)'
   31 |     if(a(i)==a(i+2)){
      |        ~^~~
a.cc:31:15: error: no match for call to '(std::vector<int>) (int)'
   31 |     if(a(i)==a(i+2)){
      |              ~^~~~~
Language: C++

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

int main(){
  int n;
  vector<int>vec(n);
  for (int i = 0; i < n; i++){
    cin >> vec.at(i);
  }
  int num = 1;
  if (n == 2 && vec.at(0) == vec.at(1)){
    cout  << 1;
  }
  else if (n == 2 && vec.at(0) != vec.at(1)){
    cout << 0;
  }
  else{
    for (int j = 0; j < n-2; j++){
    if (vec.at(j) == vec.at(j+2))
      continue;
    else if (num == 2 
    

Compiler output:
a.cc: In function 'int main()':
a.cc:21:22: error: expected ')' at end of input
   21 |     else if (num == 2
      |             ~        ^
      |                      )
a.cc:21:22: error: expected statement at end of input
a.cc:21:22: error: expected '}' at end of input
a.cc:18:34: note: to match this '{'
   18 |     for (int j = 0; j < n-2; j++){
      |                                  ^
a.cc:21:22: error: expected '}' at end of input
   21 |     else if (num == 2
      |                      ^
a.cc:17:7: note: to match this '{'
   17 |   else{
      |       ^
a.cc:21:22: error: expected '}' at end of input
   21 |     else if (num == 2
      |                      ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <stack>
#include <list>
#include <utility>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>


#define REP(i,N) for(int i = 0; i <N; i++)
using namespace std;


const int MOD = pow(10,9)+7;
const int MAX = 2047483647;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

typedef long long ll;


int in(){
    int temp;
    scanf("%d",&temp);
    return temp;
}

ll lin(){
    ll temp;
    scanf("%lld",&temp);
    return temp;
}

ll gcb(ll a, ll b){/// ユークリッドの互除法: O(log)
    
    if(b == 0) return a;
    
    return gcb(b,a%b);
}


ll lcm(ll a, ll b){
    
    return  a/gcb(a,b) * b; ///gcbは約数
}


int main() {
    
    int n = in();
    
    vector<int> inputOdd(100001,0);
    vector<int> inputEven(100001,0);

    int temp;
    for(auto i = 0; i<n/2; i++){
        temp = in();
        inputOdd[temp]++;
        
        temp = in();
        inputEven[temp]++;
    }
    
    
    auto oddmax = max_element(inputOdd.begin(),inputOdd.end());
    auto evenmax = max_element(inputEven.begin(),inputEven.end());
    
    if (oddmax-inputOdd.begin() != evenmax - inputEven.begin() ){ ///最大個数の要素が同一でなければ、それに各々寄せる
        
        cout << n - *oddmax - *evenmax << endl;
        return 0;
    }
    
    
    if (*oddmax == n/2 && *evenmax == n/2 && inputOdd[0] == inputEven[0]){
        cout << n/2 << endl;
        return 0;
    }
    
    nth_element(inputOdd.begin(),inputOdd.begin()+1,inputOdd.end());
    nth_element(inputEven.begin(),inputEven.begin()+1,inputEven.end()); //second largestを比較して、大きい方に寄せる
    
    
    int cand;

    cand =  n - *evenmax - inputOdd[1];
        
    if (cand > n - *oddmax - inputEven[1]){
        cand =n - *oddmax - inputEven[1];
    }

    
    cout << cand << endl;
    

    return 0;
}





8
102 111 119 119 119 119 103 111


Compiler output:
a.cc:109:1: error: expected unqualified-id before numeric constant
  109 | 8
      | ^