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

#include <bits/stdc++.h>
using namespace std;
#define printint(v) copy(begin(v), end(v), ostream_iterator<int>(cout," "))
#define printintv(s,e) copy(s,e, ostream_iterator<int>(cout," "))
#define forstl(i,v) for(auto &i: v)
#define forn(i,e) for(int i = 0; i < e; i++)
#define forsn(i,s,e) for(int i = s; i < e; i++)
#define rforn(i,s) for(int i = s; i >= 0; i--)
#define rforsn(i,s,e) for(int i = s; i >= e; i--)
#define clz(a) __builtin_clz(a) // count leading zeroes
#define ctz(a) __builtin_ctz(a) // count trailing zeroes
#define popc(a) __builtin_popcount(a) // count set bits (for ints only diff for ll)
//https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html for other in built
#define ln "\n"
#define dbg(x) cout<<#x<<" = "<<x<<ln
#define mp make_pair
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int,int> p32; 
typedef pair<ll,ll> p64;
typedef pair<double,double> pdd;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vector<vector<int> > vv32;
typedef vector<p64> vp64;
typedef vector<p32> vp32;
typedef map<int,int> m32;
#pragma GCC optimize ("-O2")
const int LIM = 5e5+5, MOD = 1e9+7;
int t,n,m,k,x,y;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
   /* string in;
    cin>>in;
    v32 ans;
    int iter=0;
    unordered_map<string, int> umap;
    forn(i,in.size()){
    	string buffer(1,in[i]);
    	string curr =buffer;
    	while(umap.find(buffer)!=umap.end()){
    		curr=buffer;
    		buffer += in[++i];
    		
    	}
       	umap[buffer]= ++iter;
    	ans.pb(umap[curr]);
    }
    forn(i,ans.size()){
    	cout<<ans[i]<<" ";
    }
    cout<<ln;*/
    //LZW encoder
     cin>>>n;
     m= n%100;
     if(n > 111*m){
     	cout<<111*(m+1);
     }else{
     	cout<<111*m;
     }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:57:11: error: expected primary-expression before '>' token
   57 |      cin>>>n;
      |           ^
Language: C++

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

int main() {
  int N;
  cin >> N;

  if (N<=111) {
    cout << 111 << endl;
  }
 else if (N<=222){
  cout << 222 << endl;
}
 else if (N<=333){
  cout << 333 << endl;
}
 else if (N<=444){
  cout << 444 << endl;
}
 else if (N<=555){
  cout << 555 << endl;
}
 else if (N<=666){
  cout << 666 << endl;
}
 else if (N<=777){
  cout << 777 << endl;
}
 else if (<=888){
  cout << 888 << endl;
}
 else {
  cout << 999 << endl;
}

}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:11: error: expected primary-expression before '<=' token
   29 |  else if (<=888){
      |           ^~
Language: C

#include <stdio.h>

int main()
{
      int n;
      scanf("%d",&n);
      if(n>99 && n<112) printf("%d\n", 111);{
      }else if(n>111 && n<223) {printf("%d\n", 222);
      }else if(n>222 && n<334) {printf("%d\n", 333);
      }else if(n>333 && n<445) {printf("%d\n", 444);
      }else if(n>444 && n<556) {printf("%d\n", 555);
      }else if(n>555 && n<667) {printf("%d\n", 666);
      }else if(n>666 && n<778) {printf("%d\n", 777);
      }else if(n>777 && n<889) {printf("%d\n", 888);
      }else if(n>888 && n<1000) {printf("%d\n", 999);
      return 0;
}

Compiler output:
main.c: In function 'main':
main.c:8:8: error: 'else' without a previous 'if'
    8 |       }else if(n>111 && n<223) {printf("%d\n", 222);
      |        ^~~~
main.c:17:1: error: expected declaration or statement at end of input
   17 | }
      | ^
Language: C++

#include<iostream>

int main()
{
  int n,x;
  std::cin>>n;
  
  if(n/100==n/10/10 && n%10==n/10/10)
  {
    x=n;
  }
  else
  {
    x=n/100+n/100*10+n/100*100);
  }
  
  std::cout<<x<<"\n";
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:31: error: expected ';' before ')' token
   14 |     x=n/100+n/100*10+n/100*100);
      |                               ^
      |                               ;
Language: C++

#include<iostream>
#include<algorithm>

using namespace std;

int main(){
	int n;
	cin >> n;
	int a,b,c;
	a=n%10;
	b=n%100/10;
	c=n/100;
	if(max({a,b,c})==b || max({a,b,c})=a)
		cout << 111*(c+1) << endl;
	else
		cout << 111*max({a,b,c}) << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:28: error: lvalue required as left operand of assignment
   13 |         if(max({a,b,c})==b || max({a,b,c})=a)
      |            ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
Language: Java

class Main{
	static Scanner scan = new Scanner(System.in);
	public static void main(String[] argv){
		String s = scan.next();
		char[] c = s.toCharArray();
		int num = Character.getNumericValue(c[0]);
		if(num==9){System.out.println("999");return;}
		if((Character.getNumericValue(c[1])>num) || (Character.getNumericValue(c[2])>num)){
			num += 1;
			System.out.printf("%d%d%d",num,num,num);
			return;
		}
		System.out.printf("%d%d%d",num,num,num);
		return;
	}
}

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
2 errors
Language: C++

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

int main() {
	int i=0;
	cin>>i;
	int x=0;
	//string s="";
	int c=i%10;
	i=i/10;
	int b=i%10;
	i=i/10;
	int a=i;
	if(a==9)
	{
	    if(n==999)
	    cout<<"1111"<<"\n";
	    else
	    cout<<"999"<<"\n";
	    return 0;
	}
	if(b>a)
	{
	    cout<<a+1<<a+1<<a+1<<"\n";
	}
	else if(b==a)
	{
	    if(c>a)
	    {
	        cout<<a+1<<a+1<<a+1<<"\n";
	    }
	    else if(c==a)
	    {
	        cout<<a<<a<<a<<"\n";
	    }
	    else
	    {
	        cout<<a<<a<<a<<"\n";
	    }
	}
	else
	{
	    cout<<a<<a<<a<<"\n";
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:16: error: 'n' was not declared in this scope
   16 |             if(n==999)
      |                ^
Language: C++

#include <stdio.h>

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

    // index
    int ind = N / 100;

    // judge
    int p = ind * 111;
    ans = N < p ? p : p+111;

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

Compiler output:
a.cc: In function 'int main()':
a.cc:18:18: error: expected ')' before 'ans'
   18 |     printf("%d\n" ans);
      |           ~      ^~~~
      |                  )
Language: C++

#include <iostream>
#include <math.h>

using namespace std;
int main()
{
  int number;
  cin >> number;
  double number2 = number / 111;
  if (ceil(number2) != floor(number2)) 
    int answer = ++number * 111;
  cout << answer <<endl;
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:12:11: error: 'answer' was not declared in this scope
   12 |   cout << answer <<endl;
      |           ^~~~~~
Language: C++

#include <iostream>

using namespace std;
int main()
{
  int number;
  cin >> number;
  double number2 = number / 111;
  if (ceil(number2) != floor(number2)) 
    int answer = ++number * 111;
  cout << answer <<endl;
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:9:7: error: 'ceil' was not declared in this scope
    9 |   if (ceil(number2) != floor(number2))
      |       ^~~~
a.cc:9:24: error: 'floor' was not declared in this scope
    9 |   if (ceil(number2) != floor(number2))
      |                        ^~~~~
a.cc:11:11: error: 'answer' was not declared in this scope
   11 |   cout << answer <<endl;
      |           ^~~~~~
Language: C++

#include<iostream> 
#include<string>
using namespace std; 
int main()
{
int s; 
cin>>s;
if(s%111==0)
cout<<s;
else 
{
int k=s/111+1;
cour<<k*111;
}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:1: error: 'cour' was not declared in this scope
   13 | cour<<k*111;
      | ^~~~
Language: Java

mport java.util.Scanner;

public class B {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		if(n <= 111)System.out.println("111");
		else if(n > 111 && n <= 222)System.out.println("222");
		else if(n > 222 && n <= 333)System.out.println("333");
		else if(n > 333 && n <= 444)System.out.println("444");
		else if(n > 444 && n <= 555)System.out.println("555");
		else if(n > 555 && n <= 666)System.out.println("666");
		else if(n > 666 && n <= 777)System.out.println("777");
		else if(n > 777 && n <= 888)System.out.println("888");
		else if(n > 888 && n <= 999)System.out.println("999");
	}
}

Compiler output:
Main.java:1: error: class, interface, enum, or record expected
mport java.util.Scanner;
^
1 error
Language: Java

import java.util.*;
public class Atcoder{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int n = sc.nextInt();
                int answer = 0;
		int digit = n/100;
		n = n - digit*100;
                if(digit*10+ digit >= n){
			answer = digit*100+ digit*10 + digit;
		}else{
			answer = (digit+1)*100+ (digit+1)*10 + digit+1;
		}
		System.out.println(answer);
	}
}

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

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

#include <cmath>
#include <cstdlib>
#include <climits>

//#include <stdio.h>
//#include <stdlib.h>


using namespace std;

#define debug false

int main(int argc, char *argv[]){

  int N;
  cin >> N;
  for(int i = 1; i <= 9; i++){
    if(111 * i >= N){
      cout << 111*i << endl;
      breka;
    }
  }

  return 0;
}

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:25:7: error: 'breka' was not declared in this scope
   25 |       breka;
      |       ^~~~~
Language: C++

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

int main(){
    int n; 
    cin >>n;
    if(n<=111)
       cout<<111
    else if(n<=222)
       cout<<222;
    else if(n<=333)
       cout<<333;
    else if(n<=444)
       cout<<444;
    else if(n<=555)
       cout<<555;
    else if(n<=666)
       cout<<666;
    else if(n<=777)
       cout<<777;
    else if(n<=888)
       cout<<888;
    else if(n<=999)
       cout<<999;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:17: error: expected ';' before 'else'
    8 |        cout<<111
      |                 ^
      |                 ;
    9 |     else if(n<=222)
      |     ~~~~
Language: Java

public class Main{

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String a = sc.next();
		String[] ar = a.split("");
int max = 0;
		for (String s : ar) {

			int x = Integer.parseInt(s);
			max = Math.max(max, x);
		}
		
		System.out.print(max);
		System.out.print(max);
		System.out.print(max);

	}

}


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

#include <iostream>
#include <string>
using namespace std;
int main(){
	int n;
	cin >> n;
	cout << 111*(n/111) <<<Endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:31: error: expected primary-expression before '<' token
    7 |         cout << 111*(n/111) <<<Endl;
      |                               ^
a.cc:7:32: error: 'Endl' was not declared in this scope
    7 |         cout << 111*(n/111) <<<Endl;
      |                                ^~~~
Language: C++

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

int main(){
    int n; 
    cin >>n;
    if(n<=111}
       cout<<111
    else if(n<=222)
       cout<<222;
    else if(n<=333)
       cout<<333;
    else if(n<=444)
       cout<<444;
    else if(n<=555)
       cout<<555;
    else if(n<=666)
       cout<<666;
    else if(n<=777)
       cout<<777;
    else if(n<=888)
       cout<<888;
    else if(n<=999)
       cout<<999;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:14: error: expected ')' before '}' token
    7 |     if(n<=111}
      |       ~      ^
      |              )
a.cc:7:14: error: expected primary-expression before '}' token
a.cc: At global scope:
a.cc:8:8: error: 'cout' does not name a type
    8 |        cout<<111
      |        ^~~~
a.cc:11:5: error: expected unqualified-id before 'else'
   11 |     else if(n<=333)
      |     ^~~~
a.cc:13:5: error: expected unqualified-id before 'else'
   13 |     else if(n<=444)
      |     ^~~~
a.cc:15:5: error: expected unqualified-id before 'else'
   15 |     else if(n<=555)
      |     ^~~~
a.cc:17:5: error: expected unqualified-id before 'else'
   17 |     else if(n<=666)
      |     ^~~~
a.cc:19:5: error: expected unqualified-id before 'else'
   19 |     else if(n<=777)
      |     ^~~~
a.cc:21:5: error: expected unqualified-id before 'else'
   21 |     else if(n<=888)
      |     ^~~~
a.cc:23:5: error: expected unqualified-id before 'else'
   23 |     else if(n<=999)
      |     ^~~~
a.cc:25:1: error: expected declaration before '}' token
   25 | }
      | ^
Language: C++

#include <iostream>
#include <string>

int main(){
    int a;
	cin>>a;
	for(int i=1;i<=9;i++)
	{
	    if(a<111*i){
	        cout << 111*i << endl;
	    	exit(0);
	    }
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    6 |         cin>>a;
      |         ^~~
      |         std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:10:17: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   10 |                 cout << 111*i << endl;
      |                 ^~~~
      |                 std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:10:34: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   10 |                 cout << 111*i << endl;
      |                                  ^~~~
      |                                  std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

#include <iostream>
#include <string>
using namespace std;
int main(){
	int n;
	cin >> n;
	cout << 111*(n/111) <<<Endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:31: error: expected primary-expression before '<' token
    7 |         cout << 111*(n/111) <<<Endl;
      |                               ^
a.cc:7:32: error: 'Endl' was not declared in this scope
    7 |         cout << 111*(n/111) <<<Endl;
      |                                ^~~~
Language: C++

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

using namespace std;
int main(void){
    cin.tie(0);
    iostream::sync_with_stdio(false);
    int input;
    cin >> input;
    int num_times[9];
    int output;
    for(int i=0; i < 9; i++){
        num_times[i] = 111 * (i+1);
    }
    if(input < 111){
        cout << 111 << '\n';
    }else{
        for(int i=0; i < 9; i++){
        if(num_times[i] < input && input < num_times[i+1]){
            cout << output << '\n';
            break;
        }
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:2: error: expected '}' at end of input
   25 | }
      |  ^
a.cc:5:15: note: to match this '{'
    5 | int main(void){
      |               ^
Language: C++

#include <stdio.h>
int main(){
  int n,c,a,b;
  scanf("%d",&n);
  c=n%100;
  a=(n-c)/100;
  b=111*a;
  if(b>=n)pribtf("%d",b);
  else printf("%d",b+111);
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:11: error: 'pribtf' was not declared in this scope; did you mean 'printf'?
    8 |   if(b>=n)pribtf("%d",b);
      |           ^~~~~~
      |           printf
Language: C

include<stdio.h>
int main(){
  int n,i=111;
  scanf("%d",&n);
  while(n<1000){
    if(i-111<n&&n<=i){
      n=i;
      break;
    }
    i+=111;
  }
  printf("%d\n",n);
  return 0;
}



Compiler output:
main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | include<stdio.h>
      |        ^
Language: C++

#include <stdio.h>
int main(){
  int n,c,a,b;
  scanf("%d",&n);
  c=n%100;
  a=(n-c)/100;
  b=111*a;
  if(b>n)pribtf("%d",b);
  else printf("%d",b+111);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:10: error: 'pribtf' was not declared in this scope; did you mean 'printf'?
    8 |   if(b>n)pribtf("%d",b);
      |          ^~~~~~
      |          printf
Language: C++

#include<iostream>
using namespace std;
int main(){
	int a;
	cin>>a;
	if(a%111==0){
	cout<<a<<endl;
	}
	else{
	cout<<a/b*111+111<<endl;
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:17: error: 'b' was not declared in this scope
   10 |         cout<<a/b*111+111<<endl;
      |                 ^
Language: C++

#include<iostream>
using namespace std;
int main(){
	int a;
	cin>>a;
	if(a%111==0){
		cout<<a<<endl;
	}
	else{
	cout<<a/b*111+111<<endl;
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:17: error: 'b' was not declared in this scope
   10 |         cout<<a/b*111+111<<endl;
      |                 ^
Language: C++

n = int(input())
if n <= 111: print(111)
elif n <= 222: print(222)
elif n <= 333: print(333)
elif n <= 444: print(444)
elif n <= 555: print(555)
elif n <= 666: print(666)
elif n <= 777: print(777)
elif n <= 888: print(888)
elif n <= 999: print(999)

Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n = int(input())
      | ^
Language: C++

#include<iostream>
using namespace std;
int main(){
	int a;
	cin>>a;
	if(a%111==0){
		cout<<a<<endl;
	}
	else{
	cout<<a/b*111+111<<endl;
}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:17: error: 'b' was not declared in this scope
   10 |         cout<<a/b*111+111<<endl;
      |                 ^
Language: C++


import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int N = in.nextInt();
		if(N<=111) {
			System.out.println(111);
		}else if(N<=222) {
			System.out.print(222);
		}else if(N<=333) {
			System.out.print(333);
		}else if(N<=444) {
			System.out.print(444);
		}else if(N<=555) {
			System.out.print(555);
		}else if(N<=666) {
			System.out.print(666);
		}else if(N<=777) {
			System.out.print(777);
		}else if(N<=888) {
			System.out.print(888);
		}else if(N<=999) {
			System.out.print(999);
		}
	}
}

Compiler output:
a.cc:2:1: error: 'import' does not name a type
    2 | import java.util.Scanner;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: expected unqualified-id before 'public'
    4 | public class Main {
      | ^~~~~~
Language: C

#include<stdio.h>
#include<stdlib.h>
int main(void){

  int N;
  scanf("%d",&N);
  int i,ans;
  int digit=N%10;

  if(n>(digit*100+10*digit+digit)){
    digit+=1;
    ans=(digit*100+10*digit+digit);
    if(digit==10){
      ans=1111;
    }
  }
  else{
    ans=(digit*100+10*digit+digit);
  }

  printf("%d",ans);
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:10:6: error: 'n' undeclared (first use in this function)
   10 |   if(n>(digit*100+10*digit+digit)){
      |      ^
main.c:10:6: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>

int main(void){

  int N;
  scanf("%d",&N);
  int i,ans;
  int digit=N%10;

  if(n>(digit*100+10*digit+digit)){
    digit+=1;
    ans=(digit*100+10*digit+digit);
    if(digit==10){
      printf("1111");
      exit(1);
    }
  }
  else{
    ans=(digit*100+10*digit+digit);
  }

  printf("%d",ans);
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:10:6: error: 'n' undeclared (first use in this function)
   10 |   if(n>(digit*100+10*digit+digit)){
      |      ^
main.c:10:6: note: each undeclared identifier is reported only once for each function it appears in
main.c:15:7: error: implicit declaration of function 'exit' [-Wimplicit-function-declaration]
   15 |       exit(1);
      |       ^~~~
main.c:2:1: note: include '<stdlib.h>' or provide a declaration of 'exit'
    1 | #include<stdio.h>
  +++ |+#include <stdlib.h>
    2 | 
main.c:15:7: warning: incompatible implicit declaration of built-in function 'exit' [-Wbuiltin-declaration-mismatch]
   15 |       exit(1);
      |       ^~~~
main.c:15:7: note: include '<stdlib.h>' or provide a declaration of 'exit'
Language: Java

import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
  int n = sc.nextInt();
  if(n <= 111)System.out.println("111");
  else(n <= 222)System.out.println("222");
  else(n <= 333)System.out.println("333");
  else(n <= 444)System.out.println("444");
  else(n <= 555)System.out.println("555");
  else(n <= 666)System.out.println("666");
  else(n <= 777)System.out.println("777");
  else(n <= 888)System.out.println("888");
  else(n <= 999)System.out.println("999");
}}

Compiler output:
Main.java:7: error: not a statement
  else(n <= 222)System.out.println("222");
      ^
Main.java:7: error: ';' expected
  else(n <= 222)System.out.println("222");
                ^
Main.java:8: error: not a statement
  else(n <= 333)System.out.println("333");
      ^
Main.java:8: error: ';' expected
  else(n <= 333)System.out.println("333");
                ^
Main.java:8: error: 'else' without 'if'
  else(n <= 333)System.out.println("333");
  ^
Main.java:9: error: not a statement
  else(n <= 444)System.out.println("444");
      ^
Main.java:9: error: ';' expected
  else(n <= 444)System.out.println("444");
                ^
Main.java:9: error: 'else' without 'if'
  else(n <= 444)System.out.println("444");
  ^
Main.java:10: error: not a statement
  else(n <= 555)System.out.println("555");
      ^
Main.java:10: error: ';' expected
  else(n <= 555)System.out.println("555");
                ^
Main.java:10: error: 'else' without 'if'
  else(n <= 555)System.out.println("555");
  ^
Main.java:11: error: not a statement
  else(n <= 666)System.out.println("666");
      ^
Main.java:11: error: ';' expected
  else(n <= 666)System.out.println("666");
                ^
Main.java:11: error: 'else' without 'if'
  else(n <= 666)System.out.println("666");
  ^
Main.java:12: error: not a statement
  else(n <= 777)System.out.println("777");
      ^
Main.java:12: error: ';' expected
  else(n <= 777)System.out.println("777");
                ^
Main.java:12: error: 'else' without 'if'
  else(n <= 777)System.out.println("777");
  ^
Main.java:13: error: not a statement
  else(n <= 888)System.out.println("888");
      ^
Main.java:13: error: ';' expected
  else(n <= 888)System.out.println("888");
                ^
Main.java:13: error: 'else' without 'if'
  else(n <= 888)System.out.println("888");
  ^
Main.java:14: error: not a statement
  else(n <= 999)System.out.println("999");
      ^
Main.java:14: error: ';' expected
  else(n <= 999)System.out.println("999");
                ^
Main.java:14: error: 'else' without 'if'
  else(n <= 999)System.out.println("999");
  ^
23 errors
Language: C++

// #include <bits/stdc++.h>
#include "lib.h"
using namespace std;
#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define LLINF 1e18//1234567890987654321
#define INF 1234567890
#define pb push_back
#define ins insert
#define f first
#define s second
#define db 0
#define MAXN 200026
#define MAXK 26
#define MAXX 15000006
#define rep(kk, l1, l2)for(long long kk = l1; kk < l2; kk++)
#define rep1(kk, l1, l2)for(long long kk = l1; kk <= l2; kk++)
#define bg(ms) *ms.begin()
#define ed(ms) *prev(ms.end(), 1)
#define addedge(a, b, c) v[a].pb(pi(b, c)); v[b].pb(pi(a, c))
#define ph push
#define all(x) x.begin(), x.end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
typedef long long ll;
typedef pair <ll, ll> pi;
typedef pair <ll, pi> spi;
typedef pair <pi, pi> dpi;
string s;
ll n;
int main()
{
	cin >> s;
	rep(i, 0, s.length())n = max(n, (ll) s[i]-48);
	cout << n << n << n;
}


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

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

int main(){
  int n,a[1000001];
  vector<int>b(n),c(n);
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  for(int i=0;i<n;i++){
    if(i%2==0){
     b.push_back(a[i]);
    }
    else{
      c.push_back(a[i]);
    }
  }
  sort(b.begin(),b.end());
  sort(c.begin(),c.end());
  int bfirst=0,bsecond=0;
  int cfirst=0,csecond=0;
  for(int i=0;i<n;i++){
    if(b[i]==b[i+1]){
      
  


Compiler output:
a.cc: In function 'int main()':
a.cc:24:22: error: expected '}' at end of input
   24 |     if(b[i]==b[i+1]){
      |                     ~^
a.cc:24:22: error: expected '}' at end of input
a.cc:23:23: note: to match this '{'
   23 |   for(int i=0;i<n;i++){
      |                       ^
a.cc:24:22: error: expected '}' at end of input
   24 |     if(b[i]==b[i+1]){
      |                      ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main(){
  ll n;
  cin >> n;
  vector<ll> a(n),ev(100001),od(100001);
  rep(i,n){
    cin >> a.at(i);
    if(i%2==0){
      od.at(a.at(i))++;
    }else{
      ev.at(a.at(i))++;
    }
  }
  ll maxiev=0,maxiod=0,soeev,soeod;
  rep(i,100001){
    if(maxiev<ev.at(i)){
      maxiev=ev.at(i);
      soeev=i;
    }
    if(maxiod<od.at(i)){
      maxiod=od.at(i);
      soeod=i;
    }
  }
  if(soeev!=soeod){
    cout << n/2-maxiev+n/2-maxiod;
  }else{
    if(maxiev<maxiod){
      ll q=0;
      rep(i,100001){
        if(soeev!=i && q<ev.at(i)){
          q=ev.at(i);
        }
      }
      cout << n/2-maxiod+n/2-q;
    }else if(maxiev>maxiod){
      ll q=0;
      rep(i,100001){
        if(soeod!=i && q<od.at(i)){
          q=od.at(i);
        }
      }
      cout << n/2-maxiev+n/2-q;
    }else{
      ll p=0,q=0;
      rep(i,100001){
        if(soeev!=i && q<ev.at(i)){
          q=ev.at(i);
        }
      }
      rep(i,100001){
        if(soeod!=i && p<od.at(i)){
          p=od.at(i);
        }
      }
      ll ans=max(p,q);
      cout <<n/2-ans+n/2-maxiod;
    }
  }
}
      
  }
}
    
    
  


Compiler output:
a.cc:65:3: error: expected declaration before '}' token
   65 |   }
      |   ^
a.cc:66:1: error: expected declaration before '}' token
   66 | }
      | ^
Language: C++

//#include <bits/stdc++.h> 
#include<cstdio>
#include<iostream>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using ll =long long;
using namespace std;
using Graph=vector<vector<int>>;
using Field=vector<string>;
using P =pair<int,int>;


int main(){
    int n;
    cin>>n;
    vector<int> v(n);
    rep(i,n)cin>>v[i];
    int a[10001]={};
    int b[10001]={};
    rep(i,n){
        if(i%2==0)a[v[i]]++;
        else b[v[i]]++;
    }
    int maxa[2]={},maxb[2]={};
    int indexa[2]={},indexb[2]={};
    rep(i,10001){
        if(a[i]>maxa[0]){
            maxa[0]=a[i];
            indexa[0]=i;
        }else if(a[i]>maxa[1]){
            maxa[1]=a[i];
            indexa[1]=i;
        }
        if(b[i]>maxb[0]){
            maxb[0]=b[i];
            indexb[0]=i;
        }else if(b[i]>maxb[1]){
            maxb[1]=b[i];
            indexb[1]=i;
        }
    }
    if(maxa[0]==n/2&&maxb[0]==n/2){
        if(indexa[0]==indexb[0]){
            cout<<n/2<<endl;
        }else{
            cout<<0<<endl;
        }
    }else{
        if(indexa[0]==indexb[0]){
            cout<<min(n-maxa[0]-maxb[1],n-maxa[1]-maxb[0])<<endl;
        }else{
            cout<<(n-maxa[0]-maxb[0])<<endl;
        }
    }
    return 0;
}

Compiler output:
a.cc:7:13: error: 'vector' does not name a type
    7 | using Graph=vector<vector<int>>;
      |             ^~~~~~
a.cc:8:13: error: 'vector' does not name a type
    8 | using Field=vector<string>;
      |             ^~~~~~
a.cc: In function 'int main()':
a.cc:15:5: error: 'vector' was not declared in this scope
   15 |     vector<int> v(n);
      |     ^~~~~~
a.cc:4:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    3 | #include<iostream>
  +++ |+#include <vector>
    4 | #define rep(i,n) for (int i = 0; i < (n); ++i)
a.cc:15:12: error: expected primary-expression before 'int'
   15 |     vector<int> v(n);
      |            ^~~
a.cc:16:18: error: 'v' was not declared in this scope
   16 |     rep(i,n)cin>>v[i];
      |                  ^
a.cc:20:21: error: 'v' was not declared in this scope
   20 |         if(i%2==0)a[v[i]]++;
      |                     ^
a.cc:21:16: error: 'v' was not declared in this scope
   21 |         else b[v[i]]++;
      |                ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main(){
  ll n;
  cin >> n;
  vector<ll> a(n);
  if(n==2 && a.at(1)==a.at(0)){
    cout << 1;
    return 0;
  }
  map<ll,ll> odd,even;
  rep(i,n){
    cin >> a.at(i);
    if(i%2==0){
      odd[a.at(i)]++;
    }else{
      even[a.at(i)]++;
    }
  }
  ll is=0,no=0;
  ll maxi1=0,maxi2=0;
  for(auto p: odd){
    auto c;
    c=p.second;
    if(maxi1<c){
      maxi1=c;
      is=p.first;
    }
  }
  for(auto p: even){
    auto c;
    c=p.second;
    if(maxi2<c){
      maxi2=c;
      no=p.first;
    }
  }
  vector<ll> an(n),as(n);
  ll i=0;
  for(auto p: odd){
    an.at(i)=p.second;
    i++;
  }
  i=0;
  for(auto p: even){
    as.at(i)=p.second;
    i++;
  }
  sort(an.begin(),an.end());
  reverse(an.begin(),an.end());
  sort(as.begin(),as.end());
  reverse(as.begin(),as.end());
  if(is==no){
    ll x=as.at(1),y=an.at(1);
    int q;
    q=min(maxi1,maxi2);
    if(maxi1>maxi2){
      cout << n-maxi1-x;
    }else{
      cout << n-y-maxi2;
    }
  }else{
    ll ans=n-maxi1-maxi2;
    cout << ans;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:5: error: declaration of 'auto c' has no initializer
   25 |     auto c;
      |     ^~~~
a.cc:33:5: error: declaration of 'auto c' has no initializer
   33 |     auto c;
      |     ^~~~
Language: C

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

// cant imp

int main() {
    cin.tie(0);
    cin.sync_with_stdio(0);
    
    int n, v;
    cin >> n;
    vector<int> ecnt(100001, 0), ocnt(100001, 0);
    for (int i = 0; i < n; i++) {
        scanf("%d", &v);
        if (i % 2 == 0) ecnt[v]++;
        else ocnt[v]++;
    }

    int max_ecnt = 0, max_ocnt = 0;
    int max_e = 0, max_o = 0;
    for (int i = 0; i < 100001; i++) {
        if (max_ecnt < ecnt[i]) {
            max_ecnt = ecnt[i];
            max_e = i;
        }
        if (max_ocnt < ocnt[i]) {
            max_ocnt = ocnt[i];
            max_o = i;
        }
    }

    int ans;
    if (max_o == max_e) {
        sort(ecnt.begin(), ecnt.end(), greater<int>());
        sort(ocnt.begin(), ocnt.end(), greater<int>());
        int t1 = n - max_ecnt - ocnt[1];
        int t2 = n - ecnt[1] - max_ocnt;
        ans = min(t1, t2);
    } else {
        ans = n - max_ocnt - max_ecnt;
    }

    cout << ans << endl;
}

Compiler output:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C++

/**
*    author:  yuya1234
*    created: 03.09.2020 13:17:54
**/

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
long double eps = 1.0E-14;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define FORV(i,v) for(auto i=v.begin(); i!=v.end();i++)

#define SORT(s) sort((s).begin(),(s).end())
#define SORTD(s) sort((s).rbegin(),(s).rend())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define SZ(x) ((int)(x).size())
#define MEMSET(v, h) memset((v), h, sizeof(v))

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class T>T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<class T>T lcm(T a,T b){return gcd(a,b)*(a/gcd(a,b))*(b/gcd(a,b));}

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  //cout<<fixed<<setprecision(15);

  int n;
  cin>>n;

  int *a=new int[100001];
  int *b=new int[100001];

  REP(i,100001)
  {
    a[i]=b[i]=0;
  }

  int tmp;
  REP(i,n)
  {
    cin>>tmp;
    if(i%2==0)a[tmp]++;
    else b[tmp]++;
  }

  int max11,max12,max21,max22;
  max11=max12=max21=max22=0;

  int idx11,idx12,idx21,idx22;
  idx11=idx12=idx21=idx22=0;

  FOR(i,1,100000)
  {
    if(chmax(max11,a[i]))idx11=i;
    else if(chmax(max21,a[i]))idx21=i;
  }

  FOR(i,1,100000)
  {
    if(chmax(max12,b[i]))idx12=i;
    else if(chmax(max22,b[i]))idx22=i;
  }

  int ans=0;
  if(idx11!=idx12)ans=n-max11-max12;
  //else ans=min(n-max11-max22,n-max21-max12);
  else ans=n-max11-max(max22,max12));

  cout<<ans<<endl;



  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:75:36: error: expected ';' before ')' token
   75 |   else ans=n-max11-max(max22,max12));
      |                                    ^
      |                                    ;
Language: C

#include <iostream>      // cout, endl, cin
#include <string>        // string, to_string, stoi
#include <vector>        // vector
#include <algorithm>     // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility>       // pair, make_pair
#include <tuple>         // tuple, make_tuple
#include <cstdint>       // int64_t, int*_t
#include <cstdio>        // printf
#include <map>           // map
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <deque>         // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset>        // bitset
#include <cctype>        // isupper, islower, isdigit, toupper, tolower


using namespace std;
using ll = long long;

int main()
{
  int n;
  cin >> n;
  int vec[n + 1];
  vec[0] = 0;
  vector<int> cnt_o(100001, 0);
  vector<int> cnt_e(100001, 0);
  for (int i = 1; i <= n; i++)
  {
    cin >> vec[i];
    if (i % 2 == 0)
      cnt_e[vec[i]]++;
    else
      cnt_o[vec[i]]++;
  }
  int o_first = cnt_o[1], o_second = 0;
  int e_first = cnt_e[1], e_second = 0;
  int o_a = 1, o_b = 0, e_a = 1, e_b = 0;
  //eのaは
  for (int i = 2; i <= n; i++)
  {

    if (cnt_o[i] >= o_first)
    {
      o_b = o_a;
      o_a = i;
      o_second = o_first;
      o_first = cnt_o[i];
    }
    else if (cnt_o[i] < o_first && cnt_o[i] >= o_second)
    {
      o_b = i;
      o_second = cnt_o[i];
    }
    if (cnt_e[i] >= e_first)
    {
      e_b = e_a;
      e_a = i;
      e_second = e_first;
      e_first = cnt_e[i];
    }
    else if (cnt_e[i] < e_first && cnt_e[i] >= e_second)
    {
      e_b = i;
      e_second = cnt_e[i];
    }
  }

    cout << min(n - o_first - e_second, n - o_second - e_first);
}

Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>      // cout, endl, cin
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
ll GetDigit(ll num){ return log10(num)+1; } //numの桁数を求める

int main()
{
    int n;
    cin >> n;
    vector<int> v(n);
    rep(i,n) cin >> v[i];
    bool flag = true;
    ll a = v[0];
    rep(i,n){
        if(v[i] != a) flag = false;
    }
    if(flag) {
        cout << n/2 << endl;
        return 0;
    }
    vector<int> cnt1(100005),cnt2(100005);
    vector<int> v1,v2;
    auto it1 = v1.begin();
    auto it2 = v2.begin();
    for (int i = 0; i < n; i ++)
    {
        if(i%2 == 0) {
            it1 = v1.insert(it1,v[i]);
            it1++;
        }else{
            it2 = v2.insert(it2,v[i]);
            it2++;
        }
    }
    rep(i,n/2){
        cnt1[v1[i]]++;
        cnt2[v2[i]]++;
    }
    ll maxcnt1 = 0;
    ll smaxcnt1 = 0;
    rep(i,100005){
        if(maxcnt1 < cnt1[i]) maxcnt1 = cnt1[i];
        if(maxcnt2 < cnt2[i]) maxcnt2 = cnt2[i];
    }
    ll ans = n-maxcnt1-maxcnt2;
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:44:12: error: 'maxcnt2' was not declared in this scope; did you mean 'maxcnt1'?
   44 |         if(maxcnt2 < cnt2[i]) maxcnt2 = cnt2[i];
      |            ^~~~~~~
      |            maxcnt1
a.cc:46:24: error: 'maxcnt2' was not declared in this scope; did you mean 'maxcnt1'?
   46 |     ll ans = n-maxcnt1-maxcnt2;
      |                        ^~~~~~~
      |                        maxcnt1
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
typedef long long int lli;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

int dx[] = {1, 1, 0, -1, -1, -1, 0, 1};
int dy[] = {0, 1, 1, 1, 0, -1, -1, -1};

int main(){
    int n;
    cin >> n;
    vector<int> v(n);
    rep(i, n) cin >> v[i];
    map<int, int> mEven, mOdd;
    for(int i = 0; i < n; i += 2) mEven[v[i]]++;
    for(int i = 1; i < n; i += 2) mOdd[v[i]]++;

    vector<pair<int, int>> evenCnt, oddCnt;
    for (auto mi = mEven.begin(); mi != mEven.end(); mi++){
        evenCnt.push_back(make_pair(mi->second, mi->first));
    }
    for (auto mi = mOdd.begin(); mi != mOdd.end(); mi++){
        oddCnt.push_back(make_pair(mi->second, mi->first));
    }

    int ans;
    sort(all(evenCnt));
    sort(all(oddCnt));
    if (evenCnt[0].first == oddCnt[0].first){
        if (evenCnt[0].second == oddCnt[0].second){
            if (evenCnt[1].first > oddCnt[1].first){
                ans = n - oddCnt[0].first - evenCnt[1].first;
            }
            else{
                ans = n - evenCnt[0].first - oddCnt[1].first;
            }
        }else{
            ans = n - evenCnt[0].first - oddCnt[0].first;
        }
    }
    else if (evenCnt[0].first > oddCnt[0].first){
        if (evenCnt[0].second == oddCnt[0].second){
            ans = n - evenCnt[0].first - oddCnt[1].first;
        }else{
            ans = n - evenCnt[0].first - oddCnt[0].first;
        }
    else if (evenCnt[0].first < oddCnt[0].first){
        if (evenCnt[0].second == oddCnt[0].second){
            ans = n - oddCnt[0].first - evenCnt[1].first;
        }else{
            ans = n - oddCnt[0].first - evenCnt[0].first;
        }
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:54:5: error: expected '}' before 'else'
   54 |     else if (evenCnt[0].first < oddCnt[0].first){
      |     ^~~~
a.cc:48:49: note: to match this '{'
   48 |     else if (evenCnt[0].first > oddCnt[0].first){
      |                                                 ^
Language: C++

#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define all(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long inf = numeric_limits<long long>::max();
typedef long long ll;

ll calc(vector<ll> & vec, ll mode, ll add) {
  ll ans = 0;
  rep(i, vec.size()) {
    if (vec[i] > 0) {
      ans += (abs(i - mode) - add) * vec[i];
    }
  }
  return ans;
}

ll mode(vector<ll> & vec) {
  auto max_iterator = max_element(vec.begin(), vec.end());
  return distance(vec.begin(), max_iterator);  
}

int main()
{
  int n;
  cin >> n;
  vector<ll> vec_even(pow(10, 5)+1, 0);
  vector<ll> vec_odd(pow(10, 5)+1, 0);
  rep(i, n) {
    int x;
    cin >> x;
    if (i%2 == 0) {
      vec_even[x]++;
    } else {
      vec_odd[x]++;
    }
  }
  ll a = mode(vec_even);
  ll b = mode(vec_odd);
  if (a )
  ll res_a = calc(vec_even, a, 0);
  ll res_b = calc(vec_odd, b, a == b ? 1 : 0);
  
  cout << res_a + res_b << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:47:11: error: 'res_a' was not declared in this scope; did you mean 'res_b'?
   47 |   cout << res_a + res_b << endl;
      |           ^~~~~
      |           res_b
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

// #define int ll
#define REP(i,n) for (int i = 0; i < (n); ++i)
#define FORE(i, s, n) for (int i = (s); i <= (int)(n); i++)

const int MOD = (int)1e9 + 7;

int main() {
    int N;
    cin >> N;

    vector<int> vec(N);
    REP(i, N) {
        cin >> vec.at(i);
    }

    // 偶数indで、一番多いものに合わせる
    map<int, int> even_map;
    for(int i = 0; i < N; i+=2) {
        int val = vec[i];

        if (even_map.count(val) == 1) {
            even_map[val] += 1;
        } else {
            even_map[val] = 1;
        }
    }

    // 奇数indで、一番多いものに合わせる
    map<int, int> odd_map;
    for(int i = 1; i < N; i+=2) {
        int val = vec[i];

        if (odd_map.count(val) == 1) {
            odd_map[val] += 1;
        } else {
            odd_map[val] = 1;
        }
    }

    int odd_most_freq;
    int odd_most_freq_cnt = 0;
    for (auto x : odd_map){
        int key = x.first;
        int value = x.second;

        if (value > odd_most_freq_cnt) {
            odd_most_freq = key;
            odd_most_freq_cnt = value;
        }
    }

    int even_most_freq = 0;
    int even_most_freq_cnt = 0;
    for (auto x : even_map){
        int key = x.first;
        int value = x.second;

        if (value > even_most_freq_cnt) {
            even_most_freq = key;
            even_most_freq_cnt = value;
        }
    }

    // REP(i, N) {
    //     int v = vec.at(i);
    // }

    int evens = N % 2 == 0 ? (N / 2) : (N+1) / 2

    int ans_even = evens - even_most_freq_cnt;

    int odds = N / 2;

    int ans_odd = odds - odd_most_freq_cnt;

    if (even_most_freq == odd_most_freq) {
        cout << odds << endl;
        return 0;
    }

    cout << ans_even + ans_odd << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:75:5: error: expected ',' or ';' before 'int'
   75 |     int ans_even = evens - even_most_freq_cnt;
      |     ^~~
a.cc:86:13: error: 'ans_even' was not declared in this scope
   86 |     cout << ans_even + ans_odd << endl;
      |             ^~~~~~~~
Language: C

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <vector>
#include <algorithm>
using namespace std;
#define MOD1 1000000007
#define MOD2 998244353
#define LIMIT1 200002
#define LIMIT2 500002
typedef long long ll;
typedef long double ld;
typedef const void cv;
#define rep(i,n) for((i)=0;(i)<(n);(i)++)
#define per(i,n) for((i)=(n)-1;(i)>=0;(i)--)
#define max(a,b) ((a)>(b) ? (a) : (b))
#define min(a,b) ((a)<(b) ? (a) : (b))
#define zt(a,b) (max((a),(b))-min((a),(b)))
#define absl(v) labs((v))
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll nPr(int n,int r){ll i,result=1;rep(i,r){result*=(ll)(n-i);}return result;}
ll nCr(int n,int r){ll i,result=1;if(n<r) return 0;rep(i,min(r,n-r)){result*=(ll)(n-i);result/=(ll)(i+1);}return result;}
#define nHr(n,r) nCr((int)((n)+(r)+1),(int)(r))
#define sankaku(x) (((x)*((x)+1))/2)
int dx[8]={1,0,-1,0,1,-1,-1,1},dy[8]={0,1,0,-1,1,1,-1,-1};
int upint(cv *a, cv *b) { return *(int *)a < *(int *)b ? -1 : *(int *)a > *(int *)b ? 1 : 0; }
int downint(cv *a, cv *b) { return *(int *)a < *(int *)b ? 1 : *(int *)a > *(int *)b ? -1 : 0; }
int upchar(cv *left, cv *right) {return strcmp((char *)left,(char *)right);}
int downchar(cv *left, cv *right) {return strcmp((char *)right,(char *)left);}
void tmpInit(int *c,ll m) {ll i;rep(i,m) c[i]=i;}
ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1){
            res *= a; if(mod>=1) res %= mod;
        }
        a *= a; if(mod>=1) a %= mod;
        n >>= 1;
    }
    return res;
}
void initialize(){
  
}
ll dp[LIMIT1][2]={0};
int ca[LIMIT1],cb[LIMIT1];
ll type=0;
int tmp(cv *p,cv *q){
  return dp[*(int *)q][type]-dp[*(int *)p][type];
}
int main(void){
  initialize();
  ll n,m,i,j,k,result=0;
  int a;
  
  scanf("%lld",&n);
  tmpInit(ca,100001);
  tmpInit(cb,100001);
  rep(i,n){
    scanf("%d",&a);
    dp[a][i%2]++;
  }
  type=0;
  qsort(ca,100001,sizeof(int),tmp);
  type=1;
  qsort(cb,100001,sizeof(int),tmp);
  if(ca[0]!=cb[0]){
    result = n-dp[ca[0]][0]-dp[cb[0]][1];
  }else{
    result = n-max(dp[ca[0]][0]+dp[cb[1]][1],dp[ca[1]][0]+dp[cb[0]][1]);
  }
  printf("%lld\n",result);
  return 0;
}

Compiler output:
main.c:5:10: fatal error: vector: No such file or directory
    5 | #include <vector>
      |          ^~~~~~~~
compilation terminated.
Language: C++

if (a.front().second == b.front().second) {
		int ans = a.front().first;
		if (a.size() == 1 && b.size() == 1) {
			cout << n / 2 << endl;
			return 0;
		}
		if (a[1].first >= b[1].first) {
			ans += a[1].first;
		}
		else {
			ans += b[1].first;
		}
		cout << n - ans << endl;
	}
	else {
		int ans = a.front().first + b.front().first;
		cout << n - ans << endl;
	}
	return 0;

Compiler output:
a.cc:1:1: error: expected unqualified-id before 'if'
    1 | if (a.front().second == b.front().second) {
      | ^~
a.cc:15:9: error: expected unqualified-id before 'else'
   15 |         else {
      |         ^~~~
a.cc:19:9: error: expected unqualified-id before 'return'
   19 |         return 0;
      |         ^~~~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <utility>
#include <set>
#include <stack>
#include <climits>
#include <cmath>

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define rep1(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define reps(i,s,n) for(int i=s, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define MEMSET(v, h) memset((v), h, sizeof(v))
typedef long long ll;
const char sp = ' ';


using namespace std;

int main(void){
    ll ev[200000], od[200000];
    vector<pair<ll, ll> > even, odd;
    ll n;
    ll v;
    cin>>n;
    MEMSET(ev, 0); MEMSET(od, 0);
    rep(i, n){
        cin>>v;
        if(i%2==0) ev[v]++;
        else od[v]++;
    }
    rep(i, 200000) if(ev[i]!=0) even.push_back({ev[i], i});
    rep(i, 200000) if(od[i]!=0) odd.push_back({od[i], i});
    sort(all(even)); sort(all(odd));
    if(even[even.size()-1].second!=odd[odd.size()-1].second){
        cout<<n-even[even.size()-1].first-odd[odd.size()-1].first<<endl;
    }
    else{
        ll Maxim=0;
        if(even.size()>=2) Miaxim=max(even[even.size()-2].first+odd[odd.size()-1].first, Maxim);
        if(odd.size()>=2) Maxim=max(even[even.size()-1].first+odd[odd.size()-2].first, Maxim);
        if(even.size()==odd.size()) Maxim=n/2;
        cout<<n-Maxim<<endl;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:44:28: error: 'Miaxim' was not declared in this scope; did you mean 'Maxim'?
   44 |         if(even.size()>=2) Miaxim=max(even[even.size()-2].first+odd[odd.size()-1].first, Maxim);
      |                            ^~~~~~
      |                            Maxim