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

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

int main(){
    cin.tie(0);
   	ios::sync_with_stdio(false);
    string s,ans="NO";
    cin>>s;
    char sp[s.size()];
    for (int i = 0; i < s.size(); i++)sp[i]=s[i];
    if(s.size()>9)ans="NO";
    else if(strstr(sp,"KIHABAR")!=NULL||(strstr(sp,"KIHBAR")!=NULL&&s.size()<=8)||(strstr(sp,"KIHABR")!=NULL&&s.size()<=8)||(strstr(sp,"KIHBR")!=NULL&&s.size()<=7)){
        if(((sp[0]=='A'&&sp[1]=='K')||(sp[0]=='K'&&sp[1]=='I'))&&((sp[s.size()-1]=='R'&&(sp[s.size()-2]=='A'||sp[size()-2]=='B'))||(sp[s.size()-1]=='A'&&sp[s.size()-2]=='R')))ans="YES";
    }
    cout<<ans<<'\n';
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:118: error: no matching function for call to 'size()'
   13 |         if(((sp[0]=='A'&&sp[1]=='K')||(sp[0]=='K'&&sp[1]=='I'))&&((sp[s.size()-1]=='R'&&(sp[s.size()-2]=='A'||sp[size()-2]=='B'))||(sp[s.size()-1]=='A'&&sp[s.size()-2]=='R')))ans="YES";
      |                                                                                                                  ~~~~^~
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/range_access.h:262:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/range_access.h:272:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note:   candidate expects 1 argument, 0 provided
Language: C++

#include <iostream>
#include <string>
#include <vector>

using namespace std;

string S_input;
string S = "AKIHABARA";
int size_S = S.size();
vector<string> v;

int create(string s_ch, int i);

int main() {


    cin >> S_input;
    
    create("", 0);

    auto result = find(v.begin(), v.end(), S_input);
    if (result == v.end()) {
        cout << "NO" << endl;
    } 
    else {
        cout << "YES" << *result << endl;
    }

}


int create(string s_ch, int i) {
    
    if (i == size_S) {
        v.push_back(s_ch);
        return 0;
    }
    
    if (S[i] == 'A') {
        create(s_ch, i+1);
        s_ch += S[i];
        create(s_ch, i+1);
    }
    else {
        s_ch += S[i];
        create(s_ch, i+1);
    }

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:23: error: no matching function for call to 'find(std::vector<std::__cxx11::basic_string<char> >::iterator, std::vector<std::__cxx11::basic_string<char> >::iterator, std::string&)'
   21 |     auto result = find(v.begin(), v.end(), S_input);
      |                   ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
                 from /usr/include/c++/14/bits/basic_ios.h:37,
                 from /usr/include/c++/14/ios:46,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
a.cc:21:23: note:   '__gnu_cxx::__normal_iterator<std::__cxx11::basic_string<char>*, std::vector<std::__cxx11::basic_string<char> > >' is not derived from 'std::istreambuf_iterator<_CharT>'
   21 |     auto result = find(v.begin(), v.end(), S_input);
      |                   ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define MD 1000000007
typedef long long int ll;
typedef pair<ll, ll> P;
template <typename T>
std::string tostr(const T &t){std::ostringstream os;os << t;return os.str();}
int dx[4]={1, 0, -1, 0}, dy[4]={0, 1, 0, -1};

int main()
{
    string s;
    cin>>s;
    vector<string> v{"AKIHABARA","AKIHABAR","AKIHABRA","AKIHABR",
    "AKIHBARA","AKIHBAR","AKIHBRA","AKIHBR",
    "KIHABARA","KIHABAR","KIHABRA","KIHABR",
    "KIHBARA","KIHBAR","KIHBRA","KIHBR"}
    for(int i=0;i<16;i++){
        if(s==v[i]){
            cout<<"YES"<<endl;
            return 0;
        }
    }
    cout<<"NO"<<endl;
    return 0;
}

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

#include <cstdio>
#include <cstring>
#define N 55
int main(void)
{
	char s[N];
	scanf("%s", s);
	int i, cnt = 0;
	for (i = 0; s[i]; ++i) if (s[i] == 'A') ++cnt;
	if (cnt > 4) return !printf("NO");
	char *i, *j, *k;
	i = strstr(s, "KIH");
	j = strstr(s, "B");
	k = strstr(s, "R");
	printf("%s", i == NULL || j == NULL || k == NULL ? "NO" : "YES");
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:15: error: conflicting declaration 'char* i'
   11 |         char *i, *j, *k;
      |               ^
a.cc:8:13: note: previous declaration as 'int i'
    8 |         int i, cnt = 0;
      |             ^
a.cc:12:19: error: invalid conversion from 'char*' to 'int' [-fpermissive]
   12 |         i = strstr(s, "KIH");
      |             ~~~~~~^~~~~~~~~~
      |                   |
      |                   char*
a.cc:15:27: warning: NULL used in arithmetic [-Wpointer-arith]
   15 |         printf("%s", i == NULL || j == NULL || k == NULL ? "NO" : "YES");
      |                           ^~~~
Language: Java

import java.io.*;
import java.util.regex.*;
public class Main
{
	public static void main(String args[])
	{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String str=br.readLine();
		String pattern="A?KIHA?BA?RA?$";
		boolean isMatch=Pattern.matches(str,pattern);
		if(isMatch) System.out.println("YES");
		else System.out.println("NO");
   }
}

Compiler output:
Main.java:8: error: unreported exception IOException; must be caught or declared to be thrown
		String str=br.readLine();
		                      ^
1 error
Language: Java

import java.util.regex.*;
import java.io.*
public class Main
{
	public static void main(String args[])
	{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String str=br.readLine();
		String pattern="A?KIHA?BA?RA?$";
		boolean isMatch=Pattern.matches(str,pattern);
		if(isMatch) System.out.println("YES");
		else System.out.println("NO");
   }
}

Compiler output:
Main.java:2: error: ';' expected
import java.io.*
                ^
1 error
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
    char s[100000];
    int i=0;
    while (cin>>s[i]) i++;
    if (s="AKIHBR") cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:10: error: incompatible types in assignment of 'const char [7]' to 'char [100000]'
    7 |     if (s="AKIHBR") cout<<"YES"<<endl;
      |         ~^~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
    char s[100000];
    while (cin>>s);
    if (s="AKIHBR") cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:10: error: incompatible types in assignment of 'const char [7]' to 'char [100000]'
    6 |     if (s="AKIHBR") cout<<"YES"<<endl;
      |         ~^~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin>>s;
    if (s="AKIHBR") cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:10: error: could not convert 's.std::__cxx11::basic_string<char>::operator=(((const char*)"AKIHBR"))' from 'std::__cxx11::basic_string<char>' to 'bool'
    6 |     if (s="AKIHBR") cout<<"YES"<<endl;
      |         ~^~~~~~~~~
      |          |
      |          std::__cxx11::basic_string<char>
Language: C++

#include <cstring>
#include <cstdio>

char a[60], s[16][10] = {"KIHBR", "AKIHBR", "KIHABR",
"KIHBAR", "KIHBRA", "AKIHABAR", "AKIHBAR","AKIHBRA",
"KIHABAR", "KIHABRA", "KIHBARA","AKIHABAR",
"AKIHABRA", "AKIHBARA","KIHABARA", "AKIHABARA"};

inline bool check(char *a, char *s) {
	if (strlen(a) != strlen(s)) return 0;
	for (int i = 0; i < strlen(a); i++) {
		if (a[i] != s[i]) return 0;
	}
	return 1;
}

int main() {
	gets(a);
	for (int i = 0; i < 16; i++) {
		if (check(a, s[i])) {
			return puts("Yes"), 0;
		}
	}
	puts("No");
	return 0;
}

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

#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
char st[55],st1[55];
int num,len;
int main()
{
	scanf("%s",st);
	st1[0]='A';st1[1]='K';st1[2]='I';
	st1[3]='H';st1[4]='A';st1[5]='B';
	st1[6]='A';st1[7]='R';st1[8]='A';
	num=0;
	bool flag=1;
	len=strlen(st)-1;
	for (int i=0;i<9;i++)
	{
		if (st1[i]==st[num]) 
		{
			num++;
			if (num>len) 
		    {
		    	for (int j=i+1;j<9;j++)
		    	if (st1[jAKIH]!='A') flag=0;
		    	break;
			}
		}
		else if (st1[i]!='A') flag=0; 
	}
	if (num<=len) flag=0;
	if (flag==1) printf("YES\n");
	else printf("NO\n");
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:33: error: 'jAKIH' was not declared in this scope
   24 |                         if (st1[jAKIH]!='A') flag=0;
      |                                 ^~~~~
Language: C++

#include<cstdio>
#include<cstring>
const char fin[]={"AKIHABARA"};
char ch[110];
bool b[110];

int main()
{
	gets(ch);
	int cnt=0;
	for(int i=0;cnt<9&&i<9;cnt++)
		if(ch[i]==fin[cnt])
		{
			b[cnt]=1;
			i++;
		}
	for(int i=0;i<9;i++)
	{
		if(!b[i])
			if(fin[i]!='A')
			{
				puts("NO");
				return 0;
			}
	}
	puts("YES");
	return 0;
}

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

#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=500000004;
const double EPS=1e-6;
const double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
char in[60];
char target[100]="AKIHABARA";
int main(){
	scanf("%s",in);
	int at=0;
	for(int i=0;i<9;i++){
		if(in[at]==target[i]){
			at++;continue;
		}
		if(target[i]=='A')continue;
		printf("NO\n");return 0;
	}
	if(strlen(in)==a)
	printf("YES\n");else
printf("NO\n");
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:24: error: 'a' was not declared in this scope; did you mean 'at'?
   34 |         if(strlen(in)==a)
      |                        ^
      |                        at
Language: C++

#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=500000004;
const double EPS=1e-6;
const double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
char in[60];
char target[100]="AKIHABARA";
int main(){
	scanf("%s",in);
	int at=0;
	for(int i=0;i<9;i++){
		if(in[at]==target[i]){
			at++;continue;
		}
		if(target[i]=='A')continue;
		printf("NO\n");return 0;
	}
	if(strlen(in)==a)
	printf("YES\n");else
printf("NO\n")
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:24: error: 'a' was not declared in this scope; did you mean 'at'?
   34 |         if(strlen(in)==a)
      |                        ^
      |                        at
a.cc:36:15: error: expected ';' before '}' token
   36 | printf("NO\n")
      |               ^
      |               ;
   37 | }
      | ~
Language: C++

from sys import exit

S = raw_input()
if S.count("A") > 4:
  print "NO"
  exit(0)

if S.replace("A", "") != "KIHBR":
  print "NO"
  exit(0)

l = S.split("A")
if not l[0]:
  l = l[1:]
   
if not l[0].startswith('KIH'):
  print "NO"
  exit(0)

if len(l) >= 2 and l[1].startswith('B'):
  print "NO"
  exit(0)

if len(l) >= 3 and l[2] != 'R':
  print "NO"
  exit(0)

if len(l) == 4 and l[3]:
  print "NO"
  exit(0)

if len(l) > 4:
  print "NO"
  exit(0)

print "YES"


Compiler output:
a.cc:16:24: warning: multi-character character constant [-Wmultichar]
   16 | if not l[0].startswith('KIH'):
      |                        ^~~~~
a.cc:1:1: error: 'from' does not name a type
    1 | from sys import exit
      | ^~~~
Language: C++

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

#define rep(i, N) for (int i = 0; i < N; i++)
#define pb push_back

typedef long long ll;
typedef pair<int, int> i_i;
const int INF = INT_MAX / 2;
const int MOD = 1e9 + 7;

int main() {
	string s; cin >> s;
	int N = s.length();
	if (N > 9) {
		cout << "NO" << endl;
		return 0;
	}
	string akb = "AKIHABARA";
	vector<bool> a(9);
	rep(i, N) a[8 - i] = true;
	do {
		bool ok = true;
		rep(i, 9) {
			if (a[i] && s[i] != akb[i])) ok = false;
			if (!a[i] && akb[i] != 'A') ok = false;
		}
		if (ok) {
			cout << "YES" << endl;
			return 0;
		}
	} while (next_permutation(a.begin(), a.end()));
	cout << "NO" << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:52: error: expected primary-expression before ')' token
   26 |                         if (a[i] && s[i] != akb[i])) ok = false;
      |                                                    ^
Language: C++

#include <iostream>
using namespace std;

int main() {
    string s; cin >> s;
    while (s.size() < 9) s = 'A' + s;
    sort(s.begin(), s.end());
    string tar = "AKIHABARA";
    sort(tar.begin(), tar.end());
    cout << (tar == s ? "YES" : "NO");
}


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

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, k, n) for (int i = k; i < (int)(n); i++)
#define repd(i, n) for (int i = n-1; i >= 0; i--)
#define rrepd(i, k, n) for (int i = n-1; i >= (int)(k); i--)
#define all(x) (x).begin(),(x).end()
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
//V,Pは大文字i,l,bは小文字
using ll = long long;
using Vi = vector<int>;
using VVi = vector<Vi>;
using Vl = vector<ll>;
using VVl = vector<Vl>;
using Vb = vector<bool>;
using VVb = vector<Vb>;
using P = pair<int,int>;
using Pll = pair<ll, ll>;
const ll mod = 1000000007;
const ll inf = 1000000000000;//10の12乗

int main() {
  string s;
  cin >> s;
  int a=0,b=0,c=0;
  rep(i,n){
    char c=s[i];
    if(c=='a') a++;
    else if(c=='b') b++;
    else c++;
  }
  int x=max(a,max(b,c));
  int y=min(a,min(b,c));
  if(x-y<=1) cout << "YES" << endl;
  else cout << "NO" << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:9: error: 'n' was not declared in this scope
   31 |   rep(i,n){
      |         ^
a.cc:3:45: note: in definition of macro 'rep'
    3 | #define rep(i, n) for (int i = 0; i < (int)(n); i++)
      |                                             ^
Language: C++

#include<bits/stdc++.h>

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
using ull = unsigned long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

template<class T>
bool ChangeMax(T&a,const T&b){
  if(a >= b) return false;
  a = b;    return true;
}

template<class T>
bool ChangeMin(T&a,const T&b){
  if(a <= b) return false;
  a = b;    return true;  
}

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v){
    is >> e;
  }
  return is;
}

int main(){
  string s; cin >> s;
  vector<int> v(3);
  for(auto e:v)v[e-'a']++;
  sort(v.begin(), v.end());
  cout << (v.back()-b.front() >= 2 ? "NO" : "YES") << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:46:21: error: 'b' was not declared in this scope
   46 |   cout << (v.back()-b.front() >= 2 ? "NO" : "YES") << endl;
      |                     ^
Language: C++

#include <bits/stdc++.h>
#include <iostream>
#include<math.h>
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
int main()
{
    string S;
    cin >> S;
    int64_t s = S.size();
    map<char, int64_t>d;
    d['a'] = 0;
    d['b'] = 0;
    d['c'] = 0;
    for (int64_t i=0; i<s; i++) {
        d[S[i]] = d[S[i]] + 1;
    }

    int64_t kizyun = s / 3;
    bool ikeru = true;
    for (auto c : d) {
        if (kizyun > c.second) {
            ikeru = false;
            break;
        }
    }

    int64_t min_ = min({d['a'], d['b'], d['c']}));
    int64_t max_ = max({d['a'], d['b'], d['c']}));
    if (max_ - 1 > min_) {
        ikeru = false;
    }

    if (ikeru) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:49: error: expected ',' or ';' before ')' token
   29 |     int64_t min_ = min({d['a'], d['b'], d['c']}));
      |                                                 ^
a.cc:30:49: error: expected ',' or ';' before ')' token
   30 |     int64_t max_ = max({d['a'], d['b'], d['c']}));
      |                                                 ^
Language: C++

#include <bits/stdc++.h>
#include<cmath>
#define N 100005
#define A 1000005
#define MOD 1000000007 // //100000000 998244353 //
#define inf 1000000000000000000
#define ll long long
//#define M_PI 3.141592653589793238463

using namespace std;

#define pii pair<ll, ll>
#define piii pair<ll, pii>
#define ft first
#define sd second
#define pb push_back
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n-1; i >= 0; i--)
#define itr(it, x) for(auto it = x.begin(); it != x.end(); it++)
#define mem(a, b) memset(a, (ll)b, sizeof(a))
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define edge(v, x, y) v[x].pb(y); v[y].pb(x);
#define popcount __builtin_popcount
#define ANS(s) {cout << s << "\n"; return;}

//~~~~~~fancy print~~~~~~~//
#define printpii(a) cout << a.ft << " " << a.sd << endl;
#define printpiii(a) cout << a.ft << " " << a.sd.ft << " " << a.sd.sd << endl;
#define print(a, n) rep(i, n) cout << a[i] << " "; cout << endl;
#define printv(v) for(auto x: v)cout << x << " "; cout << endl;
#define printm(a, n, m) rep(i, n) { rep(j, m) cout << a[i][j] << "\t"; cout << endl;}

ll lx[4] = {0, 0, 1, -1};
ll ly[4] = {1, -1, 0, 0};
ll dx[8] = {0, 0, 1, -1, 1, -1, 1, -1};
ll dy[8] = {1, -1, 0, 0, 1, 1, -1, -1};
void fast(){ios_base::sync_with_stdio(false);cin.tie(0);cout << setprecision(12) << fixed;}
ll lcm(ll a, ll b) {return (a*b)/__gcd(a, b); }



void solve()
{
    string s;
    cin >> s;
    ll n = s.size();
    if(n == 1) ANS("YES");
    else if(n == 2 && s[0] != s[1]) ANS("YES"); 
    map<char, ll> mp;
    for(auto x: s) mp[x]++;
    if(mp.size() < 3) ANS("NO");
    ll mx = 0;
    itr(it, mp)
    {
        mx = max(mx, it->sd);
    }
    if(mx > (n+2)/3) cout << "NO";
    else cout << "YES";

}

int main(){
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif*/
    fast();
    ll t = 1; //cin >> t;
    while(t--){
        solve();
    }
    return 0;
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:49:5: error: 'else' without a previous 'if'
   49 |     else if(n == 2 && s[0] != s[1]) ANS("YES");
      |     ^~~~
Language: C++

#include <bits/stdc++.h>
#include<cmath>
#define N 100005
#define A 1000005
#define MOD 1000000007 // //100000000 998244353 //
#define inf 1000000000000000000
#define ll long long
//#define M_PI 3.141592653589793238463

using namespace std;

#define pii pair<ll, ll>
#define piii pair<ll, pii>
#define ft first
#define sd second
#define pb push_back
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n-1; i >= 0; i--)
#define itr(it, x) for(auto it = x.begin(); it != x.end(); it++)
#define mem(a, b) memset(a, (ll)b, sizeof(a))
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define edge(v, x, y) v[x].pb(y); v[y].pb(x);
#define popcount __builtin_popcount
#define ANS(s) {cout << s << "\n"; return;}

//~~~~~~fancy print~~~~~~~//
#define printpii(a) cout << a.ft << " " << a.sd << endl;
#define printpiii(a) cout << a.ft << " " << a.sd.ft << " " << a.sd.sd << endl;
#define print(a, n) rep(i, n) cout << a[i] << " "; cout << endl;
#define printv(v) for(auto x: v)cout << x << " "; cout << endl;
#define printm(a, n, m) rep(i, n) { rep(j, m) cout << a[i][j] << "\t"; cout << endl;}

ll lx[4] = {0, 0, 1, -1};
ll ly[4] = {1, -1, 0, 0};
ll dx[8] = {0, 0, 1, -1, 1, -1, 1, -1};
ll dy[8] = {1, -1, 0, 0, 1, 1, -1, -1};
void fast(){ios_base::sync_with_stdio(false);cin.tie(0);cout << setprecision(12) << fixed;}
ll lcm(ll a, ll b) {return (a*b)/__gcd(a, b); }



void solve()
{
    string s;
    cin >> s;
    ll n = s.size();
    map<char, ll> mp;
    for(auto x: s) mp[x]++;
    if(mp.size() < 3) ANS("NO");
    ll mx = 0;
    itr(it, mp)
    {
        mx = max(mx, it->sd);
    }
    if(mx > (n+2)/3) cout << "NO";
    else cout << "YES";babacccabab


}

int main(){
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif*/
    fast();
    ll t = 1; //cin >> t;
    while(t--){
        solve();
    }
    return 0;
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:57:24: error: 'babacccabab' was not declared in this scope
   57 |     else cout << "YES";babacccabab
      |                        ^~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
//using p=pair<int,int>;
typedef long long ll;
//#define rep(i,N) for(int i=0;i<N;i++)


int main(){

 string s;
  cin>>s;

 int a=0,b=0,c=0;
 string ans = "YES";

 for(int i=0;i<s.length();i++){

    if(s[i] == 'a')
        a++;
    else if(s[i] == 'b')
         b++;
    else if(s[i] == 'c')
    c++;
 }

  if(max(a,b,c) - min(a,b,c) > 1)
    ans = "NO";

    cout<<ans<<endl;

return 0;
}


Compiler output:
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:26:9:   required from here
   26 |   if(max(a,b,c) - min(a,b,c) > 1)
      |      ~~~^~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:306:17: error: '__comp' cannot be used as a function
  306 |       if (__comp(__a, __b))
      |           ~~~~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:26:22:   required from here
   26 |   if(max(a,b,c) - min(a,b,c) > 1)
      |                   ~~~^~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:284:17: error: '__comp' cannot be used as a function
  284 |       if (__comp(__b, __a))
      |           ~~~~~~^~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
//using p=pair<int,int>;
typedef long long ll;
//#define rep(i,N) for(int i=0;i<N;i++)


int main(){

 string s;
  cin>>s;

 int a=0,b=0,c=0;
 string ans = "YES";

 for(int i=0;i<s.length();i++){

    if(s[i] == 'a')
        a++;
    else if(s[i] == ' ')
         b++;
    else if(s[i] == ' ')
    c++;
 }

  if(max(a,b,c) - min(a,b,c) > 1)
    ans = "NO";

    cout<<ans<<endl;

return 0;
}

Compiler output:
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:26:9:   required from here
   26 |   if(max(a,b,c) - min(a,b,c) > 1)
      |      ~~~^~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:306:17: error: '__comp' cannot be used as a function
  306 |       if (__comp(__a, __b))
      |           ~~~~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:26:22:   required from here
   26 |   if(max(a,b,c) - min(a,b,c) > 1)
      |                   ~~~^~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:284:17: error: '__comp' cannot be used as a function
  284 |       if (__comp(__b, __a))
      |           ~~~~~~^~~~~~~~~~
Language: C++

#include <algorithm>
#include <iostream>
using namespace std;
using ll = long long;
#define repl(i, l, r) for (int i = l; i < r; i++)
#define rep(i, n) repl(i, 0, n)
int main() {
	string s;
	cin >> s;
	int n = s.size();
	vector<int> a(3);
	rep(i, n) a[s[i] - 'a']++;
	sort(a.begin(), a.end());
	if (a[2] - a[0] <= 1)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:9: error: 'vector' was not declared in this scope
   11 |         vector<int> a(3);
      |         ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    2 | #include <iostream>
  +++ |+#include <vector>
    3 | using namespace std;
a.cc:11:16: error: expected primary-expression before 'int'
   11 |         vector<int> a(3);
      |                ^~~
a.cc:12:19: error: 'a' was not declared in this scope
   12 |         rep(i, n) a[s[i] - 'a']++;
      |                   ^
a.cc:13:14: error: 'a' was not declared in this scope
   13 |         sort(a.begin(), a.end());
      |              ^
Language: C++

#include<algorithm>//sort(all(変数),greater<型名>())で降順に、*max_element(all(変数))で最大値を獲得
#include<bits/stdc++.h>
#include<cmath>//切り上げceil(値)
#include<deque>
#include<iomanip>//setprecision(数字)
#include<iostream>
#include<list>
#include<map>
#include<numeric>
// xとyのgcdは__gcd(x,y),xとyのlcmは(x*y)/__gcd、accumulate(all(変数),0)で要素の全加算
#include<queue>//priority_queue<型名> 変数
#include<set>
#include<stack>
#include<string>//変数.substr(どこから,いくつ)
#include<vector>
#define rep(i,n)  for(ll i=0; i<n; i++)
#define rrep(i,n) for(ll i=n-1; 0<=i; i--)
#define vll vector<ll>
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define INF 1e9
using ll = long long;
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main(){
  string s;  cin >> s;
  int x(3);
  rep(i,s.size()){
    if(s[i] == 'a'){
      x[0]++;
    }else if(s[i] == 'b'){
      x[1]++;
    }else{
      x[2]++;
    }
  }
  if(*max_element(all(x))-*min_element(all(x)) <= 1) cout << "YES";
  else cout << "NO";
  cout << "\n";
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:8: error: invalid types 'int[int]' for array subscript
   32 |       x[0]++;
      |        ^
a.cc:34:8: error: invalid types 'int[int]' for array subscript
   34 |       x[1]++;
      |        ^
a.cc:36:8: error: invalid types 'int[int]' for array subscript
   36 |       x[2]++;
      |        ^
a.cc:20:20: error: request for member 'begin' in 'x', which is of non-class type 'int'
   20 | #define all(x) (x).begin(),(x).end()
      |                    ^~~~~
a.cc:39:19: note: in expansion of macro 'all'
   39 |   if(*max_element(all(x))-*min_element(all(x)) <= 1) cout << "YES";
      |                   ^~~
a.cc:20:32: error: request for member 'end' in 'x', which is of non-class type 'int'
   20 | #define all(x) (x).begin(),(x).end()
      |                                ^~~
a.cc:39:19: note: in expansion of macro 'all'
   39 |   if(*max_element(all(x))-*min_element(all(x)) <= 1) cout << "YES";
      |                   ^~~
a.cc:20:20: error: request for member 'begin' in 'x', which is of non-class type 'int'
   20 | #define all(x) (x).begin(),(x).end()
      |                    ^~~~~
a.cc:39:40: note: in expansion of macro 'all'
   39 |   if(*max_element(all(x))-*min_element(all(x)) <= 1) cout << "YES";
      |                                        ^~~
a.cc:20:32: error: request for member 'end' in 'x', which is of non-class type 'int'
   20 | #define all(x) (x).begin(),(x).end()
      |                                ^~~
a.cc:39:40: note: in expansion of macro 'all'
   39 |   if(*max_element(all(x))-*min_element(all(x)) <= 1) cout << "YES";
      |                                        ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
string s;
  cin>>s;
  int N=s.size();
  map<char,int>M;
  M['a']=0;
  M['b']=0;
  M['c']=0;
  for(int i=0;i<N;i++){
  char x=s.at(i);
    M.at(x)++;
  }int A=M.at('a');
  int B=M.at('b');
  int C=M.at('c');
  if(abs(A-B)<=1 abs(B-C)<=1 abs(A-C)<=1)
    cout<<"YES"<<endl;
  else
    cout<<"NO"<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:17: error: expected ')' before 'abs'
   17 |   if(abs(A-B)<=1 abs(B-C)<=1 abs(A-C)<=1)
      |     ~           ^~~~
      |                 )
Language: C++

#include <bits/stdc++.h>
#define exrep(i, a, b) for(long long i = a; i <= b; i++)
#define rep(i,n)for(long long i=0;i<(long long)(n);i++)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vector<ll> > vvl;
typedef vector<vector<P> > vvp;
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; }
 
const ll MOD=1e9+7;
const ll INF=1e18;
const int MAX=510000;
const double pi=acos(-1);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
  
  string s;
  cin >> s;
  int n=s.size();
  vector<int>vec(3);
  rep(i,n){
    if(s[i]=='a')vec[0]++;
    if(s[i]=='b')vec[1]++;
    if(s[i]=='c')vec[2]++;
    mp[s[i]]++;
  }
  bool ok=true;
    int mx=max(vec[0],max(vec[1],vec[2]));
    int mn=min(vec[0],min(vec[1],vec[2]));
   if(mx>mn+1)ok=false;
  if(!ok)cout << "NO" << endl;
  else cout << "YES" << endl;
  return 0;     
}


Compiler output:
a.cc: In function 'int main()':
a.cc:39:5: error: 'mp' was not declared in this scope; did you mean 'vp'?
   39 |     mp[s[i]]++;
      |     ^~
      |     vp
Language: C++

int main(){
    int N;
    cin >>N;
    vector<ll> A(N);
    rep(i,N) cin >>A[i];
    sort(all(A));
    ll end1 = 0 ,end2 = 0;
    ll end = A[0];
    rep2(i,1,N){
        if(A[i]==end){
            if(end!=end1){
                end2 = end1;
                end1 = end;
            }
        }
        end =A[i];
    }
    cout <<end1*end2<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:5: error: 'cin' was not declared in this scope
    3 |     cin >>N;
      |     ^~~
a.cc:4:5: error: 'vector' was not declared in this scope
    4 |     vector<ll> A(N);
      |     ^~~~~~
a.cc:4:12: error: 'll' was not declared in this scope
    4 |     vector<ll> A(N);
      |            ^~
a.cc:4:16: error: 'A' was not declared in this scope
    4 |     vector<ll> A(N);
      |                ^
a.cc:5:9: error: 'i' was not declared in this scope
    5 |     rep(i,N) cin >>A[i];
      |         ^
a.cc:5:5: error: 'rep' was not declared in this scope
    5 |     rep(i,N) cin >>A[i];
      |     ^~~
a.cc:6:10: error: 'all' was not declared in this scope
    6 |     sort(all(A));
      |          ^~~
a.cc:6:5: error: 'sort' was not declared in this scope; did you mean 'short'?
    6 |     sort(all(A));
      |     ^~~~
      |     short
a.cc:7:7: error: expected ';' before 'end1'
    7 |     ll end1 = 0 ,end2 = 0;
      |       ^~~~~
      |       ;
a.cc:8:7: error: expected ';' before 'end'
    8 |     ll end = A[0];
      |       ^~~~
      |       ;
a.cc:9:5: error: 'rep2' was not declared in this scope
    9 |     rep2(i,1,N){
      |     ^~~~
a.cc:18:5: error: 'cout' was not declared in this scope
   18 |     cout <<end1*end2<<endl;
      |     ^~~~
a.cc:18:12: error: 'end1' was not declared in this scope
   18 |     cout <<end1*end2<<endl;
      |            ^~~~
a.cc:18:17: error: 'end2' was not declared in this scope
   18 |     cout <<end1*end2<<endl;
      |                 ^~~~
a.cc:18:23: error: 'endl' was not declared in this scope
   18 |     cout <<end1*end2<<endl;
      |                       ^~~~
Language: C++

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

int main()
{
    string S;
    cin >> S;

    int a = count(S.begin(), S.end(), 'a');
    int b = count(S.begin(), S.end(), 'b');
    int c = count(S.begin(), S.end(), 'c');

    if (abs(a - b) <= 1 && abs(a - c) <= 1 && abs(c - b) <= 1 &&)
        puts("YES");
    else
        puts("NO");
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:65: error: expected primary-expression before ')' token
   13 |     if (abs(a - b) <= 1 && abs(a - c) <= 1 && abs(c - b) <= 1 &&)
      |                                                                 ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep0(i, n) for (long long i = 0; i < (long long)(n); i++)
#define rep1(i,n) for(long long i=1;i<=(long long)(n);i++)
#define all(v) v.begin(),v.end()
typedef long long ll;

int main() {
	string S;
  ll A,B,C,s,t;
  cin>>S;
  rep0(i,S.size()){
    if(S[i]=='a'){A++;}
    if(S[i]=='b'){B++;}
    if(S[i]=='c'){C++;}
    s=min(min(A,B),C);
    t=max(max(A,B),C);
    if(max-min==1){cout<<"YES"<<endl;}
    else{cout<<"NO"<<endl;}
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:11: error: invalid operands of types '<unresolved overloaded function type>' and '<unresolved overloaded function type>' to binary 'operator-'
   18 |     if(max-min==1){cout<<"YES"<<endl;}
      |        ~~~^~~~
Language: C++

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

int main()
{
    string S;
    cin >> S;

    int a = count(S.begin(), S.end(), 'a');
    int b = count(S.begin(), S.end(), 'b');
    int c = count(S.begin(), S.end(), 'c');

    if ((a + b + c) % 2 == 0)
    {
        if (a % 2 != 0 || b % 2 != 0 || c % 2 != 0)
            puts("YES");
        else
            puts("NO");
    }
    else
    {
        if ((a == 0 && b % 2 == 1 && c % 2 == 0) ||
            (a == 0 && b % 2 == 0 && c % 2 == 1) ||
            (a % 2 == 1 && b == 0 && c % 2 == 0) ||
            (a % 2 == 0 && b == 0 && c % 2 == 1) ||
            (a % 2 == 0 && b % 2 == 1 && c == 0) ||
            (a % 2 == 1 % % b % 2 == 0 && c == 0) ||
            (a == 0 && b == 0) ||
            (b == 0 && c == 0) ||
            (a == 0 && c == 0))
            puts("NO");
        else
            puts("YES");
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:27: error: expected primary-expression before '%' token
   27 |             (a % 2 == 1 % % b % 2 == 0 && c == 0) ||
      |                           ^
Language: C++

S=input()
x=dict()
for i in range(len(S)):
    s=S[i]
    if s in x:
        x[s]+=1
    else:
        x[s]=1
l=[]
cnt=0
for idx in x:
    l.append(x[idx])
    cnt+=1
if cnt!=3:
    print("NO")
    exit()
l.sort()
x=l[0]
y=l[1]
z=l[2]
y=y-x
z=z-x
if y>1 or z>1:
    print("NO")
else:
    print("YES")

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

#include <iostream>
using namespace std;

int main(){
  string s;
  cin>>s;
  int cnt[3]{};
  for(int i=0;i<s.size();i++)cnt[s[i]-'a']++;
  for(int i=0;i<3;i++)
    if(cnt[i]*3-2>cnt.size()){
      puts("NO");
      return 0;
    }
  puts("YES");
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:23: error: request for member 'size' in 'cnt', which is of non-class type 'int [3]'
   10 |     if(cnt[i]*3-2>cnt.size()){
      |                       ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long; // ll は long long　と同じとする。
int main () {
    string S;
    cin >> S;
    int A = 0;
    int B = 0;
    int C = 0;
    for(int i = 0; i < S.size(); i++){
        if(S.at(i) == 'a'){
            A++;
        }
        if(S>at(i) == 'b'){
            B++;
        }
        if(S>at(i) == 'c'){
            C++;
        }
    }
    if(abs(A - B) <= 1 && abs(B - C) <= 1 && abs(A - C) <= 1){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:14: error: 'at' was not declared in this scope
   14 |         if(S>at(i) == 'b'){
      |              ^~
a.cc:17:14: error: 'at' was not declared in this scope
   17 |         if(S>at(i) == 'c'){
      |              ^~
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long; // ll は long long　と同じとする。
int main () {
    string S;
    cin >> S;
    for(int i = 0; i < S.size(); i++){
        if(S.at(i) == 'a'){
            A++;
        }
        if(S>at(i) == 'b'){
            B++;
        }
        if(S>at(i) == 'c'){
            C++;
        }
    }
    if(abs(A - B) <= 1 && abs(B - C) <= 1 && abs(A - C) <= 1){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:13: error: 'A' was not declared in this scope
    9 |             A++;
      |             ^
a.cc:11:14: error: 'at' was not declared in this scope
   11 |         if(S>at(i) == 'b'){
      |              ^~
a.cc:12:13: error: 'B' was not declared in this scope
   12 |             B++;
      |             ^
a.cc:14:14: error: 'at' was not declared in this scope
   14 |         if(S>at(i) == 'c'){
      |              ^~
a.cc:15:13: error: 'C' was not declared in this scope
   15 |             C++;
      |             ^
a.cc:18:12: error: 'A' was not declared in this scope
   18 |     if(abs(A - B) <= 1 && abs(B - C) <= 1 && abs(A - C) <= 1){
      |            ^
a.cc:18:16: error: 'B' was not declared in this scope
   18 |     if(abs(A - B) <= 1 && abs(B - C) <= 1 && abs(A - C) <= 1){
      |                ^
a.cc:18:35: error: 'C' was not declared in this scope
   18 |     if(abs(A - B) <= 1 && abs(B - C) <= 1 && abs(A - C) <= 1){
      |                                   ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long; // ll は long long　と同じとする。
int main () {
    int S;
    cin >> S;
    for(int i = 0; i < S.size() - 2; i++){
        if(S.at(i) == S.at(i + 1)){
            cout << "NO" << endl;
        }
        else if(S.at(i) == S.at(i + 2)){
            cout << "NO" << endl;
        }
        else if(S.at(S.size() - 2) == S.at(S.size() - 1)){
            cout << "NO" << endl;
        }
        else{
            cout << "YES" << endl;
        }
    }

}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:26: error: request for member 'size' in 'S', which is of non-class type 'int'
    7 |     for(int i = 0; i < S.size() - 2; i++){
      |                          ^~~~
a.cc:8:14: error: request for member 'at' in 'S', which is of non-class type 'int'
    8 |         if(S.at(i) == S.at(i + 1)){
      |              ^~
a.cc:8:25: error: request for member 'at' in 'S', which is of non-class type 'int'
    8 |         if(S.at(i) == S.at(i + 1)){
      |                         ^~
a.cc:11:19: error: request for member 'at' in 'S', which is of non-class type 'int'
   11 |         else if(S.at(i) == S.at(i + 2)){
      |                   ^~
a.cc:11:30: error: request for member 'at' in 'S', which is of non-class type 'int'
   11 |         else if(S.at(i) == S.at(i + 2)){
      |                              ^~
a.cc:14:19: error: request for member 'at' in 'S', which is of non-class type 'int'
   14 |         else if(S.at(S.size() - 2) == S.at(S.size() - 1)){
      |                   ^~
a.cc:14:24: error: request for member 'size' in 'S', which is of non-class type 'int'
   14 |         else if(S.at(S.size() - 2) == S.at(S.size() - 1)){
      |                        ^~~~
a.cc:14:41: error: request for member 'at' in 'S', which is of non-class type 'int'
   14 |         else if(S.at(S.size() - 2) == S.at(S.size() - 1)){
      |                                         ^~
a.cc:14:46: error: request for member 'size' in 'S', which is of non-class type 'int'
   14 |         else if(S.at(S.size() - 2) == S.at(S.size() - 1)){
      |                                              ^~~~
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
#define INF 1000000000000000000

int main(){
  string s;
  cin >> s;
  int a_count = 0;
  int b_count = 0;
  int c_count = 0;
  rep(i, s.size()){
    if (s[i] == 'a') a_count++;
    if (s[i] == 'b') b_count++;
    if (s[i] == 'c') c_count++;
  }
  int max_count = max(a_count, max(b_count, c_count));
  int min_count = min(a_count, min(b_count, c_count));
  if (max_count - min_count <= 1) cout << "YES" << endl;
  else cout << "NO" << endl;
                      


Compiler output:
a.cc: In function 'int main()':
a.cc:21:29: error: expected '}' at end of input
   21 |   else cout << "NO" << endl;
      |                             ^
a.cc:7:11: note: to match this '{'
    7 | int main(){
      |           ^
Language: C++

#include <bits/stdc++.h> 
using namespace std; 
#define lli long long int 
#define uli unsigned long long int 
#define INF 999999999999999999 
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n) 
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end()); 
#define Sort(n) sort(n.begin(), n.end()) 
#define Rev(n) reverse(n.begin(),n.end()) 
#define Out(S) cout << S << endl 
#define NeOut(S) cout << S 
#define HpOut(S) cout << setprecision(25) << S << endl 
#define Vec(K,L,N,S) vector<L> K(N,S) 
#define DV(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S)) 
#define TV(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S))) 
#define pint pair<lli,lli> 
#define paf(L,R) pair<L,R> 
#define mod 1000000007 
#define MAX 5100000 
#define ALL(a) a.begin(),a.end() 
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a)) 
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a)) 
int main(){
ios::sync_with_stdio(false); 
cin.tie(0); 
lli A,B,C,D,E,F,N,M,K,L,X,Y,Z,H,W,sum=0,num=0,flag=0;string S,T; 
cin >> S;
N=S.size();
Vec(P,lli,26,0);.
rep(i,0,N)P[S[i]-'a']++;
rep(i,0,26)if(P[i]>(N-P[i]))flag=1;
if(flag)Out("No");
else Out("Yes");
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:17: error: expected primary-expression before '.' token
   31 | Vec(P,lli,26,0);.
      |                 ^
a.cc:6:20: error: expected unqualified-id before 'for'
    6 | #define rep(i,m,n) for(lli i = m;i < n;i++)
      |                    ^~~
a.cc:32:1: note: in expansion of macro 'rep'
   32 | rep(i,0,N)P[S[i]-'a']++;
      | ^~~
a.cc:32:5: error: 'i' was not declared in this scope
   32 | rep(i,0,N)P[S[i]-'a']++;
      |     ^
a.cc:6:34: note: in definition of macro 'rep'
    6 | #define rep(i,m,n) for(lli i = m;i < n;i++)
      |                                  ^
Language: C++

#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <cstdlib>
#include <map>
#include <queue>
#include <algorithm>
#include <stack>
#include <functional>
#define rep(i,j,n) for(i=j;i<(n);i++)
#define rrep(i,j,n) for(i=j;i>(n);i--)
typedef long long int lli;
#define N 1000000007

using namespace std;

int main(){
    lli n;
    string s,ans="NO";
    lli i,j;
    map<char,lli> map;
    cin>>s;
    rep(i,0,s.size()){
        map[s[i]]++;
    }
    i((abs(map['a']-map['b'])<=1)&&(abs(map['a']-map['c'])<=1)&&(abs(map['c']-map['b'])<=1)){
        ans="YES";
    }
    cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:6: error: 'i' cannot be used as a function
   28 |     i((abs(map['a']-map['b'])<=1)&&(abs(map['a']-map['c'])<=1)&&(abs(map['c']-map['b'])<=1)){
      |     ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>

#define I inline
#define fi first
#define se second
#define R register
#define LL long long
#define mp make_pair
#define reg register int
#define pii pair<int,int>
#define fo(i, a, b) for(reg i = a; i <= b; i++)
#define fd(i, a, b) for(reg i = a; i >= b; i--)
#define cr const reg&
using namespace std;

I int _max(cr x, cr y) {return x > y ? x : y;}
I int _min(cr x, cr y) {return x < y ? x : y;}
I int read() {
	reg x = 0, f = 1; char ch = getchar();
	while(ch < '0' || ch > '9') {if(ch == '-') f = -1; ch = getchar();}
	while(ch >= '0' && ch <= '9') x = (x << 3) + (x << 1) + (ch ^ 48), ch = getchar();
	return x * f;
}
I void ptt(LL x) {if(x >= 10) ptt(x / 10); putchar(x % 10 + '0');}
I void put(LL x) {x < 0 ? putchar('-'), ptt(-x) : ptt(x);}
I void pr1(LL x) {put(x), putchar(' ');}
I void pr2(LL x) {put(x), puts("");}

const int N=1e5+5;
char s[N];int cnt[3],n,mx;
int main(){
    scanf("%s",s+1),n=strlen(s+1);
    fp(i,1,n)++cnt[s[i]-'a'];
    mx=max(cnt[0],max(cnt[1],cnt[2]));
    if(!cnt[0]||!cnt[1]||!cnt[2])return puts(mx<=1?"YES":"NO"),0;
    fp(i,0,2)if(cnt[i]<mx-1)return puts("NO"),0;
    puts("YES");
    return 0;
}



Compiler output:
a.cc:16:15: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   16 | I int _max(cr x, cr y) {return x > y ? x : y;}
      |               ^
a.cc:16:21: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   16 | I int _max(cr x, cr y) {return x > y ? x : y;}
      |                     ^
a.cc:17:15: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   17 | I int _min(cr x, cr y) {return x < y ? x : y;}
      |               ^
a.cc:17:21: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   17 | I int _min(cr x, cr y) {return x < y ? x : y;}
      |                     ^
a.cc: In function 'int read()':
a.cc:19:13: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   19 |         reg x = 0, f = 1; char ch = getchar();
      |             ^
a.cc:19:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   19 |         reg x = 0, f = 1; char ch = getchar();
      |                    ^
a.cc: In function 'int main()':
a.cc:33:8: error: 'i' was not declared in this scope
   33 |     fp(i,1,n)++cnt[s[i]-'a'];
      |        ^
a.cc:33:5: error: 'fp' was not declared in this scope; did you mean 'mp'?
   33 |     fp(i,1,n)++cnt[s[i]-'a'];
      |     ^~
      |     mp