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

#include <iostream>
#include <string>

using namespace std;
int main(){
	string s;
	cin >> s;
	int i,n,a = 0,b = 0, c = 0;
	n = s.size();
	for(i=0;i<n;i++){
		if(s[i]=='a'){
			a++;
		}
		if(s[i]=='b'){
			b++;
		}
		if(s[i]=='c'){
			c++;
		}
	}
	
	int s = max({a,b,c}),t = min({a,b,c});
	if(s==t || s-t==1){
		cout << "YES" << endl;
	}
	cout  << "NO" << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:13: error: conflicting declaration 'int s'
   22 |         int s = max({a,b,c}),t = min({a,b,c});
      |             ^
a.cc:6:16: note: previous declaration as 'std::string s'
    6 |         string s;
      |                ^
a.cc:22:20: error: no matching function for call to 'max(<brace-enclosed initializer list>)'
   22 |         int s = max({a,b,c}),t = min({a,b,c});
      |                 ~~~^~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 1 provided
a.cc:23:15: error: 't' was not declared in this scope
   23 |         if(s==t || s-t==1){
      |               ^
Language: C++

#include <iostream>
#include <string>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)

std::string S;
int cnt[3];

int main()
{
  std::cin >> S;

  rep( i, S.size() )
    ++cnt[S[i]-'a'];

  int mi = *std::min_element( cnt, cnt+3 );

  rep( i, 3 )
  {
    if( cnt[i]-mi >= 2 )
    {
      std::cout << "NO" << std::endl;

      return 0;
    }
  }

  std::cout << "YES" << std::endl;

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:18: error: 'min_element' is not a member of 'std'; did you mean 'tuple_element'?
   16 |   int mi = *std::min_element( cnt, cnt+3 );
      |                  ^~~~~~~~~~~
      |                  tuple_element
Language: C++

#include <iostream>
#include <string>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)

std::string S;
int cnt[3];

int main()
{
  std::cin >> S;

  rep( i, S.size() )
    ++cnt[S[i]-'a'];

  int mi = *std::min_element( cnt, cnt+3 );

  rep( i, 3 )
  {
    if( cnt[i]-mi >= 2 )
    {
      puts( "NO" );

      return 0;
    }
  }

  puts( "YES" );

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:18: error: 'min_element' is not a member of 'std'; did you mean 'tuple_element'?
   16 |   int mi = *std::min_element( cnt, cnt+3 );
      |                  ^~~~~~~~~~~
      |                  tuple_element
Language: C++

s=raw_input()
a,b,c=0,0,0
for ch in s :
    if ch=='a' :
        a+=1
    elif ch=='b' :
        b+=1
    else :
        c+=1

if max(a,b,c)<=min(a,b,c)+1 :
    print "YES"
else :
    print "NO"


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

#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define rep(i,a,b) for (int i=a; i<=b; i++)
#define per(i,a,b) for (int i=a; i>=b; i--)
typedef long long ll;
using namespace std;
inline void read(int &x) {
	x=0; char c=getchar(); int f=1;
	while (!isdigit(c)) {if (c=='-') f=-1; c=getchar();}
	while (isdigit(c)) {x=x*10+c-'0'; c=getchar();} x*=f;
}
inline int max(int a, int b) {return a>b ? a : b;}
inline int min(int a, int b) {return a<b ? a : b;}
const int N = 102000;
char s[N];
int buc[4];

int main() {
	scanf("%s",s+1); n=strlen(s+1);
	rep(i,1,n) buc[s[i]-'a']++;
	int x=1000000; rep(i,1,3) x=min(x,buc[i]);
	rep(i,1,3) buc[i]-=x;
	printf("%s", (buc[1]<=1&&buc[2]<=1&&buc[3]<=1) ? "YES" : "NO");
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:26: error: 'n' was not declared in this scope
   21 |         scanf("%s",s+1); n=strlen(s+1);
      |                          ^
Language: Java

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;


public class B {
	
	public static void main(String[] args){
		try(final Scanner sc = new Scanner(System.in)){
			int a_count = 0, b_count = 0, c_count = 0;
			for(final char c : sc.next().toCharArray()){
				switch (c) {
				case 'a': a_count++; break;
				case 'b': b_count++; break;
				case 'c': c_count++; break;
				}
			}
			
			final int sum = a_count + b_count + c_count;
			final int max_count = Math.max(a_count, Math.max(b_count, c_count));
			final int min_count = Math.min(a_count, Math.min(b_count, c_count));
			final int mid_count = sum - max_count - min_count;
			
			final int rest_count = sum - max_count;
			
			if(max_count >= rest_count){
				final int diff = max_count - rest_count;
				
				if(min_count == 0){
					System.out.println(diff <= 0 ? "YES" : "NO");
				}else{
					System.out.println(diff <= 1 ? "YES" : "NO");
				}
			}else{
				final int must_fill = mid_count - min_count;
				final int req_must_fill = must_fill;
				final int max_must_fill = must_fill;
				
				final int common_fill = min_count;
				final int req_common_fill = 0;
				final int max_common_fill = common_fill * 2 + 1;
				
				System.out.println(req_must_fill);
				//System.out.println(req_must_fill + req_common_fill);
				//System.out.println(max_must_fill + " " + max_common_fill);
				//System.out.println(max_must_fill + max_common_fill);
				
				if(req_must_fill + req_common_fill > max_count){
					System.out.println("NO");
				}else if(max_must_fill + max_common_fill < max_count){
					System.out.println("NO");
				}else{
					System.out.println("YES");
				}
				
			}
		}
	}
	
	public static class Scanner implements AutoCloseable {
		private BufferedReader br;
		private StringTokenizer tok;

		public Scanner(InputStream is) {
			br = new BufferedReader(new InputStreamReader(is));
		}

		private void getLine() {
			try {
				while (!hasNext()) {tok = new StringTokenizer(br.readLine());}
			} catch(IOException e){ /* ignore */ }
		}

		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}

		public String next() {
			getLine(); return tok.nextToken();
		}

		public int nextInt(){
			return Integer.parseInt(next());
		}
		public long nextLong(){
			return Long.parseLong(next());
		}
		public double nextDouble(){
			return Double.parseDouble(next());
		}
		
		public int[] nextIntArray(int n){
			int[] ret = new int[n];
			for(int i = 0; i < n; i++){ ret[i] = nextInt(); }
			return ret;
		}
		public long[] nextLongArray(int n){
			long[] ret = new long[n];
			for(int i = 0; i < n; i++){ ret[i] = nextLong(); }
			return ret;
		}
		public double[] nextDoubleArray(int n){
			double[] ret = new double[n];
			for(int i = 0; i < n; i++){ ret[i] = nextDouble(); }
			return ret;
		}

		public void close() {
			try{ br.close(); } catch (IOException e){ /*ignore*/ }
		}
	}
}


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

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

int main() {
	string s;
	cin >> s;
	int a = 0, b = 0, c = 0;
	for (char &d : s) {
		if (d == 'a') {
			a++;
		}
		if (d == 'b') {
			b++;
		}
		if (d == 'c) {
			c++;
		}
	}
	cout << (max({a, b, c}) - min({a, b, c}) <= 1 ? "YES" : "NO") << endl;
	return 0;
}

Compiler output:
a.cc:15:26: warning: missing terminating ' character
   15 |                 if (d == 'c) {
      |                          ^
a.cc:15:26: error: missing terminating ' character
   15 |                 if (d == 'c) {
      |                          ^~~~~
a.cc: In function 'int main()':
a.cc:17:17: error: expected primary-expression before '}' token
   17 |                 }
      |                 ^
a.cc:16:29: error: expected ')' before '}' token
   16 |                         c++;
      |                             ^
      |                             )
   17 |                 }
      |                 ~            
a.cc:15:20: note: to match this '('
   15 |                 if (d == 'c) {
      |                    ^
a.cc:17:17: error: expected primary-expression before '}' token
   17 |                 }
      |                 ^
a.cc: At global scope:
a.cc:19:9: error: 'cout' does not name a type
   19 |         cout << (max({a, b, c}) - min({a, b, c}) <= 1 ? "YES" : "NO") << endl;
      |         ^~~~
a.cc:19:31: error: expected unqualified-id before ')' token
   19 |         cout << (max({a, b, c}) - min({a, b, c}) <= 1 ? "YES" : "NO") << endl;
      |                               ^
a.cc:19:48: error: expected unqualified-id before ')' token
   19 |         cout << (max({a, b, c}) - min({a, b, c}) <= 1 ? "YES" : "NO") << endl;
      |                                                ^
a.cc:20:9: error: expected unqualified-id before 'return'
   20 |         return 0;
      |         ^~~~~~
a.cc:21:1: error: expected declaration before '}' token
   21 | }
      | ^
Language: Java

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;


public class B {
	
	public static void main(String[] args){
		try(final Scanner sc = new Scanner(System.in)){
			int a_count = 0, b_count = 0, c_count = 0;
			for(final char c : sc.next().toCharArray()){
				switch (c) {
				case 'a': a_count++; break;
				case 'b': b_count++; break;
				case 'c': c_count++; break;
				}
			}
			
			final int sum = a_count + b_count + c_count;
			final int max_count = Math.max(a_count, Math.max(b_count, c_count));
			final int min_count = Math.min(a_count, Math.min(b_count, c_count));
			final int mid_count = sum - max_count - min_count;
			
			final int rest_count = sum - max_count;
			
			if(max_count >= rest_count){
				final int diff = max_count - rest_count;
				
				if(min_count == 0){
					System.out.println(diff <= 0 ? "YES" : "NO");
				}else{
					System.out.println(diff <= 1 ? "YES" : "NO");
				}
			}else{
				final int can_make_pair = Math.min(mid_count, min_count);
				final int can_use_pair = Math.min(max_count / 2, can_make_pair);
				
				final int new_max = max_count - can_use_pair * 2;
				final int new_mid = mid_count - can_use_pair;
				final int new_min = min_count - can_use_pair;
				
				//System.out.println(can_use_pair);
				//System.out.println(new_max + " " + new_mid + " " + new_min);
				
				if(new_max == 0){
					final int diff = new_mid - new_min;
					if(diff <= 2){
						System.out.println("YES");
					}else{
						System.out.println("NO");
					}
				}else{ // new_min == 0
					final int diff = new_max - new_mid;
					if(diff <= 2){
						System.out.println("YES");
					}else{
						System.out.println("NO");
					}
				}
			}
		}
	}
	
	public static class Scanner implements AutoCloseable {
		private BufferedReader br;
		private StringTokenizer tok;

		public Scanner(InputStream is) {
			br = new BufferedReader(new InputStreamReader(is));
		}

		private void getLine() {
			try {
				while (!hasNext()) {tok = new StringTokenizer(br.readLine());}
			} catch(IOException e){ /* ignore */ }
		}

		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}

		public String next() {
			getLine(); return tok.nextToken();
		}

		public int nextInt(){
			return Integer.parseInt(next());
		}
		public long nextLong(){
			return Long.parseLong(next());
		}
		public double nextDouble(){
			return Double.parseDouble(next());
		}
		
		public int[] nextIntArray(int n){
			int[] ret = new int[n];
			for(int i = 0; i < n; i++){ ret[i] = nextInt(); }
			return ret;
		}
		public long[] nextLongArray(int n){
			long[] ret = new long[n];
			for(int i = 0; i < n; i++){ ret[i] = nextLong(); }
			return ret;
		}
		public double[] nextDoubleArray(int n){
			double[] ret = new double[n];
			for(int i = 0; i < n; i++){ ret[i] = nextDouble(); }
			return ret;
		}

		public void close() {
			try{ br.close(); } catch (IOException e){ /*ignore*/ }
		}
	}
}


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

#include <iostream>
#include<map>
#include<cstring>
using namespace std;
int a[110000];
const int maxn=1e5;
string code="AKIHABARA",st;
int cnt[5]={0};
int main(int argc, const char * argv[])
{
    cin>>st;
    int len=st.length();
    for(int i=0;i<len;i++)cnt[st[i]-'a']++;
    sort(cnt+0,cnt+3);
    if(cnt[2]-cnt[0]>1)cout<<"NO"<<endl;
    else cout<<"YES"<<endl;
}


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

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>

#include <set>
int main(){
	std::string S;
	std::cin >> S;
	std::vector<int> count(3);
	count[0]=count[1]=count[2]=0;
	for(int i=0;i<S.size();i++){
		if(S[i]=='a'){
			count[0]++;
		}else if(S[i]=='b'){
			count[1]++;
		}else{
			count[2]++;
		}
	}
	std::cout << count[0] <<	count[1] << 	count[2]; 
	if(count[0]==0||count[1]==0||count[2]==0){
		std::cout << "NO" <<std::endl;
		return 0;
	}
	int temp;
	std::sort(count.begin(),count.end());
	if(count[0]==count[1]&&count[1]==count[2]){
		std::cout <<"YES" <<std::endl;
	}
	else if(count[0]==count[1]&&count[2]==count[0]+1||){
		std::cout <<"YES" <<std::endl;
	}else if(count[1]==count[2]&&count[0]==count[1]-1){
		std::cout <<"YES" <<std::endl;
	}else{
		std::cout << "NO" <<std::endl;
	}
}

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

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;


public class B {
	
	public static void main(String[] args){
		try(final Scanner sc = new Scanner(System.in)){
			int a_count = 0, b_count = 0, c_count = 0;
			for(final char c : sc.next().toCharArray()){
				switch (c) {
				case 'a': a_count++; break;
				case 'b': b_count++; break;
				case 'c': c_count++; break;
				}
			}
			
			final int sum = a_count + b_count + c_count;
			final int max_count = Math.max(a_count, Math.max(b_count, c_count));
			final int min_count = Math.min(a_count, Math.min(b_count, c_count));
			final int mid_count = sum - max_count - min_count;
			
			final int rest_count = sum - max_count;
			
			if(max_count >= rest_count){
				final int diff = max_count - rest_count;
				
				if(min_count == 0){
					System.out.println(diff <= 0 ? "YES" : "NO");
				}else{
					System.out.println(diff <= 1 ? "YES" : "NO");
				}
			}else{
				final int diff = rest_count - max_count;
				final int can_make_rest_pair = Math.min(diff, Math.min(mid_count, min_count));
				
				System.out.println("NO");
			}
		}
	}
	
	public static class Scanner implements AutoCloseable {
		private BufferedReader br;
		private StringTokenizer tok;

		public Scanner(InputStream is) {
			br = new BufferedReader(new InputStreamReader(is));
		}

		private void getLine() {
			try {
				while (!hasNext()) {tok = new StringTokenizer(br.readLine());}
			} catch(IOException e){ /* ignore */ }
		}

		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}

		public String next() {
			getLine(); return tok.nextToken();
		}

		public int nextInt(){
			return Integer.parseInt(next());
		}
		public long nextLong(){
			return Long.parseLong(next());
		}
		public double nextDouble(){
			return Double.parseDouble(next());
		}
		
		public int[] nextIntArray(int n){
			int[] ret = new int[n];
			for(int i = 0; i < n; i++){ ret[i] = nextInt(); }
			return ret;
		}
		public long[] nextLongArray(int n){
			long[] ret = new long[n];
			for(int i = 0; i < n; i++){ ret[i] = nextLong(); }
			return ret;
		}
		public double[] nextDoubleArray(int n){
			double[] ret = new double[n];
			for(int i = 0; i < n; i++){ ret[i] = nextDouble(); }
			return ret;
		}

		public void close() {
			try{ br.close(); } catch (IOException e){ /*ignore*/ }
		}
	}
}


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

#include <iostream>
using namespace std;
int main(){
  string s;
  cin >> s;
  int abc[3];fill(abc,abc+3,0);
  for(int i = 0; i < s.length(); ++i) ++abc[s[i]-'a'];
  int M = max({abc[0],abc[1],abc[2]}), m = min({abc[0],abc[1],abc[2]});
  if(M < m+2) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}


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

#include <iostream>
using namespace std;
int main(){
  string s;
  cin >> s;
  int abc[3];fill(abc,abc+3,0);
  for(int i = 0; i < s.length(); ++i) ++abc[s[i]-'a'];
  int M = max({abc[0],abc[1],abc[2]}), m = min({abc[0],abc[1],abc[2]});
  if(M < m+2) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:14: error: no matching function for call to 'max(<brace-enclosed initializer list>)'
    8 |   int M = max({abc[0],abc[1],abc[2]}), m = min({abc[0],abc[1],abc[2]});
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 1 provided
a.cc:9:10: error: 'm' was not declared in this scope
    9 |   if(M < m+2) cout << "YES" << endl;
      |          ^
Language: C

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for (ll i=0; i<n; ++i)
#define all(c) begin(c),end(c)
/*
3
7 12 8

7  12 8
17 12 16

めっちゃ簡単？
4通り*50かな
ああ、2^50ということか
それはTLEだから、重複箇所はまとめるとかDPとか、
0000000
0000001
0000010
0000011
関係してるのってその前後2か所だけ
ああ
A A
B B
*/
int main(){
  ll N; cin>>N;
  if(N==1){
    cout<<0<<endl;
    return 0;
  }
  vector<ll> D(N+10,0),E(N+10,0);
  rep(i,N) cin>>D[i];
  rep(i,N) E[i] = 24-D[i];
  ll x=12, y=12;
/*
rep(i,N) cout<<D[i]<<" "; 
cout<<endl;
rep(i,N) cout<<E[i]<<" ";
cout<<endl;
*/
  for(ll i=0; i<N-1; i++){
    ll a,b,c,d;
    (a=abs(D[i]-D[i+1]))%=12;
    (b=abs(D[i]-E[i+1]))%=12;
    (c=abs(E[i]-D[i+1]))%=12;
    (d=abs(E[i]-E[i+1]))%=12;
//printf("%d,%d,%d,%d \n",a,b,c,d);  
    x=min(x,max(a,c));
    y=min(y,max(b,d));
  }
  ll ans=max(x,y);
  cout<<ans<<endl;
}

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<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 50;
 
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;
}
using namespace std;
 

void solve(){
   int n;
   cin>>n;
   int d,ans=0,mmin=24;
   map<int,int>mp;
   rep(i,n){
       cin>>d;
       if(d==0){
           cout<<0<<"\n";
           return;
       }
       mmin=min(mmin,d);
       mp[d]++;
   }
   vector<int>v;
   if(n>24){
       cout<<0<<"\n";
       return 0;
   }
   for(auto x:mp){
       if(x.second>2){
           cout<<0<<"\n";
           return;
       }
       rep(i,x.second)v.pb(x.first);
   }
   for(auto x:mp){
       if(x.first==1){
           cout<<1<<"\n";
           return;
       }
   }
   v.pb(0);
   vector<int>w(n+1);
   for(int i=0;i<(1<<n);++i){
       rep(j,n+1){
           if((1<<j)&i)w[j]=24-v[j];
           else w[j]=v[j];
       }
       int minv=30;
       rep(j,n){
           for(int k=j+1;k<n+1;++k){
               minv=min(minv,abs(w[j]-w[k]));
           }
       }
       ans=max(ans,minv);
   }
   cout<<min(mmin,ans)<<"\n";
}
 
 
signed main(){
	ios::sync_with_stdio(false);
        cin.tie(0);
	cout<<fixed<<setprecision(15);
	solve();
	return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:59:15: error: return-statement with a value, in function returning 'void' [-fpermissive]
   59 |        return 0;
      |               ^
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
  int n;cin>>n;
  vector<int> a;
  a.push_back(0);
  for(int i = 0; n > i; i++){
    cin>>tmp;
    a.push_back(tmp);
  }
  sort(a.begin(),a.end());
  for(int i = 0; n > i; i+=2){
    a[i] = 24 - a[i];
  }
  sort(a.begin(),a.end());
  int ans = 10000;
  for(int i = 1; n > i; i++){
    ans = min(ans,a[i]-a[i-1]);
  }
  cout << ans << endl;
}

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

#include <bits/stdc++.h>

using namespace std;

using ll = long long;

const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}

int main () {
  cin.tie(0);
  cout << fixed << setprecision(10);
  int n; cin >> n;
  vector<int> d(n);
  map<int, bool> mp;
  for(int i=0;i<n;++i) {
    cin >> d[i];
    d[i] = min(d[i], 24 - d[i]);
    if(if(mp[d[i]] || d[i] == 0) {
      cout << 0 << endl;
      return 0;
    } else {
      mp[d[i]] = true;
    }
  }
  sort(d.begin(), d.end());
  // printv(d);
  vector<int> t1(n+1), t2(n+1);
  t1[n] = 0;
  bool now = 0;
  for(int i=0;i<n;++i) {
    if(now) {
      t1[i] = d[i];
    } else {
      t1[i] = 24 - d[i];
    }
    now = !now;
  }
  t2[n] = 0;
  now = 1;
  for(int i=0;i<n;++i) {
    if(now) {
      t2[i] = d[i];
    } else {
      t2[i] = 24 - d[i];
    }
    now = !now;
  }
  sort(t1.begin(), t1.end());
  sort(t2.begin(), t2.end());
  // printv(t1);
  // printv(t2);

  int mi1 = INF, mi2 = INF;
  for(int i=0;i<n;++i) {
    mi1 = min(mi1, t1[i+1] - t1[i]);
    mi2 = min(mi2, t2[i+1] - t2[i]);
  }

  cout << max(mi1, mi2) << endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:8: error: expected primary-expression before 'if'
   30 |     if(if(mp[d[i]] || d[i] == 0) {
      |        ^~
a.cc:30:8: error: expected ')' before 'if'
   30 |     if(if(mp[d[i]] || d[i] == 0) {
      |       ~^~
      |        )
a.cc:36:3: error: expected primary-expression before '}' token
   36 |   }
      |   ^
Language: C++


#include<bits/stdc++.h>
using namespace std;
#define inf 1000000000
#define INF 1000000000000000
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
#define IN(a,n) rep(i,n){ cin>>a[i]; }
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265
#define F first
#define S second
#define PB push_back
#define EB emplace_back
void init(){
  cin.tie(0);
  ios::sync_with_stdio(false);
}

int v[100];

int main(){
  int n;
  cin>>n;
  rep(i,n){
    cin>>v[i+1];
  }
  sort(all(v));
  FOR(i,1,n+1){
    if(i%2==0)
      v[i]=24-v[i];
  }
  sort(all(v));

 
  int ans=24;
  FOR(i,1,n+1){
    ans=min(ans,v[i]-v[i-1]);
  }

  cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:18: error: request for member 'begin' in 'v', which is of non-class type 'int [100]'
   15 | #define all(a) a.begin(),a.end()
      |                  ^~~~~
a.cc:37:8: note: in expansion of macro 'all'
   37 |   sort(all(v));
      |        ^~~
a.cc:15:28: error: request for member 'end' in 'v', which is of non-class type 'int [100]'
   15 | #define all(a) a.begin(),a.end()
      |                            ^~~
a.cc:37:8: note: in expansion of macro 'all'
   37 |   sort(all(v));
      |        ^~~
a.cc:15:18: error: request for member 'begin' in 'v', which is of non-class type 'int [100]'
   15 | #define all(a) a.begin(),a.end()
      |                  ^~~~~
a.cc:42:8: note: in expansion of macro 'all'
   42 |   sort(all(v));
      |        ^~~
a.cc:15:28: error: request for member 'end' in 'v', which is of non-class type 'int [100]'
   15 | #define all(a) a.begin(),a.end()
      |                            ^~~
a.cc:42:8: note: in expansion of macro 'all'
   42 |   sort(all(v));
      |        ^~~
Language: C++

#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define vi vector<int>
#define vvi vector<vi>
#define substr(s,f,t) (s.substr(f-1,t-f+1))
#define ALL(a) (a).begin(),(a).end()
#define Yes(hoge) cout<<((hoge)?"Yes":"No")<<endl;
#define YES(hoge) cout<<((hoge)?"YES":"NO")<<endl;
using namespace std;
struct Grid{ll x,y,t;};
struct Edge{ll to,cost;};
struct Graph{vector<vector<Edge>>E;int V;
  const ll Inf = llINF;const int MAX_V=201010;vector<ll>d;
  Graph(int n):E(n){d.resize(MAX_V);E.resize(n);V=n;}
  void init(){for(int i=0;i<MAX_V;i++)d[i]=Inf;}
  void add_edge(ll from,ll to,ll cost){E[from].pb({to,cost});}
};
int n;
int dep;
int ans=0;
set<int>se;
vi hog;
void dfs(int bit,int d){
  if(dep==d){
    int cnt=0;
    for(int num:se){
      if(bit&(1<<cnt)){
	hog.pb((24-num)%24);
      }else{
	hog.pb(num);
      }
      cnt++;
    }
    int mi=INF;
    for(int i=0;i<hog.size();i++)
      for(int j=i+1;j<hog.size();j++)
	mi=min(mi,abs(hog[i]-hog[j]));
    for(int i=0;i<dep;i++)hog.pop_back();
    ans=max(ans,mi);
    return;
  }
  
  dfs(bit+1<<d,d+1);
  dfs(bit,d+1);
}
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>n;
  se.insert(0);
  vi hh(30);
  hh[0]++;
  bool fl=false;
  for(int i=1;i<=n;i++){int a;cin>>a;ho[a]++;if(ho[a]>=3)fl=true;}
  if(fl)cout<<0<<endl;
  else{
    for(int i=0;i<30;i++){
      if(ho[i]==1){
	se.insert(i);
      }else if(ho[i]==2){
	hog.pb(i);
	hog.pb((24-i)%24);
      }
    }
    dep=se.size();
    dfs(0,0);
    cout<<ans<<endl;
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:61:38: error: 'ho' was not declared in this scope; did you mean 'hh'?
   61 |   for(int i=1;i<=n;i++){int a;cin>>a;ho[a]++;if(ho[a]>=3)fl=true;}
      |                                      ^~
      |                                      hh
a.cc:65:10: error: 'ho' was not declared in this scope; did you mean 'hh'?
   65 |       if(ho[i]==1){
      |          ^~
      |          hh
Language: C++

#include <iostream>
#include <iomanip>
#include <cstring>
#include <algorithm> 
#include <math.h>
#include <queue>
#include <functional>
#include <map>
#include <vector>
#include <string>
using namespace std;
typedef long long ll;

int main(void){
    int n;
    vector<int> v;
    map<int, int> mp;

    cin >> n;
    for (int i = 0; i <= 12; i++) mp[i] = 0;
    mp[0]++;

    for (int i = 0; i < n; i++){
        int d;
        cin >> d;
        mp[d]++;
        if (d == 0 || d == 12) v.push_back(d);
        if (mp[d] == 3){
            cout << 0 << endl;
            return 0;
        }
       
    }

    int ans = 0;

    for (int i = 0; i < 1 << 11; i++){
        while (v.size() != 0) v.pop_back();
        for (int j = 0; j < mp[0]; j++) v.push_back(0);
        for (int j = 0; j < mp[12]; j++) v.push_back(12);
        for (int j = 0; j < 11; j++){
         
            if (mp[j+1] == 2){
                v.push_back(j + 1); v.push_back(23 - j);
            }
            else if (mp[j+1] == 1){
                if ((1 & i >> j) == 0) v.push_back(j + 1);
                else v.push_back(23 - j);
            }

        }
        
        int m = 100;
        for (int j = 0; j < v.size(); j++){
            for (int k = j + 1; k < v.size(); k++)  m = min(m, max(v[j] - v[k], v[k] - v[j]));

        ans = max(ans, m);

    }

    cout << ans << endl;

}

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

#include <cstdio>
#include <algorithm>
#include <queue>
#include <cmath>
#define ROP(i,n) for(int i=0;i<n;i++)
using namespace std;
priority_queue<int> que;
int main(){
  int N,D[50],DD[50];
  scanf("%d",&N);
  if(N==1){
    printf("0\n");return 0;
  }
  ROP(i,N){
    scanf(" %d",&D[i]);
    DD[i]=D[i];
  }
  
  ROP(i,N){
    int MIN=12;DD[i]=24-D[i],cnt=0;
    ROP(j,N){
      if(i==j) continue;
      MIN=min(MIN,abs(DD[i]-D[j]));
    }
    DD[i]=D[i];
    ROP(j,N){
      if(i==j) continue;
      if(DD[i]==D[j]){
        if(++cnt==2){
          printf("0\n");
          return 0;
        }
        continue;
      }
      MIN=min(MIN,abs(DD[i]-D[j]));
    }
    ROP(i,N){
      MIN=min(MIN,D[i]);
    }
    que.push(MIN);
  }
  printf("%d\n",que.top());
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:30: error: 'cnt' was not declared in this scope; did you mean 'int'?
   20 |     int MIN=12;DD[i]=24-D[i],cnt=0;
      |                              ^~~
      |                              int
Language: C++

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <queue>
#include <cmath>
#define ROP(i,n) for(int i=0;i<n;i++)
using namespace std;
priority_queue<int> que;
int main(){
  int N,D[50],DD[50];
  scanf("%d",&N);
  if(N==1) printf("0\n"),return 0;
  ROP(i,N){
    scanf(" %d",&D[i]);
    DD[i]=D[i];
    if(D[i]==0){
      printf("0\n");
      return 0;
    }
  }
  ROP(i,N){
    int MIN=12;DD[i]=24-D[i];
    ROP(j,N){
      if(i==j) continue;
      MIN=min(MIN,abs(DD[i]-D[j]));
    }
    DD[i]=D[i];
    ROP(j,N){
      if(i==j) continue;
      if(DD[i]==D[j]) continue;
      MIN=min(MIN,abs(DD[i]-D[j]));
    }
    ROP(i,N){
      MIN=min(MIN,D[i]);
    }
    que.push(MIN);
  }
  printf("%d\n",que.top());
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:26: error: expected primary-expression before 'return'
   12 |   if(N==1) printf("0\n"),return 0;
      |                          ^~~~~~
Language: C++

#include <iostream>
using namespace std;
#include<string.h>
#include<set>
#include<stdio.h>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cstring>
#include <cstdio>
#include <cstdlib>
#include<stack>
#include<vector>
int  a[100];
int b[100];
int main()
{
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>a[i];
    if(n==1)
    {
        cout<<a[1]<<endl;
        return 0;
    }
    int min1=1e9;
    int min2=1e9;
    b[0]=0;
    sort(a+1,a+1+n);
    for(int i=1;i<=n;i++)
    {
        if(i%2==0)
            b[i]=24-a[i];
        else
            b[i]=a[i];
    //cout<<b[i]<<endl;
    }
    sort(b,b+1+n);
    for(int i=1;i<=n;i++)
    {
         min1=min(min1,abs(b[i]-b[i-1]));
         //cout<<b[i]<<endl;
    }
     for(int i=1;i<=n;i++)
    {
        if(i%2==1)
            b[i]=24-a[i];
        else
            b[i]=a[i];
            //cout<<b[i]<<endl;
    }
    sort(b,b+1+n);
    for(int i=1;i<=n;i++)
    {
        min2=min(min2,abs(b[i]-b[i-1]));
    }
    cout<<min1(min1,min2)<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:61:15: error: 'min1' cannot be used as a function
   61 |     cout<<min1(min1,min2)<<endl;
      |           ~~~~^~~~~~~~~~~
Language: C++

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

int main(){
	int n,d[52]={},dr[52]={},i,j,k,sm1=24,sm2=24,sm3=24,smax=0;
	cin>>n;
	FOR(i,1,n+1){
		cin>>d[i];
	}
	n++;
	sort(d,d+n);
	FOR(i,0,n)dr[i]=24-d[i];
	int f=0,s1,s2,s3;
	FOR(i,1,n){
		//cout<<d[i]<<" "<<dr[i]<<endl;
		if(f==0){
			s1=d[i]-dr[i-1];
			s2=dr[i]-d[i-1];
			if(s1>12||s1<-12)s1=d[i]-d[i-1];
			if(s2>12||s2<-12)s2=d[i]-d[i-1];
		}else{
			s2=d[i]-dr[i-1];
			s1=dr[i]-d[i-1];
			if(s1>12||s1<-12)s1=d[i]-d[i-1];
			if(s2>12||s2<-12)s2=d[i]-d[i-1];
		}
		if(n>=2){
			s3=d[i]-dr[i-2];
		}
		if(s1<0)s1=-s1;
		if(s2<0)s2=-s2;
		if(sm1>s1)sm1=s1;
		if(sm2>s2)sm2=s2;
		if(sm1>s3)sm1=s3;
		if(sm2>s3)sm2=s3;
		f=(f+1)%2;
	}
	//sm1=sm1%12;
	//sm2=sm2%12;
	smax=sm1>sm2?sm1:sm2;
	if(n==2)smax=d[1];
	FORQ(i,1,12){
		if(upper_bound(d.begin(), d.begin()+n-1, i)-lower_bound(d.begin(), d.begin()+n-1, i)>=3)smax=0;
	}
	cout<<smax<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:77:34: error: request for member 'begin' in 'd', which is of non-class type 'int [52]'
   77 |                 if(upper_bound(d.begin(), d.begin()+n-1, i)-lower_bound(d.begin(), d.begin()+n-1, i)>=3)smax=0;
      |                                  ^~~~~
a.cc:77:45: error: request for member 'begin' in 'd', which is of non-class type 'int [52]'
   77 |                 if(upper_bound(d.begin(), d.begin()+n-1, i)-lower_bound(d.begin(), d.begin()+n-1, i)>=3)smax=0;
      |                                             ^~~~~
a.cc:77:75: error: request for member 'begin' in 'd', which is of non-class type 'int [52]'
   77 |                 if(upper_bound(d.begin(), d.begin()+n-1, i)-lower_bound(d.begin(), d.begin()+n-1, i)>=3)smax=0;
      |                                                                           ^~~~~
a.cc:77:86: error: request for member 'begin' in 'd', which is of non-class type 'int [52]'
   77 |                 if(upper_bound(d.begin(), d.begin()+n-1, i)-lower_bound(d.begin(), d.begin()+n-1, i)>=3)smax=0;
      |                                                                                      ^~~~~
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<complex>
#define INF 1047483647
#define llINF 9223372036854775807
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long

using namespace std;
int ma=0;
int time[13]={};
int n;
int mm=0;
void dfs(int depth,int s){
  if(depth==13||depth==mm+1){
    if(s!=INF)
      ma=max(s,ma);
    // cout<<ma<<endl;
    return;
  }
  int s2=s;
  for(int i=1;i<depth;i++){
    if(time[i]>0){
      //cout<<"!"<<endl;
      s=min(s,abs(depth-i));
      s2=min(s2,abs((24-depth)-i));
    }
  }
  if(time[depth]>=2){
    s=min(s,0);
    s2=min(s2,24-2*depth);
  }
  dfs(depth+1,s);
  dfs(depth+1,s2);
}
int main(){
  cin>>n;
  for(int i=0;i<n;i++){
    int a;
    cin>>a;
    time[a]++;
  }
  for(int i=12;i>=1;i--)
    if(time[i]){
      mm=i;
      break;
    }
  dfs(1,INF);
  cout<<ma<<endl;
  return 0;
}


Compiler output:
a.cc:22:12: error: 'int time [13]' redeclared as different kind of entity
   22 | int time[13]={};
      |            ^
In file included from /usr/include/pthread.h:23,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
                 from /usr/include/c++/14/ext/atomicity.h:35,
                 from /usr/include/c++/14/bits/ios_base.h:39,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
   76 | extern time_t time (time_t *__timer) __THROW;
      |               ^~~~
a.cc: In function 'void dfs(int, int)':
a.cc:34:14: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   34 |     if(time[i]>0){
      |              ^
a.cc:34:15: error: ordered comparison of pointer with integer zero ('time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} and 'int')
   34 |     if(time[i]>0){
      |        ~~~~~~~^~
a.cc:40:16: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   40 |   if(time[depth]>=2){
      |                ^
a.cc:40:17: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   40 |   if(time[depth]>=2){
      |      ~~~~~~~~~~~^~~
a.cc: In function 'int main()':
a.cc:52:11: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   52 |     time[a]++;
      |           ^
a.cc:52:11: warning: ISO C++ forbids incrementing a pointer of type 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} [-Wpointer-arith]
   52 |     time[a]++;
      |     ~~~~~~^
a.cc:52:11: error: lvalue required as increment operand
   52 |     time[a]++;
      |           ^
a.cc:55:14: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   55 |     if(time[i]){
      |              ^
Language: C++

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

#define fs first
#define sc second
#define pb emplace_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

signed main() {
  int n;
  // cin >> n;
  scanf("%d", &n);

  int d[51] = {};
  for (int i = 0; i < n; ++i) {
    scanf("%d", d + i);
  }

  // vector<int> d(n);
  // for (auto &i : d) cin >> i;
  // d.push_back(0);

  if (n >= 24) {
    cout << 0 << endl;
    return 0;
  }

  int ans = 0;
  for (int i = 0; i < (1 << n); ++i) {
    // vector<int> a(n + 1);
    int a[50] = {};
    for (int j = 0; j < n; ++j) {
      if (i & (1 << j)) {
        a[j] = d[j];
      } else {
        a[j] = 24 - d[j];
      }
    }

    // int diff = 1001001;
    // for (int j = 0; j < a.size(); ++j) {
    //   for (int k = 0; k < a.size(); k++) {
    //     if (j == k) continue;
    //     diff = min(diff, min(abs(a[j] - a[k]), 24 - abs(a[j] - a[k])));
    //   }
    // }

    // sort(all(a));
    sort(a, a + n + 1);
    int diff = min(a[n - 1]], 24 - a[n - 1]]);
    for (int j = 1; j <= n; ++j) {
      diff = min(diff, min(a[j] - a[j - 1], 24 - (a[j] - a[j - 1])));
    }
    // for (int j = 0; j < a.size(); ++j) {
    //   cout << a[j] << " ";
    // }
    // cout << " : " << diff << endl;

    ans = max(diff, ans);
  }

  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:54:28: error: expected ')' before ']' token
   54 |     int diff = min(a[n - 1]], 24 - a[n - 1]]);
      |                   ~        ^
      |                            )
Language: C++

#include "bits/stdc++.h"

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define DUMP(v) REP(aa, (v).size()) { cout << v[aa]; if (aa != v.size() - 1)cout << " "; else cout << endl; }
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll max(ll a, int b) { return max(a, ll(b)); }
ll max(int a, ll b) { return max(ll(a), b); }
ll min(ll a, int b) { return min(a, ll(b)); }
ll min(int a, ll b) { return min(ll(a), b); }
///(´・ω・`)(´・ω・`)(´・ω・`)(´・ω・`)(´・ω・`)(´・ω・`)///
struct Scc {
	int n;
	vector<vector<int>> g,
		rg;//逆向きのグラフ
	vector<int> cmp,//cmp[i]:頂点iが属する強連結成分の番号
		visited,
		num;//帰りがけ順で頂点が入る
	Scc(int N) {
		n = N;
		cmp.resize(n);
		visited.resize(n);
		g.resize(n);
		rg.resize(n);
	}
	void add_edge(int from, int to) {
		g[from].push_back(to);
		rg[to].push_back(from);
	}

	void dfs(int v) {
		visited[v] = true;
		for (int i = 0; i < g[v].size(); ++i) {
			if (!visited[g[v][i]])dfs(g[v][i]);
		}
		num.push_back(v);
	}

	void rdfs(int v, int k) {
		visited[v] = true;
		cmp[v] = k;
		for (int i = 0; i < rg[v].size(); ++i) {
			if (!visited[rg[v][i]])rdfs(rg[v][i], k);
		}
	}
	int calc() {
		for (int i = 0; i < n; ++i)visited[i] = false;
		num.clear();
		for (int i = 0; i < n; ++i) {
			if (!visited[i])dfs(i);
		}
		for (int i = 0; i < n; ++i)visited[i] = false;
		int k = 0;
		for (int i = num.size() - 1; i >= 0; --i) {
			if (!visited[num[i]]) {
				rdfs(num[i], k);
				++k;
			}
		}
		return k;
	}
};

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vi d(n);
	REP(i, n)cin >> d[i];
	int mint = INF;
	REP(i, n) {
		mint = min(min(d[i], 24 - d[i]), mint);
	}
	RREP(t, mint + 1) {
		Scc scc(2 * n);
		REP(i, n) {
			FOR(j, i + 1, n) {
				if (abs(d[i] - d[j]) < t) {
					if (abs(d[i] + d[j] - 24) < t) {
						goto next;
					}
					else {
						scc.add_edge(i, n + j);
						scc.add_edge(j, n + i);
					}
				}
				if (abs(d[i] + d[j] - 24) < t) {
					scc.add_edge(i, j);
					scc.add_edge(j, i);
				}
			}
		}
		scc.calc();
		int f = 1;
		REP(i, n) {
			if (scc.cmp[i] == scc.cmp[n + i])f = 0;
		}
		if (f) {
			cout << t << endl;
			return 0;
		}
	next:;
	}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:122:9: error: jump to label 'next'
  122 |         next:;
      |         ^~~~
a.cc:100:54: note:   from here
  100 |                                                 goto next;
      |                                                      ^~~~
a.cc:114:21: note:   crosses initialization of 'int f'
  114 |                 int f = 1;
      |                     ^
Language: C++

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

#define fs first
#define sc second
#define pb emplace_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

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

  int d[1010] = {};
  for (int i = 0; i < n; ++i) {
    cin >> d[i];
  }

  if (n >= 24) {
    cout << 0 << endl;
    return 0;
  }

  int ans = 0;
  int a[100];
  for (int i = 0; i < (1 << n); ++i) {
    for (int j = 0; j < n; ++j) {
      if (i & (1 << j)) {
        a[j] = d[j];
      } else {
        a[j] = 24 - d[j];
      }
    }
    sort(a, a + n);
    int diff = min(24 - a[n - 1], a[n - 1]);
    for (int i = 1; i < n; ++i) {
      diff = min(diff, min(a[i] - a[i - 1], 24 - (a[i] - a[i - 1]));
    }

    // int diff = 1001001;
    // for (int j = 0; j <= n; ++j) {
    //   for (int k = 0; k <= n; ++k) {
    //     if (j == k) continue;
    //     diff = min(diff, min(abs(a[j] - a[k]), 24 - abs(a[j] - a[k])));
    //   }
    // }

    ans = max(diff, ans);
  }

  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:38:68: error: expected ')' before ';' token
   38 |       diff = min(diff, min(a[i] - a[i - 1], 24 - (a[i] - a[i - 1]));
      |                 ~                                                  ^
      |                                                                    )
Language: C++

#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <algorithm>
#include <assert.h>
using namespace std;
int main() {
    std::ios::sync_with_stdio(false);
    cin.tie(0);
    int freq[13];
    for(int i = 0; i<13; i++){
        freq[i] = 0;
    }
    int n;
    cin >> n;
    for(int i = 0; i<n; i++){
        int x;
        cin >> x;
        assert(x<=12);
        freq[x]++;
    }
    vector<int> def;
    vector<int> li;
    if(freq[0]>0){
        cout << 0 << endl;
        return 0;
    }
    def.push_back(0);
    for(int i = 1; i<13; i++){
        if(freq[i]==0){
            continue;
        }
        else if(freq[i]==1){
            li.push_back(i);
        }
        else{
            def.push_back(i);
            def.push_back(24-i);
        }
    }
    int nn = li.size();
    int len = (1<<nn);
    int ans = 24;
    int defs = 24;
    for(int i = 0; i<def.size(); i++){
        for(int j = i+1; j<def.size(); j++){
            int ab = abs(def[i]-def[j]);
            ab = min(ab,24-ab);
            defs = min(defs,ab);
        }
    }
    ans = -1;
    for(int ma = 0; ma<len; ma++){
        vector<int> temp;
        for(int j = 0; j<nn; j++){
            bool on = ((1<<ma)&i)!=0;
            if(on){
                temp.push_back(li[j]);
            }
            else{
                temp.push_back(24-li[j]);
            }
        }
        int now = defs;
        for(int i = 0; i<nn; i++){
            for(int j = i+1; j<nn; j++){
                int ab = abs(temp[i]-temp[j]);
                ab = min(ab,24-ab);
                now = min(now,ab);
            }
        }
        for(int i =0 ; i<nn; i++){
            for(int j = 0; j<def.size(); j++){
                int ab = abs(temp[i]-def[j]);
                ab = min(ab,24-ab);
                now = min(now,ab);
            }
        }
        ans = max(ans,now);
    }
    assert(ans>=0);
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:57:32: error: 'i' was not declared in this scope
   57 |             bool on = ((1<<ma)&i)!=0;
      |                                ^