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

#include <bits/stdc++.h>
using namespace std;main(){string s;cin>>s;
                           if(regex_match(s,regex("A?KIHA?BA?RA?")))
    return cout<<"YES";
  cout<<"NO"<<;}


Compiler output:
a.cc:2:21: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    2 | using namespace std;main(){string s;cin>>s;
      |                     ^~~~
a.cc: In function 'int main()':
a.cc:4:16: error: cannot convert 'std::basic_ostream<char>' to 'int' in return
    4 |     return cout<<"YES";
      |            ~~~~^~~~~~~
      |                |
      |                std::basic_ostream<char>
a.cc:5:15: error: expected primary-expression before ';' token
    5 |   cout<<"NO"<<;}
      |               ^
Language: C++

#include "bits/stdc++.h"
using namespace std;
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define put(a) cout<<a<<"\n"
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){if(a>b){a=b;return 1;}return 0;}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){if(a<b){a=b;return 1;}return 0;}

int main(){
    string s;
    cin >> s;
    vector<string>t;
    t.push_back("KIHBR");
    t.push_back("AKIHBR");
    t.push_back("KIHABR");
    t.push_back("AKIHABR");
    t.push_back("KIHBAR");
    t.push_back("AKIHBAR");
    t.push_back("KIHABAR");
    t.push_back("AKIHABAR");
    t.push_back("KIHBRA");
    t.push_back("AIHBRA");
    t.push_back("KIHABRA");
    t.push_back("AIHABRA");
    t.push_back("KIHBARA");
    t.push_back("AIHBARA");
    t.push_back("KIHABARA");
    t.push_back("AIHABARA");
    bool flag = false;
    REP(i,16){
        if(s==t[i])flag = true:
    }
    if(flag){
        put("Yes");
    }else{
        put("No");
    }
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:41:31: error: expected ';' before ':' token
   41 |         if(s==t[i])flag = true:
      |                               ^
      |                               ;
Language: C++

import re

s = input()
m = re.match('A?KIHA?BA?RA?', s)

if m:
    print("YES")
else:
    print("NO")


Compiler output:
a.cc:4:14: warning: multi-character literal with 13 characters exceeds 'int' size of 4 bytes
    4 | m = re.match('A?KIHA?BA?RA?', s)
      |              ^~~~~~~~~~~~~~~
a.cc:1:1: error: 'import' does not name a type
    1 | import re
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

#include <bits/stdc++.h> using namespace std; int main(){ string s;cin >> s; if(regex_search(s, regex("A?KIHA?BA?RA?"))) cout << "YES" << endl; else cout << "NO" << endl;}


Compiler output:
a.cc:1:26: warning: extra tokens at end of #include directive
    1 | #include <bits/stdc++.h> using namespace std; int main(){ string s;cin >> s; if(regex_search(s, regex("A?KIHA?BA?RA?"))) cout << "YES" << endl; else cout << "NO" << endl;}
      |                          ^~~~~
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <list>
#include <deque>
#include <string>
#include <algorithm>
#include <cmath>
#include <ctype.h>
using namespace std;
#define dump(a) cout << (a) << '\n';
typedef long long Int;
Int mod = 1e9+7;
Int MOD = 998244353;

int main() {
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    string t[] = {
        "KIHBR",
        "KIHBRA",
        "KIHBAR",
        "KIHBARA",
        "KIHABR",
        "KIHABRA",
        "KIHABAR",
        "KIHABARA",
        "AKIHBR",
        "AKIHBRA",
        "AKIHBAR",
        "AKIHBARA",
        "AKIHABR",
        "AIHABRA",
        "AKIHABAR",
        "AKIHABARA"
    }
    for (Int i = 0; i < 16; i++) {
        if (s == t[i]) {
            dump("YES");
            return 0;
        }
    }
    dump("NO");
    return 0;  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:5: error: expected ',' or ';' before 'for'
   40 |     for (Int i = 0; i < 16; i++) {
      |     ^~~
a.cc:40:21: error: 'i' was not declared in this scope
   40 |     for (Int i = 0; i < 16; i++) {
      |                     ^
Language: C++

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

int main() {
	string S, A="AKIHABARA+", T; cin >> S;
	int P=0; bool flag=true;
	for(int i=0; i<S.size(); ++i){
	    if(S[i]==A[P]) ++P;
	    else if(A[P]=='A' && S[i]==A[P+1]) P += 2;
	    else{
	        flag=false;
	        break;
	    }
	}
	if(flag && (P==8 || P==9) cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:34: error: expected ';' before 'cout'
   16 |         if(flag && (P==8 || P==9) cout << "YES" << endl;
      |                                  ^~~~~
      |                                  ;
a.cc:17:9: error: expected primary-expression before 'else'
   17 |         else cout << "NO" << endl;
      |         ^~~~
a.cc:16:57: error: expected ')' before 'else'
   16 |         if(flag && (P==8 || P==9) cout << "YES" << endl;
      |           ~                                             ^
      |                                                         )
   17 |         else cout << "NO" << endl;
      |         ~~~~
Language: C++

>

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define itn int

typedef long long ll;
typedef pair<ll,ll> p;


int main()
{
  string s;
  cin >> s;
  string akiba = "KIHBR";

  int now = 0;
  for (int i = 0; i < int(s.size()); i++)
  {
    if(s[i] != akiba[now] && s[i] != 'A')
    {
      cout << "NO" << endl;
      return 0;
    }
    if(s[i] == akiba[now]) now++;
  }

  now = 0;
  akiba = "AKIHABARA";
  for (int i = 0; i < int(s.size()); i++)
  {
    if(s[i] != akiba[now])
    {
      if(akiba[now] == 'A'){
        i--;
        now++;
        continue;
      }
      else{
        cout << "NO" << endl;
        return 0;
      }
    }
    now++;
  }
  cout << "YES" << endl;
}


Compiler output:
a.cc:1:1: error: expected unqualified-id before '>' token
    1 | >
      | ^
a.cc:11:9: error: 'pair' does not name a type
   11 | typedef pair<ll,ll> p;
      |         ^~~~
a.cc: In function 'int main()':
a.cc:16:3: error: 'string' was not declared in this scope
   16 |   string s;
      |   ^~~~~~
a.cc:17:3: error: 'cin' was not declared in this scope
   17 |   cin >> s;
      |   ^~~
a.cc:17:10: error: 's' was not declared in this scope
   17 |   cin >> s;
      |          ^
a.cc:18:9: error: expected ';' before 'akiba'
   18 |   string akiba = "KIHBR";
      |         ^~~~~~
      |         ;
a.cc:23:16: error: 'akiba' was not declared in this scope
   23 |     if(s[i] != akiba[now] && s[i] != 'A')
      |                ^~~~~
a.cc:25:7: error: 'cout' was not declared in this scope
   25 |       cout << "NO" << endl;
      |       ^~~~
a.cc:25:23: error: 'endl' was not declared in this scope
   25 |       cout << "NO" << endl;
      |                       ^~~~
a.cc:28:16: error: 'akiba' was not declared in this scope
   28 |     if(s[i] == akiba[now]) now++;
      |                ^~~~~
a.cc:32:3: error: 'akiba' was not declared in this scope
   32 |   akiba = "AKIHABARA";
      |   ^~~~~
a.cc:43:9: error: 'cout' was not declared in this scope
   43 |         cout << "NO" << endl;
      |         ^~~~
a.cc:43:25: error: 'endl' was not declared in this scope
   43 |         cout << "NO" << endl;
      |                         ^~~~
a.cc:49:3: error: 'cout' was not declared in this scope
   49 |   cout << "YES" << endl;
      |   ^~~~
a.cc:49:20: error: 'endl' was not declared in this scope
   49 |   cout << "YES" << endl;
      |                    ^~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <stack>
#include <queue>
using namespace std;
using ll = long long;
map <int ,int> mpa,mpb;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  string S;
  cin >> S;
  n=S.size();
  if(S=="AKIHABARA"){
    cout << "Yes" << endl;
    return 0;
  }
  else if(S=="KIHABARA"){
    cout << "Yes" << endl;
    return 0;
  }
  else if(S=="AKIHBARA"){
    cout << "Yes" << endl;
    return 0;
  }
  else if(S=="AKIHABRA"){
    cout << "Yes" << endl;
    return 0;
  }
  else if(S=="AKIHABAR"){
    cout << "Yes" << endl;
    return 0;
  }
  else if(S=="KIHBARA"){
    cout << "Yes" << endl;
    return 0;
  }
  else if(S=="KIHABRA"){
    cout << "Yes" << endl;
    return 0;
  }
  else if(S=="KIHABAR"){
    cout << "Yes" << endl;
    return 0;
  }
  else if(S=="AKIHBRA"){
    cout << "Yes" << endl;
    return 0;
  }
  else if(S=="AKIHBAR"){
    cout << "Yes" << endl;
    return 0;
  }
  else if(S=="AKIHABR"){
    cout << "Yes" << endl;
    return 0;
  }
  else if(S=="AKIHBR"){
    cout << "Yes" << endl;
    return 0;
  }
  else if(S=="KIHABR"){
    cout << "Yes" << endl;
    return 0;
  }
  else if(S=="KIHBAR"){
    cout << "Yes" << endl;
    return 0;
  }
  else if(S=="KIHBRA"){
    cout << "Yes" << endl;
    return 0;
  }
  else if(S=="KIHBR"){
    cout << "Yes" << endl;
    return 0;
  }
  else{
    cout << "No" << endl;
    return 0;
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:3: error: 'n' was not declared in this scope
   22 |   n=S.size();
      |   ^
Language: C++

#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<bitset>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
typedef long long int ll;
typedef pair<int,int> P;
struct edge{int to,cost;};
#define REP(i,n) for(int i=0;i<(n);i++)
const int INF=100000000;

int main(){
	string s,t="";
	cin>>s;
	else{
		REP(Bit,1<<4){
			bitset<4> b(Bit);
			t="";
			t=t+(b[3]==1?"A":"")+"KIH"+(b[2]==1?"A":"")+"B"+(b[1]==1?"A":"")+"R"+(b[3]==1?"A":"");
			if(s==t){
				cout<<"YES"<<endl;
				return 0;
			}
			DEB(b)DEB(b[0])END
		}
		cout<<"NO"<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:9: error: 'else' without a previous 'if'
   35 |         else{
      |         ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
string s;
int main() {
	vector<string> ok = {
		"KIHBR",
		"AKIHBR",
		"KIHABR",
		"KIHBAR",
		"KIHBRA",
		"AKIHABR",
		"AKIHBAR",
		"AKIHBRA",
		"KIHABAR",
		"KIHABRA",
		"KIHBARA",
		"AKIHABAR",
		"AKIHABRA",
		"AKIHBARA",
		"KIHABARA",
		"AKIHABARA"
	};
	cin >> s; bool flag = false;
	for(int i = 0; i < 16; i++) {
		if(s == t[i]) flag = true;
	}
	cout << (flag ? "YES" : "NO") << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:25: error: 't' was not declared in this scope
   25 |                 if(s == t[i]) flag = true;
      |                         ^
Language: C++

#include<iostream>
#include<vector>
using namespace std;
int main(){
  string s;
  cin>>s;
  for(int i=0;i<4;i++){
    do{
      if(s=="AKIHABRA"){
        cout<<"Yes"<<endl;return 0;
      }
    }while(next_permutation(s.begin(),s.end()));
    
    s+='A';
  }
  cout<<"No"<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:12: error: 'next_permutation' was not declared in this scope
   12 |     }while(next_permutation(s.begin(),s.end()));
      |            ^~~~~~~~~~~~~~~~
Language: C++

#include<iostream>
#include<vector>
using namespace std;
int main(){
  string s;
  cin>>s;
  for(int i=0;i<4;i++){
    do{
      if(s=="AKIHABRA"){
        cout<<"Yes"<<endl;
      }
    }while(next_permutation(s.begin(),s.end()));
    
    s+='A';
  }
  cout<<"No"<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:12: error: 'next_permutation' was not declared in this scope
   12 |     }while(next_permutation(s.begin(),s.end()));
      |            ^~~~~~~~~~~~~~~~
Language: C++

#include<iostream>
#include<vector>
using namespace std;
int main(){
  string s;
  cin>>s;
  for(int i=0;i<4;i++){
    do{
      if(s=="AKIHABRA"){
        cout<<"Yes"<<endl;
      }
    }while(next_permutation(s.begin(),s.end()))
    s+='A';
  }
  cout<<"No"<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:12: error: 'next_permutation' was not declared in this scope
   12 |     }while(next_permutation(s.begin(),s.end()))
      |            ^~~~~~~~~~~~~~~~
a.cc:12:48: error: expected ';' before 's'
   12 |     }while(next_permutation(s.begin(),s.end()))
      |                                                ^
      |                                                ;
   13 |     s+='A';
      |     ~
Language: C++

#include<iostream>
#include<vector>
using namespace std;
int main(){
  string s;
  cin>>s;
  for(int i=0;i<4;i++){
    do{
      if(s=="AKIHABRA"){
        cout<<"Yes"<<endl;
      }
    }while(s.begin(),s.end())
    s+='A';
  }
  cout<<"No"<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:19: warning: ignoring return value of 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::iterator std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::begin() [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; iterator = std::__cxx11::basic_string<char>::iterator]', declared with attribute 'nodiscard' [-Wunused-result]
   12 |     }while(s.begin(),s.end())
      |            ~~~~~~~^~
In file included from /usr/include/c++/14/string:54,
                 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/basic_string.h:960:7: note: declared here
  960 |       begin() _GLIBCXX_NOEXCEPT
      |       ^~~~~
a.cc:12:21: error: could not convert '(((void)s.std::__cxx11::basic_string<char>::begin()), s.std::__cxx11::basic_string<char>::end())' from 'std::__cxx11::basic_string<char>::iterator' to 'bool'
   12 |     }while(s.begin(),s.end())
      |            ~~~~~~~~~^~~~~~~~
      |                     |
      |                     std::__cxx11::basic_string<char>::iterator
a.cc:12:30: error: expected ';' before 's'
   12 |     }while(s.begin(),s.end())
      |                              ^
      |                              ;
   13 |     s+='A';
      |     ~
Language: C++

//iphone cording
#include<iostream>
#include<string>
using namespace std;
int main(){
string s;cin>>s;
cout<<”NO”<<endl;
}

Compiler output:
a.cc:7:7: error: extended character ” is not valid in an identifier
    7 | cout<<”NO”<<endl;
      |       ^
a.cc:7:7: error: extended character ” is not valid in an identifier
a.cc: In function 'int main()':
a.cc:7:7: error: '\U0000201dNO\U0000201d' was not declared in this scope
    7 | cout<<”NO”<<endl;
      |       ^~~~
Language: C++

//iphone cording
#include<iostream>
#include<string>
using namespace std;
int main(){
string s;cin>>s;
cout<<“NO“<<endl;
}

Compiler output:
a.cc:7:7: error: extended character “ is not valid in an identifier
    7 | cout<<“NO“<<endl;
      |       ^
a.cc:7:7: error: extended character “ is not valid in an identifier
a.cc: In function 'int main()':
a.cc:7:7: error: '\U0000201cNO\U0000201c' was not declared in this scope
    7 | cout<<“NO“<<endl;
      |       ^~~~
Language: C++

//iphone cording
#include<iostream>
#include<string>
using namespace std;
int main(){
string s;cin>>s;
cout<<てんNO<<endl;
}
″

Compiler output:
a.cc:9:1: error: extended character ″ is not valid in an identifier
    9 | ″
      | ^
a.cc: In function 'int main()':
a.cc:7:7: error: '\U00003066\U00003093NO' was not declared in this scope
    7 | cout<<てんNO<<endl;
      |       ^~~~~~
a.cc: At global scope:
a.cc:9:1: error: '\U00002033' does not name a type
    9 | ″
      | ^
Language: C++

//iphone cording
#include<iostream>
#include<string>
using namespace std;
int main(){
string s;cin>>s;
cout<<NO<<endl;
}


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

//iphone cording
#include<iostream>
#include<string>
using namespace std;
int main(){
string s;cin>>s;
coutNOendl;
}


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

//iphone cording
#include<iostream>
#include<string>
using namespace std;
int main(){
string s;cin>>s;
cout<<“NO”;}


Compiler output:
a.cc:7:7: error: extended character “ is not valid in an identifier
    7 | cout<<“NO”;}
      |       ^
a.cc:7:7: error: extended character ” is not valid in an identifier
a.cc: In function 'int main()':
a.cc:7:7: error: '\U0000201cNO\U0000201d' was not declared in this scope
    7 | cout<<“NO”;}
      |       ^~~~
Language: C++

//iphone cording
#include<iostream>
#include<string>
using namespace std;
int main(){
string s;cin>>s;
cout<<“NO”<<endl;
}

Compiler output:
a.cc:7:7: error: extended character “ is not valid in an identifier
    7 | cout<<“NO”<<endl;
      |       ^
a.cc:7:7: error: extended character ” is not valid in an identifier
a.cc: In function 'int main()':
a.cc:7:7: error: '\U0000201cNO\U0000201d' was not declared in this scope
    7 | cout<<“NO”<<endl;
      |       ^~~~
Language: Java

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

public class Akiba {
	public static void main(String[] args) throws IOException{
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));
		
		
		String str = in.readLine();
		int length = str.length();
		
		String s = "KIHBR";
		
		StringBuilder noA = new StringBuilder();
		for(int i = 0; i < length; i++){
			if(str.charAt(i) != 'A'){
				noA.append(str.charAt(i));
			}
		}
		
		boolean failed = false;
		
		//System.err.println(noA.toString());
		if(s.equals(noA.toString())){
			//GOOD
			//have to check #of As
			int i = 0;
			char c = str.charAt(i);
			int count  = 0;
			while(str.charAt(i) != 'K'){
				count++;
				i++;
			}
			if(count > 1){
				//System.err.println("Failed at K");
				//out.write("NO" + "\n");
				failed =true;
			}
			count = 0;
			i++;
			if(str.charAt(i) != 'I'){
				//System.err.println("Failed at I");
				//out.write("NO" + "\n");
				failed =true;
			}
			i++;
			if(str.charAt(i) != 'H'){
				//System.err.println("Failed at H");
				//out.write("NO" + "\n");
				failed =true;
			}
			i++;
			while(str.charAt(i) != 'B'){
				count++;
				i++;
			}
			if(count > 1){
				//System.err.println("Failed at B");
				//out.write("NO" + "\n");
				failed =true;
			}
			count = 0;
			i++;
			while(str.charAt(i) != 'R'){
				count++;
				i++;
			}
			if(count > 1){
				//System.err.println("Failed at R");
				//out.write("NO" + "\n");
				failed =true;
			}
			count = 0;
			i++;
			while(i < str.length()){
				count++;
				i++;
			}
			if(count > 1){
				//System.err.println("Failed at LAST As");
				//out.write("NO" + "\n");
				failed =true;
			}
			if(!failed){
				out.write("YES" + "\n");
			}
			else{
				out.write("NO" + "\n");
			}
			
		}
		else{
			//System.err.println("Failed at BASE");
			out.write("NO" + "\n");
		}
		
		
		out.close();
		in.close();
	}
}


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

package contest;

import io.InputReader;
import java.io.PrintWriter;
import java.util.Arrays;

public class TaskD {
    public void solve(int testNumber, InputReader in, PrintWriter out) {
        int n = in.nextInt();
        Person[] persons = new Person[n];
        for (int i = 0; i < n; i++) {
            persons[i] = new Person(in.nextInt(), in.nextInt());
        }
        Arrays.sort(persons);
        int[][] dp = new int[n + 1][n + 1];
        for (int i = 0; i <= n; i++) {
            Arrays.fill(dp[i], Integer.MAX_VALUE);
        }

        dp[0][0] = 0;
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= i; j++) {
                if (persons[i - 1].h >= dp[i - 1][j - 1]) {
                    dp[i][j] = Math.min(dp[i - 1][j], dp[i - 1][j - 1] + persons[i - 1].p);
                } else {
                    dp[i][j] = dp[i - 1][j];
                }
            }
        }

        int ans = Integer.MAX_VALUE;
        for (int i = 1; i <= n; i++) {
            if (dp[n][i] < Integer.MAX_VALUE) {
                ans = i;
            }
        }

        out.println(ans);
    }

    class Person implements Comparable<Person>{
        int h;
        int p;

        public Person(int h, int p) {
            this.h = h;
            this.p = p;
        }

        @Override
        public int compareTo(Person o) {
            return Integer.compare(h + p, o.h + o.p);
        }
    }
}



Compiler output:
Main.java:7: error: class TaskD is public, should be declared in a file named TaskD.java
public class TaskD {
       ^
Main.java:3: error: package io does not exist
import io.InputReader;
         ^
Main.java:8: error: cannot find symbol
    public void solve(int testNumber, InputReader in, PrintWriter out) {
                                      ^
  symbol:   class InputReader
  location: class TaskD
3 errors
Language: Java

import java.util.*;

public class Akiba {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String rexp = "^A?KIHA?BA?RA?$";
    if (s.matches(rexp)) {
      System.out.println("YES");
    } else {
      System.out.println("NO");
    }
  }
}


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

import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		
		
		if(s.indexOf("AA") != -1 || s.indexOf("KIH") == -1){//連続するAが存在するなら作れない
			System.out.println("NO");
		}
		
		s = s.replace('A', '');//Aはあとから好きなだけ追加できるので除去
	
		
		if(s.equals("KIHBR")){//残るのがこれだけならば作れる
			System.out.println("YES");
		}else{
			System.out.println("NO");
		}
		
		sc.close();
	}
	
}


Compiler output:
Main.java:14: error: empty character literal
		s = s.replace('A', '');//A???????????????????
		                   ^
1 error
Language: C++

#include<stdio.h>
#include<string.h>
int main()
{
char a[100];
char b[100]="AKIHABARA";
scanf("%s",a);
int h1,h2;
int number1=0,number2=0;
h1=strlen(a);
h2=strlen(b);
int q;
for(q=0;q<h1;q++)
if(a[q]!='A')
number1++;
for(q=0;q<h2;q++)
if(b[q]!='A')
number2++;
if(number1!=number2)
{printf("NO\n");
return 0;
}
int q=0;
int u;
for( u=0;u<h2;u++)
if(a[q]==b[u])
q++;
if(q==h1)
printf("YES\n");
else
printf("NO\n");
return 0;
 } 

Compiler output:
a.cc: In function 'int main()':
a.cc:23:5: error: redeclaration of 'int q'
   23 | int q=0;
      |     ^
a.cc:12:5: note: 'int q' previously declared here
   12 | int q;
      |     ^
Language: C++

#include<stdio.h>
#include<string.h>
int main()
{char a[100];
 char b[100]="AKIHABARA";
gets(a);
int h1,h2;
h1=strlen(a);
h2=strlen(b);
int q=0;
for(int u=0;u<h2;u++)
if(a[q]==b[u])
q++;
if(q==h1)
printf("YES\n");
else
printf("NO\n");
return 0;
 } 

Compiler output:
a.cc: In function 'int main()':
a.cc:6:1: error: 'gets' was not declared in this scope; did you mean 'getw'?
    6 | gets(a);
      | ^~~~
      | getw
Language: C

#include <stdio.h>
#include <string.h>
#define Max 50+5
int main(int argc, char *argv[])
{
	char S[50+5];
	while(scanf("%s",S)!=EOF)
	{
		int len=strlen(S);
		if(len>9)
		{
			printf("NO\n");
			continue;
		}
		int flag=1;
		int temp=0;
		for(int i=0;i<len;i++)
		{
			if(temp==0&&S[i]=='K')
			{
				temp=1;
			}
			else if(temp==1&&S[i]=='I')
			{
				temp=2;
			}
			else if(temp==2&&S[i]=='H')
			{
				temp=3;
			}
			else if(temp==3&&S[i]=='B')
			{
				temp=4;
			}
			else if(temp==4&&S[i]=='R')
			{
				temp=5;
			}
		}
		if(temp!=5)
		{
			printf("NO\n");
			continue;
		}
		for(int i=0;i<len;i++)
		{
			if(S[i]=='K'&&i>1)
			{
				flag=0;
				break;
			}
			if(S[i]=='K'&&S[i+1]!='I')
			{
				flag=0;
				break;
			}
			else if(S[i]=='I'&&S[i+1]!='H')
			{
				flag=0;
				break;
			}
			else if(S[i]=='H'&&((S[i+1]!='B'&&S[i+2]!='B')||(S[i+2]=='B'&&s[i+1]!='A')))
			{
				flag=0;
				break;
			}
			else if(S[i]=='B'&&((S[i+1]!='R'&&S[i+2]!='R')||(S[i+2]=='R'&&s[i+1]!='A')))
			{
				flag=0;
				break;
			}
			else if(S[i]=='R'&&i<len-2)
			{
				flag=0;
				break;
			}
		}
		if(flag==0)
			printf("NO\n");
		else
			printf("YES\n");		
	}
	return 0;
}


Compiler output:
main.c: In function 'main':
main.c:62:87: error: 's' undeclared (first use in this function)
   62 |                         else if(S[i]=='H'&&((S[i+1]!='B'&&S[i+2]!='B')||(S[i+2]=='B'&&s[i+1]!='A')))
      |                                                                                       ^
main.c:62:87: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

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

int main()
{
	char in[1000];
	while (cin >> in)
	{
		if (strlen(in) == 0)
			break;
		int m ,len = strlen(in), flag = 0;
		for (int i = 0; i < len; i++)
		{
			if (in[i] == 'A'&&in[i + 1] == 'A')
				flag = 1;
			if (in[i] == 'A')
			{
				for (int j = i; j < len - 1; j++)
					in[i] = in[i + 1];
				len--;
			}
		}	
		if (strcmp(in , "KIHBR")==0)
			printf("YES\n");
		else
			printf("NO\n");
		
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:21: error: 'strlen' was not declared in this scope
   11 |                 if (strlen(in) == 0)
      |                     ^~~~~~
a.cc:4:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <algorithm>
  +++ |+#include <cstring>
    4 | using namespace std;
a.cc:13:30: error: 'strlen' was not declared in this scope
   13 |                 int m ,len = strlen(in), flag = 0;
      |                              ^~~~~~
a.cc:13:30: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
a.cc:17:33: error: 'flag' was not declared in this scope
   17 |                                 flag = 1;
      |                                 ^~~~
a.cc:25:21: error: 'strcmp' was not declared in this scope
   25 |                 if (strcmp(in , "KIHBR")==0)
      |                     ^~~~~~
a.cc:25:21: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
Language: C++

int main() {
	string s, t = "AKIHABARA";
	cin >> s;
	if (s.size() > t.size()) {
		cout << "NO" << endl;
		return 0;
	}
	int i = 0, j = 0;
	for (; i < s.size() && j < t.size(); ) {
		if (s[i] == t[j]) {
			i++;
			j++;
		} else if (t[j] == 'A') {
			j++;
		} else {
			cout << "NO" << endl;
			return 0;
		}
		cerr << i << ' ' << j << endl;
	}
	cout << (j + 1 == t.size() ? "YES" : "NO") << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:2:9: error: 'string' was not declared in this scope
    2 |         string s, t = "AKIHABARA";
      |         ^~~~~~
a.cc:3:9: error: 'cin' was not declared in this scope
    3 |         cin >> s;
      |         ^~~
a.cc:3:16: error: 's' was not declared in this scope
    3 |         cin >> s;
      |                ^
a.cc:4:24: error: 't' was not declared in this scope
    4 |         if (s.size() > t.size()) {
      |                        ^
a.cc:5:17: error: 'cout' was not declared in this scope
    5 |                 cout << "NO" << endl;
      |                 ^~~~
a.cc:5:33: error: 'endl' was not declared in this scope
    5 |                 cout << "NO" << endl;
      |                                 ^~~~
a.cc:9:36: error: 't' was not declared in this scope
    9 |         for (; i < s.size() && j < t.size(); ) {
      |                                    ^
a.cc:16:25: error: 'cout' was not declared in this scope
   16 |                         cout << "NO" << endl;
      |                         ^~~~
a.cc:16:41: error: 'endl' was not declared in this scope
   16 |                         cout << "NO" << endl;
      |                                         ^~~~
a.cc:19:17: error: 'cerr' was not declared in this scope
   19 |                 cerr << i << ' ' << j << endl;
      |                 ^~~~
a.cc:19:42: error: 'endl' was not declared in this scope
   19 |                 cerr << i << ' ' << j << endl;
      |                                          ^~~~
a.cc:21:9: error: 'cout' was not declared in this scope
   21 |         cout << (j + 1 == t.size() ? "YES" : "NO") << endl;
      |         ^~~~
a.cc:21:27: error: 't' was not declared in this scope
   21 |         cout << (j + 1 == t.size() ? "YES" : "NO") << endl;
      |                           ^
a.cc:21:55: error: 'endl' was not declared in this scope
   21 |         cout << (j + 1 == t.size() ? "YES" : "NO") << endl;
      |                                                       ^~~~
Language: C++

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

int main()
{
string s;
cin>>s;
bool flag=0;
if(s.length()>9)
{
flag=1;
}
else
{
for(int i=0;i<s.length();i++)
{
if((i<s.length())&&((s[i]+s[i+1]=="KA")||(s[i]+s[i+1]=="AI")||(s[i]+s[i+1]=="IA")||(s[i]+s[i+1]=="AH")))
{
flag=1;
break;
}
else if(s[i]=='A') s.erase(s.begin()+i);
}
}
if(flag) cout<<"NO"<<endl;
else if(s=="KIHBR") cout<<"YES"<<endl;
else cout<<"NO"<<endl;

return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:33: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   20 | if((i<s.length())&&((s[i]+s[i+1]=="KA")||(s[i]+s[i+1]=="AI")||(s[i]+s[i+1]=="IA")||(s[i]+s[i+1]=="AH")))
a.cc:20:54: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   20 | if((i<s.length())&&((s[i]+s[i+1]=="KA")||(s[i]+s[i+1]=="AI")||(s[i]+s[i+1]=="IA")||(s[i]+s[i+1]=="AH")))
a.cc:20:75: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   20 | if((i<s.length())&&((s[i]+s[i+1]=="KA")||(s[i]+s[i+1]=="AI")||(s[i]+s[i+1]=="IA")||(s[i]+s[i+1]=="AH")))
a.cc:20:96: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   20 | if((i<s.length())&&((s[i]+s[i+1]=="KA")||(s[i]+s[i+1]=="AI")||(s[i]+s[i+1]=="IA")||(s[i]+s[i+1]=="AH")))
Language: C++

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

int main()
{
string s;
cin>>s;
bool flag=0;
if(s.length()>9)
{
flag=1;
}
else
{
for(int i=0;i<s.length();i++)
{
if(i<s.length()&&((s[i]+s[i+1]=="KA")||(s[i]+s[i+1]=="AI")||(s[i]+s[i+1]=="IA")||(s[i]+s[i+1]=="AH")))
{
flag=1;
break;
}
else if(s[i]=='A') s.erase(s.begin()+i);
}
}
if(flag) cout<<"NO"<<endl;
else if(s=="KIHBR") cout<<"YES"<<endl;
else cout<<"NO"<<endl;

return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:31: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   20 | if(i<s.length()&&((s[i]+s[i+1]=="KA")||(s[i]+s[i+1]=="AI")||(s[i]+s[i+1]=="IA")||(s[i]+s[i+1]=="AH")))
a.cc:20:52: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   20 | if(i<s.length()&&((s[i]+s[i+1]=="KA")||(s[i]+s[i+1]=="AI")||(s[i]+s[i+1]=="IA")||(s[i]+s[i+1]=="AH")))
a.cc:20:73: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   20 | if(i<s.length()&&((s[i]+s[i+1]=="KA")||(s[i]+s[i+1]=="AI")||(s[i]+s[i+1]=="IA")||(s[i]+s[i+1]=="AH")))
a.cc:20:94: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   20 | if(i<s.length()&&((s[i]+s[i+1]=="KA")||(s[i]+s[i+1]=="AI")||(s[i]+s[i+1]=="IA")||(s[i]+s[i+1]=="AH")))
Language: C

char str[] = "KIHBR";

if(strcmp(str, S) == 0){
	return "YES"
}else
	return "NO"
}

Compiler output:
main.c:3:1: error: expected identifier or '(' before 'if'
    3 | if(strcmp(str, S) == 0){
      | ^~
main.c:5:2: error: expected identifier or '(' before 'else'
    5 | }else
      |  ^~~~
Language: C++

#include<bits/stdc++.h>

using namespace std;

int main(){
    string s;
    cin >> s;
    int idx[5] = {-1,-1,-1,-1,-1};
    int count=0;
    for(int i=0;i<s.length();i++){
        if(s[i]=='K'){
            idx[0] = i;
        }else if(s[i]=='I'){
            idx[1] = i;
        }else if(s[i]=='H'){
            idx[2] = i;
        }else if(s[i]=='B'){
            idx[3] = i;
        }else if(s[i]=='R'){
            idx[4] = i;
        }
        if(s[i]=="A"||s[i]=="K"||s[i]=="I"||s[i]=="H"||s[i]=="B"||s[i]=="R"){
            
        }else{
            cout << "NO" << endl;
            return 0;
        }
    }
    
    
    
    if(idx[0]<idx[1]&&idx[1]<idx[2]&&idx[2]<idx[3]&&idx[3]<idx[4]&&s.length()<10){
        if(idx[0]<=1&&idx[1]==idx[0]+1&&idx[2]==idx[1]+1&&idx[3]-idx[2]>=1&&idx[4]-idx[3]>=1&&s.length()-idx[4]>=1){
            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;    
        }
        
    }else{
        cout << "NO" << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:16: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   22 |         if(s[i]=="A"||s[i]=="K"||s[i]=="I"||s[i]=="H"||s[i]=="B"||s[i]=="R"){
a.cc:22:27: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   22 |         if(s[i]=="A"||s[i]=="K"||s[i]=="I"||s[i]=="H"||s[i]=="B"||s[i]=="R"){
a.cc:22:38: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   22 |         if(s[i]=="A"||s[i]=="K"||s[i]=="I"||s[i]=="H"||s[i]=="B"||s[i]=="R"){
a.cc:22:49: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   22 |         if(s[i]=="A"||s[i]=="K"||s[i]=="I"||s[i]=="H"||s[i]=="B"||s[i]=="R"){
a.cc:22:60: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   22 |         if(s[i]=="A"||s[i]=="K"||s[i]=="I"||s[i]=="H"||s[i]=="B"||s[i]=="R"){
a.cc:22:71: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   22 |         if(s[i]=="A"||s[i]=="K"||s[i]=="I"||s[i]=="H"||s[i]=="B"||s[i]=="R"){
Language: Java

import java.util.Scanner;

public class ReviewNote{
	public static void main(String[] args){
		
		char[] son = {'K' , 'I' , 'H' , 'B' , 'R'};
		int cnt = 0;
		boolean a = false;
		
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		
		
		for( char c : s.toCharArray()){
			if(a){
				if( c == 'A'){
					System.out.println("NO");
					return;
				}
				
			}else{
				if(c == son[cnt]){
					++cnt;
				}else{
					System.out.println("NO");
					return;
				}
			}
		}
		
		System.out.println("YES");
	}
}

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

#include<bits/stdc++.h>

using namespace std;

int main(){
    string s;
    cin >> s;
    int idx[5] = {-1,-1,-1,-1,-1};
    int count=0;
    for(int i=0;i<s.length();i++){
        if(s[i]=='K'){
            idx[0] = i;
        }else if(s[i]=='I'){
            idx[1] = i;
        }else if(s[i]=='H'){
            idx[2] = i;
        }else if(s[i]=='B'){
            idx[3] = i;
        }else if(s[i]=='R'){
            idx[4] = i;
        }
    }
    
    if(idx[0]<idx[1]&&idx[1]<idx[2]&&idx[2]<idx[3]&&idx[3]<idx[4]&&s.length()<10){
        if(idx[0]<=1&&idx[1]==idx[0]+1&&idx[2]==idx[1]+1&&idx[3]-idx[2]>=1&&idx[4]-idx[3]>=1&&s.length-idx[4]>=1){
            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;    
        }
        
    }else{
        cout << "NO" << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:97: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
   25 |         if(idx[0]<=1&&idx[1]==idx[0]+1&&idx[2]==idx[1]+1&&idx[3]-idx[2]>=1&&idx[4]-idx[3]>=1&&s.length-idx[4]>=1){
      |                                                                                               ~~^~~~~~
      |                                                                                                       ()
Language: C++

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

int main()
{
string s;
cin>>s;
if(s.length()>9)
{
 cout<<"NO"<<endl
}
else
{
for(int i=0;i<s.length();i++)
{
if(s[i]=='A') s.erase(s.begin()+i);
}
if(s=="KIHBR") cout<<"YES"<<endl;
else cout<<"NO"<<endl;
}
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:18: error: expected ';' before '}' token
   13 |  cout<<"NO"<<endl
      |                  ^
      |                  ;
   14 | }
      | ~
Language: C++

#include<bits/stdc++.h>
using namespace std;
string  s;
int n[300];
int p[55];
int main(){
    while(cin>>s){
        memset(n,0,sizeof(n));
        memset(p,-1,sizeof(p));
        for(int i=0;s[i];++i)
            ++n[s[i]],p[s[i]]=i;
        if(n['A']<4 && n['K']==1 && n['I']==1 &&n['H']==1&&n['B']==1 && n['R']==1
           p['K']<n['I'] && n['I']<n['H'] && n['H']<n['B'] &&n['B']<n['R'])
            cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:82: error: expected ')' before 'p'
   12 |         if(n['A']<4 && n['K']==1 && n['I']==1 &&n['H']==1&&n['B']==1 && n['R']==1
      |           ~                                                                      ^
      |                                                                                  )
   13 |            p['K']<n['I'] && n['I']<n['H'] && n['H']<n['B'] &&n['B']<n['R'])
      |            ~
Language: C++

#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sys/time.h>
#include <cmath>
#include <tuple>
#include <queue>

using namespace std;

void solve(strning s) {
    string aki = "AKIHABARA";
    bool flag = true;
    while (!aki.empty()) {
        if (aki.back() == s.back()) {
            aki.pop_back();
            s.pop_back();
        } else if (aki.back() == 'A'){
            aki.pop_back();
        } else {
            flag = false;
            break;
        }
    }
    if (flag) {
        std::cout << "YES" << std::endl;
    } else {
        std::cout << "NO" << std::endl;
    }
}

int main() {
    struct timeval start,end;
    long long span;
    string s;

    gettimeofday(&start,NULL);

    std::cin >> s;
    solve(s);

    gettimeofday(&end,NULL);
    span = (end.tv_sec -start.tv_sec)*1000000LL + (end.tv_usec - start.tv_usec);
    std::cerr << "--Total Time: " << span/1000 << "ms" << endl;
    return 0;
}


Compiler output:
a.cc:15:6: error: variable or field 'solve' declared void
   15 | void solve(strning s) {
      |      ^~~~~
a.cc:15:12: error: 'strning' was not declared in this scope; did you mean 'stdin'?
   15 | void solve(strning s) {
      |            ^~~~~~~
      |            stdin
a.cc: In function 'int main()':
a.cc:44:5: error: 'solve' was not declared in this scope
   44 |     solve(s);
      |     ^~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll = int64_t;
int main(){
	string s; cin >> s;
	strint po;
	for(int i = 0; i < s.size(); ++i){
		if(s[i] != 'A') po += s[i];
	}
	if(po == "KIHBR")cout << "YES\n";
	else cout << "NO\n";
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:9: error: 'strint' was not declared in this scope; did you mean 'strcat'?
    6 |         strint po;
      |         ^~~~~~
      |         strcat
a.cc:8:33: error: 'po' was not declared in this scope; did you mean 'pow'?
    8 |                 if(s[i] != 'A') po += s[i];
      |                                 ^~
      |                                 pow
a.cc:10:12: error: 'po' was not declared in this scope; did you mean 'pow'?
   10 |         if(po == "KIHBR")cout << "YES\n";
      |            ^~
      |            pow
Language: C++

#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cwchar>
#include <cwctype>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <codecvt>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, n) for(int i = 1; i <= (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize("Ofast")
using namespace std;
typedef int64_t ll;
typedef long double ld;
const ll INF=pow(10,18);
const double inf=pow(10,10);
const ld pi=acosl(1);
const ll mod = 1000000007;
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};

map< int64_t, int > prime_factor(int64_t n) {
  map< int64_t, int > ret;
  for(int64_t i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}

bool solve(){
  string s;cin>>s;
  vector<ll>count(26,0);
  rep(i,s.size()){
    count[s[i]-'a']++;
  }
  rep(i,26){
    if(count[i]>s.size()/2){
      cout<<"NO"<<endl;
      return false;
    }
  }
  cout<<"YES"<<endl;
  
  return false;
}

signed main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout<<fixed;
  cout<<seaprecision(30);
  return solve();
}

Compiler output:
a.cc: In function 'int main()':
a.cc:126:9: error: 'seaprecision' was not declared in this scope
  126 |   cout<<seaprecision(30);
      |         ^~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define LINF 1e18
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};

const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const double PI = acos(-1.0);
const double EPS = 1e-10;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    string S;
    cin>>S;
    N = S.size();

    map<char,int> mp;
    REP(i,N) mp[S[i]]++;
    if(N==1){
        cout<<"NO"<<endl;
    }
    else if(N==2){
        if(S[0]==S[1]) cout<<"NO"<<endl;
        else cout<<"YES"<<endl;
    }
    else{
        int ma,mi;
        int a,b,c;
        for(auto x:mp){
            if(x.first=='a') a=x.second;
            else if(x.first=='b') b=x.second;
            else c=x.second;
        }
        ma = max({a,b,c});
        mi = min({a,b,c});

        if(ma>=N-1){
            cout<<"NO"<<endl;
            return 0;
        }
        int flg = (a>=N-2) + (b>=N-2) + (c>=N-2);
        if(flg >= 2){
            cout<<"NO"<<endl;
        }
        else{
            if(N%2==1){
                if(mi==1 && ma==((N-1)/2)) cout<<"NO"<<endl;
                else cout<<"YES"<<endl;
            }
            else cout<<"YES"<<endl;
    }
}


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

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

int main() {
  string S;
  cin >> S;
  int a=0,b=0,c=0;
  for(int i=0;i<S.length;i++){
    if(S[i]=='a')a+=1;
    else if(S[i]=='b')b+=1;
    else if(S[i]=='c')c+=1;
  }
  if((a-b)*(a-c)==0 || (a-b)*(a-c)==1)cout <<"YES";
  else cout <<"NO";
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:19: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
    8 |   for(int i=0;i<S.length;i++){
      |                 ~~^~~~~~
      |                         ()
Language: C++

#pragma once
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const ll INF = 1000000007;
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
int pr[100010];
void uini(int n) {
	for (size_t i = 0; i <= n; i++)
	{
		pr[i] = i;
	}
}

int parent(int x) {
	if (x == pr[x]) return x;
	return pr[x] = parent(pr[x]);
}

bool unit(int x, int y) {
	int px = parent(x);
	int py = parent(y);

	if (px == py) return false;
	if (px < py) {
		pr[py] = px;
	}
	else {
		pr[px] = py;
	}
	return true;
}

void solv() {

	string s;
	cin >> s;
	int c[3];
	fill(c, c + 3, 0);
	for (size_t i = 0; i < s.size(); i++)
	{
		c[s[i] - 'a']++;
	}
	if (abs(a[0] - a[1]) > 1 || abs(a[0] - a[2]) > 1 || abs(a[2] - a[1]) > 1) {
		cout << "NO" << endl;
	}
	else cout << "YES" << endl;
}


int main() {
	solv();

	return 0;
}


Compiler output:
a.cc:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
a.cc: In function 'void solv()':
a.cc:62:17: error: 'a' was not declared in this scope
   62 |         if (abs(a[0] - a[1]) > 1 || abs(a[0] - a[2]) > 1 || abs(a[2] - a[1]) > 1) {
      |                 ^