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

#include <bits/stdc++.h>
using namespace std;
string a; 
int main()
{
  cin>>a;
  if(a.length()==3&&(a[0]==a[1]||a[0]==a[2]||a[1]==a[2]))return cout<<"NO\n";
  return cout<<"YES\n",0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:69: error: cannot convert 'std::basic_ostream<char>' to 'int' in return
    7 |   if(a.length()==3&&(a[0]==a[1]||a[0]==a[2]||a[1]==a[2]))return cout<<"NO\n";
      |                                                                 ~~~~^~~~~~~~
      |                                                                     |
      |                                                                     std::basic_ostream<char>
Language: C++

#include <bits/stdc++.h>

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { std::cout << #a << " = " << a << "\n"; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T, class V> istream& operator>> (istream& ist, pair<T, V>& p) { return ist >> p.first >> p.second; }
template<class T> ostream& operator<< (ostream& ost, pair<T, T>& p) { return ost << p.first << ", " << p.second; }
template<class T> istream& operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) ist >> e; return ist; }

typedef long long ll;
int const inf = 1<<29;

int main() {
  string s; cin >> s;
  int n = s.size();
  map<char, int> mp;
  rep(i, n) {
    mp[s[i]-'a']++;
  }
  if (n == 1) {
    cout << "YES\n";
  }
  else if (n == 2) {
    cout << (mp.size() == 2 ? "YES\n" : "NO\n");
  }
  else {
    int max = std::max(mp[0], mp[1], mp[2]);
    bool ng = 0;
    rep(i, 3) {
      if (max - mp[i] > 1) {
        ng = 1;
      }
    }
    cout << (ng ? "NO\n" : "YES\n");
  }
}


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:34:23:   required from here
   34 |     int max = std::max(mp[0], mp[1], mp[2]);
      |               ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:306:17: error: '__comp' cannot be used as a function
  306 |       if (__comp(__a, __b))
      |           ~~~~~~^~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main () {
  string S;
  cin >> S;
  vector<int> data(3);
  for(char a：S){
    data.at(a - 'a')++;
  }
  sort(data.begin(), data.end());
  cout << (data.at(2) - data.at(0) <= 1?"YES":"NO") << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:16: error: expected ';' before ')' token
    7 |   for(char a：S){
      |                ^
      |                ;
a.cc:7:16: error: expected primary-expression before ')' token
a.cc:7:16: error: expected ';' before ')' token
    7 |   for(char a：S){
      |                ^
      |                ;
a.cc:8:13: error: 'a' was not declared in this scope
    8 |     data.at(a - 'a')++;
      |             ^
Language: C++

#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <algorithm> // sort

#define REP(i, n) for (long long i = 0; i < (n); i++) 
typedef long long ll;
static const ll INF = 1000000000000000000LL;
using namespace std;


int main() {
    vector <int> cnt(3);
    string res;

    string s;
    cin >> s;
    REP(i, s.size())
    {
        cnt[s[i] - 'a']++;
    }

    //max(cnt[0]) がその他より多いとだめそう
    //cnt[0]cnt[1]だけ多くてもダメそう
    //maxとminの差が1以下ならいけそう

    int imax = 0;
    int imin = MOD;
    REP(i,3)
    {
        imax = max(imax, cnt[i]);
        imin = min(imin, cnt[i]);
    } 

    if(imax - imin <= 1)res = "YES";
    else res = "NO";

    cout << res << endl;

    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:29:16: error: 'MOD' was not declared in this scope
   29 |     int imin = MOD;
      |                ^~~
Language: C++

s=str(input())
a=0
b=0
c=0
for i in range(len(s)):
    if(s[i]=='a'):
        a+=1
    if(s[i]=='b'):
        b+=1
    if(s[i]=='c'):
        c+=1

if(abs(a-b)<2 and abs(c-b)<2 and abs(c-a)<2):
    print("YES")
else:
    print("NO")
   

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

#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
using vl = vector<ll>;
using vvl = vector<vl>;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
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;
}

void print(const std::vector<ll> &v) {
    std::for_each(v.begin(), v.end(), [](ll x) { std::cout << x << " "; });
    std::cout << std::endl;
}
//三種類の文字しか含まない
int main() {
    string S;
    cin >> S;
    map<char, int> cnt;
    REP(i, S.length()) { cnt[S[i]]++; }
    if(S.length() == 1) {
        cout << "YES" << endl;
        return 0;
    }
    int kinds = 0;
    if(cnt['a'] != 0) {
        kinds++;
    }
    if(cnt['b'] != 0) {
        kinds++;
    }
    if(cnt['c'] != 0) {
        kinds++;
    }
    if(kinds == 1 and S.length() > 1) {
        cout << "NO" << endl;
        return 0;
    }
    if(kinds == 2 and S.length() > 2) {
        cout << "NO" << endl;
        return 0;
    } else if(kinds == 2 and S.legnth() <= 2) {
        cout << "YES" << endl;
        return 0;
    }
    //三種類のときを考える
    int N = S.length();
    //全部同じ回数かどれか位置だけおおい
    bool flag = true;
    for(int i = 'a'; i <= 'c'; i++) {
        if(cnt[(char)i] == N / 3 or cnt[(char)i] == N / 3 + 1) {
            continue;
        } else {
            flag = false;
        }
    }
    if(flag) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:62:32: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'legnth'; did you mean 'length'?
   62 |     } else if(kinds == 2 and S.legnth() <= 2) {
      |                                ^~~~~~
      |                                length
Language: C++

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

int main()
{
    string s;
    cin >> s;
    int n = s.size();
    int b[3] {0};
    for(int i = 0; i < n; i++) b[s[i] - 'a']++;
    sort(b, b + 3);
    if(b[2] - b[0] <= 1) cout << "YES" << endl;
    else cout << "NO" << endl;
}

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

#include<iostream>
#include<vector>
#include<string>
#include<set>
#include<queue>
using namespace std;

#define MIN(a,b) ((a)<(b)?(a):(b))

int main() {
	string s;
	cin >> s;
	sort(s.begin(), s.end());
	char tmp=s[0 ];
	for (int i = 1; i < s.size();) {
		if (s[i] == s[i - 1]) {
			s.erase(s.begin() + i-1, s.begin() + i+1);
		}
		else {
			i++;
		}
	}
	if (s.size() % 2 !=1) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}
	return 0;
}

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

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

int main(){
  string s,base="abc"; cin>>s;
  int ca=0,cb=0,cc=0;
  for(int i=0;i<s.size();i++){
    if(s[i]==base[0]) ca++;
    else if(s[i]==base[1]) cb++;
    else cc++;
  }
  int x=s.size()/3;
  ca-=x；cb-=x; cc-=x;
  if(ca>=0 && ca<2 && cb>=0 && cb<2 && cc>=0 && cc<2){
    cout<<"YES"<<endl;
  }else{
    cout<<"NO"<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:7: error: 'x\U0000ff1bcb' was not declared in this scope
   13 |   ca-=x；cb-=x; cc-=x;
      |       ^~~~~
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:17:32: error: expected primary-expression before '||' token
   17 |   if(a[0]==a[1] && a[1]==a[2]) || (a[0]==a[1] && a[1]==a[2]-1) || a[0]+1==a[1] && a[1]==a[2]){
      |                                ^~
Language: C++

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


int main(){
	string S;
  	cin>>S;
  	int act=0,bct=0,cct=0;
  	for(int k=0;k<S.size();k++){
      if(S.at(k)=='a') act++;
      else if(S.at(k)=='b') bct++;
      else cct++;
    }
  
	if(abs(abt-cct)<=1&&abs(bbt-cct)<=1&&abs(cct-bbt)<=1){
      cout<<"YES"<<endl;
    }else{
      cout<<"NO"<<endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:16: error: 'abt' was not declared in this scope; did you mean 'act'?
   15 |         if(abs(abt-cct)<=1&&abs(bbt-cct)<=1&&abs(cct-bbt)<=1){
      |                ^~~
      |                act
a.cc:15:33: error: 'bbt' was not declared in this scope; did you mean 'bct'?
   15 |         if(abs(abt-cct)<=1&&abs(bbt-cct)<=1&&abs(cct-bbt)<=1){
      |                                 ^~~
      |                                 bct
Language: Java

import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    int a = 0, b = 0, c = 0;
    for (int i = 0; i < S.length(); i++) {
      char x = S.charAt(i);
      if (x == 'a') a++;
      if (x == 'b') b++;
      if (x == 'c') c++;
    }
    boolean ans = Math.max(Math.max(a,b),c)-Math.min(Math.min(a,b),c) <= 1) {
    System.out.println(ans ? "YES" : " NO");
  }
}


Compiler output:
Main.java:14: error: ';' expected
    boolean ans = Math.max(Math.max(a,b),c)-Math.min(Math.min(a,b),c) <= 1) {
                                                                          ^
Main.java:17: error: reached end of file while parsing
}
 ^
2 errors
Language: Java

import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    int a = 0, b = 0, c = 0;
    for (int i = 0; i < S.length(); i++) {
      char x = S.charAt(i);
      if (x == 'a') a++;
      if (x == 'b') b++;
      if (x == 'c') c++;
    }
    if (Math.max(Math.max(a,b),c)-Math.min(Marh.min(a,b),c) <= 1) {
      System.out.println("YES");
    } else {
      System.out.println("NO");
    } 
  }
}


Compiler output:
Main.java:14: error: cannot find symbol
    if (Math.max(Math.max(a,b),c)-Math.min(Marh.min(a,b),c) <= 1) {
                                           ^
  symbol:   variable Marh
  location: class Main
1 error
Language: C++

#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include <numeric>
#include<map>
#include<unordered_map>
#include <queue>
 
using namespace std;
using ll=long long;
#define rep(i,n)  for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()

int main(){
    string s;
    cin >> s;
    vector<ll> cnt(3, 0);
    rep(i, s.size()){ 
        cnt[s[i]-'a']++;
    }
    sort(ALL(cnt), greater<ll>());
    // cout << cnt[0] << " & " << cnt[1] << " & " << cnt[2] << endl;
    if(cnt[0]==cnt[1] && cnt[1]-cnt[0] <= 1)cout << "YES\n";
    else if(cnt[1]==cnt[2]&&cnt[0]-cnt[1]<=1)cout << "YES\n"
    else cout << "NO\n";
    

}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:61: error: expected ';' before 'else'
   27 |     else if(cnt[1]==cnt[2]&&cnt[0]-cnt[1]<=1)cout << "YES\n"
      |                                                             ^
      |                                                             ;
   28 |     else cout << "NO\n";
      |     ~~~~
Language: C++

#include "bits/stdc++.h"
using namespace std;
#define int long long
#define double long double
#define low lower_bound
#define upp upper_bound
#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define Rep(i,n) for (int i = (int)(n); i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define rever(vec) reverse(all(vec));
#define cend printf("\n");
#define prique(T) priority_queue<T, vector<T>, greater<T>>
#define prique2(T) priority_queue<T>

struct edge { int to, cost; };
using P = pair<int, int>;
using PP = pair<P, int>;
using D = pair<double, double>;
const int mod2 = 998244353;
const int mod = (int)1e9 + 7, inf = (int)1e16;
const string sp = " ";
template<class T> inline void chmax(T& a, T b) { a = max(a, b); }
template<class T> inline void chmin(T& a, T b) { a = min(a, b); }

int modpow(int x, int n) {
	int ans = 1;
	while (n > 0) {
		if (n & 1) {
			ans *= x;
			if (mod <= ans) ans %= mod;
		}
		x *= x;
		if (mod <= x) x %= mod;
		n >>= 1;
	}
	return ans;
}

int fact[1000000];
void f_init(int n) {
	if (1000000 <= n) return;
	fact[0] = fact[1] = 1;
	for (int i = 2; i <= n; ++i) {
		fact[i] *= fact[i - 1];
		if (mod <= fact[i]) fact[i] %= mod;
	}
	return;
}

int comb(int n, int r) {
	if (n < r) return 0;
	int ans = fact[n] * modpow(fact[n - r], mod - 2) % mod * modpow(fact[r], mod - 2);
	if (ans < 0) return ans + mod;
	return ans;
}

int perm(int n, int r) {
	if (n < r) return 0;
	if (n - r < r) r = n - r;
	int ans= fact[n] * modpow(fact[n - r], mod - 2) % mod;
	if (ans < 0) return ans + mod;
	return ans;
}

int gcd(int a, int b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

int lcm(int a, int b) {
	return a / gcd(a, b) * b;
}

bool pri(int p) {
	for (int i = 2; i * i <= p; ++i) if (p % i == 0) return false;
	return p > 1;
}

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

string s;
int n;
int cnt[3];
signed main() {
  cin>>s;
  n=s.size();
  rep(i,n) {
    cnt[s[i]-'a']++;
  }
  if(max{cnt[0],cnt[1],cnt[2]}>=min{cnt[0],cnt[1],cnt[2]}-1) puts("YES");
  else puts("NO");
}

Compiler output:
a.cc: In function 'int main()':
a.cc:100:9: error: expected ')' before '{' token
  100 |   if(max{cnt[0],cnt[1],cnt[2]}>=min{cnt[0],cnt[1],cnt[2]}-1) puts("YES");
      |     ~   ^
      |         )
a.cc:100:60: error: cannot resolve overloaded function 'max' based on conversion to type 'bool'
  100 |   if(max{cnt[0],cnt[1],cnt[2]}>=min{cnt[0],cnt[1],cnt[2]}-1) puts("YES");
      |                                                            ^
Language: C++

#include "bits/stdc++.h"
using namespace std;
#define int long long
#define double long double
#define low lower_bound
#define upp upper_bound
#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define Rep(i,n) for (int i = (int)(n); i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define rever(vec) reverse(all(vec));
#define cend printf("\n");
#define prique(T) priority_queue<T, vector<T>, greater<T>>
#define prique2(T) priority_queue<T>

struct edge { int to, cost; };
using P = pair<int, int>;
using PP = pair<P, int>;
using D = pair<double, double>;
const int mod2 = 998244353;
const int mod = (int)1e9 + 7, inf = (int)1e16;
const string sp = " ";
template<class T> inline void chmax(T& a, T b) { a = max(a, b); }
template<class T> inline void chmin(T& a, T b) { a = min(a, b); }

int modpow(int x, int n) {
	int ans = 1;
	while (n > 0) {
		if (n & 1) {
			ans *= x;
			if (mod <= ans) ans %= mod;
		}
		x *= x;
		if (mod <= x) x %= mod;
		n >>= 1;
	}
	return ans;
}

int fact[1000000];
void f_init(int n) {
	if (1000000 <= n) return;
	fact[0] = fact[1] = 1;
	for (int i = 2; i <= n; ++i) {
		fact[i] *= fact[i - 1];
		if (mod <= fact[i]) fact[i] %= mod;
	}
	return;
}

int comb(int n, int r) {
	if (n < r) return 0;
	int ans = fact[n] * modpow(fact[n - r], mod - 2) % mod * modpow(fact[r], mod - 2);
	if (ans < 0) return ans + mod;
	return ans;
}

int perm(int n, int r) {
	if (n < r) return 0;
	if (n - r < r) r = n - r;
	int ans= fact[n] * modpow(fact[n - r], mod - 2) % mod;
	if (ans < 0) return ans + mod;
	return ans;
}

int gcd(int a, int b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

int lcm(int a, int b) {
	return a / gcd(a, b) * b;
}

bool pri(int p) {
	for (int i = 2; i * i <= p; ++i) if (p % i == 0) return false;
	return p > 1;
}

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

string s;
int n;
int cnt[3];
signed main() {
  cin>>s;
  n=s.size();
  rep(i,n) {
    cnt[s[i]-'a']++;
  }
  if(max{cnt[0],cnt[1],cnt[2]}>=min{cnt[0],cnt[1],cnt[2]}-1) puts("YES");
  else puts("NO");

Compiler output:
a.cc: In function 'int main()':
a.cc:100:9: error: expected ')' before '{' token
  100 |   if(max{cnt[0],cnt[1],cnt[2]}>=min{cnt[0],cnt[1],cnt[2]}-1) puts("YES");
      |     ~   ^
      |         )
a.cc:100:60: error: cannot resolve overloaded function 'max' based on conversion to type 'bool'
  100 |   if(max{cnt[0],cnt[1],cnt[2]}>=min{cnt[0],cnt[1],cnt[2]}-1) puts("YES");
      |                                                            ^
a.cc:101:19: error: expected '}' at end of input
  101 |   else puts("NO");
      |                   ^
a.cc:94:15: note: to match this '{'
   94 | signed main() {
      |               ^
Language: C++

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

int main() {
  string s; cin >> s;
  vector<int> d(3, 0);
  for(int i = 0; i < s.size(); ++i) {
    d[s[i] - 'a']++;
  }
  sort(d.begin(), d.end());
  if(d[2] - d[0] <= 1) {
    std::cout << "YES" << std::endl;
  } else {
    std::cout << "NO" << std::endl;
  }
  return 0;
}


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

import java.io.PrintStream;
import java.util.Arrays;
import java.util.Scanner;

import library.common.Predef;

public class Main {
    static final Scanner     sc = new Scanner(System.in);
    static final PrintStream so = System.out;
    public static void main(String[] args) {
        char[] s = nchars();
        int[] count = new int[3];
        for (int i = 0; i < s.length; i++) {
            count[s[i] - 'a']++;
        }
        Arrays.sort(count);
        so.println(count[2] - count[0] <= 1 ? "YES" : "NO");
    }

    private static long nlong() {
        return sc.nextLong();
    }

    private static int nint() {
        return sc.nextInt();
    }

    private static String nstr() {
        return sc.next();
    }

    private static char[] nchars() {
        return sc.next().toCharArray();
    }

    private static long[] nlongs(int n) {
        return nlongs(n, 0, 0);
    }
    
    private static int[] nints(int n) {
        return nints(n, 0, 0);
    }

    private static int[] nints(int n, int padL, int padR) {
        int[] a = new int[padL + n + padR];
        for (int i = 0; i < n; i++)
            a[padL + i] = nint();
        return a;
    }

    private static long[] nlongs(int n, int padL, int padR) {
        long[] a = new long[padL + n + padR];
        for (int i = 0; i < n; i++)
            a[padL + i] = nlong();
        return a;
    }
    
    private static String[] nstrs(int n) {
        String[] a = new String[n];
        for (int i = 0; i < n; i++)
            a[i] = nstr();
        return a;
    }
    
    private static char[][] nchars2D(int h, int w) {
        return nchars2D(h, w, 0);
    }
    
    private static char[][] nchars2D(int h, int w, int pad) {
        char[][] a2 = new char[h+pad*2][w+pad*2];
        for(int i = 0; i < h; i++)
            System.arraycopy(nchars(), 0, a2[pad+i], pad, w);
        return a2;
    }
}


Compiler output:
Main.java:5: error: package library.common does not exist
import library.common.Predef;
                     ^
1 error
Language: C++

https://atcoder.jp/contests/cf17-final/submit?taskScreenName=cf17_final_b#include<bits/stdc++.h>
using namespace std;

string str;

map<char,int> mapa;

int main(){
	mapa['a'] = 0;
	mapa['b'] = 0;
	mapa['c'] = 0;
	cin >> str;
	int mini = 0x3f3f3f3f;
	for(auto &it: str){
		mapa[it] ++ ;
	}
	
	for(auto &it : mapa)
		mini = min(mini, mapa[it.first]);
	for(auto &it: mapa)
		it.second -= mini;
	int c = 0;
	
	for(auto &it: mapa){
		if(it.second >= 2)
			c = 100;
		else if(it.second)
			c++;
	}
	if(c <= 2)
		cout<<"YES";
	else
		cout<<"NO";
}

Compiler output:
a.cc:1:1: error: 'https' does not name a type
    1 | https://atcoder.jp/contests/cf17-final/submit?taskScreenName=cf17_final_b#include<bits/stdc++.h>
      | ^~~~~
a.cc:4:1: error: 'string' does not name a type
    4 | string str;
      | ^~~~~~
a.cc:6:1: error: 'map' does not name a type
    6 | map<char,int> mapa;
      | ^~~
a.cc: In function 'int main()':
a.cc:9:9: error: 'mapa' was not declared in this scope
    9 |         mapa['a'] = 0;
      |         ^~~~
a.cc:12:9: error: 'cin' was not declared in this scope
   12 |         cin >> str;
      |         ^~~
a.cc:12:16: error: 'str' was not declared in this scope; did you mean 'std'?
   12 |         cin >> str;
      |                ^~~
      |                std
a.cc:19:24: error: 'min' was not declared in this scope; did you mean 'mini'?
   19 |                 mini = min(mini, mapa[it.first]);
      |                        ^~~
      |                        mini
a.cc:31:17: error: 'cout' was not declared in this scope
   31 |                 cout<<"YES";
      |                 ^~~~
a.cc:33:17: error: 'cout' was not declared in this scope
   33 |                 cout<<"NO";
      |                 ^~~~
Language: C++

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


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

    string s;
    cin>>s;
    int n=s.size();
    int cnt[3]={};
    for(int i=0;i<n;i++){
        cnt[s[i]-'a']++;
    }
    bool ok=true;
    if(n==1){
        cout<<"Yes"<<endl;
        return 0;
    }
    if(n==2){
        for(int i=0;i<3;i++){
            if(cny[i]==2) ok=false;
        }
        if(ok){
            cout<<"Yes"<<endl
        }
        else cout<<"No"<<endl;
        return 0;
    }
    for (int i = 0; i < 3; i++)
    {
        if(cnt[i]==0) ok=false;
        int k=(n+(3-n%3)%3)/3;
        if(cnt[i]>k) ok=false;
    }
    if(ok){
        cout<<"YES"<<endl;
    }
    else cout<<"NO"<<endl;

    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:16: error: 'cny' was not declared in this scope; did you mean 'cnt'?
   23 |             if(cny[i]==2) ok=false;
      |                ^~~
      |                cnt
a.cc:26:30: error: expected ';' before '}' token
   26 |             cout<<"Yes"<<endl
      |                              ^
      |                              ;
   27 |         }
      |         ~
Language: C++

#include<stdio.h>
#include<string.h>
#include<time.h>
#include<math.h>
#include<stdlib.h>
#include<iostream>
#include<iomanip>
#include<utility>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#define ll long long
#define fi first
#define sec second
#define pb push_back
#define mp make_pair
#define rep(a,b,c) for(int a=1;a<=b;a+=c)
#define repp(a,b,c,d) for(int a=b;a<=c;a+=d)

const double PI=acos(-1);
const double EPS=1e-12;
const int MOD=1e9+7;
const int INF=1<<30;


using namespace std;

int main(){
	ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	int a=0,b=0,c=0;
	string s; 
	cin>>s; 
	int len=s.length();
	repp(i,0,len-1,1){
		if(s[i]=='a')a++
		else if(s[i]=='b')b++;
		else c++;
	}
	int maxx=max(max(a,b),c);
	int minn=min(min(a,b),c);
	if(maxx-minn<=1)cout<<"YES"<<endl; 
	else cout<<"NO"<<endl; 
	return 0;
}

    

Compiler output:
a.cc: In function 'int main()':
a.cc:37:33: error: expected ';' before 'else'
   37 |                 if(s[i]=='a')a++
      |                                 ^
      |                                 ;
   38 |                 else if(s[i]=='b')b++;
      |                 ~~~~
Language: C++

#include "bits/stdc++.h"

using namespace std;

typedef pair<int, int> P;
#define int long long
#define ll long long
#define mod 1000000007
#define INF (1LL<<60)

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)


signed main(){

	string s;
	cin >> s;
	int a[3] = {0,0,0};
	for (int i = 0; i < s.length(); i++)
		a[s[i] - 'a']++;
	sort(a, a + 3);

	if (a[2] - a[0] <= 1)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;


	return 0;
}#include "bits/stdc++.h"

using namespace std;

typedef pair<int, int> P;
#define int long long
#define ll long long
#define mod 1000000007
#define INF (1LL<<60)

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)


signed main(){

	string s;
	cin >> s;
	int a[3] = {0,0,0};
	for (int i = 0; i < s.length(); i++)
		a[s[i] - 'a']++;
	sort(a, a + 3);

	if (a[2] - a[0] <= 1)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;


	return 0;
}

Compiler output:
a.cc:30:2: error: stray '#' in program
   30 | }#include "bits/stdc++.h"
      |  ^
a.cc:30:3: error: 'include' does not name a type
   30 | }#include "bits/stdc++.h"
      |   ^~~~~~~
a.cc:34:24: error: conflicting declaration 'typedef struct std::pair<long long int, long long int> P'
   34 | typedef pair<int, int> P;
      |                        ^
a.cc:5:24: note: previous declaration as 'typedef struct std::pair<int, int> P'
    5 | typedef pair<int, int> P;
      |                        ^
a.cc:43:8: error: redefinition of 'int main()'
   43 | signed main(){
      |        ^~~~
a.cc:14:8: note: 'int main()' previously defined here
   14 | signed main(){
      |        ^~~~
Language: C++

#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
const int MX = 200005;

    // 整数スキャン（複数）
    /*
    int x;
    scanf("%d",&x);
    int y;
    scanf("%d",&y);
    int z;
    scanf("%d",&z);

    // n個の整数のスキャン
    /*
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    */

    // 文字列スキャン
    /*
    string s;
    cin >> s;
    */

    // n個の文字列スキャン
    /*
    vector<string> slist;
    rep(i,n){
        string s;
        cin >> s;
        slist.push_back(s);
    }
    */

int main() {
    string s;
    cin >> s;
    int a[3]={};
    rep(i,s.size()){
        if(s[i]=='a'){
            a[0];
        }
        if(s[i]=='b'){
            a[1];
        }
        if(s[i]=='c'){
            a[2];
        } 
    }
    int ma=0;
    int mi=99999999;
    rep(i,3){
        maxs(ma,a[i]);
        mins(mi,a[i]);
    }
    if(max-min<=1)yn;



    return 0;
}
 
 


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

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

const int maxn = 1e5+5;
char s[maxn];
int t[3];

int main()
{
    gets(s);
    for(int i = 0; i < strlen(s); i++)
    {
        if(s[i] == 'a')
            t[0]++;
        if(s[i] == 'b')
            t[1]++;
        if(s[i] == 'c')
            t[2]++;
    }
    sort(t,t+3);
    if(t[2]-t[0] >= 2)
        printf("NO\n");
    else
        printf("YES\n");
    return 0;
}


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

#include<bits/stdc++.h>
#include <iostream>
#include <stdio.h>
using namespace std;
int main()
{
    char s[100100],i,num_a=0,num_b=0,num_c=0;
    scanf("%s",s);
    int n=strlen(s);
    for(i=0;i<n;i++)
    {
        if(s[i]=='a') num_a++;
        else if(s[i]=='b') num_b++;
        else (s[i]=='c') num_c++;
    }
    int m=max(num_a,max(num_b,num_c));
    if(m-num_a<2&&m-num_b<2&&m-num_c<2) printf("YES");
    else printf("NO");
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:25: error: expected ';' before 'num_c'
   14 |         else (s[i]=='c') num_c++;
      |                         ^~~~~~
      |                         ;
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,m,k,t,cot=0;
int main()
{
    char s[100005];
    int a=0,b=0,c=0;
    gets(s);
    int n=strlen(s);
    for(int i=0;i<n;i++)
    {
        if(s[i]=='a')
            a++;
        else if(s[i]=='b')
            b++;
        else
            c++;
    }
    if(a+b>=c||a+c>=b||c+b>=a)
    {
        if(a<=2*c&&a<=2*b&&b<=a*2&&b<=2*c&&c<=2*a&&c<=2*b)
            printf("YES");
        else
            printf("NO");
    }
    else
        printf("NO");
    return 0;
}


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

#include<cstdio>
#include<cmath>
#include<cstring>
using namespace std;

const int maxn = 1e5+5;
char s[maxn];

int main()
{
    while(gets(s)!=NULL)
    {
        int a = 0, b = 0, c = 0;
        int num = 0;
        for(int i = 0; i < strlen(s); i++)
        {
            if(s[i] == 'a')
            {
                a++;
                if(a == 1)
                    num++;
            }
            if(s[i] == 'b')
            {
                b++;
                if(b == 1)
                    num++;
            }
            if(s[i] == 'c')
            {
                c++;
                if(c == 1)
                    num++;
            }
        }
        if(num == 3)
        {
            int t1 = abs(a-b);
            int t2 = abs(b-c);
            int t3 = abs(a-c);
            if(t1>1 || t2>1 || t3>1)
                printf("NO\n");
            else
                printf("YES\n");
        }
        else if(num == 1 && (a==1||b==1||c==1))
        {
            printf("YES\n");
        }
        else
            printf("NO\n");
    }
    return 0;
}


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

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

const int maxn = 1e5+5;
char s[maxn];

int main()
{
    while(gets(s)!=NULL)
    {
        int a = 0, b = 0, c = 0;
        int num = 0;
        for(int i = 0; i < strlen(s); i++)
        {
            if(s[i] == 'a')
            {
                a++;
                if(a == 1)
                    num++;
            }
            if(s[i] == 'b')
            {
                b++;
                if(b == 1)
                    num++;
            }
            if(s[i] == 'c')
            {
                c++;
                if(c == 1)
                    num++;
            }
        }
        if(num == 3)
        {
            int t1 = abs(a-b);
            int t2 = abs(b-c);
            int t3 = abs(a-c);
            if(t1>1 || t2>1 || t3>1)
                printf("NO\n");
            else
                printf("YES\n");
        }
        else if(num == 1 && (a==1||b==1||c==1))
        {
            printf("YES\n");
        }
        else
            printf("NO\n");
    }
    return 0;
}


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

#include <cstring>
#include <cstdio>

#define abs(k) (k > 0 ? k : -k)

int a[3];
char s[100010];

int main() {
	gets(s);
	for (int i = 0; i < strlen(s); i++) {
		a[s[i] - 'a'] ++;
	}
	if (abs(a[0] - a[1]) < 2 && abs(a[0] - a[2]) < 2 && abs(a[1] - a[2]) < 2) puts("YES");
	else puts("NO");
	return 0;
}

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

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

signed main(){
    string s;cin>>s;
    int cnt[3]={};
    rep(i,s.size())cnt[s[i]-'a']++;
    sort(cnt,cnt+3);
    if(cnt[2]-cnt[0]<=1){
        cout<<"YES"<<endl;
    }#include<bits/stdc++.h>
using namespace std;

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

signed main(){
    string s;cin>>s;
    int cnt[3]={};
    rep(i,s.size())cnt[s[i]-'a']++;
    sort(cnt,cnt+3);
    if(cnt[2]-cnt[0]<=1){
        cout<<"YES"<<endl;
    }
    else{
        cout<<"NO"<<endl;
    }
    return 0;
}

    else{
        cout<<"NO"<<endl;
    }
    return 0;
}


Compiler output:
a.cc:25:6: error: stray '#' in program
   25 |     }#include<bits/stdc++.h>
      |      ^
a.cc: In function 'int main()':
a.cc:25:7: error: 'include' was not declared in this scope
   25 |     }#include<bits/stdc++.h>
      |       ^~~~~~~
a.cc:25:15: error: 'bits' was not declared in this scope
   25 |     }#include<bits/stdc++.h>
      |               ^~~~
a.cc:25:20: error: 'stdc' was not declared in this scope; did you mean 'std'?
   25 |     }#include<bits/stdc++.h>
      |                    ^~~~
      |                    std
a.cc:26:1: error: expected primary-expression before 'using'
   26 | using namespace std;
      | ^~~~~
a.cc:39:1: error: a template declaration cannot appear at block scope
   39 | template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
      | ^~~~~~~~
a.cc:42:12: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   42 | signed main(){
      |            ^~
a.cc:42:12: note: remove parentheses to default-initialize a variable
   42 | signed main(){
      |            ^~
      |            --
a.cc:42:12: note: or replace parentheses with braces to value-initialize a variable
a.cc:42:14: error: a function-definition is not allowed here before '{' token
   42 | signed main(){
      |              ^
a.cc:56:5: error: 'else' without a previous 'if'
   56 |     else{
      |     ^~~~
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define debug(var) do{cout << #var << " : "; view(var);}while(0)
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
template<class T> void view(T e) {cout << e << endl;}
template<class T> void view(const vector<T> &v) {for(const auto &e : v){cout << e << " ";} cout << endl;}
template<class T> void view(const vector<vector<T>> &vv) {for(const auto &v : vv){view(v);}}
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

int main() {
    int n; cin >> n;
    map<int,int> mp;
    mp[0] = 1;
    rep(i,n) {
        int x; cin >> x;
        mp[x]++;
    }
    bool corner = false;
    if (mp[0] >= 2 || mp[12] >= 2) coner = true;
    vint search;
    vint x;
    for (P p : mp) {
        if (p.second >= 3) corner = true;
        if (p.first == 0 || p.first == 12) x.push_back(p.first);
        else {
            if (p.second == 1) search.push_back(p.first);
            if (p.second == 2) {
                x.push_back(p.first);
                x.push_back(24-p.first);
            }
        }
    }
    if (corner) cout << 0 << endl;
    else {
        int n_ = search.size();
        int ans = 0;
        rep(i,1<<n_) {
            vint tmp = x;
            rep(j,n_) {
                if (i>>j&1) tmp.push_back(search[j]);
                else tmp.push_back((24-search[j])%24);
            }
            int diff = inf;
            rep(i,tmp.size())rep(j,i) diff = min(diff,abs(tmp[i]-tmp[j]));
            ans = max(diff,ans);
        }
        cout << ans << endl;
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:36: error: 'coner' was not declared in this scope; did you mean 'corner'?
   32 |     if (mp[0] >= 2 || mp[12] >= 2) coner = true;
      |                                    ^~~~~
      |                                    corner
Language: C++

    #include<iostream>
    #include<stdio.h>
    //#include <bits/stdc++.h>
    #include<vector>
    #include<float.h>
    #include<iomanip>
    #include<algorithm>
    #include<string>
    #include<cstring>
    #include<math.h>
    #include<cmath>
    #include<sstream>
    #include<set>
    #include<map>
    #include<queue>
    #include<cassert>
    #include<cmath>
    #include<cstdint>
     
    #define INF 1e9
    #define rep(i,n)for(int i=0;(i)<(int)(n);i++)
    #define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
    #define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
    #define vec(type,n) vector<type>(n)
    #define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
    #define ALL(a)  (a).begin(),(a).end()
    #define chmin(a, b) a = min(a, b)
    #define chmax(a, b) a = max(a, b)
     
    using namespace std;
    using ll = long long;
    using Graph = vector<vector<int>>;
    using P = pair<ll, ll>;
     
const int MOD = 1e9 + 7;

vector<ll>bitSearch(int bit,int n){
    vector<ll>S;
    rep(i,n)if(bit&(1<<i))S.push_back(i);
    S.push_back(1e9);
    return S;
}


int main(){
   int n;
   cin >> n;
   if(n >= 24){
      cout << 0 << endl;
      return 0;
   }
   vector<int> a(n);
   rep(i, n)cin >> a[i];
   vector<int> d(50, 0), list;

   rep(i, n){
      d[a[i]]++;
   }

   int res = 0;
   d[0]++;
   rep(i, 13){
      if(d[i] > 0)list.push_back(i);
      if(d[i] > 2 || (i % 12 = 0 && d[i] > 1)){
         cout << 0 << endl;
         return 0;
      }
   }
   
   for(int bit = 0; bit <= (1 << list.size()); bit++){
      auto S = bitSearch(bit, (int)list.size());
      auto tmp = list;
      int sz = tmp.size();
      rep(i, sz){
         int now = tmp[i];
         if(i == *lower_bound(ALL(S), i))tmp[i] = (24 - tmp[i]) % 24;
         if(d[now] == 2)tmp.push_back((24 - tmp[i]) % 24);
      }
      int dif = INF;
      sort(ALL(tmp));
      rep(i, (int)tmp.size()){
         REP(j, i + 1, (int)tmp.size() - 1){
            chmin(dif, abs(tmp[i] - tmp[j]));
         }
      }
      chmax(res, dif);
   }
   cout << res << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:64:25: error: lvalue required as left operand of assignment
   64 |       if(d[i] > 2 || (i % 12 = 0 && d[i] > 1)){
      |                       ~~^~~~
Language: C++

#include <iostream>
#include <vector>
using namespace std;
int INF = 12;
int main(){
	int N;
	cin >> N;
	vector<int> D(N);
	for (int i = 0; i < N; i++){
		cin >> D[i];
	}
	vector<int> cnt(13, 0);
	cnt[0]++;
	for (int i = 0; i < N; i++){
		cnt[D[i]]++;
	}
	bool zero = false;
	if (cnt[0] >= 2 || cnt[12] >= 2){
		zero = true;
	}
	for (int i = 1; i <= 11; i++){
		if (cnt[i] >= 3){
			zero = true;
		}
	}
	if (zero){
		cout << 0 << endl;
	} else {
		int ans = 0;
		for (int i = 0; i < (1 << 11); i++){
			vector<int> t;
			for (int j = 0; j <= 12; j++){
				if (cnt[j] == 1){
					if (j == 0){
						t.push_back(0);
						t.push_back(24);
					} else if (j == 12){
						t.push_back(12);
					} else {
						if (i >> (j - 1) & 1){
							t.push_back(24 - j);
						} else {
							t.push_back(j);
						}
					}
				}
				if (cnt[j] == 2){
					t.push_back(j);
					t.push_back(24 - j);
				}
			}
			sort(t.begin(), t.end());
			int s = INF;
			int sz = t.size();
			for (int j = 0; j < sz - 1; j++){
				s = min(s, t[j + 1] - t[j]);
			}
			ans = max(ans, s);
		}
		cout << ans << endl;
	}
}

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

#include <bits/stdc++.h>

using ll = long long;
using namespace std;

int main() {
    ll n;cin >> n;
    if(n >= 23){
        cout<<0<<endl;
        return;
    }
    vector<int> v;
    map<int, int> mp;
    for(int i = 0;i < n;i++){
        int d;cin >> d;
        v.push_back(d);
        mp[d]++;
    }
    for(auto a : mp){
        if(a.first == 0){
            if(a.second >= 1){
                cout<<0<<endl;
                return 0;
            }
        }else{
            if(a.second >= 3){
                cout<<0<<endl;
                return 0;
            }
        }
    }
 
    vector<int> vf(24);
    vf[0] = 1;
    if(mp[0] >= 1){
        cout<<0<<endl;
        return 0;
    }
    vector<int> c;
    for(auto a : mp){
        if(a.first == 0)continue;
        if(a.second == 2){
            vf[a.first] = 1;
            vf[24 - a.first] = 1;
        }else if(a.second == 1){
            c.push_back(a.first);
        }
    }
    vector<int> fff(c.size());
    int ans = 0;
    auto check = [&](){
        vector<int> vvv = vf;
        for(int i = 0;i < c.size();i++){
            if(fff[i] == 0){
                vvv[c[i]] = 1;
            }else{
                vvv[24 - c[i]] = 1;
            }
        }
        int ss = 1e9;
        for(int i = 0;i < 23;i++){
            for(int j = i + 1;j < 24;j++){
                if(vvv[i] == 1 && vvv[j] == 1)ss = min(j - i, ss);
            }
        }
        ans = max(ans, ss);
    };
    function<void(int)> f = [&](int i){
        if(i == c.size()){
            check();
            return;
        }
        fff[i] = 0;f(i + 1);
        fff[i] = 1;f(i + 1);
    };
    f(0);
    cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:9: error: return-statement with no value, in function returning 'int' [-fpermissive]
   10 |         return;
      |         ^~~~~~
Language: C++

#include <bits/stdc++.h>

using ll = long long;
using namespace std;

int main() {
    ll n;cin >> n;
    if(n >= 23){
        cout<<0<<endl;
        return;
    }
    vector<int> v;
    map<int, int> mp;
    for(int i = 0;i < n;i++){
        int d;cin >> d;
        v.push_back(d);
        mp[d]++;
    }
    for(auto a : mp){
        if(a.first == 0){
            if(a.second >= 1){
                cout<<0<<endl;
                return 0;
            }
        }else{
            if(a.second >= 3){
                cout<<0<<endl;
                return 0;
            }
        }
    }
    if(n + 1 >= 23){
        cout<<0<<endl;
        return 0;
    }
    vector<int> vf(24);
    vf[0] = 1;
    if(mp[0] >= 1){
        cout<<0<<endl;
        return 0;
    }
    vector<int> c;
    for(auto a : mp){
        if(a.first == 0)continue;
        if(a.second == 2){
            vf[a.first] = 1;
            vf[24 - a.first] = 1;
        }else if(a.second == 1){
            c.push_back(a.first);
        }
    }
    vector<int> fff(c.size());
    int ans = 0;
    auto check = [&](){
        vector<int> vvv = vf;
        for(int i = 0;i < c.size();i++){
            if(fff[i] == 0){
                vvv[c[i]] = 1;
            }else{
                vvv[24 - c[i]] = 1;
            }
        }
        int ss = 1e9;
        for(int i = 0;i < 23;i++){
            for(int j = i + 1;j < 24;j++){
                if(vvv[i] == 1 && vvv[j] == 1)ss = min(j - i, ss);
            }
        }
        ans = max(ans, ss);
    };
    function<void(int)> f = [&](int i){
        if(i == c.size()){
            check();
            return;
        }
        fff[i] = 0;f(i + 1);
        fff[i] = 1;f(i + 1);
    };
    f(0);
    cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:9: error: return-statement with no value, in function returning 'int' [-fpermissive]
   10 |         return;
      |         ^~~~~~
Language: C++

#include <bits/stdc++.h>

using ll = long long;
using namespace std;

int main() {
    ll n;cin >> n;
    vector<int> v;
    map<int, int> mp;
    for(int i = 0;i < n;i++){
        int d;cin >> d;
        v.push_back(d);
        mp[d]++;
    }
    for(auto a : mp){
        if(a.first == 0){
            if(a.second >= 1){
                cout<<0<<endl;
                return 0;
            }
        }else{
            if(a.second >= 2){
                cout<<0<<endl;
                return 0;
            }
        }
    }
    if(n + 1 >= 23){
        cout<<0<<endl;
        return 0;
    }
    int cnt = 0;
    mp[0]++;
    vector<int> v(24);
    bool f = true;
    for(auto a : mp){
        if(a.second == 2){
            v[a.first] = 2;
            v[24 - a.first - 1] = 2;
        }else if(a.second == 1){
            if(a.first == 0){
                v[a.first] = 2;
            }else{
                if(f){
                    v[a.first] = 2;
                }else{
                    v[23 - a.first] = 2;
                }
                f = !f;
            }
        }
    }
    int ans = 1e9;
    for(int i = 0;i < n - 1;i++){
        for(int j = i;j < n;j++){
            if(v[j] == 2 && v[i] == 2)ans = min(ans, min(j - i, 12 - j + i));    
        }
    }
    cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:17: error: redeclaration of 'std::vector<int> v'
   34 |     vector<int> v(24);
      |                 ^
a.cc:8:17: note: 'std::vector<int> v' previously declared here
    8 |     vector<int> v;
      |                 ^