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

#include <stdio.h>
#include <stdlib.h>
 
int main(void) {
	int n;
 
 	scanf("%d", &n);
 
	int guu[n];
	int ki[n];

	int gucount = 0;
	int baka = 0;
	int bakavalue = 0;
	int guuindex = 0;

	int kicount = 0;
	int aho = 0;
	int ahovalue = 0;
	int kiindex = 0;

	int output = 0;

	if(n < 2 || n > 100000 || n % 2 != 0) {
		exit(0);
	}

	if(n == 2) {
        printf("0");
        return 0;
    }

    for(int i= 0; i < n; i++) {
        guu[i] = 0;
        ki[i] = 0;
    }

    for(int i = 0; i < n; i++) {
        scanf("%d", &input);
        num = i % 2;
        if(num == 0) {
            guu[input]++;
        } else {
            ki[input]++;
        }
    }

    for(int i = 0; i < n; i++) {
        if(guu[i] != 0) {
            if(gucount < guu[i]) {
            	// 2番目のcount(偶数)
                baka = gucount;
                // 2番目のindex(偶数)
                bakavalue = guuindex;
                // 1番目のcount(偶数)
                gucount = guu[i];
                // 1番目のindex(偶数)
                guuindex = i;
            } else if(baka < guu[i]) {
            	// 2番目のcount(偶数)
                baka = guu[i];
                // 2番目のindex(偶数)
                bakavalue = i;
            }
        }
        
        if(ki[i] != 0) {
            if(kicount < ki[i]) {
                aho = kicount;
                ahovalue = kiindex;
                kicount = ki[i];
                kiindex = i;
            } else if(aho < ki[i]) {
                aho = ki[i];
                ahovalue = i;
            }
        }
    }

    if(bakavalue == ahovalue) {
    	if(gucount >= kicount) {
    		output = (n / 2 - gucount) + (n / 2 - aho);
    	} else {
    		output = (n / 2 - baka) + (n / 2 - kicount);
    	}
    } else {
    	output = (n / 2 - gucount) + (n / 2 - kicount);
    }

	printf("%d\n", output);
}

Compiler output:
main.c: In function 'main':
main.c:39:22: error: 'input' undeclared (first use in this function)
   39 |         scanf("%d", &input);
      |                      ^~~~~
main.c:39:22: note: each undeclared identifier is reported only once for each function it appears in
main.c:40:9: error: 'num' undeclared (first use in this function)
   40 |         num = i % 2;
      |         ^~~
Language: Java


import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] odd = new int[100001]; // iが奇数であるviからなる数列Oについて、1-100000までのそれぞれの数が存在する個数
		int[] even = new int[100001];
		for (int i = 1; i <= n; i++) {
			int v = sc.nextInt();
			if (i%2 != 0) {
				odd[v]++;
			} else {
				even[v]++;
			}
		}

		int odd_max1 = 0;
		int odd_max2 = 0;
		for (int i = 1; i < 100000; i++) {
			if (odd[i] > odd[odd_max1]) {
				odd_max2 = odd_max1;
				odd_max1 = i;
			}
		}
		int even_max1 = 0;
		int even_max2 = 0;
		for (int i = 2; i < 100001; i++) {
			if (even[i] > even[even_max1]) {
				even_max2 = even_max1;
				even_max1 = i;
			}
		}
		int rewrite = n;
		if (odd_max1 != even_max1) {
			rewrite = n - odd[odd_max1] - even[even_max1];
		} else {
			if

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

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

void mode(int, int*);
int main() {
	int  n,i,j,count = 0,xmode,ymode;
	int xvalue, yvalue;
	cin >> n;
	int Xary[n / 2];
	int Yary[n / 2];
	for ( i = 0; i < n; i++)
	{
		if (i % 2 == 0) {
			cin >> Xary[i/2];
		}
		else {
			cin >> Yary[i-1/2];
		}
	}
	xmode = mode(n, Xary, xvalue);
	ymode = mode(n, Yary, yvalue);

	if (xmode == ymode) {
		if (xvalue == yvalue) {
			cout << n / 2;
		}
		else if (xvalue > yvalue) {
			cout << yvalue;
		}
		else {
			cout << xvalue;
		}
	}
	else if (xmode > ymode) {
		cout << ymode;
	}
	else
	{
		cout << xmode;
	}
	return 0;
}


int mode(int n,int* data ,int* pvalue) {
	int i, j,count,value = 0,mode = 0;
	for ( i = 0; i < n/2; i++)
	{
		count = 1;
		for ( j = i + 1; j < n/2; j++)
		{
			if (data[i] == data[j])count++;
		}
		if (mode < count) {
			mode = count;
			value = mode;
		}
	}
	pvalue = &value;
	return mode;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:21: error: too many arguments to function 'void mode(int, int*)'
   23 |         xmode = mode(n, Xary, xvalue);
      |                 ~~~~^~~~~~~~~~~~~~~~~
a.cc:7:6: note: declared here
    7 | void mode(int, int*);
      |      ^~~~
a.cc:23:21: error: void value not ignored as it ought to be
   23 |         xmode = mode(n, Xary, xvalue);
      |                 ~~~~^~~~~~~~~~~~~~~~~
a.cc:24:21: error: too many arguments to function 'void mode(int, int*)'
   24 |         ymode = mode(n, Yary, yvalue);
      |                 ~~~~^~~~~~~~~~~~~~~~~
a.cc:7:6: note: declared here
    7 | void mode(int, int*);
      |      ^~~~
a.cc:24:21: error: void value not ignored as it ought to be
   24 |         ymode = mode(n, Yary, yvalue);
      |                 ~~~~^~~~~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <assert>

using namespace std;

int main(int argc, char* argv[]) {
    int N;
    std::cin >> N;

    auto v1 = new int[N/2];
    auto v2 = new int[N/2];
    for (int i = 0; i < N / 2; i++) {
        std::cin >> v1[i];
        std::cin >> v2[i];
    }

    auto bucket1 = new int[10002];
    auto bucket2 = new int[10002];
    for (int i = 0; i < 10002; i++) {
        bucket1[i] = 0;
        bucket2[i] = 0;
    }

    for (int i = 0; i < N / 2; i++) {
        bucket1[v1[i]]++;
        bucket2[v2[i]]++;
    }

    int max1 = 0;
    int max2 = 0;
    int index1 = 0;
    int index2 = 0;
    for (int i = 0; i < 10002; i++) {
        if (max1 < bucket1[i]) {
            max1 = bucket1[i];
            index1 = i;
        }
        if (max2 < bucket2[i]) {
            max2 = bucket2[i];
            index2 = i;
        }
    }
    //printf("%d %d", index1, index2);

    std::sort(bucket1, bucket1 + 10002, std::greater<int>());
    std::sort(bucket2, bucket2 + 10002, std::greater<int>());

    assert(max1 == bucket1[0]);
    assert(max2 == bucket2[0]);
    //printf("%d %d, %d %d \n", max1, bucket1[1], max2, bucket2[1]);

    int cnt = 0;
    if (index1 == index2) {
        int sum1, sum2, v;
        if (max1 > max2) {
            v = N/2 - max1 + N/2 - bucket2[1];
        } else if (max1 < max2) {
            v = N/2 - bucket1[1] + N/2 - max2;
        } else /* (max1 == max2) */ {
            sum1 = max1 + bucket2[1];
            sum2 = bucket1[1] + max2;
            v = std::max(sum1, sum2);
            //printf("%d %d %d \n", sum1, sum2, v);
        }
        //printf("%d \n", v);
        cnt = N - v;
    } else {
        cnt = N - max1 - max2;
    }

    printf("%d\n", cnt);
    return 0;
}

Compiler output:
a.cc:3:10: fatal error: assert: No such file or directory
    3 | #include <assert>
      |          ^~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <algorithm>

using namespace std;

int main(int argc, char* argv[]) {
    int N;
    std::cin >> N;

    auto v1 = new int[N/2];
    auto v2 = new int[N/2];
    for (int i = 0; i < N / 2; i++) {
        std::cin >> v1[i];
        std::cin >> v2[i];
    }

    auto bucket1 = new int[10002];
    auto bucket2 = new int[10002];
    for (int i = 0; i < 10002; i++) {
        bucket1[i] = 0;
        bucket2[i] = 0;
    }

    for (int i = 0; i < N / 2; i++) {
        bucket1[v1[i]]++;
        bucket2[v2[i]]++;
    }

    int max1 = 0;
    int max2 = 0;
    int index1 = 0;
    int index2 = 0;
    for (int i = 0; i < 10002; i++) {
        if (max1 < bucket1[i]) {
            max1 = bucket1[i];
            index1 = i;
        }
        if (max2 < bucket2[i]) {
            max2 = bucket2[i];
            index2 = i;
        }
    }
    //printf("%d %d", index1, index2);

    std::sort(bucket1, bucket1 + 10002, std::greater<int>());
    std::sort(bucket2, bucket2 + 10002, std::greater<int>());

    assert(max1 == bucket1[0]);
    assert(max2 == bucket2[0]);
    //printf("%d %d, %d %d \n", max1, bucket1[1], max2, bucket2[1]);

    int cnt = 0;
    if (index1 == index2) {
        int sum1, sum2, v;
        if (max1 > max2) {
            v = N/2 - max1 + N/2 - bucket2[1];
        } else if (max1 < max2) {
            v = N/2 - bucket1[1] + N/2 - max2;
        } else /* (max1 == max2) */ {
            sum1 = max1 + bucket2[1];
            sum2 = bucket1[1] + max2;
            v = std::max(sum1, sum2);
            //printf("%d %d %d \n", sum1, sum2, v);
        }
        //printf("%d \n", v);
        cnt = N - v;
    } else {
        cnt = N - max1 - max2;
    }

    printf("%d\n", cnt);
    return 0;
}

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:48:5: error: 'assert' was not declared in this scope
   48 |     assert(max1 == bucket1[0]);
      |     ^~~~~~
a.cc:3:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'
    2 | #include <algorithm>
  +++ |+#include <cassert>
    3 |
Language: C

#include <stdio.h>
#define N 100000

int main(){
  int n;
  scanf("%d\n",&n);
  //
  if(n==2){
    n = 0;
    printf("%d",n);
    return 0;
  }
  //
  int a1[N];
  int a2[N];
  for(int i=0;i<N;i++){
    a1[i] = 0;
    a2[i] = 0;
  }
  int m1 = 1;
  int n1 = 1;
  int m2 = 0;
  int n2 = 0;
  int num11,num12,num21,num22;
  int y,z;
  for(int i=0;i<n;i++){
    y = i%2;
    scanf("%d%*c",&z);
    if(y==0){
      a1[z]++;
    }else{
      a2[z]++;
    }
  }
  //
  for(int i=0;i<N;i++){
    if(a1[i] > m1){
      n1 = m1;
      num12 = num11;
      m1 = a1[i];
      num11 = i;
    }else if(a1[i] > n1){
      n1 = a1[i];
      num12 = i;
    }
    if(a2[i] > m2){
      n2 = m2;
      num22 = num21;
      m2 = a2[i];
      num21 = i;
    }else if(a2[i] > n2){
      n2 = a2[i];
      num22 = i;
    }
  }
  int answer;
  if(num11 == num21){
    if(m1+n2 < m2+n1){
      answer = n - m2 - n1;
    }else if(n1==0 && n2==0){
      answer = n/2;
    }else{
      answer = n - m1 - n2;
  }else{
    answer = n - m1 - m2;
  }
  printf("%d",answer);
}

Compiler output:
main.c: In function 'main':
main.c:64:4: error: expected '}' before 'else'
   64 |   }else{
      |    ^~~~
Language: C++

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

int main(void){
    int n,i, buf;
    cin >> n;
    vector<int> vec1(MAX), vec2(MAX);
    for(i=0; i<MAX; i++){
        vec1.at(i) = 0;
        vec2.at(i) = 0;
    }
    for(i=0; i<n; i++){
        cin >> buf;
        if(i%2 == 0){
            vec1.at(buf-1)++;
        }else{
            vec2.at(buf-1)++;
        }
    }
    int m1 = 0, m2 = 0;
    for(i=0; i<MAX; i++){
        if(vec1.at(i) > vec1.at(m1)){
            m1 = i;
        }if(vec2.at(i) > vec2.at(m2)){
            m2 = i;
        }
    }
    
    sort(vec1.begin(), vec1.end());
    sort(vec2.begin(), vec2.end());
    reverse(vec1.begin(), vec1.end());
    reverse(vec2.begin(), vec2.end());
    
    int ans;
    if(m1 != m2){
        ans = n-vec1.at(0)-vec2.at(0);
    }else{
        ans = min(n-vec1.at(1)-vec2.at(0), n-vec1.at(0)-vec2.at(1));
    }
    cout << ans << endl;
    return 0;
}

    return 0;
}


Compiler output:
a.cc:45:5: error: expected unqualified-id before 'return'
   45 |     return 0;
      |     ^~~~~~
a.cc:46:1: error: expected declaration before '}' token
   46 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  vector<int> v_e(100010);
  vector<int> v_o(100010);
  cin >> n;
  for (int i = 0; i < n; i++) {
    int v;
    cin >> v;
    if (i%2==0)
      v_e.at(v)++;
    else
      v_o.at(v)++;
  }
 
  vector<int>::iterator maxItVE = max_element(v_e.begin(), v_e.end());
  int maxVE = *maxItVE;
  int iVE = distance(v_e.begin(), maxItVE);
  v_e[iVE] = 0;
  int maxVE2 = *max_element(v_e.begin(), v_e.end());
  
  vector<int>::iterator maxItVO = max_element(v_o.begin(), v_o.end());
  int maxVO = *maxItVO;
  int iVO = distance(v_o.begin(), maxItVO);
  v_o[iVO] = 0;
  int maxVO2 = *max_element(v_o.begin(), v_o.end());
  
  if (iVE == iVO) {
    cout << n - maxVE - maxVO << endl;
  } else 
    cout << n - max(maxVE2+maxVO, maxVE+maxVO2) << endl;
  } 
  return 0;
}

Compiler output:
a.cc:35:3: error: expected unqualified-id before 'return'
   35 |   return 0;
      |   ^~~~~~
a.cc:36:1: error: expected declaration before '}' token
   36 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  vector<int> v_e(100010);
  vector<int> v_o(100010);
  cin >> n;
  for (int i = 0; i < n; i++) {
    int v;
    cin >> v;
    if (i%2==0)
      v_e.at(v)++;
    else
      v_o.at(v)++;
  }
 
  vector<int>::iterator maxItVE = max_element(v_e.begin(), v_e.end());
  int maxVE = *maxItVE;
  int iVE = distance(v_e.begin(), maxItVE);
  A[iVE] = 0;
  int maxVE2 = *max_element(v_e.begin(), v_e.end());
  
  vector<int>::iterator maxItVO = max_element(v_o.begin(), v_o.end());
  int maxVO = *maxItVO;
  int iVO = distance(v_o.begin(), maxItVO);
  A[iVO] = 0;
  int maxVO2 = *max_element(v_o.begin(), v_o.end());
  
  if (eno1 != ono1) {
    cout << n - maxVE - maxVO << endl;
  } else 
    cout << n - max(maxVE2+maxVO, maxVE+maxVO2) << endl;
  } 
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:3: error: 'A' was not declared in this scope
   21 |   A[iVE] = 0;
      |   ^
a.cc:30:7: error: 'eno1' was not declared in this scope
   30 |   if (eno1 != ono1) {
      |       ^~~~
a.cc:30:15: error: 'ono1' was not declared in this scope
   30 |   if (eno1 != ono1) {
      |               ^~~~
a.cc: At global scope:
a.cc:35:3: error: expected unqualified-id before 'return'
   35 |   return 0;
      |   ^~~~~~
a.cc:36:1: error: expected declaration before '}' token
   36 | }
      | ^
Language: C++

#include <bits/stdc++.h>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
const double pi=acos(-1.0);
ll mod=1000000007;

bool cmp(pii a,pii b){
	return a.second>b.second;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;cin >> n;
	vector<int> a(n);
	rep(i,n) cin >> a.at(i);
	vector<pii> b(100001);
	vector<pii> c(100001);
	rep(i,100001){
		b.at(i).first=i;
		c.at(i).first=i;
	}
	for(int i=0;i<n-2;i+=2){
		if(a.at(i)==a.at(i+2)) b.at(a.at(i)).second++;
	}
	sort(b.begin(),b.end(),cmp);
	for(int i=1;i<n-2;i+=2){
		if(a.at(i)==a.at(i+2)) c.at(a.at(i)).second++;
	}
	sort(c.begin(),c.end(),cmp);
	if(n==2){
		if(a.at(0)==a.at(1)) cout << 1 << endl;
		else cout << 0 << endl;
	}
	else if(b.at(0).first==c.at(0).first){
		if(b.at(0).second+1+c.at(0).second+1==n) cout << n/2 << endl;
		else{
			if(b.at(0).second==c.at(0).second){
				if(b.at(1).second>=c.at(1).second) cout << n-(b.at(1).second+1)-(c.at(0).second+1) << endl;
				else cout << n-(b.at(0).second+1)-(c.at(1).second+1) cout << endl;
			}
			else if(b.at(0).second>c.at(0).second) cout << n-(b.at(0).second+1)-(c.at(1).second+1) << endl;
			else cout << n-(b.at(1).second+1)-(c.at(0).second+1) << endl;
		}
	}
	else{
		if(b.at(0).first!=c.at(0).first) cout << n-(b.at(0).second+1)-(c.at(0).second+1) << endl;
		else cout << n-(max(b.at(0).second,c.at(0).second)+1)-1 << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:45:85: error: expected ';' before 'cout'
   45 |                                 else cout << n-(b.at(0).second+1)-(c.at(1).second+1) cout << endl;
      |                                                                                     ^~~~~
      |                                                                                     ;
Language: C++

#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<utility>
#include<numeric>
#include<vector>
#include<map>
#include<unordered_map>
#include<set>
#include<tuple>
#include<stack>
#include<queue>
#include<functional>
#include<iterator>
#include<cmath>
#include<cctype>

using namespace std;

typedef long long ll;
typedef pair<int,int> P;

const int INF = 1e9;
const ll LINF = 1e18;

struct edge{int to,cost;};


int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);

	int n;
	cin >> n;

	int a[n/2],b[n/2];
	for(int i=0;i<n/2;i++){
		cin >> a[i] >> b[i];
	}
	sort(a,a+n/2); sort(b,b+n/2);
	int prev=a[0];
	vector<pair<int,int>> num_v_a;
	int ind=0,num=0;
	for(int i=1;i<n/2;i++){
		if(prev==a[i]) num++;
		else{
			num_v_a.push_back(P(num,prev));
			num=0;
			prev=a[i];
		}
	}	
	if(num!=0){
		num_v_a.push_back(P(num,prev);
	}
	prev=b[0];
	vector<pair<int,int>> num_v_b;
	ind=0,num=0;
	for(int i=1;i<n/2;i++){
		if(prev==b[i]) num++;
		else{
			num_v_b.push_back(P(num,prev));
			num=0;
			prev=b[i];
		}
	}
	if(num!=0){
		num_v_a.push_back(P(num,prev);
	}
	sort(num_v_a.begin(),num_v_a.end());
	reverse(num_v_a.begin(),num_v_a.end());
	sort(num_v_b.begin(),num_v_b.end());
	reverse(num_v_b.begin(),num_v_b.end());

//	printf("a最大%d %d個 %d %d \n",maxa,maxnuma,maxb,maxnumb);
	int ans=INF;
	if(num_v_a[0].second != num_v_b[0].second){
		cout << n-num_v_a[0].first-num_v_b[0].first << "\n";
	}else{
		if(num_v_a[0].first+num_v_b[0].first == n){
			cout << n/2;
		}else{
			int ans=INF;
			if(num_v_a.size()>=2){
				ans = n-num_v_a[1].first - num_v_b[0].first;
			}else if(num_v_b.size()>=2){
				ans = min(ans,n-num_v_a[1].first - num_v_b[0].first);
			}
		}
		cout << ans << "\n";
	}
	return 0;
}
                          

Compiler output:
a.cc: In function 'int main()':
a.cc:54:46: error: expected ')' before ';' token
   54 |                 num_v_a.push_back(P(num,prev);
      |                                  ~           ^
      |                                              )
a.cc:68:46: error: expected ')' before ';' token
   68 |                 num_v_a.push_back(P(num,prev);
      |                                  ~           ^
      |                                              )
Language: Java

class Main{
	static Scanner scan = new Scanner(System.in);
	public static void main(String[] argv){
		c();
	}
  	static void c(){
		int n = scan.nextInt();
		Map<Integer, Integer> mapEven = new HashMap<>();
		Map<Integer, Integer> mapOdd = new HashMap<>();
		for(int i=0;i<n;i++){
			int temp = scan.nextInt();
			if(i%2==0){
				mapEven.put(temp,mapEven.getOrDefault(temp, 0)+1);
			}
			else{
				mapOdd.put(temp,mapOdd.getOrDefault(temp, 0)+1);
			}
		}
		List<Map.Entry<Integer, Integer>> o = new ArrayList<>(mapOdd.entrySet());
    	List<Map.Entry<Integer, Integer>> e = new ArrayList<>(mapEven.entrySet());
    	o.sort((o1, o2) -> o2.getValue() - o1.getValue());
    	e.sort((o1, o2) -> o2.getValue() - o1.getValue());
		int o1 = o.get(0).getValue();
    	int o2 = o.size() == 1 ? 0 : o.get(1).getValue();
    	int e1 = e.get(0).getValue();
    	int e2 = e.size() == 1 ? 0 : e.get(1).getValue();
		if (!o.get(0).getKey().equals(e.get(0).getKey())) {
      		System.out.println(n - o1 - e1);
    	}
		else {
      		System.out.println(n - Math.max(o1 + e2, o2 + e1));
    	}
	}
}


Compiler output:
Main.java:2: error: cannot find symbol
	static Scanner scan = new Scanner(System.in);
	       ^
  symbol:   class Scanner
  location: class Main
Main.java:2: error: cannot find symbol
	static Scanner scan = new Scanner(System.in);
	                          ^
  symbol:   class Scanner
  location: class Main
Main.java:8: error: cannot find symbol
		Map<Integer, Integer> mapEven = new HashMap<>();
		^
  symbol:   class Map
  location: class Main
Main.java:8: error: cannot find symbol
		Map<Integer, Integer> mapEven = new HashMap<>();
		                                    ^
  symbol:   class HashMap
  location: class Main
Main.java:9: error: cannot find symbol
		Map<Integer, Integer> mapOdd = new HashMap<>();
		^
  symbol:   class Map
  location: class Main
Main.java:9: error: cannot find symbol
		Map<Integer, Integer> mapOdd = new HashMap<>();
		                                   ^
  symbol:   class HashMap
  location: class Main
Main.java:19: error: cannot find symbol
		List<Map.Entry<Integer, Integer>> o = new ArrayList<>(mapOdd.entrySet());
		^
  symbol:   class List
  location: class Main
Main.java:19: error: package Map does not exist
		List<Map.Entry<Integer, Integer>> o = new ArrayList<>(mapOdd.entrySet());
		        ^
Main.java:19: error: cannot find symbol
		List<Map.Entry<Integer, Integer>> o = new ArrayList<>(mapOdd.entrySet());
		                                          ^
  symbol:   class ArrayList
  location: class Main
Main.java:20: error: cannot find symbol
    	List<Map.Entry<Integer, Integer>> e = new ArrayList<>(mapEven.entrySet());
    	^
  symbol:   class List
  location: class Main
Main.java:20: error: package Map does not exist
    	List<Map.Entry<Integer, Integer>> e = new ArrayList<>(mapEven.entrySet());
    	        ^
Main.java:20: error: cannot find symbol
    	List<Map.Entry<Integer, Integer>> e = new ArrayList<>(mapEven.entrySet());
    	                                          ^
  symbol:   class ArrayList
  location: class Main
12 errors
Language: C++

#include <stdio.h>
#include <iostream>
#include <vector>

int main()
{
    int N;
    int v[100000];
    int ans;

    // 整数の入力
    scanf("%d", &N);

    // get data
    for(int i=0; i<N; i++){
        std::cin >> v[i];
    }

    int counter_odd[100000];
    int counter_even[100000];

    // init
    for(int i=0; i<100000; i++){
        counter_odd[i] = 0;
        counter_even[i] = 0;
    }

    // count
    for(int i=0; i<N; i+=2){
        counter_odd[v[i]] += 1;        
        counter_even[v[i+1]] += 1;
    }

    // best, second_best and its count
    int num_best[2], num_s_best[2], count_best[2] = {0, 0}, count_s_best[2] = {0, 0};
    for(int i=0; i<100000; i++){
            if(counter_odd[i] > count_best[0]){
                int temp = count_best[0];
                count_best[0] = counter_odd[i];
                count_s_best[0] = temp;
                temp = num_best[0];
                num_best[0] = i;
                num_s_best[0] = temp;
            }
            else if(counter_odd[i] > count_s_best[0]){
                count_s_best[0] = counter_odd[i];
                num_s_best[0] = i;
            }
            if(counter_even[i] > count_best[1]){
                int temp = count_best[1];
                count_best[1] = counter_even[i];
                count_s_best[1] = temp;
                temp = num_best[1];
                num_best[1] = i;
                num_s_best[1] = temp;
            }
            else if(counter_even[i] > count_s_best[1]){
                count_s_best[1] = counter_even[i];
                num_s_best[1] = i;
            }
    }

    if(num_best[0] != num_best[1]){
        ans = N - count_best[0] - count_best[1];
    }
    else if(count_best[0] > count_best[1]){
        ans = N - count_best[0] - count_s_best[1];
    }
    else if(count_best[0] < count_best[1]{
        ans = N - count_s_best[0] - count_best[1];
    }
    else if(count_s_best[0] > count_s_best[1]){
        ans = N - count_s_best[0] - count_best[1];
    }
    else{
        ans = N - count_best[0] - count_s_best[1];
    }
    
    // 出力
    printf("%d\n", ans);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:69:42: error: expected ';' before '{' token
   69 |     else if(count_best[0] < count_best[1]{
      |                                          ^
      |                                          ;
a.cc:72:5: error: expected primary-expression before 'else'
   72 |     else if(count_s_best[0] > count_s_best[1]){
      |     ^~~~
a.cc:71:6: error: expected ')' before 'else'
   71 |     }
      |      ^
      |      )
   72 |     else if(count_s_best[0] > count_s_best[1]){
      |     ~~~~
a.cc:69:12: note: to match this '('
   69 |     else if(count_best[0] < count_best[1]{
      |            ^
Language: C

#include <stdio.h>

int main(){
  int n;
  scanf("%d\n",&n);
  //
  if(n==2){
    n = 0;
    printf("%d",n);
    return 0;
  //
  int m = n/2;
  int array1[m][2];
  int array2[m][2];
  for(int i=0;i<m;i++){
    array1[i][0] = 0;
    array2[i][0] = 0;
  }
  int x;
  int last1 = 0;
  int last2 = 0;
  scanf("%d%*c",&x);
  array1[0][0] = x;
  array1[0][1] = 1;
  scanf("%d%*c",&x);
  array2[0][0] = x;
  array2[0][1] = 1;
  //
  int j,k;
  for(int i=2;i<n;i++){
    scanf("%d%*c",&x);
    j = 0;
    k = i%2;
    while(1){
      if(k==0){
	if(array1[j][0] == 0){
	  array1[j][0] = x;
	  array1[j][1] = 1;
	  last1++;
	  break;
	}else if(array1[j][0] == x){
	  array1[j][1] += 1;
	  break;
	}else{
	  j++;
	}
      }else{
	if(array2[j][0] == 0){
	  array2[j][0] = x;
	  array2[j][1] = 1;
	  last2++;
	  break;
	}else if(array2[j][0] == x){
	  array2[j][1] += 1;
	  break;
	}else{
	  j++;
	}
      }
    }
  }
  //
  if(array1[0][0]==array2[0][0] && last1==0 && last2==0){
    m = n/2;
    printf("%d",m);
    return 0;
  }
  //
  int answer,max,amount,count;
  answer = 0;
  max = array1[0][1];
  amount = array1[0][1];
  count = 1;
  while(last1){
    if(max < array1[count][1]){
      max = array1[count][1];
      answer += amount;
      amount = array1[count][1];
      count++;
      last1--;
    }else{
      answer += array1[count][1];
      count++;
      last1--;
    }
  }
  max = array2[0][1];
  amount = array2[0][1];
  count = 1;
  while(last2){
    if(max < array2[count][1]){
      max = array2[count][1];
      answer += amount;
      amount = array2[count][1];
      count++;
      last2--;
    }else{
      answer += array2[count][1];
      count++;
      last2--;
    }
  }
  printf("%d",answer);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:105:1: error: expected declaration or statement at end of input
  105 | }
      | ^
Language: C

#include <stdio.h>

int main(){
  int n;
  scanf("%d\n",&n);
  //
  if(n==2){
    n = 0;
    printf("%d",n);
    return 0;
  //
  int m = n/2;
  int array1[m][2];
  int array2[m][2];
  for(int i=0;i<m;i++){
    array1[i][0] = 0;
    array2[i][0] = 0;
  }
  int x;
  int last1 = 0;
  int last2 = 0;
  scanf("%d%*c",&x);
  array1[0][0] = x;
  array1[0][1] = 1;
  scanf("%d%*c",&x);
  array2[0][0] = x;
  array2[0][1] = 1;
  //
  int j,k;
  for(int i=2;i<n;i++){
    scanf("%d%*c",&x);
    j = 0;
    k = i%2;
    while(1){
      if(k==0){
	if(array1[j][0] == 0){
	  array1[j][0] = x;
	  array1[j][1] = 1;
	  last1++;
	  break;
	}else if(array1[j][0] == x){
	  array1[j][1] += 1;
	  break;
	}else{
	  j++;
	}
      }else{
	if(array2[j][0] == 0){
	  array2[j][0] = x;
	  array2[j][1] = 1;
	  last2++;
	  break;
	}else if(array2[j][0] == x){
	  array2[j][1] += 1;
	  break;
	}else{
	  j++;
	}
      }
    }
  }
  //
  if(array1[0][0]==array2[0][0] && last1==0 && last2==0){
    m = n/2;
    printf("%d",m);
    return 0;
  }
  //
  int answer,max,amount,count;
  answer = 0;
  max = array1[0][1];
  amount = array1[0][1];
  count = 1;
  while(last1){
    if(max < array1[count][1]){
      max = array1[count][1];
      answer += amount;
      amount = array1[count][1];
      count++;
      last1--;
    }else{
      answer += array1[count][1];
      count++;
      last1--;
    }
  }
  max = array2[0][1];
  amount = array2[0][1];
  count = 1;
  while(last2){
    if(max < array2[count][1]){
      max = array2[count][1];
      answer += amount;
      amount = array2[count][1];
      count++;
      last2--;
    }else{
      answer += array2[count][1];
      count++
      last2--;
    }
  }
  printf("%d",answer);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:99:14: error: expected ';' before 'last2'
   99 |       count++
      |              ^
      |              ;
  100 |       last2--;
      |       ~~~~~   
main.c:105:1: error: expected declaration or statement at end of input
  105 | }
      | ^
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;
const int ARRAYSIZE = 100001;
int main() {
    
    int n;
    cin >> n;
    
    int cnt[2][ARRAYSIZE] = {};
    int varr[n] = {};
    for (int i = 0; i < n; i++) {
        int v;
        cin >> v;
        varr[i] = v;
        cnt[i % 2][v]++;
    }
    
    int maxn[2] = {0, 0};
    int maxv[2] = {-1, -1};
    int secn[2] = {0, 0};
    int secv[2] = {-1, -1};
    for (int v = ARRAYSIZE; v--;) {
        for (int i = 2; i--;) {
            if (maxn[i] < cnt[i][v]) {
                maxn[i] = cnt[i][v];
                maxv[i] = v;
            }
        }
    }
    for (int v = ARRAYSIZE; v--;) {
        for (int i = 2; i--;) {
            if (secn[i] < cnt[i][v] && maxv[i] != v) {
                secn[i] = cnt[i][v];
                secv[i] = v;
            }
        }
    }
    
    cout << n - max(maxn[0] + maxn[1], secn[0] + maxn[1], maxn[0] + secn[1]) << endl;
    
}

Compiler output:
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:40:20:   required from here
   40 |     cout << n - max(maxn[0] + maxn[1], secn[0] + maxn[1], maxn[0] + secn[1]) << endl;
      |                 ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:306:17: error: '__comp' cannot be used as a function
  306 |       if (__comp(__a, __b))
      |           ~~~~~~^~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    int t;
    vector<int> fi(100001),se(100001);
    int fic=0,sec=0;
    for(int i = 0; i< n; i++){
        cin>>t;
        if(i%2==0){
            fi[t]++;
            fic++;
        }
        else{
            se[t]++;
            sec++;
        }
    }
    int a=0,b=0,at,bt;
    for(int i = 0; i < n; i++){
        if(fi[i] != 0){
            a++;
            at = i;
        }
        if(se[i] != 0){
            b++;
            bt = i;
        }
    }
    if(a == 1&& b ==1&&at!=bt){
        cout<<"0";
        return 0;
    }
    if(a==1&&b==1&&at==bt){
        cout<<n/2;
        return 0;
    }
    if(fi==se){
        cout<<n/2;
        return 0;
    }
    auto fi_max = max_element(fi.begin(),fi.end());
    auto se_max = max_element(se.begin(),se.end());
    if(fi_max-fi.begin()==se_max-se.begin()){
        if(*fi_max>*se_max){
            se.erase(se_max);
            se_max = max_element(se.begin(),se.end());
            break;
        }
        else if(*fi_max<*se_max){
            fi.erase(fi_max);
            fi_max = max_element(fi.begin(),fi.end());
            break;
        }
        else{
            auto bfm=fi_max,auto bsm=se_max;
            se.erase(se_max);
            se_max = max_element(se.begin(),se.end());
            fi.erase(fi_max);
            fi_max = max_element(fi.begin(),fi.end());
            if(*fi_max>*se_max)
                se_max =bsm;
            else
                fi_max =bfm;
            
        }
    }
    fic -= *fi_max;
    sec -= *se_max;
    cout<<fic+sec;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:49:13: error: break statement not within loop or switch
   49 |             break;
      |             ^~~~~
a.cc:54:13: error: break statement not within loop or switch
   54 |             break;
      |             ^~~~~
a.cc:57:29: error: expected unqualified-id before 'auto'
   57 |             auto bfm=fi_max,auto bsm=se_max;
      |                             ^~~~
a.cc:63:25: error: 'bsm' was not declared in this scope; did you mean 'bfm'?
   63 |                 se_max =bsm;
      |                         ^~~
      |                         bfm
Language: C++

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

int main() {

	int n,a[50001],b[50001];
	int c = 0,d = 0;
	cin >> n;
	for(int i=0; i!=n; i++){
		if(i % 2 == 0){
			cin >> a[i];
			for(int j=0; j!=n/2; j++){
				if(a[j] == a[i]){
					a[j] = a[i];
					a[i] = a[50000];
					break;
				}
			}
			if(a[i] != a[50000]){
				c = i;
			}
		}else{
			cin >> b[i];
			for(int j=0; j!=n/2; j++){
				if(b[j] == b[i]){
					b[j] = b[i];
					b[i] = b[50000];
					break;
				}
			}
			if(b[i] != b[50000]){
				d = i;
			}
		}
	}
	
	qsort(a,c,sizeof(int),quick);
	qsort(b,d,sizeof(int),quick);
	cout << n - (a[0] + b[0]) << '\n';
	
	return 0;
}

int quick( const void * a , const void * b ) {
  if( *( int * )a < *( int * )b ) {
    return -1;
  }
  else
  if( *( int * )a == *( int * )b ) {
    return 0;
  }
  return 1;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:31: error: 'quick' was not declared in this scope
   38 |         qsort(a,c,sizeof(int),quick);
      |                               ^~~~~
Language: C++

#include <iostream>
using namespace std;

int main() {

	int n,a[50001],b[50001];
	int c = 0,d = 0;
	cin >> n;
	for(int i=0; i!=n; i++){
		if(i % 2 == 0){
			cin >> a[i];
			for(int j=0; j!=n/2; j++){
				if(a[j] == a[i]){
					a[j] = a[i];
					a[i] = a[50000];
					break;
				}
			}
			if(a[i] != a[50000]){
				c = i;
			}
		}else{
			cin >> b[i];
			for(int j=0; j!=n/2; j++){
				if(b[j] == b[i]){
					b[j] = b[i];
					b[i] = b[50000];
					break;
				}
			}
			if(b[i] != b[50000]){
				d = i;
			}
		}
	}
	
	qsort(a,c,sizeof(int),quick);
	qsort(b,d,sizeof(int),quick);
	cout << n - (a[0] + b[0]) << '\n';
	
	return 0;
}

int quick( const void * a , const void * b ) {
  if( *( int * )a < *( int * )b ) {
    return -1;
  }
  else
  if( *( int * )a == *( int * )b ) {
    return 0;
  }
  return 1;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:31: error: 'quick' was not declared in this scope
   37 |         qsort(a,c,sizeof(int),quick);
      |                               ^~~~~
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
#define MAX_N 100010
const int MOD = 1e9 + 7;
const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, 1, -1};
typedef long long ll;
using namespace std;
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	int v[MAX_N];
	vector<int> odd(MAX_N, 0);
	vector<int> even(MAX_N, 0);
	for(int i = 0; i < n; i++)
	{
		cin >> v[i];
		if(i % 2 == 1)
			odd[v[i]]++;
		else
			even[v[i]]++;
	}
	int ans1, ans2;
	int max_odd = -1;
	int max_even = -1;
	for(int i = 1; i < MAX_N; i++)
	{
		if(even[i] > max_even)
		{
			if(ans2 == i)
				continue;
			max_even = even[i];
			ans1 = i;
		}
		if(odd[i] > max_odd)
		{
			if(ans1 == i)
				continue;
			max_odd = odd[i];
			ans2 = i;
		}
	}
	int cnt1 = 0;
	for(int i = 0; i < n; i++)
	{
		if(i % 2)
		{
			if(v[i] != ans2)
				cnt1++;
		}
		else
		{
			if(v[i] != ans1)
				cnt1++;
		}
	}
	for(int i = n -1; i >= 0; i--)
	{
		if(i % 2)
		{
			if(v[i] != ans2)
				cnt2++;
		}
		else
		{
			if(v[i] != ans1)
				cnt2++;
		}
	}
	cout << min(cnt1,cnt2) << endl;
	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:69:33: error: 'cnt2' was not declared in this scope; did you mean 'cnt1'?
   69 |                                 cnt2++;
      |                                 ^~~~
      |                                 cnt1
a.cc:74:33: error: 'cnt2' was not declared in this scope; did you mean 'cnt1'?
   74 |                                 cnt2++;
      |                                 ^~~~
      |                                 cnt1
a.cc:77:26: error: 'cnt2' was not declared in this scope; did you mean 'cnt1'?
   77 |         cout << min(cnt1,cnt2) << endl;
      |                          ^~~~
      |                          cnt1
Language: C++

#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort((c).begin(), (c).end())
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl;
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define ll long long

using namespace std;

signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n, num;
    cin >> n;
    vector<int> v;
    REP(_, n)
    {
        cin >> num;
        v.PB(num);
    }


    map<int , int> map;
    REP(i, n)
    {
        map[v[i]]++;
    }

    cout << n - (map[map.end] + map[map.end-1]);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:21: error: no match for 'operator[]' (operand types are 'std::map<int, int>' and '<unresolved overloaded function type>')
   40 |     cout << n - (map[map.end] + map[map.end-1]);
      |                     ^
In file included from /usr/include/c++/14/map:63,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:152,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_map.h:504:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const key_type&) [with _Key = int; _Tp = int; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, int> >; mapped_type = int; key_type = int]'
  504 |       operator[](const key_type& __k)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_map.h:504:34: note:   no known conversion for argument 1 from '<unresolved overloaded function type>' to 'const std::map<int, int>::key_type&' {aka 'const int&'}
  504 |       operator[](const key_type& __k)
      |                  ~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_map.h:524:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](key_type&&) [with _Key = int; _Tp = int; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, int> >; mapped_type = int; key_type = int]'
  524 |       operator[](key_type&& __k)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_map.h:524:29: note:   no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::map<int, int>::key_type&&' {aka 'int&&'}
  524 |       operator[](key_type&& __k)
      |                  ~~~~~~~~~~~^~~
a.cc:40:44: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator-'
   40 |     cout << n - (map[map.end] + map[map.end-1]);
      |                                     ~~~~~~~^~
      |                                         |   |
      |                                         |   int
      |                                         <unresolved overloaded function type>
Language: C++

#include <bits/stdc++.h>

#define rep(i, a, b)    for (int i(a); i <= (b); ++i)
#define dec(i, a, b)    for (int i(a); i >= (b); --i)
#define MP        make_pair
#define fi        first
#define se        second
typedef long long LL;
typedef pair <int, int> PII;

int n;
int answer = 1e9;
map <int, int> map1, map2;
multiset <int> s1, s2;
using namespace std;
int main(){
    
    scanf("%d", &n);
    
    rep(i, 1, n){
        int x;
        scanf("%d", &x);
        if (i & 1) map1[x]++;
        else map2[x]++;
    }
    
    for (auto u : map1) s1.insert(u.se);
    for (auto u : map2) s2.insert(u.se);
    
    for (auto u : map1){
        int x = u.se;
        if (map2.count(u.fi)){
            int ll = map2[u.fi];
            s2.erase(s2.find(ll));
            if (map2.size() > 1u){
                answer = min(answer, n - x - (*s2.rbegin()));
            }
            
            else answer = min(answer, n - x);
            s2.insert(ll);
        }
        
        else{
            answer = min(answer, n - x - (*s2.rbegin()));
        }
        
    }
    
    printf("%d\n", answer);
    return 0;
}


Compiler output:
a.cc:9:9: error: 'pair' does not name a type
    9 | typedef pair <int, int> PII;
      |         ^~~~
a.cc:13:1: error: 'map' does not name a type
   13 | map <int, int> map1, map2;
      | ^~~
a.cc:14:1: error: 'multiset' does not name a type
   14 | multiset <int> s1, s2;
      | ^~~~~~~~
a.cc: In function 'int main()':
a.cc:23:20: error: 'map1' was not declared in this scope
   23 |         if (i & 1) map1[x]++;
      |                    ^~~~
a.cc:24:14: error: 'map2' was not declared in this scope
   24 |         else map2[x]++;
      |              ^~~~
a.cc:27:19: error: 'map1' was not declared in this scope
   27 |     for (auto u : map1) s1.insert(u.se);
      |                   ^~~~
a.cc:27:25: error: 's1' was not declared in this scope; did you mean 'y1'?
   27 |     for (auto u : map1) s1.insert(u.se);
      |                         ^~
      |                         y1
a.cc:28:19: error: 'map2' was not declared in this scope
   28 |     for (auto u : map2) s2.insert(u.se);
      |                   ^~~~
a.cc:28:25: error: 's2' was not declared in this scope; did you mean 'se'?
   28 |     for (auto u : map2) s2.insert(u.se);
      |                         ^~
      |                         se
a.cc:30:19: error: 'map1' was not declared in this scope
   30 |     for (auto u : map1){
      |                   ^~~~
a.cc:32:13: error: 'map2' was not declared in this scope
   32 |         if (map2.count(u.fi)){
      |             ^~~~
a.cc:34:13: error: 's2' was not declared in this scope; did you mean 'se'?
   34 |             s2.erase(s2.find(ll));
      |             ^~
      |             se
a.cc:44:44: error: 's2' was not declared in this scope; did you mean 'se'?
   44 |             answer = min(answer, n - x - (*s2.rbegin()));
      |                                            ^~
      |                                            se
Language: C++

#include<bits/stdc++.h>
using namespace std;
const int MAXN=1e5+7;
int ans[MAXN];
int num[MAXN];
int main()
{
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&ans[i]);
		num[ans[i]]++;
		s.insert(make_pair(ans[i],ans[i+1]));
	}
	set<pair<int,int> >::iterator it;
	it=s.begin();
	if(s.size()==1&&it->first==it->second)
	{
		cout<<n/2<<endl;
		return 0;
	}
	int max1=0;
	int max2=0;
	int x=ans[1],y=0;
	for(int i=1;i<=n;i=i+2)
	{
		if(num[ans[i]]>max1)
		{
			max1=num[ans[i]];
			x=ans[i];
		}
		if(num[ans[i+1]]>max2)
		{
			max2=num[ans[i+1]];
			y=ans[i+1];
		}
	}
	int tot=0;
	for(int i=1;i<=n;i=i+2)
	{
		if(ans[i]!=x)
			tot++;
		if(ans[i+1]!=y)
		tot++;
	}
	cout<<tot<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:17: error: 's' was not declared in this scope
   14 |                 s.insert(make_pair(ans[i],ans[i+1]));
      |                 ^
a.cc:17:12: error: 's' was not declared in this scope
   17 |         it=s.begin();
      |            ^
Language: Java

import java.util.*;

class Main
{
    public static void main (String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n/2];
        int[] b = new int[n/2];

        for(int i = 0; i < n/2; i++){
            a[i] = sc.nextInt();
            b[i] = sc.nextInt();
        }

        int ans_a1 = 1;
        int ans_a2 = 1;
        int ans_b1 = 1;
        int ans_b2 = 1;
        
        Arrays.sort(a);
        Arrays.sort(b);

        int k = 1; 
        int l = 1;
        int x1 = 0;
        int y1 = 0;

        for(int i = 1; i < n/2; i++){
            if(a[i] == a[i-1]){
                k++;
                if(ans_a1 <= k){
                    ans_a2 = ans_a1;
                    ans_a1 = k;
                    x1 = a[i-1];
                }
                else if(ans_a2 =< k){
                    ans_a2 = k;
                }
            }
            else{
                k = 1;
            }
        }


        for(int i = 1; i < n/2; i++){
            if(b[i] == b[i-1]){
                l++;
                if(ans_b1 <= l){
                    ans_b2 = ans_b1;
                    ans_b1 = l;
                    y1 = b[i-1];
                }
                else if(ans_b2 =< l){
                    ans_b2 = l;
                }
            }
            else{
                l = 1;
            }
        }
        int ans = n - (ans_a1 + ans_b1);

        if(ans_a1 == n/2) ans_a2 = 0;
        if(ans_b1 == n/2) ans_b2 = 0;
        if(x1 == y1){
            if(ans_a1 > ans_b1){
                ans = n - (ans_a1 + ans_b2);
            }
            else{
                ans = n - (ans_b1 + ans_a2);
            }
        }
        System.out.println(ans);
    }
}

Compiler output:
Main.java:38: error: > or ',' expected
                else if(ans_a2 =< k){
                                   ^
Main.java:56: error: > or ',' expected
                else if(ans_b2 =< l){
                                   ^
2 errors
Language: C++

#include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstring>
#include <chrono>
#include <complex>
#define endl "\n"
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 1000000000000000001;
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
  #define pb push_back
#define f first
#define s second
  #define MAXN 100005
	#define int long long int 
using namespace std;
int arr[MAXN];
map<int,int> cnt1;
map<int,int> cnt2;
int main()
{
	std::ios::sync_with_stdio(false);
	int n;
	cin>>n;

	int max1=0;
	int nax1=0;
	int e1=-1;
	int max2=0;
	int nax2=0;
	int e2=-1;
	for(int i=0; i<n; i++) {
		cin>>arr[i];
		if(i%2==0) {
			cnt1[arr[i]]++;
			if(cnt1[arr[i]]>max1) {

				max1=cnt1[arr[i]];
				e1=arr[i];
			}
		}
		else{
			cnt2[arr[i]]++;

			if(cnt2[arr[i]]>max2) {

				max2=cnt2[arr[i]];
				e2=arr[i];
			}
		}
	}
	//cout<<e1<<" "<<e2<<endl;
	if(e1!=e2)
		cout<<n-(max1+max2)<<endl;
	else{
		if(cnt1.size()>=2) {
			auto it1 = next(cnt1.rbegin(), 1);

			nax1=it1->second;

		}
		if(cnt2.size()>=2) {
			auto it2 = next(cnt2.rbegin(), 1);
			nax2=it2->second;
		}
		int m =max(max1+nax2,nax1+max2);
		//	cout<<nax1<<" "<<nax2<<endl;
		cout<<n-m<<endl;
	}


	return 0;
}


Compiler output:
a.cc:25:31: error: '::main' must return 'int'
   25 |         #define int long long int
      |                               ^~~
a.cc:30:1: note: in expansion of macro 'int'
   30 | int main()
      | ^~~
Language: C

#include <stdio.h>

int main(void)
{
    int num1[1000][2] = {0};
    int mum2[1000][2] = {0};
    int n, tn;

    scnaf("%d", &n);
    scanf("%d %d", &num1[0][0], &num2[0][0]);
    for (int i = 0; i < n; i++)
    {
        int temp1, temp2;
        scanf("%d %d", &temp1, &temp2);
        for (int x1 = 0, x1 <1000; )
        {
            if (num1[x1][0] == 0)
            {
                num1[x1][1] = temp1;
                break;
            }
            else if (num1[x1][0] == temp1)
            {
                num1[x1][1]++;
                break;
            }
            else
                x1++;
        }

        for (int x2 = 0; x2 < 1000; )
        {
            if (num2[x2][0] == 0)
            {
                num2[x2][1] = temp2;
                break;
            }
            else if (num2[x2][0] == temp2)
            {
                num2[x2][1]++;
                break;
            }
            else
                x2++;
        }
    }

    int max1 = num1[0][1], max2 = num2[0][1];
    for (int x1 = 0; x1 < 1000; )
    {
        if (max1 < num1[x1][1])
            max1 = num1[x1][1];
    }
    for (int x2 = 0; x2 < 1000; )
    {
        if (max2 < num2[x2][1])
            max2 = num2[x2][1];
    }

    printf("%d\n", n - max1 - max2);

    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:9:5: error: implicit declaration of function 'scnaf'; did you mean 'scanf'? [-Wimplicit-function-declaration]
    9 |     scnaf("%d", &n);
      |     ^~~~~
      |     scanf
main.c:10:34: error: 'num2' undeclared (first use in this function); did you mean 'mum2'?
   10 |     scanf("%d %d", &num1[0][0], &num2[0][0]);
      |                                  ^~~~
      |                                  mum2
main.c:10:34: note: each undeclared identifier is reported only once for each function it appears in
main.c:15:29: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
   15 |         for (int x1 = 0, x1 <1000; )
      |                             ^
main.c:15:36: error: expected expression before ')' token
   15 |         for (int x1 = 0, x1 <1000; )
      |                                    ^