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

#include <iostream>
#include <string>
#include <sstream>
using namespace std;

int main() {
	int n,count; 
    cin >> n;
  	int v[n];
    for (int i = 0; i < n; ++i) cin >> v[n];
    count = 0;
  	for (int i = 0; i < n; ++i) {
      if(v[0] != v[2*i]){
        count +=1;
      }
      if(v[1] != v[2*i+1]){
        count +=1;
      }
      if(v[i] = v[i+1] && v[i+1] = v[i+2]){
      	count += 2;
      }
    }
  
    cout << count << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:24: error: lvalue required as left operand of assignment
   19 |       if(v[i] = v[i+1] && v[i+1] = v[i+2]){
      |                 ~~~~~~~^~~~~~~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

#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;

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(ans, 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: In function 'int main()':
a.cc:40:30: error: 'ans' was not declared in this scope; did you mean 'abs'?
   40 |                 answer = min(ans, n - x - (*s2.rbegin()));
      |                              ^~~
      |                              abs
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <complex>
using namespace std;
long long n=0;
long long i=0;
long long tmp=0;
long long tmp2=0;
long long tmp3=0;
long long ans=0;
long long maxV=0;
long long maxW=0;
long long memoV=0;
long long memoW=0;
long long ans1=0;
long long ans2=0;
int main(){
  cin >> n;
  vector<long long> v(100001);
  vector<long long> w(100001);
  for(i=0;i<n;i+=2){
    cin >> tmp;
    v.at(tmp)++;
    cin >> tmp;
    w.at(tmp)++;
  }
  
  for(i=0;i<=100000;i++){
    if(maxV < v.at(i)){
      memoV=i;
      maxV=v.at(i);
    }
  }
  
  for(i=0;i<=100000;i++){
    if(maxW < w.at(i)){
      memoW=i;
      maxW=w.at(i);
    }
  }
  sort(v.begin(),v.end());
  sort(w.begin(),w.end());
  reverse(v.begin(),v.end());
  reverse(w.begin(),w.end());
  
  if(memoV == memoW){
    
    if(v.at(0)>w.at(0)){
      ans+=w.at(0);
      for(i=1;i<=100000;i++){
        if(v.at(i)!=0){
          ans+=v.at(i);
        } else if (v.at(i)==0){
          break;
        }
      }
      for(i=2;i<=100000;i++){
        if(w.at(i)!=0){
          ans+=w.at(i);
        } else if (w.at(i)==0){
          break;
        }
      }
    } else if(v.at(0)<w.at(0)){
      ans+=v.at(0);
      for(i=2;i<=100000;i++){
        if(v.at(i)!=0){
          ans+=v.at(i);
        } else if (v.at(i)==0){
          break;
        }
      }
      for(i=1;i<=100000;i++){
        if(w.at(i)!=0){
          ans+=w.at(i);
        } else if (w.at(i)==0){
          break;
        }
      }
    } else{
      ans+=w.at(0);
      for(i=1;i<=100000;i++){
        if(v.at(i)!=0){
          tmp2+=v.at(i);
        } else if (v.at(i)==0){
          break;
        }
      }
      for(i=2;i<=100000;i++){
        if(w.at(i)!=0){
          tmp3+=w.at(i);
        } else if (w.at(i)==0){
          break;
        }
      }
      ans1=min(tmp2,tmp3);
      for(i=2;i<=100000;i++){
        if(v.at(i)!=0){
          tmp2+=v.at(i);
        } else if (v.at(i)==0){
          break;
        }
      }
      for(i=1;i<=100000;i++){
        if(w.at(i)!=0){
          tmp3+=w.at(i);
        } else if (w.at(i)==0){
          break;
        }
      }
      ans2=min(tmp2,tmp3);
      
      ans = min (ans1,ans2);
    }
  }
} else {
  for(i=1;i<=100000;i++){
    if(v.at(i)!=0){
      ans+=v.at(i);
    } else if (v.at(i)==0){
      break;
    }
  }
  for(i=1;i<=100000;i++){
    if(w.at(i)!=0){
      ans+=w.at(i);
    } else if (w.at(i)==0){
      break;
    }
  }
}
cout << ans << endl;
return 0;
}





Compiler output:
a.cc:117:3: error: expected unqualified-id before 'else'
  117 | } else {
      |   ^~~~
a.cc:133:1: error: 'cout' does not name a type
  133 | cout << ans << endl;
      | ^~~~
a.cc:134:1: error: expected unqualified-id before 'return'
  134 | return 0;
      | ^~~~~~
a.cc:135:1: error: expected declaration before '}' token
  135 | }
      | ^
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){

	int n,x;
	int cou=0;
	cin>>n;
	std::vector<int>v(n);
	std::vector<int>co(100001);
	
	for(int i=0;i<n;i++){
		cin>>v[i];
		co[v[i]]++;
	}
	x=co[0];
	for(int i=0;i<100001;i++){
		if(x<co[i])
			x=i;
	}
	for(int i=0;i<=n-1;i+=2){
		if(v[i]==x && v[i+1]==x)
			cou++;
	}

	std:sort(co.begin(),co.end());
	
	if(co[99999]==0){
		cout<<co[100000]/2<<endl;
		return 0;
	}
	if(co[99998]==0){
		cout<<cou<<endl;
		return 0;
	}

	cout<<n-co[99999]-co[100000]+cou<<endl;
	
	ret

Compiler output:
a.cc: In function 'int main()':
a.cc:40:9: error: 'ret' was not declared in this scope
   40 |         ret
      |         ^~~
a.cc:40:12: error: expected '}' at end of input
   40 |         ret
      |            ^
a.cc:5:11: note: to match this '{'
    5 | int main(){
      |           ^
Language: C++

#include <iostream>
#include <vector>
#include <cmath>
#include <queue>
#include <deque>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <functional>
#include <bitset>
#include <utility>
#include <sstream>
#include <fstream>
#include <stack>
#include <cstdlib>
#include <complex>
#include <set>
#include <unordered_map>
#include <map>

using namespace std;

#define INF 1070000000LL
#define pb push_back
#define irep(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) irep(i,0,n)

typedef long long lint;
typedef pair<int, int> pint;
struct Edge{
    int to,weight;
};
typedef vector<vector<Edge> > Graph;

int main(){
    int num;
    cin >> num;
    unordered_map<int, int> even_map;
    unordered_map<int, int> odd_map;
    rep(i,num){
	int tmp;
	cin >> tmp; 
	if(i%2 == 0){
	    even_map[tmp]++;
	}
	else{
	    odd_map[tmp]++;
	}
    }

    priority_queue<pint> even, odd;
    for(auto pair : even_map){
	even.push(make_pair(pair.second, pair.first));
    }
    for(auto pair : odd_map){
	odd.push(make_pair(pair.second, pair.first));
    }

    auto even_item = even.top();
    int even_size = even.size();
    auto odd_item = odd.top();
    int odd_size = odd.size();
    pint even_item2, odd_item2;

    if(even_item.second != odd_item.second){

Compiler output:
a.cc: In function 'int main()':
a.cc:66:45: error: expected '}' at end of input
   66 |     if(even_item.second != odd_item.second){
      |                                            ~^
a.cc:66:45: error: expected '}' at end of input
a.cc:36:11: note: to match this '{'
   36 | int main(){
      |           ^
Language: C++

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

int main() {
  int n; cin >> n;
  int v[n], v1[n];
  int count_num_kind[100001];
  memset(count_num_kind,0,sizeof(count_num_kind));
  for (int i = 0; i < n; i++) {
    cin >> v[i];
    v1[i] = v[i];
    count_num_kind[v[i]] = 1;
  }
  int count = 0;
  for (int i = 0; i < 100001; i++) {
    if (count_num_kind[i]==1) {
      count++;
    }
  }
  long long ans = 0;
  if (count == 1) {
    ans = n/2;
  }
  else {
    for (int i = 2; i < n; i++) {
      if (v[i-2] != v[i]) {
        v[i] = v[i-2];
        ans++;
      }
    }
    int c = 0;
    for (int i = n-1; i >= 2; i--) {
      if (v1[i-2] != v1[i]) {
        v1[i-2] = v1[i];
        c++;
      }
    }
    ans = min(c,ans);
  }
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:39:14: error: no matching function for call to 'min(int&, long long int&)'
   39 |     ans = min(c,ans);
      |           ~~~^~~~~~~
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:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:39:14: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   39 |     ans = min(c,ans);
      |           ~~~^~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
Language: C++

#include <iostream>

using namespace std;

int maxIndent(int a[], int n){
    int max = 0;

    for(int i = 0; i < n; i++){
        if(a[i] > a[max]) {
            max = i;
        }
    }
    return max;
}

int secondIndent(int a[], int n, int max) {
    int second = 0;

    if(max == 0) {
        second = 1;
    }

    for(int i = 0; i < n; i++) {
        if (i == max) {
            continue;
        }

        if(a[i] > a[second]) {
            second = i;
        }
    }
    return second;
}

int main(void){
    int M = 100000
    int n;
    cin >> n;
 
    int v[n];
    for (int i = 0; i < n; i++) {
        cin >> v[i];
    }
 
    int odd[M];
    int even[M];
    for (int i = 0; i < M; i++) {
        odd[i] = 0;
        even[i] = 0;
    }

    for (int i = 0; i < n - 1; i = i + 2) {
        even[int(v[i])]++;
        odd[int(v[i+1])]++;
    }

    int o = maxIndent(odd, M);
    int e = maxIndent(even, M);

    if (o == e) {
        if (odd[o] > even[e]) {
            e = secondIndent(even, M, e);
        } else {
            o = secondIndent(odd, M, o);
        }
    }

    int cnt_even = 0;
    int cnt_odd = 0;
    for (int i = 0; i < M; i++) {
        if (i != e) {
            cnt_even += even[i];
        }

        if (i != o) {
            cnt_odd += odd[i];
        }
    }

    cout << cnt_even + cnt_odd << endl;
 
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:5: error: expected ',' or ';' before 'int'
   37 |     int n;
      |     ^~~
a.cc:38:12: error: 'n' was not declared in this scope
   38 |     cin >> n;
      |            ^
a.cc:42:16: error: 'v' was not declared in this scope
   42 |         cin >> v[i];
      |                ^
a.cc:53:18: error: 'v' was not declared in this scope
   53 |         even[int(v[i])]++;
      |                  ^
Language: C++

#include<iostream>
#include<vector>
using namespace std;
int main(){
  vector< pair<int ,int> > amax,bmax;
  int n,a,b;
  cin >> n;
  int retu[n];
  for(int i = 0; i < n; i++){
    cin >> retu[i];
    if(i%2 == 0){
      int flag = 0;
      for(int j = 0; j < amax.size() ; j++) if(retu[i] == amax[j].second){
        flag = 1;
        amax[j].first += 1;
      }
      if(!flag) amax.push_back(make_pair(1,retu[i]));
    }
    else{
      int flag = 0;
      for(int j = 0; j < bmax.size() ; j++) if(retu[i] == bmax[j].second){
        flag = 1;
        bmax[j].first += 1;
      }
      if(!flag) bmax.push_back(make_pair(1,retu[i]));
    }
  }
  int ans = 0;
  sort(amax.begin(),amax.end());
  sort(bmax.begin(), bmax.end());
  //if(amax[amax.end()-1].second != bmax[bmax.end()-1].second) ans = n-(amax[amax.end()-1].first + bmax[bmax.end()-1].first);
  if(amax[amax.size()-1].second != bmax[bmax.size()-1].second) ans = n-(amax[amax.size()-1].first + bmax[bmax.size()-1].first);
  //cout << amax[amax.size()-1].second << " " <<  bmax[bmax.size()-1].second <<amax[amax.size()-1].first<< " " << bmax[bmax.size()-1].first <<endl;
  else if(amax[amax.size()-1].first + bmax[bmax.size()-1].first == n) ans = n/2;
  else if(amax[amax.size()-1].first - amax[amax.size()-2].first < bmax[bmax.size()-1].first - bmax[bmax.size()-2].first){
    ans = n-(amax[amax.size()-2].first + bmax[bmax.size()-1].first);
  }
  else ans = n-(amax[amax.size()-1].first + bmax[bmax.size()-2].first);

  cout << ans << endl;
}


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

#include <iostream>
#include <map>
#define create_tmp_num(a, b) a * 10 + b

using namespace std;
int main(void){
    cin.tie(0);
    iostream::sync_with_stdio(false);

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

    map<int, int> mp1, mp2;
    int max1=0, max2=0, index1, index2;

    int output = 0;

    for(int i=0; i<n/2; i+=2){
        map<int, int>::iterator itr = mp1.find(v[i]);
        // みつからなかったら　
        if(itr == mp1.end()){
            mp1[v[i]] = 1;
        }else{
            // 見つかった数をカウントする
            mp1[v[i]] = mp1[v[i]] + 1;
        }

        itr = mp2.find(v[i+1]);
                // みつからなかったら　
        if(itr == mp2.end()){
            mp2[v[i+1]] = 1;
        }else{
            // 見つかった数をカウントする
            mp2[v[i+1]] = mp1[v[i+1]] + 1
        }
    }
    for(map<int, int>::iterator it = mp1.begin(); it!=mp1.end(); it++ ) {
      if( max1 < it->second ){
          max1 = it->second;
          index1 = it->first;
      }
    }

    for(map<int, int>::iterator it = mp2.begin(); it!=mp2.end(); it++ ) {
      if( max2 < it->second ){
          max2 = it->second;
          index2 = it->first;
      }
    }
    if(index1 != index2){
        if(max1==n/2 && max2!=n/2){
            output = n - max2;
        }else if(max1!=n/2 && max2==n/2){
            output = n - max1;
        }else{
            output = n - max1 - max2;            
        }
    }else{
        if(max1 < max2){
            // output = max1;
            int tmp1 = 0;
            int tmpindex1 = 0;
                for(map<int, int>::iterator it = mp1.begin(); it!=mp1.end(); it++ ) {
                    if( tmp1 < it->second  && it->first!=index1){
                        tmp1= it->second;
                        tmpindex1 = it->first;
                    }
                }
            output = n/2 - tmp1;
        }else{
            // output = max2;
            int tmp1 = 0;
            int tmpindex1 = 0;
                for(map<int, int>::iterator it = mp2.begin(); it!=mp2.end(); it++ ) {
                    if( tmp1 < it->second  && it->first!=index1){
                        tmp1= it->second;
                        tmpindex1 = it->first;
                    }
                }
            output = n/2 - tmp1;
        }
    }

    cout << output << '\n';
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:42: error: expected ';' before '}' token
   38 |             mp2[v[i+1]] = mp1[v[i+1]] + 1
      |                                          ^
      |                                          ;
   39 |         }
      |         ~
Language: Java


public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int N = in.nextInt();
		int a[]=new int[N/2];
		int b[]=new int[N/2];
		int d[]=new int[100001]; 
		int f[]=new int[100001]; 
		int l=N/2;
		for(int i=0;i<N/2;i++) {
			a[i]=in.nextInt();
			b[i]=in.nextInt();
		}
		
		for (int i = 0; i < l; i++) {
			d[a[i]]++;				// 頻度を数える：a[i]の値に該当する頻度値を1増やす
		}
		int max=1;
		int maxse=1;
		for (int i = 1; i < 100001; i++) {
			if (d[i] > d[max]) {
				maxse=max;
				max = i;			// 最大頻度を求める
			}
		}
		for (int i = 1; i < 100001; i++) {
			if (d[i] > d[maxse]&&!(i==max)) {
				maxse = i;			// 最大頻度を求める
			}
		}
		
		for (int i = 0; i < l; i++) {
			f[b[i]]++;				// 頻度を数える：a[i]の値に該当する頻度値を1増やす
		}
		
		int max2=1;
		int maxse2=1;
		for (int i = 1; i < 100001; i++) {
			if (f[i] > f[max2]) {
				maxse=max2;
				max2 = i;			// 最大頻度を求める
			}
		}
		for (int i = 1; i < 100001; i++) {
			if (f[i] > f[maxse2]&&!(i==max2)) {
				maxse2 = i;			// 最大頻度を求める
			}
		}
		
	    if(l-d[max]==0&&l-f[max2]==0&&b[0]==a[0]) {
	    	System.out.println(l);
	    }else if(max==max2){
	    	System.out.println(Math.min(2*l-d[max]-f[maxse2],2*l-d[maxse]-f[max2]));
	    }else {
	    	System.out.println(l-d[max]+(l-f[max2]));	    	
	    }

	}
}

Compiler output:
Main.java:4: error: cannot find symbol
		Scanner in = new Scanner(System.in);
		^
  symbol:   class Scanner
  location: class Main
Main.java:4: error: cannot find symbol
		Scanner in = new Scanner(System.in);
		                 ^
  symbol:   class Scanner
  location: class Main
2 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++){
        for(int n=0; n<2; n++){
            if(counter_odd[i] > counter_best[n]){
                int temp = counter_best[n];
                counter_best[n] = counter_odd[i];
                counter_s_best[n] = temp;
                temp = num_best[n];
                num_best[n] = i;
                num_s_best[n] = temp;
            }
            else if(counter_odd[i] > counter_s_best[n]){
                counter_s_best[n] = counter_odd[i];
                num_s_best[n] = 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{
        ans = N - count_s_best[0] - count_best[1];
    }

    // 出力
    printf("%d\n", ans);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:33: error: 'counter_best' was not declared in this scope; did you mean 'count_s_best'?
   38 |             if(counter_odd[i] > counter_best[n]){
      |                                 ^~~~~~~~~~~~
      |                                 count_s_best
a.cc:41:17: error: 'counter_s_best' was not declared in this scope; did you mean 'count_s_best'?
   41 |                 counter_s_best[n] = temp;
      |                 ^~~~~~~~~~~~~~
      |                 count_s_best
a.cc:46:38: error: 'counter_s_best' was not declared in this scope; did you mean 'count_s_best'?
   46 |             else if(counter_odd[i] > counter_s_best[n]){
      |                                      ^~~~~~~~~~~~~~
      |                                      count_s_best
Language: C++

#include <stdio.h>
int main(){
  int j,i,n, a[100000],num[50000],max,ans;
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d",&a[i]);
  }
  ans=0;
  int temp_mode, temp_cnt,mode,cnt;
int s1,s2,s3,s4,w1,w2,x,y;
 mode = 0;
 cnt = 0;
 for(i = 1; i <= n/2; i++){
  temp_cnt = 1;
   x=2i;
   
  for(j = i + 1; j < n/2; j++){
    y=2j;
   if( a[x] == a[y]){
    temp_cnt++;
   }
  }
  if( temp_cnt > cnt){
   cnt = temp_cnt;
   mode = num[x]; 
  }
 }
 s1=cnt;
  w1=mode;
  
   mode = 0;
 cnt = 0;
 for(i = 1; i <= n/2; i++){
  temp_cnt = 1;
   x=2i;
  for(j = i + 1; j < n/2; j++){
    y=2j;
   if( a[x] == a[y] && a[x]!=w1 ){
    temp_cnt++;
   }
  }
  if( temp_cnt > cnt){
   cnt = temp_cnt;
   mode = num[x]; 
  }
 }
  
  s2=cnt;
  
   mode = 0;
 cnt = 0;
 for(i = 1; i <= n/2; i++){
  temp_cnt = 1;
   x=2i-1;
  for(j = i + 1; j < n/2; j++){
    y=2j-1;
   if( a[x] == a[y]){
    temp_cnt++;
   }
  }
  if( temp_cnt > cnt){
   cnt = temp_cnt;
   mode = num[x]; 
  }
 }
 
  s3=cnt;
  w2=mode;
   mode = 0;
 cnt = 0;
 for(i = 1; i <= n/2; i++){
  temp_cnt = 1;
   x=2i-1;
  for(j = i + 1; j < n/2; j++){
    y=2j-1;
   if( a[x] == a[y] && a[x]!=w2){
    temp_cnt++;
   }
  }
  if( temp_cnt > cnt){
   cnt = temp_cnt;
   mode = num[x]; 
  }
 }
  s4=cnt;
  
  if(w1!=w2) printf("%d",n-s1-s3);
  else if (s1+s4>s2+s3) printf("%d",n-s1-s4);
  else printf("%d",n-s2-s3);
  return 0;
}
  


Compiler output:
a.cc: In function 'int main()':
a.cc:15:6: error: cannot convert '__complex__ int' to 'int' in assignment
   15 |    x=2i;
      |      ^~
a.cc:18:7: error: cannot convert '__complex__ int' to 'int' in assignment
   18 |     y=2j;
      |       ^~
      |       |
      |       __complex__ int
a.cc:35:6: error: cannot convert '__complex__ int' to 'int' in assignment
   35 |    x=2i;
      |      ^~
a.cc:37:7: error: cannot convert '__complex__ int' to 'int' in assignment
   37 |     y=2j;
      |       ^~
      |       |
      |       __complex__ int
a.cc:54:8: error: cannot convert '__complex__ int' to 'int' in assignment
   54 |    x=2i-1;
a.cc:56:9: error: cannot convert '__complex__ int' to 'int' in assignment
   56 |     y=2j-1;
      |       ~~^~
      |         |
      |         __complex__ int
a.cc:73:8: error: cannot convert '__complex__ int' to 'int' in assignment
   73 |    x=2i-1;
a.cc:75:9: error: cannot convert '__complex__ int' to 'int' in assignment
   75 |     y=2j-1;
      |       ~~^~
      |         |
      |         __complex__ int
Language: C++

#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>

#define size_t int

using namespace std;

int main(int argc, char const *argv[]) {
  int N;
  scanf("%d", &N);
  int v[N];
  int nn1[100001];
  int nn2[100001];
  for (size_t i = 0; i < 100001; i++) {
    nn1[i] = 0;
    nn2[i] = 0;
  }
  for (size_t i = 0; i < N; i++) {
    scanf("%d", &v[i]);
    if (!(i%2)) {
      nn1[v[i]]++;
    } else {
      nn2[v[i]]++;
    }
  }
  vector<pair<int, int> > pairs1;
  vector<pair<int, int> > pairs2;

  for (size_t i = 0; i < 100001; i++) {
    if (nn1[i] != 0) {
      pairs1.push_back(make_pair(nn1[i], i));
    }
    if (nn2[i] != 0) {
      pairs2.push_back(make_pair(nn2[i], i));
    }
  }
  sort(pairs1.begin(), pairs1.end());
  sort(pairs2.begin(), pairs2.end());
  // printf("%d", pairs2[0].first);
  if (pairs1[pairs1.size()-1].second != pairs2[pairs1.size()-1].second) {
    // printf("aaa");
    printf("%d\n", N - pairs1[pairs1.size()-1].first - pairs2[pairs2.size()-1].first);
  } else {
    int r1 = pairs1.size() >= 2 ? N - pairs1[pairs1.size()-2].first - pairs2[pairs2.size()-1].first : INT_MAX;
    int r2 = pairs2.size() >= 2 ? N - pairs1[pairs1.size()-1].first - pairs2[pairs2.size()-2].first : INT_MAX;
    if (r1 == INT_MAX && r2 == INT_MAX) {
      printf("%d\n", N / 2);
      return 0;
    }
    printf("%d\n", r1 > r2 ? r2 : r1);
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:46:103: error: 'INT_MAX' was not declared in this scope
   46 |     int r1 = pairs1.size() >= 2 ? N - pairs1[pairs1.size()-2].first - pairs2[pairs2.size()-1].first : INT_MAX;
      |                                                                                                       ^~~~~~~
a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    4 | #include <string>
  +++ |+#include <climits>
    5 |
Language: Java


public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int N = in.nextInt();
		int a[]=new int[N/2];
		int b[]=new int[N/2];
		int d[]=new int[100001]; 
		int f[]=new int[100001]; 
		int l=N/2;
		for(int i=0;i<N/2;i++) {
			a[i]=in.nextInt();
			b[i]=in.nextInt();
		}
		
		for (int i = 0; i < l; i++) {
			d[a[i]]++;				// 頻度を数える：a[i]の値に該当する頻度値を1増やす
		}
		int max=1;
		for (int i = 1; i < 100001; i++) {
			if (d[i] > d[max]) {
				max = i;			// 最大頻度を求める
			}
		}
		
		for (int i = 0; i < l; i++) {
			f[b[i]]++;				// 頻度を数える：a[i]の値に該当する頻度値を1増やす
		}
		
		int max2=1;
		for (int i = 1; i < 100001; i++) {
			if (f[i] > f[max2]) {
				max2 = i;			// 最大頻度を求める
			}
		}
		
	    if(l-d[max]==0&&l-f[max2]==0&&b[0]==a[0]) {
	    	System.out.println(l);
	    }else {
	    	System.out.println(l-d[max]+(l-f[max2]));	    	
	    }

	}
}


Compiler output:
Main.java:4: error: cannot find symbol
		Scanner in = new Scanner(System.in);
		^
  symbol:   class Scanner
  location: class Main
Main.java:4: error: cannot find symbol
		Scanner in = new Scanner(System.in);
		                 ^
  symbol:   class Scanner
  location: class Main
2 errors
Language: C

#include<stdio.h>
int main(void){
  int i,j,k,n,v[100001],o,e,oc,ec,omin=100000,emin=100000;
  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%d",&v[i]);
  for(i=0;i<n;i+=2){
    e=v[i];
    o=v[i+1];
    for(j=0,ec=0;j<n;j+=2){
      if(e-v[j])ec++;
    }
    for(j=1,oc=0;j<n;j+=2){
      if(o-v[j])oc++;
    }
    if(ec<emin)emin=ec;
    if(oc<omin)omin=oc;  
  }
  if(omin+emin==0){
  printf("%d",omin+emin);
  return 0;
}

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

#include <iostream>
#include <map>
#include <string>

using namespace std;




int main(int argc, char *argv[])
{
	int n;
	map<int, int> odd;
	map<int, int> even;
	int ans = INT_MAX;

	cin >> n;

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

		if (i % 2){
			odd[v]++;
		}
		else{
			even[v]++;
		}

	}

	
	for (map<int, int>::iterator odd_iter = odd.begin(); odd_iter != odd.end(); odd_iter++){
		for (map<int, int>::iterator even_iter = even.begin(); even_iter != even.end(); even_iter++){
			int tmp_ans = 0;

			if (odd_iter->first != even_iter->first){
				tmp_ans += n / 2 - odd_iter->second;
				tmp_ans += n / 2 - even_iter->second;
			}
			else{
				if (odd_iter->second > even_iter->second){
					tmp_ans += n / 2 - odd_iter->second;
					tmp_ans += n / 2;
				}
				else{
					tmp_ans += n / 2;
					tmp_ans += n / 2 - even_iter->second;
				}
			}

			if (tmp_ans < ans){
				ans = tmp_ans;
			}
		}

	}


	cout << ans << endl;

	return 0;
}



Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:15:19: error: 'INT_MAX' was not declared in this scope
   15 |         int ans = INT_MAX;
      |                   ^~~~~~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include <map>
  +++ |+#include <climits>
    3 | #include <string>
Language: C++

#include<iostream>
#include <bits/stdc++.h>
#include<stdio.h>
#include <stdlib.h>
using namespace std;
int main(){
	int N,flag=0,evenmax=0,oddmax=0,memo1,memo2;
	cin>>N;
	int a[N],b[N],c[N];
	for(int i=0;i<N;i++){
		cin>>a[i];
		b[i]=a[i];
		c[i]=0;
	}
	stop:
	for(int j=0;j<N;j=j+2){
		for(int k=0;k<N;k=k+2){
			if(a[j]!=0&&a[j]==b[k]){
				c[j]++;
			}
		}
	}
	for(int j=1;j<N;j=j+2){
		for(int k=1;k<N;k=k+2){
			if(a[j]!=0&&a[j]==b[k]){
				c[j]++;
			}
		}
	}
	for(int j=0;j<N;j=j+2){
		if(evenmax<c[j]){
			evenmax=c[j];
			memo1=j;
		}
	}
	for(int j=1;j<N;j=j+2){
		if(oddmax<c[j]){
			oddmax=c[j];
			memo2=j;
		}
	}
	if(a[memo1]==a[memo2]){
		if(evenmax>=oddmax){
			memo2=0;
		}else{
			memo1=0;
		}
			for(int j=0;j<N;j=j++){
				c[j]=0;
			}		
		}
		goto stop;
	}else{
		cout<<abs(evenmax-oddmax)<<endl;
	}
}

Compiler output:
a.cc:53:10: error: expected unqualified-id before 'else'
   53 |         }else{
      |          ^~~~
a.cc:56:1: error: expected declaration before '}' token
   56 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int n, ans, res, a1, a2;
map <int, int> c1;
map <int, int> c2;

int main() {
	while(scanf("%d", &n) != EOF) {
		c1.clear();
		c2.clear();
		ans = 0, res = 0;
		for(int i = 1; i <= n; i++) {
			scanf("%d", &a[i]);
			if(i & 1) {
				c1[a[i]]++;
				if(ans < c1[a[i]]) {
					a1 = a[i];
					ans = c1[a[i]];
				}
			}
			else {
				c2[a[i]]++;
				if(res < c2[a[i]]) {
					a2 = a[i];
					res = c2[a[i]];
				}
			}
		}
		if(a1 == a2){
			if(ans == res) {
				int sum1 = 0, sum2 = 0;
				for(int i = 1; i <= n; i++) {
					if(a1 == a[i]) continue;
					if(i & 1) sum1 = max(sum1, c1[a[i]]);
					else sum2 = max(sum2, c2[a[i]]);
				}
				if(sum1 >= sum2) ans = sum1;
				else res = sum2;
			}
			else if(ans < res) {
				ans = 0;
				for(int i = 1; i <= n; i += 2){
					if(a[i] != a2) ans = max(ans, c1[a[i]]);
				}
			}
			else {
				ans2 = 0;
				for(int i = 2; i <= n; i += 2){
					if(a[i] != a1) res = max(res, c2[a[i]]);
				}
			}
		}
		printf("%d\n", n - ans - res);
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:38: error: 'a' was not declared in this scope
   13 |                         scanf("%d", &a[i]);
      |                                      ^
a.cc:33:50: error: 'a' was not declared in this scope
   33 |                                         if(a1 == a[i]) continue;
      |                                                  ^
a.cc:34:71: error: 'a' was not declared in this scope
   34 |                                         if(i & 1) sum1 = max(sum1, c1[a[i]]);
      |                                                                       ^
a.cc:35:66: error: 'a' was not declared in this scope
   35 |                                         else sum2 = max(sum2, c2[a[i]]);
      |                                                                  ^
a.cc:43:44: error: 'a' was not declared in this scope
   43 |                                         if(a[i] != a2) ans = max(ans, c1[a[i]]);
      |                                            ^
a.cc:47:33: error: 'ans2' was not declared in this scope; did you mean 'ans'?
   47 |                                 ans2 = 0;
      |                                 ^~~~
      |                                 ans
a.cc:49:44: error: 'a' was not declared in this scope
   49 |                                         if(a[i] != a1) res = max(res, c2[a[i]]);
      |                                            ^
Language: C++

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

const int SIZE = 1E6;

int A[SIZE];
struct poss{
	int pos, T;
} P[SIZE], K[SIZE];

bool cmp(poss A, poss B) {
	return A.T > B.T;
}

int main() {
	int Tot; cin >> Tot;
	for(int pos = 1; pos <= Tot; pos++)
		cin >> A[pos];
	for(int pos = 1; pos <= Tot; pos += 2)
		P[A[pos]].T++, P[A[pos]].pos = A[pos];
	for(int pos = 2; pos <= Tot; pos += 2)
		K[A[pos]].T++, K[A[pos]].pos = A[pos];
	sort(P, P + SIZE - 1, cmp); sort(K, K + SIZE - 1, cmp);
	
	if(P[0].T == P[1].T || K[0].T == K[1].T) {
		cout << (Tot - P[0].T - K[0].T) << endl; return 0;
	}
	if(P[0].pos == K[0].pos) {
		if(P[1].T == 0)
			cout << Tot - P[0].T - K[1].T << endl;
		else if(K[1].T == 0)
			cout << Tot - P[1].T - K[0].T << endl;
		else 
			ccout << min(Tot - P[1].T - K[0].T, Tot - P[0].T - K[1].T) << endl;
	}
	else 
		cout << (Tot - P[0].T - K[0].T) << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:25: error: 'ccout' was not declared in this scope
   34 |                         ccout << min(Tot - P[1].T - K[0].T, Tot - P[0].T - K[1].T) << endl;
      |                         ^~~~~
Language: C++

#include<iostream>
using namespace std;

int main(){
  int N;
  int v[100020],v1[5000],v2[5000];

  cin >>N;
  for(int i=0; i<N;i++) cin >> v[i];
  for(int i=0; i < N/2; i++) v1[i]=v[2*i];
  for(int i=0; i<N/2; i++) v2[i]=v[2*i+1];

  sort(v1,v1+N/2, greater<int>());
  sort(v2,v2+N/2, greater<int>());

  int a[10000],b[10000];
  for(int i=0; i<N/2; i++) {
    a[v1[i]]++;
    b[v2[i]]++;
  }
  sort(a,a+N, greater<int>());
  sort(b,b+N, greater<int>());
  if(v1[0]==v2[0]) cout <<N/2;
  else cout << N-a[0]-b[0];

}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   13 |   sort(v1,v1+N/2, greater<int>());
      |   ^~~~
      |   short
Language: Java


import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class test3 {

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

//    Scanner cin = new Scanner(new FileReader("input.txt"));
    Scanner cin = new Scanner(System.in);

    int count = cin.nextInt();

    HashMap<Integer, Integer> even = new HashMap<Integer, Integer>();
    HashMap<Integer, Integer> odd = new HashMap<Integer, Integer>();
    for (int i = 0; i<count; i++) {
      int num = cin.nextInt();
      if (i%2==0) {
        if (even.containsKey(num)) {
          int temp = even.get(num);
          even.put(num, temp + 1);
        } else {
          even.put(num, 1);
        }
      }
      else {
        if (odd.containsKey(num)) {
          int temp = odd.get(num);
          odd.put(num, temp + 1);
        } else {
          odd.put(num, 1);
        }
      }
    }

    int firstEven = 0;
    int secondEven = 0;
    int firstEvenT = 0;
    int secondEvenT = 0;
    int firstOdd = 0;
    int secondOdd = 0;
    int firstOddT = 0;
    int secondOddT = 0;

    for (Map.Entry<Integer, Integer> entry : even.entrySet()) {
      int item = entry.getKey();
      int index = entry.getValue();
      if (index > firstEvenT) {
        secondEven = firstEven;
        secondEvenT = firstEvenT;
        firstEven = item;
        firstEvenT = index;
      }
      else if (index > secondEvenT) {
        secondEven = item;
        secondEvenT = index;
      }
    }

    for (Map.Entry<Integer, Integer> entry : odd.entrySet()) {
      int item = entry.getKey();
      int index = entry.getValue();
      if (index > firstOddT) {
        secondOdd = firstOdd;
        secondOddT = firstOddT;
        firstOdd = item;
        firstOddT = index;
      }
      else if (index > secondOddT) {
        secondOdd = item;
        secondOddT = index;
      }
    }

//    System.out.println(firstEven+" "+firstEvenT+" "+firstOdd+" "+firstOddT);
//    System.out.println(secondEven+" "+secondEvenT+" "+secondOdd+" "+secondOddT);

    if (firstEven != firstOdd) {
      System.out.println(count - firstEvenT - firstOddT);
    }
    else {
      if (firstEvenT >= firstOddT) {
        System.out.println(count - firstEvenT - secondOddT);
      }
      else {
        System.out.println(count - firstOddT - secondEvenT);
      }
    }

  }

}

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

#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main(){
  int n,oddn=0,evenn=0,oddcn=0,evencn=0,oddscn,evenscn;
  int odd,even;
  int oddc[100001],evenc[100001];
  cin>>n;
  for(int i=0;i<100001;i++){
    oddc[i]=evenc[i]=0;
  }
  for(int i=0;i<n/2;i++){
    cin>>odd>>even;
    oddc[odd]++;
    evenc[even]++;
  }
  for(int i=0;i<100001;i++){
    if(oddcn<=oddc[i]){
      oddn=i;
      oddscn=oddcn;
      oddcn=oddc[i];
    }
    else if(oddscn<oddc[i]) oddscn=oddc[i];
    if(evencn<=evenc[i]){
      evenn=i;
      evenscn=evencn;
      evencn=evenc[i];
    }
    else if(evenscn<evenc[i]) evenscn=evenc[i];
  }
  if(oddn!=evenn){
    cout<<n-oddcn-evencn<<endl;
  }
  else{
    if(oddcn+evencn==n){
      cout<<n/2<<endl;
    }
    else if(oddcn>evencn){
      cout<<n-oddcn-evenscn<<endl;
    }
    else if(evencn>oddcn){
      cout<<n-evencn-oddscn<<endl;
    }
    else{
      if(oddscn>=evenscn){
	cout<<n-oddscn-evencn<<endl;
      }else{
	cout<<n-oddcn-evenscn<<ebdl;
      }
    }
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:48:32: error: 'ebdl' was not declared in this scope
   48 |         cout<<n-oddcn-evenscn<<ebdl;
      |                                ^~~~
Language: C++

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

int n,v[100010];
int vmin=1,vmax=100000;
bool ismono=true;
int monotmp;
int odd[100001],even[100010];
int oddmax,evenmax;
int oddmaxi,evenmaxi;
int aans;

bool check()
{
	bool ret=true;
	int i,tmp;
	tmp=v[1];
	for(i=1;i<=n;i+=2)
	{
		if(v[i]!=tmp)
		{
			ret=false;
			break;
		}
	}
	tmp=v[2];
	for(i=2;i<=n;i+=2)
	{
		if(v[i]!=tmp)
		{
			ret=false;
			break;
		}
	}
	return ret;
}


int main()
{
	cin >> n;
	cin >> v[1];
	vmin=v[1];
	vmax=v[1];
	monotmp=v[1];
	odd[v[1]]++;
	for(int i=2;i<=n;i++)
	{
		cin >> v[i];
		if(v[i]<vmin)vmin=v[i];
		if(v[i]>vmax)vmax=v[i];
		
		if(i%2==0)even[v[i]]++;
		else odd[v[i]]++;
		
		if(v[i]!=monotmp)ismono=false;
	}
	
	if(ismono)
	{
		cout << n/2 << endl;
		return 0;
	}
	
	if(check())
	{
		cout << 0 << endl;
		return 0;
	}
	//main
	oddmax=odd[0];
	for(int i=vmin;i<=vmax;i++)
	{
		if(odd[i]>oddmax)
		{
			oddmax=odd[i];
			oddmaxi=i;
		}
	}
	evenmax=even[0];
	for(int i=vmin;i<=vmax;i++)
	{
		if(even[i]>evenmax)
		{
			evenmax=even[i];
			evenmaxi=i;
		}
	}
	if(oddmaxi==evenmaxi)
	{
		if(odd[oddmaxi]<=even[evenmaxi])
		{
			tmp=odd[oddmaxi];
			odd[oddmaxi]=0;
			oddmax=odd[0];
			for(int i=vmin;i<=vmax;i++)
			{
				if(odd[i]>oddmax)
				{
					oddmax=odd[i];
					oddmaxi=i;
				}
			}
		}
		else if(odd[oddmaxi]>even[evenmaxi])
		{
			tmp=even[evenmaxi];
			even[evenmaxi]=0;
			evenmax=even[0];
			for(int i=vmin;i<=vmax;i++)
			{
				if(even[i]>evenmax)
				{
					evenmax=even[i];
					evenmaxi=i;
				}
			}
		}
	}
	cout << n-oddmax-evenmax+aans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:94:25: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   94 |                         tmp=odd[oddmaxi];
      |                         ^~~
      |                         tm
a.cc:108:25: error: 'tmp' was not declared in this scope; did you mean 'tm'?
  108 |                         tmp=even[evenmaxi];
      |                         ^~~
      |                         tm
Language: C++

#include <iostream>
#include <map>
#define create_tmp_num(a, b) a * 10 + b

using namespace std;
int main(void){
    cin.tie(0);
    iostream::sync_with_stdio(false);

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

    map<int, int> mp1, mp2;
    int max1=0, max2=0, index1, index2;

    int output = 0;

    for(int i=0; i<n/2; i+=2){
        map<int, int>::iterator itr = mp1.find(v[i]);
        // みつからなかったら　
        if(itr == mp1.end()){
            mp1[v[i]] = 1;
        }else{
            // 見つかった数をカウントする
            mp1[v[i]]++;
        }

        map<int, int>::iterator itr = mp2.find(v[i+1]);
                // みつからなかったら　
        if(itr == mp2.end()){
            mp2[v[i+1]] = 1;
        }else{
            // 見つかった数をカウントする
            mp2[v[i+1]]++;
        }
    }
    for(map<int, int>::iterator it = mp1.begin(); it!=mp1.end(); it++ ) {
      if( max1 < it->second ){
          max1 = it->second;
          index1 = it->first;
      }
    }

    for(map<int, int>::iterator it = mp2.begin(); it!=mp2.end(); it++ ) {
      if( max2 < it->second ){
          max2 = it->second;
          index2 = it->first;
      }
    }
    if(index1 != index2){
        output += (n - max1 - max2); 
    }else{
        if(max1 < max2){
            output += max1;
        }else{
            output += max2;
        }
    }

    cout << output;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:33: error: redeclaration of 'std::map<int, int>::iterator itr'
   32 |         map<int, int>::iterator itr = mp2.find(v[i+1]);
      |                                 ^~~
a.cc:23:33: note: 'std::map<int, int>::iterator itr' previously declared here
   23 |         map<int, int>::iterator itr = mp1.find(v[i]);
      |                                 ^~~
Language: C++

#include <iostream>
using namespace std;

int main(){
    int n, v[100001];
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> v[i];
    }
    int o = v[0];
    int e = v[1];
    int cnt++;
    for(int i = 0; i < n; i++){
        if(i % 2 == 0){
            if(v[i] != o || v[i] == e){
                cnt++;
            }
        } else {
            if(v[i] != e || v[i] == o){
                cnt++;
            }
        }
    }
    cout << cnt << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:12: error: expected initializer before '++' token
   12 |     int cnt++;
      |            ^~
a.cc:16:17: error: 'cnt' was not declared in this scope; did you mean 'int'?
   16 |                 cnt++;
      |                 ^~~
      |                 int
a.cc:20:17: error: 'cnt' was not declared in this scope; did you mean 'int'?
   20 |                 cnt++;
      |                 ^~~
      |                 int
a.cc:24:13: error: 'cnt' was not declared in this scope; did you mean 'int'?
   24 |     cout << cnt << endl;
      |             ^~~
      |             int
Language: C++

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

typedef struct ScoreTag{
   int num;
   int count;
} Score;

int main(){
   int n;
   cin >> n;
   int* nums1 = new int[n/2];
   int* nums2 = new int[n/2];

   int k;
   for(int i=0;i<n;i++){
      cin >> k;
      if(i % 2 == 0){
         nums1[i/2] = k;
      }else{
         nums2[i/2] = k;
      }
   }

   sort(nums1, nums1 + n/2);
   sort(nums2, nums2 + n/2);

   Score s1_top = {0}, s1_sec = {0} ,s2_top= {0},s2_sec={0};
   int cur = nums1[0];
   int count =0;
   for(int i=0;i<n/2;i++){
      if(nums1[i] == cur){
         count ++;
      }else{
         if(s1_top.count < count){
            s1_sec = s1_top;
            s1_top.num = nums1[i-1];
            s1_top.count = count;
         }else if(s1_sec.count < count){
            s1_sec.count = count;
            s1_sec.num = nums1[i-1];
         }
         count =1;
         cur = nums1[i];
      }
   }
   if(s1_top.count < count){
      s1_sec = s1_top;
      s1_top.num = nums1[n-1];
      s1_top.count = count;
   }else if(s1_sec.count < count){
      s1_sec.count = count;
      s1_sec.num = nu
        ms1[n-1];
   }
     cur = nums2[0];
   count = 0;
   for(int i=0;i<n/2;i++){
      if(nums2[i] == cur){
         count ++;
      }else{
         if(s2_top.count < count){
            s2_sec = s2_top;
            s2_top.num = nums2[i-1];
            s2_top.count = count;
         }else if(s1_sec.count < count){
            s2_sec.count = count;
            s2_sec.num = nums2[i-1];
         }
         count = 1;
         cur = nums2[i];
      }
   }
   if(s2_top.count < count){
      s2_sec = s2_top;
      s2_top.num = nums2[n-1];
      s2_top.count = count;
   }else if(s2_sec.count < count){
      s2_sec.count = count;
      s2_sec.num = nums2[n-1];
   }

   int ans = 0;
   if(s1_top.num != s2_top.num){
      ans = n - s1_top.count - s2_top.count;
   }else{
      int ans1 = n - s1_top.count - s2_sec.count;
      int ans2 = n - s2_top.count - s1_sec.count;

      ans = min(ans1, ans2);
   }
   cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:55:20: error: 'nu' was not declared in this scope; did you mean 'n'?
   55 |       s1_sec.num = nu
      |                    ^~
      |                    n
Language: C++

#include <iostream>
#include <map>
#define create_tmp_num(a, b) a * 10 + b

using namespace std;
int main(void){
    cin.tie(0);
    iostream::sync_with_stdio(false);

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

    map<int, int> mp1, mp2;
    int max1=0, max2=0, index1, index2;

    int output = 0;

    for(int i=0; i<n/2; i+=2){
        auto itr = mp1.find(v[i]);
        // みつからなかったら　
        if(itr == mp1.end()){
            mp1[v[i]] = 1;
        }else{
            // 見つかった数をカウントする
            mp1[v[i]]++;
        }

        auto itr = mp2.find(v[i+1]);
                // みつからなかったら　
        if(itr == mp2.end()){
            mp2[v[i+1]] = 1;
        }else{
            // 見つかった数をカウントする
            mp2[v[i+1]]++;
        }
    }
    for(map<int, int>::iterator it = mp1.begin(); it!=mp1.end(); it++ ) {
      if( max1 < it->second ){
          max1 = it->second;
          index1 = it->first;
      }
    }

    for(map<int, int>::iterator it = mp2.begin(); it!=mp2.end(); it++ ) {
      if( max2 < it->second ){
          max2 = it->second;
          index2 = it->first;
      }
    }
    if(index1 != index2){
        output += (n - max1 - max2); 
    }else{
        if(max1 < max2){
            output += max1;
        }else{
            output += max2;
        }
    }

    cout << output;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:14: error: conflicting declaration 'auto itr'
   32 |         auto itr = mp2.find(v[i+1]);
      |              ^~~
a.cc:23:14: note: previous declaration as 'std::_Rb_tree_iterator<std::pair<const int, int> > itr'
   23 |         auto itr = mp1.find(v[i]);
      |              ^~~
Language: C++

#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define lli long long int
using namespace std;
int maxRepeating(int* arr, int n, int k) 
{ 
    // Iterate though input array, for every element 
    // arr[i], increment arr[arr[i]%k] by k 
    for (int i = 0; i< n; i++) 
        arr[arr[i]%k] += k; 
  
    // Find index of the maximum repeating element 
    int max = arr[0], result = 0; 
    for (int i = 1; i < n; i++) 
    { 
        if (arr[i] > max) 
        { 
            max = arr[i]; 
            result = i; 
        } 
    } 
  
    Uncomment this code to get the original array back 
       for (int i = 0; i< n; i++) 
          arr[i] = arr[i]%k; 
  
    // Return index of the maximum element 
    return result; 
} 
int main()
{
//fastio;
int n;
cin>>n;
int k=100000;
n=n/2;
int a[n],b[n];
for(int i=0;i<n;i++)
cin>>a[i]>>b[i];
int c=maxRepeating(a,n,k);
int d=maxRepeating(b,n,k);
sort(a,a+n);
sort(b,b+n);int e=0,f=0;
for(int i=0;i<n;i++)
{if(a[i]==c)
e++;
if(a[i]<c)
break;}
for(int i=0;i<n;i++)
{if(b[i]==c)
f++;
if(b[i]<c)
break;}
if(c==d)
cout<<2*n;
else
{int g;
g=n+n-e-f;
cout<<g;
}
}


Compiler output:
a.cc: In function 'int maxRepeating(int*, int, int)':
a.cc:23:5: error: 'Uncomment' was not declared in this scope
   23 |     Uncomment this code to get the original array back
      |     ^~~~~~~~~
a.cc:24:24: error: 'i' was not declared in this scope
   24 |        for (int i = 0; i< n; i++)
      |                        ^