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


#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>

typedef unsigned long long ULLONG;
typedef long long LLONG;
static const LLONG MOD_NUM = 1000000007;

template<class _T> static void getint(_T& a) {
	std::cin >> a;
}
template<class _T> static void getint(_T& a, _T& b) {
	std::cin >> a >> b;
}
template<class _T> static void getint(_T& a, _T& b, _T& c) {
	std::cin >> a >> b >> c;
}

static void CodeFes2017FinalC();

int main()
{
	CodeFes2017FinalC();
	fflush(stdout);
	return 0;
}

static int cf2017fC_dfs(const std::vector<int>& di, int idx, std::vector<int>& times)
{
	int orgSize = times.size();

	int time = 0;
	if (idx > 12){
		int size = times.size();
		if (size > 1) {
			time = 36;
			for (int i = 0; i < size; i++) {
				for (int j = i + 1; j < size; j++) {
					int diff = abs(times[i] - times[j]);
					diff = std::min(diff, 24 - diff);
					time = std::min(time, diff);
				}
			}
		}
	}
	else {
		if (di[idx] == 1) {
			times.push_back(idx);
			time = cf2017fC_dfs(di, idx + 1, times);
			times.erase(times.begin() + orgSize, times.end());
			times.push_back(24 - idx);
			time = std::max(time, cf2017fC_dfs(di, idx + 1, times));
		}
		else if (di[idx] == 0) {
			time = cf2017fC_dfs(di, idx + 1, times);
		}
		else if (di[idx] == 2) {
			times.push_back(idx);
			times.push_back(24 - idx);
			time = std::max(time, cf2017fC_dfs(di, idx + 1, times));
		}
	}
	return time;
}


Compiler output:
a.cc:28:13: warning: 'void CodeFes2017FinalC()' used but never defined
   28 | static void CodeFes2017FinalC();
      |             ^~~~~~~~~~~~~~~~~
/usr/bin/ld: /tmp/ccAfI2jv.o: in function `main':
a.cc:(.text+0x5): undefined reference to `CodeFes2017FinalC()'
collect2: error: ld returned 1 exit status
Language: C

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<stdint.h>
#include<tgmath.h>
#include<stdbool.h>
#include<sys/queue.h>
#include<time.h>
#define ll long long
#define min(a, b) ((a) > (b) ? (b) : (a))
#define max(a, b) ((a) > (b) ? (a) : (b))
int cmp(const int *a, const int *b){return *a - *b;}

int n, d[55];

int main(){
    scanf("%d", &n);
    for(int i=0; i<n; i++){
        scanf("%d", &d[i]);
    }
    a[n] = 0; n++;
    qsort(d, n, 4, cmp);
    for(int i=1; i<n; i++){
        if(d[i-1] > 0)d[i] *= -1;
    }
    qsort(d, n, 4, cmp);
    int ans = d[1] - d[0];
    for(int i=1; i<n; i++){
        ans = min(ans, d[i] - d[i-1]);
    }
    printf("%d\n", ans);
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:21:5: error: 'a' undeclared (first use in this function)
   21 |     a[n] = 0; n++;
      |     ^
main.c:21:5: note: each undeclared identifier is reported only once for each function it appears in
main.c:22:20: error: passing argument 4 of 'qsort' from incompatible pointer type [-Wincompatible-pointer-types]
   22 |     qsort(d, n, 4, cmp);
      |                    ^~~
      |                    |
      |                    int (*)(const int *, const int *)
In file included from main.c:2:
/usr/include/stdlib.h:971:34: note: expected '__compar_fn_t' {aka 'int (*)(const void *, const void *)'} but argument is of type 'int (*)(const int *, const int *)'
  971 |                    __compar_fn_t __compar) __nonnull ((1, 4));
      |                    ~~~~~~~~~~~~~~^~~~~~~~
main.c:26:20: error: passing argument 4 of 'qsort' from incompatible pointer type [-Wincompatible-pointer-types]
   26 |     qsort(d, n, 4, cmp);
      |                    ^~~
      |                    |
      |                    int (*)(const int *, const int *)
/usr/include/stdlib.h:971:34: note: expected '__compar_fn_t' {aka 'int (*)(const void *, const void *)'} but argument is of type 'int (*)(const int *, const int *)'
  971 |                    __compar_fn_t __compar) __nonnull ((1, 4));
      |                    ~~~~~~~~~~~~~~^~~~~~~~
Language: C

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pli = pair<ll, int>;
using pil = pair<int, ll>;
using uint = unsigned int;
template <typename T>
using Graph = vector<vector<T>>;
const int MOD = 1e9 + 7;
const ld PI = acosl(-1);

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

    int N;
    cin >> N;

    vector<int> cnt(13);
    cnt[0] = 1;
    bool iszero = false;
    for (int i = 0; i < N; ++i) {
        int a;
        cin >> a;
        cnt[a]++;
        if (cnt[a] >= 3)
            iszero = true;
    }

    if (iszero) {
        cout << 0 << endl;
        return 0;
    }

    int ans = 0;
    for (int i = 0; i < (1 << 13); ++i) {
        vector<int> v;
        for (int j = 0; j < 13; ++j) {
            if (!cnt[j])
                continue;
            if (cnt[j] == 2) {
                v.push_back(j);
                v.push_back(24 - j);
                continue;
            }
            if (i & (1 << j))
                v.push_back(24 - j);
            else
                v.push_back(j);
        }

        int siz = v.size();
        int res = 12;
        for (int j = 0; j < siz; ++j) {
            for (int k = j + 1; k < siz; ++k) {
                int dif = abs(v[j] - v[k]);
                res = min(res, min(dif, 24 - dif));
            }
        }
        ans = max(ans, res);
    }

    cout << ans << endl;
    return 0;
}


Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
#include <cassert>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define PI 3.14159265358979
using namespace std;
using ll = long long;
using P = pair<int, int>;
struct Edge
{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w) {}
};
// using Graph = vector<vector<Edge>>;
using Graph = vector<vector<int>>;

const long long INF = 1LL << 60;
const int INT_INF = 1000000000;

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

int count(vector<int> &vis)
{
  int mi = INT_INF;
  for (int i = 0; i < 24; i++)
  {
    for (int j = 0; j < 24; j++)
    {
      if (vis[i] && vis[j] && i != j)
      {
        int d1 = abs(i - j);
        int d2 = 24 - d1;
        int d = min(d1, d2);
        mi = min(mi, d);
      }
    }
  }
  return mi;
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N;
  cin >> N;
  vector<int> D(N);
  for (auto &it : D)
    cin >> it;

  vector<int> cnt(13);
  for (int i = 0; i < N; i++)
    cnt[D[i]]++;
  if (cnt[0])
  {
    cout << 0 << endl;
    return 0;
  }
  vis[0] = 1;
  vector<int> v;
  vector<int> vis(24);
  for (int i = 1; i < 12; i++)
  {
    if (cnt[i] == 1)
      v.push_back(i);
    else if (cnt[i] == 2)
      vis[i] = vis[24 - i] = 1;
    else if (2 < cnt[i])
    {
      cout << 0 << endl;
      return 0;
    }
  }
  if (cnt[12] == 1)
    vis[12] = 1;
  else if (2 <= cnt[12])
  {
    cout << 0 << endl;
    return 0;
  }

  int M = v.size();
  if (M == 0)
  {
    cout << count(vis) << endl;
    return 0;
  }

  int ans = 0;
  for (int bit = 0; bit < (1 << M); bit++)
  {
    for (int i = 0; i < M; i++)
    {
      if (bit & (1 << i))
      {
        vis[v[i]] = 1, vis[24 - v[i]] = 0;
      }
      else
      {
        vis[v[i]] = 0, vis[24 - v[i]] = 1;
      }
    }
    ans = max(ans, count(vis));
  }
  cout << ans << endl;
  return 0;
}

//  公式解説の図を基に考える．cnt[i]:=時間iの人の人数とする．まず，例外から考える．1 <= cnt[0]のとき，高橋君と被るので答えは0.cnt[12] == 0　その時間に人がいるのは間違いない．1 < cnt[12]そのなかの二人の答えが被るので答えは0.ほかのある時間t([1, 11])を考える．cnt[t] == 0なら人はいない．cnt[t] == 1ならば時間tか時間24-tに人がいる．これは分からないので全探索．cnt[t] == 2ならば時間tと時間24 - tのどちらにも人がいる．ここは確定．2 <= cnt[t]ならばどうやっても2人がいる時間ができてしまうため答えは0 あとはcnt[t] == 1である部分のみを全探索して距離の最小をチェックする．


Compiler output:
a.cc: In function 'int main()':
a.cc:60:3: error: 'vis' was not declared in this scope
   60 |   vis[0] = 1;
      |   ^~~
Language: C++

#include <bits/stdc++.h>

#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;
using namespace boost::adaptors;

int main() {
    int64_t n;
    cin >> n;

    vector<int64_t> c(13);
    for (auto i : irange(0L, n)) {
        int64_t d;
        cin >> d;
        ++c[d];
    }

    if (c[0] >= 1 || c[12] >= 2) {
        cout << 0 << endl;
        return 0;
    }

    vector<int64_t> h, h1;
    h1.push_back(0L);

    for (auto i : irange(1L, 13L)) {
        if (c[i] >= 3) {
            cout << 0 << endl;
            return 0;
        }

        if (c[i] == 2) {
            h1.push_back(i);
            h1.push_back(24 - i);
        }

        if (c[i] == 1) {
            h.push_back(i);
        }
    }

    int64_t ans = 0;
    for (auto s : irange(0uL, 1uL << h.size())) {
        bitset<12> bs(s);
        auto h2 = h1;

        for (auto i : irange(0uL, h.size())) {
            if (bs[i]) {
                h2.push_back(h[i]);
            } else {
                h2.push_back(24 - h[i]);
            }
        }

        int64_t s = 24;
        for (auto i : irange(0uL, h2.size())) {
            for (auto j : irange(0uL, h2.size())) {
                if (i != j) {
                    s = min(s, abs(h2[i] - h2[j]));
                }
            }
        }

        ans = max(ans, s);
    }

    cout << ans << endl;
}

Compiler output:
a.cc:3:10: fatal error: boost/range/adaptors.hpp: No such file or directory
    3 | #include <boost/range/adaptors.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include <bits/stdc++.h>
using namespace std;
// type alias
typedef long long LL;
typedef pair<int,int> II;
typedef tuple<int,int,int> III;
typedef vector<int> VI;
typedef vector<string> VS;
typedef unordered_map<int,int> MAPII;
typedef unordered_set<int> SETI;
template<class T> using VV=vector<vector<T>>;
// minmax
template<class T> inline T SMIN(T& a, const T b) { return a=(a>b)?b:a; }
template<class T> inline T SMAX(T& a, const T b) { return a=(a<b)?b:a; }
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// collection
#define ALL(c) (c).begin(),(c).end()
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))
// stdout
#define println(args...) fprintf(stdout, ##args),putchar('\n');
// debug cerr
template<class Iter> void __kumaerrc(Iter begin, Iter end) { for(; begin!=end; ++begin) { cerr<<*begin<<','; } cerr<<endl; }
void __kumaerr(istream_iterator<string> it) { (void)it; cerr<<endl; }
template<typename T, typename... Args> void __kumaerr(istream_iterator<string> it, T a, Args... args) { cerr<<*it<<"="<<a<<", ",__kumaerr(++it, args...); }
template<typename S, typename T> std::ostream& operator<<(std::ostream& _os, const std::pair<S,T>& _p) { return _os<<"{"<<_p.first<<','<<_p.second<<"}"; }
#define __KUMATRACE__ true
#ifdef __KUMATRACE__
#define dump(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); __kumaerr(_it, args); }
#define dumpc(ar) { cerr<<#ar<<": "; FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }
#define dumpC(beg,end) { cerr<<"~"<<#end<<": "; __kumaerrc(beg,end); }
#else
#define dump(args...)
#define dumpc(ar)
#define dumpC(beg,end)
#endif

// $ cp-batch Test | diff Test.out -
// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG -fsanitize=address Test.cpp && ./a.out

/*
 
 5/3/2020
 
 18:44-
 
 */

const int MAX_N=100+1;
int D[MAX_N];
int N;

int solve() {
  
  sort(D,D+N+1);
  REPE(x,24) {
    VI ng(48,0);
    auto ranges=[&](int t) -> VI {
      VI res;
      FOR(i,t-x,t+x) {
        if(i>=0&&i<SZ(ng)) res.push_back(i);
        if(i+24>=0&&i+24<SZ(ng)) res.push_back(i+24);
      }
      return res;
    };
    
    VI ts=ranges(D[0]);
    FORR(t,ts) ng[t]=1;
    FOR(i,1,N+1) {
//      dump(x,i,D[i]);
      if(!ng[D[i]]) {
        VI ts=ranges(D[i]);
        FORR(t,ts) ng[t]=1;
      } else if(!ng[24-D[i]]) {
        VI ts=ranges(D[i]);
        FORR(t,ts) ng[t]=1;
      } else {
        return x-1;
      }
    }
  }
  return 24;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout<<setprecision(12)<<fixed;
  
  cin>>N;
  REP(i,N) cin>>D[i+1];
  cout<<solve()<<endl;
  
  return 0;
}


Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

//g++ -std=c++14 test.cpp -o test.out
 
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <map> 
#include <utility>
#include <limits.h>
#include <bitset>
#include <set>
using namespace std;
 
#define LL long long int
const LL INF = (LL)(1e18)+1;
const int INF_INT = 2147483647-1e6-1;
const LL mod = 1000000007ll;
const int mod_int = 1000000007;
 
LL N;
LL D[51];
 
LL ans = INF;
 
void solve(){
	//i個目の都市について見ていく
	for(int i=0;i<N;i++){
		for(int j=i+1;j<N;j++){
			LL diff = min(abs(24-D[i]-D[j]));
			if(D[i]==0 && D[j]==0) ans = 0;
			if(D[i]==12 && D[j]==12) ans = 0;
			ans = min(ans,diff);
		}
	}
}
 
int main(){
    cin >> N;
    N++;
    D[0] = 0;
    for(int i=1;i<N;i++) cin >> D[i];
 
    solve();
 
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:35:38: error: no matching function for call to 'min(long long int)'
   35 |                         LL diff = min(abs(24-D[i]-D[j]));
      |                                   ~~~^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/specfun.h:43,
                 from /usr/include/c++/14/cmath:3906,
                 from /usr/include/c++/14/math.h:36,
                 from a.cc:5:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:7:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   template argument deduction/substitution failed:
a.cc:35:38: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   35 |                         LL diff = min(abs(24-D[i]-D[j]));
      |                                   ~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   candidate expects 2 arguments, 1 provided
Language: Java

import java.util.*

fun Int.bit(i: Int) = 1 shl i and this > 0

fun main(A: Array<String>) {
    val s = Scanner(System.`in`)
    val n = s.nextInt()
    if (n > 24) {
        println(0)
        return
    }
    val a = IntArray(n) { Integer.parseInt(s.next()) }
    val b = BitSet(25)
    b.set(0)
    b.set(24)

    var r = 0
    outer@ for (f in 0..(1 shl n)) {
        b.clear(1, 24)
        for (i in 0 until n) {
            val j = if (1 shl i and f > 0) 24 - a[i] else a[i]
            if (b[j])
                continue@outer
            b.set(j)
        }
        val v = b.stream().skip(1)
                .map { o: Int -> o - b.previousSetBit(o - 1) }
                .min().asInt
        r = Math.max(r, v)
    }
    println(r)
}


Compiler output:
Main.java:1: error: ';' expected
import java.util.*
                  ^
Main.java:6: error: illegal character: '`'
    val s = Scanner(System.`in`)
                           ^
Main.java:6: error: illegal character: '`'
    val s = Scanner(System.`in`)
                              ^
Main.java:18: error: <identifier> expected
    outer@ for (f in 0..(1 shl n)) {
          ^
Main.java:18: error: class, interface, enum, or record expected
    outer@ for (f in 0..(1 shl n)) {
           ^
Main.java:24: error: class, interface, enum, or record expected
            b.set(j)
            ^
6 errors
Language: C++

#include <bits/stdc++.h>

#define rep(X,N) for(ll X = 0; X < (N); X++)
#define PI (acos(-1.0))
#define pback push_back
#define mpair make_pair
#define MODN 1000000007
#define ALL(V) (V).begin(),(V).end()
#define INT_MAX_HALF (INT_MAX / 2)
#define EPS (1e-10)

using namespace std;
typedef long long ll;

int mindiff(int bit){

    int result = INT_MAX;
    int tmp = 1;

    rep(i, 23){
        if(bit & (1<< i + 1)){
            result = min(result, tmp);
            tmp = 1;
        }else{
            tmp++;
        }
    }

    result = min(result, tmp);

    return result;
}


int main(){

    int n;
    cin >> n;

    vector<int> d(n);

    rep(i, n){
        cin >> d[i];
    }

    vector<vector<pair<int, int>>> dp(n + 1, vector<pair<int,int>>(2));

    dp[0][0] = mpair(24, 1);
    dp[0][1] = mpair(24, 1);

    rep(i, n){
        rep(j, 2){

            int state = dp[i][j].second;

            if(state & (1<<d[i])){
                dp[i + 1][0] = max(dp[i + 1][0] ,mpair(0, state));
            }else{
                int nextstate = state + (1<<d[i]);
                dp[i + 1][0] = max(dp[i + 1][0], mpair(mindiff(nextstate), nextstate));
            }

            if(d[i] != 0){
                if(state & (1<<(24 - d[i]))){
                    dp[i + 1][1] = max(dp[i + 1][1] ,mpair(0, state));
                }else{
                    int nextstate = state + (1<<(24 - d[i]));
                    dp[i + 1][1] = max(dp[i + 1][1], mpair(mindiff(nextstate), nextstate));
                }
            }else[
                dp[i + 1][1] = max(dp[i + 1][1], mpair(0, state));
            ]
            
        }
    }

    /*
    assert(mindiff(1) == 23);
    assert(mindiff(3) == 0);
    assert(mindiff(5) == 1);
    assert(mindiff(9) == 2);
    assert(mindiff(17) == 3);
    assert(mindiff(33) == 4);
    assert(mindiff(65) == 5);
    assert(mindiff(129) == 6);
    assert(mindiff(257) == 7);
    assert(mindiff(513) == 8);
    assert(mindiff(1025) == 9);
    assert(mindiff(2049) == 10);
    assert(mindiff(4097) == 11);
    assert(mindiff(8193) == 10);
    assert(mindiff((1<<16) + (1<<8)) == 7);
    

    rep(i, n){
        cerr << dp[i + 1][0].first << " " << dp[i + 1][1].first << endl;
    }
    */

    int ans = max(dp[n][0].first, dp[n][1].first);

    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:71:19: error: expected ',' before '[' token
   71 |                 dp[i + 1][1] = max(dp[i + 1][1], mpair(0, state));
      |                   ^
      |                   ,
a.cc:71:19: error: expected identifier before '[' token
a.cc:71:66: error: expected ']' before ';' token
   71 |                 dp[i + 1][1] = max(dp[i + 1][1], mpair(0, state));
      |                                                                  ^
      |                                                                  ]
a.cc: In lambda function:
a.cc:71:66: error: expected '{' before ';' token
a.cc: In function 'int main()':
a.cc:72:13: error: expected primary-expression before ']' token
   72 |             ]
      |             ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
#define Priq priority_queue<int,vi,greater<int>>
#define pb push_back
#define mp make_pair
#define INF (1ll<<60)
signed main(){
  int N; cin>>N;
  vi A(13);
  rep(i,0,N){
    int X; cin>>X;
    A[X]++;
  }
  bool flag=1;
  if(A[0]>=1) flag=0;
  rep(i,1,12){
    if(A[i]>=3) flag=0;
  }
  if(A[12]>=2) flag=0;
  int ans=0;
  if(flag){
    rep(i,0,(1ll<<11)){
      vector<bool> F(24);
      F[0]=1;
      if(A[12]==1) F[12]=1;
      rep(j,0,11){
        if(A[j+1]==2){
          F[j+1]=1;
          F[23-j]=1;
        }
        else if(B.test(j)) F[j+1]=1;
        else F[23-j]=1;
      }
      int sum=12;
      rep(j,0,24){
        REP(k,j+1,24){
          if(F[j]&&F[k]){
            sum=min({sum,k-j,24-k+j});
          }
        }
      }
      ans=max(ans,sum);
    }
  }
  cout<<ans<<endl;
  }


Compiler output:
a.cc: In function 'int main()':
a.cc:43:17: error: 'B' was not declared in this scope
   43 |         else if(B.test(j)) F[j+1]=1;
      |                 ^
Language: C++

#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
  ll n;
  cin>>n;
  vector<pll> p(n);
  rep(i,n) {
    ll a;
    cin>>a;
    p[i]=mp(a,24-a);
  }
  ll ans=INF;
  rep(i,n){
    ll cuf=INF;
    ll cus=INF;
    for(int j=i+1;j<n;j++){
      ll kk=max(abs(p[i].F-p[j].F),abs(p[i].F-[j].S));
      ll uu=max(abs(p[i].S-p[j].F),abs(p[i].S-[j].S));
      cuf=min(cuf,kk);
      cus=min(cus,uu);
    }
    ans=min(ans,max(cuf,cus));
  }
  COUT(ans);
}

Compiler output:
a.cc: In lambda function:
a.cc:56:50: error: expected '{' before '.' token
   56 |       ll kk=max(abs(p[i].F-p[j].F),abs(p[i].F-[j].S));
      |                                                  ^
a.cc: In function 'int main()':
a.cc:16:11: error: 'struct main()::<lambda()>' has no member named 'second'
   16 | #define S second
      |           ^~~~~~
a.cc:56:51: note: in expansion of macro 'S'
   56 |       ll kk=max(abs(p[i].F-p[j].F),abs(p[i].F-[j].S));
      |                                                   ^
a.cc: In lambda function:
a.cc:57:50: error: expected '{' before '.' token
   57 |       ll uu=max(abs(p[i].S-p[j].F),abs(p[i].S-[j].S));
      |                                                  ^
a.cc: In function 'int main()':
a.cc:16:11: error: 'struct main()::<lambda()>' has no member named 'second'
   16 | #define S second
      |           ^~~~~~
a.cc:57:51: note: in expansion of macro 'S'
   57 |       ll uu=max(abs(p[i].S-p[j].F),abs(p[i].S-[j].S));
      |                                                   ^
Language: C++

#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P>IP;
typedef vector<ll> V;
typedef vector<V> V2;
typedef vector<vector<P> > G;
void g_dir(G &graph, ll a, ll b, ll w = 1){graph[a].push_back(P(b, w));}
void g_undir(G &graph, ll a, ll b, ll w = 1){g_dir(graph, a, b, w);g_dir(graph, b, a, w);}
#define rep(i, n) for(ll (i) = 0; (i) < (n); (i)++)
#define rep1(i, n) for(ll (i) = 1; (i) <= (n); (i)++)
#define rrep(i, n) for(ll (i) = (n) - 1; (i) >= 0; (i)--)
#define rrep1(i, n) for(ll (i) = (n); (i) >= 1; (i)--)
template<class T> void chmax(T &a, const T &b){if(a < b){a = b;}}
template<class T> void chmin(T &a, const T &b){if(a > b){a = b;}}
const ll INF = 1145141919;
const ll MOD = 1000000007;
const ll NUM = 101010;

int main(){

    ll N;
    cin >> N;
    V v(13, 0);
    v[0] = 1;
    rep(i, N){
        ll a;
        cin >> a;
        v[a]++;
    }
    ll flg = 0;
    if(v[0] >= 2 || v[12] >= 2)flg = 1;
    rep(i, 13)if(cnt[i] >= 3)flg = 1;
    if(flg){
        cout << 0 << endl;
        return 0;
    }
    return 1;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:18: error: 'cnt' was not declared in this scope; did you mean 'int'?
   34 |     rep(i, 13)if(cnt[i] >= 3)flg = 1;
      |                  ^~~
      |                  int
Language: C++

N = int(input())
D = list(map(int,input().split()))

DC = {}
for d in D:
  if d == 0:
    print(0)
    exit()
  if d in DC:
    DC[d] += 1
  else:
    DC[d] = 1

def Gap(T):
  res = 10**18
  mn = 0
  for i in range(1,len(T)):
    if T[i]:
      res = min(res,i-mn)
      mn = i
  return res

T = [True] + [False for _ in range(22)] + [True]
DD = []
for k,v in DC.items():
  if v == 1:
    DD.append(k)
  elif v > 1:
    T[k] = True
    T[24-k] = True

if len(DD) == 0:
  print(Gap(T))
else:
  ans = 0
  for i in range(1<<len(DD)):
    TT = T[:]
    for j in range(len(DD)):
      if (i>>j)&1 == 1:
        TT[DD[j]] = True
      else:
        TT[24-DD[j]] = True
    ans = max(ans,Gap(TT))
  print(ans)


Compiler output:
a.cc:1:1: error: 'N' does not name a type
    1 | N = int(input())
      | ^
a.cc:5:1: error: expected unqualified-id before 'for'
    5 | for d in D:
      | ^~~
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<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

int count(vector<int> circ) {
    int mi = 101010;
    REP(i, circ.size()) {
        REP(j, circ.size()) {
            if(i != j) {
                int d1 = abs(circ[i] - circ[j]);
                int d2 = 24 - d1;
                int d = min(d1, d2);
                mi = min(mi, d);
            }
        }
    }
    // print(circ);
    // cout << mi << endl;
    return mi;
}

int main() {
    int N;
    cin >> N;
    // Nがかなり小さい
    vector<ll> D(N);
    vector<ll> F(N);
    map<int, int> cnt;
    REP(i, N) {
        cin >> D[i];
        cnt[D[i]]++;
    }
    // https://www.hamayanhamayan.com/entry/2017/11/27/224728
    // D_iごとにカウントするる
    //おなじD_iに三人以上いる場合は0
    //一人だけの場合は左右の二通り
    // 2^11とおりを試せばよい
    if(cnt[0] > 0) {
        cout << 0 << endl;
        return 0;
    }
    REP(i, 13) {
        if(cnt[i] > 2) {
            cout << 0 << endl;
            return 0;
        }
    }
    // D[i]が2のときはそれを全探査
    vector<int> v;
    vector<int> cricle;
    circle.push_back(0);
    REP(i, 13) {
        if(i == 12) {
            if(cnt[i] > 0) {
                cricle.push_back(i);
            }
        } else if(cnt[i] == 1) {
            v.push_back(i);
        } else if(cnt[i] == 2) {
            cricle.push_back(i);
            cricle.push_back(24 - i);
        }
    }
    // print(cricle);
    // print(v);
    int ans = 0;
    if(v.size() == 0) {
        cout << count(cricle) << endl;
        return 0;
    }
    REP(msk, 1 << v.size()) {
        vector<int> tmp = cricle;
        REP(j, v.size()) {
            if(msk & (1 << j)) {
                tmp.push_back(v[j]);
            } else {
                tmp.push_back(24 - v[j]);
            }
        }
        ans = max(ans, count(tmp));
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:82:5: error: 'circle' was not declared in this scope; did you mean 'cricle'?
   82 |     circle.push_back(0);
      |     ^~~~~~
      |     cricle
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<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

int main() {
    int N;
    cin >> N;
    // Nがかなり小さい
    vector<int> D(N);
    vector<int> F(N);
    REP(i, N) {
        cin >> D[i];
        F[i] = 24 - D[i];
    }
    ll ans = INF;
    for(int i = 0; i < N; i++) {
        for(int j = 0; j < N; j++) {
            if(i == j) {
                continue;
            } else {
                ans = min(ans, abs(D[i] - F[i]);
                ans = min(ans, abs(D[i] - D[j]);
                ans = min(ans, abs(F[i] - F[j]);
                ans = min(ans, abs(F[i] - D[j]);
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:52:48: error: expected ')' before ';' token
   52 |                 ans = min(ans, abs(D[i] - F[i]);
      |                          ~                     ^
      |                                                )
a.cc:53:48: error: expected ')' before ';' token
   53 |                 ans = min(ans, abs(D[i] - D[j]);
      |                          ~                     ^
      |                                                )
a.cc:54:48: error: expected ')' before ';' token
   54 |                 ans = min(ans, abs(F[i] - F[j]);
      |                          ~                     ^
      |                                                )
a.cc:55:48: error: expected ')' before ';' token
   55 |                 ans = min(ans, abs(F[i] - D[j]);
      |                          ~                     ^
      |                                                )
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0; i<(n); i++)
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(){
    int n; cin>>n;
    vector<int> time(24);
    time[0]++;
    rep(i,n){int d; cin>>d; time[d]++;}
    int ans=-100; tmp=100;
    rep(i,(1<<12)){
        vector<int> time_=time;
        rep(j,12){
            if(i&(1<<j) && time_[j+1]>=1){
                time_[j+1]--;
                time_[23-j]++;
            }
        }
        rep(x,24){
            rep(y,24){
                if(x>=y)continue;
                if(max(time_[x],time_[y])>=2){tmp=0;break;}
                if(min(time_[x],time_[y])>0){chmin(tmp,y-x);}
            }
        }
        chmax(ans,tmp);
        tmp=100;
    }
    cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:19: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   13 |     int ans=-100; tmp=100;
      |                   ^~~
      |                   tm
Language: C++

#include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
#include <functional>

using namespace std;
int main(){
    int n;
    cin >> n;
    vector<int> vec;
    vec.push_back(0);
    vec.push_back(24);
    vector<bool> reg(24);
    for(int i=0;i<n;i++){
        int x;
        cin >> x;
        if(x==0){
            cout<<0<<endl;
            return 0;
        }
        if(find(vec.begin(),vec.end(),x)!=vec.end()){
            if(find(vec.begin(),vec.end(),24-x)!=vec.end()){
                cout<<0<<endl;
                return 0;
            }
            vec.push_back(24-x);
            reg[x]=1;
            reg[24-x]=1;
        }else{
            vec.push_back(x);
        }
    }
  //  cout<<vec[2]<<endl;
   // cout<<vec.size()<<endl;
    int Min=1e9;
    for(int i=0;i<vec.size();i++){
        for(int j=0;j<vec.size();j++){
            if(i==j)continue;
            if(vec[i]==0&&vec[j]==24)continue;
            if(reg[vec[i]]&&reg[vec[j]]){
                x=abs(vec[i]-vec[j]);
            }
            int x = max(abs(vec[i]-vec[j]),abs(24-vec[i]-vec[j]));
            Min = min(x,Min);
        }
    }
    cout<<Min<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:42:17: error: 'x' was not declared in this scope
   42 |                 x=abs(vec[i]-vec[j]);
      |                 ^
Language: C++

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

int table[n][24];

signed main() {
  int n;cin>>n;
  vector<int> d;
  vector<int> c(12,0);
  for(int i=0;i<n;++i) {
    int f;cin>>f;
    ++c[f%12];
  }

  for(int i=0;i<12;++i){
    if(c[i]>0) d.push_back(i);
  }
  
  int ans = 0;
  n = d.size();
  for(int bit=0;bit<(1<<n);++bit){
    for(int i=0;i<n;++i){
      vector<int> p(d);
      if ((bit>>i) & 1) {
        d[i] = 24 - d[i];
      }
      
      int tmp = 1e9+1;
      for(int j=0;j<=12;++j){
        tmp = min(abs(d[j]-d[(j+1)%12]), tmp);
      }

      if (tmp<=12) ans = max(ans, tmp);
    }
  }
  cout<<ans<<endl;
  
  return 0;
}


Compiler output:
a.cc:6:11: error: 'n' was not declared in this scope; did you mean 'yn'?
    6 | int table[n][24];
      |           ^
      |           yn
Language: C++

#include<bits/stdc++.h>
#define ll long long

using namespace std;

int main()
{
	ll n ;
	scanf("%lld",&n);
	map <ll , ll > cnt;
	for(int i = 0; i  < n ; i++)
	{
		ll input;
		scanf("%lld",&input);
		cnt[input]++;		
	}
	vector<ll> db , fn;
	ll ans = 0;	
	bool valid = 1;
	for(int i = 0 ; i<= 12; i++)
	{	
		if(cnt[i] >= 3)
		{
			valid = 0;
		}
		if(cnt[i] == 2)
		{
			fn.push_back(i);
			fn.push_back(24-i);
		}
		if(cnt[i] == 1)
		{
			db.push_back(i);
		}
	}
	if(!valid)
	{
		cout<<0<<endl;
		return 0;
	}
//	sort(fn.begin(),fn.end());
	for(int i = 0 ; i< (1<<db.size()) ; i++)
	{		
		ll temp = 500;		
		vector<ll> z ;
		z = fn;
		for(int j = 0;  j < db.size() ; j++)
		{
			if(i &(1<<j))
			{
//				cout<<i<<" "<<(i&(1<<j))<<endl;
				z.push_back(24-db[j]);
			}
			else
			z.push_back(db[j]);
		}
		sort(z.begin(),z.end());
		ll zz = 0;
		for(int i = 0; i < z.size(); i++)
		{
//			cout<<z[i]<<" ";
			temp = min(temp,abs(z[i] -zz));
			zz = z[i];
		}
//		temp = min(temp,abs(z[z.size()-1] - z[0]));
//		cout<<endl;
		ans = max(ans,temp);
	}
	if(db.size() == 0)
	{
		sort(fn.begin(),fn.end());
		ll zz = 0;
		ll temp = 9999999;
		for(int i = 0; i < z.size(); i++)
		{
//			cout<<z[i]<<" ";
			temp = min(temp,abs(fn[i] -zz));
			zz = fn[i];
		}
		ans = max(ans,temp);
	}
	printf("%lld\n",ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:74:36: error: 'z' was not declared in this scope
   74 |                 for(int i = 0; i < z.size(); i++)
      |                                    ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;cin>>n;
	vector<int> a(n);
	for(auto&& w:a)cin>>w;
	sort(begin(a),end(a));
	int vmin=a[0];
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
		if(i==j)continue;
		int v=min(a[j]+a[i],24-a[j]-a[i]);
		vmin=max(vmin,v);
	}
	cout<<vmin<<endl;

			
}

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

#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;cin>>n;
	vector<int> a(n);
	for(auto&& w:a)cin>>w;
	sort(begin(a),end(a));
	int vmin=a[0];
	for(int i=0;i<n;i++){
		for(int j=0<j<n;j++){
		if(i==j)continue;
		int v=min(a[j]+a[i],24-a[j]-a[i])
		vmin=max(vmin,v);
	}
	cout<<vmin<<endl;

			
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:36: error: expected ';' before ')' token
   10 |                 for(int j=0<j<n;j++){
      |                                    ^
      |                                    ;
a.cc:13:17: error: expected ',' or ';' before 'vmin'
   13 |                 vmin=max(vmin,v);
      |                 ^~~~
a.cc:18:2: error: expected '}' at end of input
   18 | }
      |  ^
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^
Language: C++

#include <cstdio>
#include <algorithm>
#include <queue>
#include <cstring>
using namespace std;

int N, d;
int V[2][50];
int E[2][50][50];

struct Node
{
	int n;
	int mt;
	int h;
	bool sel[50];
	bool operator< (const Node & node) const
	{
		return h < node.h;
	}
	Node() : n(0), mt(0x0FFFFFFF), h(0)
	{
	}
	Node(const Node & node) : n(node.n), mt(node.mt), h(node.h)
	{
		if(n > 0)
			memcpy(sel, &node.sel, sizeof(bool) * n);
	}
};

int tdiff(int t1, int t2)
{
	int diff = abs(t1 - t2);
	return min(diff, 24 - diff);
}

int bnb(int minedge)
{
	priority_queue <Node> pq;
	pq.push(Node());
	int bnd = 0;
	while (!pq.empty())
	{
		Node node = pq.top();
		pq.pop();
		if (node.h < bnd)
			continue;
		if (node.n == N)
		{
			bnd = max(bnd, node.mt);
			if (minedge <= bnd)
				break;
			continue;
		}
		for (int s = 0; s < 2; ++s)
		{
			node.sel[node.n] = s;

			// compute new minimum tdiff
			// between new vertex and others.
			int backup = node.mt;
			for (int m = 0; m < node.n; ++m)
				node.mt = min(node.mt, tdiff(V[node.sel[m]][m], V[s][node.n]));
			
			// compute heuristic
			// select others having always best edges
			node.h = node.mt;
			for (int m = node.n + 1; m < N; ++m)
				node.h = min(node.h, E[1][node.n][m]);

			++node.n;
			pq.push(node);
			node.mt = backup;
			--node.n;
		}
	}
	return min(bnd, minedge);
}

int main(void)
{
	//freopen("input.txt", "r", stdin);
	scanf("%d", &N);
	int minedge = 0x0FFFFFFF;
	int dupchk[13] = { 0, };
	for (int n = 0; n < N; ++n)
	{
		scanf("%d", &d);
		++dupchk[d];
		V[0][n] = min(d, 24 - d);
		V[1][n] = max(d, 24 - d);
		minedge = min(minedge, V[0][n]);
	}

	// pigeon's hole
	if (dupchk[0] >= 1)
	{
		printf("0");
		return;
	}
	for (int h = 1; h < 12; ++h)
		if (dupchk[h] >= 3)
		{
			printf("0");
			return 0;
		}
	if (dupchk[12] >= 2)
	{
		printf("0");
		return 0;
	}

	for (int n = 0; n < N; ++n)
		for (int m = n + 1; m < N; ++m)
		{
			E[0][n][m] = 0x0FFFFFFF;
			E[1][n][m] = 0;
			for (int i = 0; i < 2; ++i)
				for (int j = 0; j < 2; ++j)
				{
					int td = tdiff(V[i][n], V[j][m]);
					E[0][n][m] = min(E[0][n][m], td);
					E[1][n][m] = max(E[1][n][m], td);
				}
		}
	printf("%d", bnb(minedge));
	return 0;
}

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

#include <iostream>
#include <set>
#include <algorithm>
#include <numeric>
#include <iterator>

int abs(int a) { return (a > 0) ? a : -a; }

int main() {
    int n, t, ret = 0;
    std::cin >> n;
    std::set<int> s;
    std::vector<int> num(13, 0);
    for (auto i = 0; i < n; i++) {
        std::cin >> t;
        s.insert(t);
        num[t]++;
        if (num[t] > 2 || t == 0) {
            std::cout << 0 << std::endl;
            return 0;
        }
    }

    for (int i = 0, size = 1 << s.size(); i < size; i++) {
        std::set<int> t;
        //t.insert(0);
        int j = i;
        for (auto d : s) {
            int tmp = ((j & 1) ? d : 24 - d);
            t.insert(tmp);
            if (num[d] > 1) t.insert(24 - tmp);
            j >>= 1;
        }
        std::set<int> result;
        std::adjacent_difference(t.begin(), t.end(), std::inserter(result, result.end()));
        if (ret < *result.cbegin()) ret = *result.cbegin();
    }

    std::cout << ret << std::endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:10: error: 'vector' is not a member of 'std'
   13 |     std::vector<int> num(13, 0);
      |          ^~~~~~
a.cc:6:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    5 | #include <iterator>
  +++ |+#include <vector>
    6 | 
a.cc:13:17: error: expected primary-expression before 'int'
   13 |     std::vector<int> num(13, 0);
      |                 ^~~
a.cc:17:9: error: 'num' was not declared in this scope; did you mean 'enum'?
   17 |         num[t]++;
      |         ^~~
      |         enum
a.cc:31:17: error: 'num' was not declared in this scope; did you mean 'enum'?
   31 |             if (num[d] > 1) t.insert(24 - tmp);
      |                 ^~~
      |                 enum
Language: C++

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

int rec[55], tmp[55], cur[55];
int n, ans;

void dfs(int i) {
	if (i == n) {
		memcpy(tmp, cur, sizeof tmp);
		sort(tmp, tmp+n);
		int mx = 24;
		for (int i = 0; j = n-1; i < n; j = i++) {
			int t = abs(tmp[i] - tmp[j]);
			mx = min(t, 24 - t);
		}
		ans = max(ans, mx);
	}
	for (int j = -1; j < 2; j += 2) {
		cur[i] = rec[i] * j;
		dfs(i+1);
		if (!d[i] && d[i] == 12) {
			break;
		}
	}
}

int main() {
	scanf("%d", &n);
	if (n > 23) {
		puts("0");
		return 0;
	}
	for (int i = 1; i <= n; i++) {
		scanf("%d", rec+i);
	}
	n++;
	cur[1] = rec[1];
	dfs(2);
	printf("%d", ans);
}

Compiler output:
a.cc: In function 'void dfs(int)':
a.cc:12:33: error: 'j' was not declared in this scope
   12 |                 for (int i = 0; j = n-1; i < n; j = i++) {
      |                                 ^
a.cc:12:47: error: expected ')' before ';' token
   12 |                 for (int i = 0; j = n-1; i < n; j = i++) {
      |                     ~                         ^
      |                                               )
a.cc:12:49: error: 'j' was not declared in this scope
   12 |                 for (int i = 0; j = n-1; i < n; j = i++) {
      |                                                 ^
a.cc:21:22: error: 'd' was not declared in this scope
   21 |                 if (!d[i] && d[i] == 12) {
      |                      ^
Language: C++

#include <bits/stdc++.h>

#define fr first
#define sc second
#define pb push_back


using namespace std;

int a[55];
pair<int, int>p[55];
vector<int>vec;
main()
{
    int n, mn;
    mn = 25;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    if (n == 1)
    {
        cout << a[i];
        return 0;
    }
    for (int i = 0; i < n; i++)
    {
        if (a[i])
        {
            p[i].fr = a[i];
            p[i].sc = 24 - a[i];
        }
        else
        {
            cout << 0;
            return 0;
        }
    }
    for (int i = 0; i < n; i++)
    {
        for (int j = i + 1; j < n; j++){
            int num = max(abs(a[i] - a[j]), abs(p[i].sc - p[j].sc));
            int num1 = max(abs(p[i].fr - p[j].sc), abs(p[i].sc - p[j].fr));
            num = max(num1, num);
            vec.pb(num);
        }
    }
    sort(vec.begin(), vec.end());
    cout << vec.front();
}




Compiler output:
a.cc:13:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   13 | main()
      | ^~~~
a.cc: In function 'int main()':
a.cc:24:19: error: 'i' was not declared in this scope
   24 |         cout << a[i];
      |                   ^
Language: C++

#include <iostream>
using namespace std;

const int N = 51;
int d[N];
int p[N];
int n;
int res;

void backtrack(int i) {
    if (i == n) {
        sort(p, p + n);
        int s = 24;
        for (int i = 0, j = n - 1; i < n; j = i++) {
            s = min(s, min(abs(p[i] - p[j]), 24 - abs(p[i] - p[j])));
        }
        res = max(res, s);
    } else {
        for (int t = -1; t <= 1; t += 1) {
            p[i] = d[i] * t;
            backtrack(i + 1);
        }
    }
}

int main() {
    cin >> n;
    for (int i = 0; i < n; ++i) cin >> d[i];
    ++n;
    if (n > 24) {
        cout << 0 << endl;
    }
    backtrack(0);
    cout << res << endl;
    return 0;
}


Compiler output:
a.cc: In function 'void backtrack(int)':
a.cc:12:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   12 |         sort(p, p + n);
      |         ^~~~
      |         short
Language: C++

/*
https://img.atcoder.jp/cf17-final/editorial.pdf
贪心+dp
关于为什么按 hi + pi 升序排列，官方题解说的很有道理。
这边提供另外一种证明：考虑一个合法的选的序列，对于每一个 i 必须满足 sum_{j <= i}{h_j} <= h_i + p_i,
因为前缀和递增所以 hi + pi 也必须递增。
*/
#include <bits/stdc++.h>
#define rep(i, x, y) for (int i = x; i <= y; i++)
using namespace std;

const int N = 5005;
const ll inf = 0x3f3f3f3f3f3f3f3f;
int n, a[N], b[N], c[N], id[N];
ll mn[N];

bool cmp(int x, int y) { return c[x] == c[y] ? b[x] < b[y] : c[x] < c[y]; }

int main() {
    cin >> n;
    rep(i, 1, n) scanf("%d%d", &a[i], &b[i]), c[i] = a[i] + b[i], id[i] = i;
    sort(id + 1, id + n + 1, cmp);
    memset(mn, 0x3f, sizeof(mn));
    mn[0] = 0;
    rep(i, 1, n) {
        for (int j = n - 1; j >= 0; j--)
            if (mn[j] != inf && mn[j] <= a[id[i]])
                mn[j + 1] = min(mn[j + 1], mn[j] + b[id[i]]);
    }
    for (int i = n; i >= 0; i--) if (mn[i] != inf) return printf("%d\n", i), 0;
	return 0;
}

Compiler output:
a.cc:13:7: error: 'll' does not name a type
   13 | const ll inf = 0x3f3f3f3f3f3f3f3f;
      |       ^~
a.cc:15:1: error: 'll' does not name a type
   15 | ll mn[N];
      | ^~
a.cc: In function 'int main()':
a.cc:23:12: error: 'mn' was not declared in this scope; did you mean 'yn'?
   23 |     memset(mn, 0x3f, sizeof(mn));
      |            ^~
      |            yn
a.cc:27:26: error: 'inf' was not declared in this scope; did you mean 'ynf'?
   27 |             if (mn[j] != inf && mn[j] <= a[id[i]])
      |                          ^~~
      |                          ynf
a.cc:30:47: error: 'inf' was not declared in this scope; did you mean 'ynf'?
   30 |     for (int i = n; i >= 0; i--) if (mn[i] != inf) return printf("%d\n", i), 0;
      |                                               ^~~
      |                                               ynf