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

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

int main(void) {
    int a=0,b=0;
    string s;
    cin >> s;
    int ans=0;
    for (int i=1 ; i<s.size(); i++) if (s[i-1] != s[i]) ans = max(i, (s.size() - i));
    cout << ans << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:66: error: no matching function for call to 'max(int&, std::__cxx11::basic_string<char>::size_type)'
    9 |     for (int i=1 ; i<s.size(); i++) if (s[i-1] != s[i]) ans = max(i, (s.size() - i));
      |                                                               ~~~^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: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:   template argument deduction/substitution failed:
a.cc:9:66: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'})
    9 |     for (int i=1 ; i<s.size(); i++) if (s[i-1] != s[i]) ans = max(i, (s.size() - i));
      |                                                               ~~~^~~~~~~~~~~~~~~~~~~
/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, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:9:66: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
    9 |     for (int i=1 ; i<s.size(); i++) if (s[i-1] != s[i]) ans = max(i, (s.size() - i));
      |                                                               ~~~^~~~~~~~~~~~~~~~~~~
Language: C++

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

int main(void) {
    int a=0,b=0;
    string s;
    cin >> s;
    int ans=0;
    for (int i=1 ; i<s.size(); i++) if (s[i-1] != s[i]) ans = max(i, s.size() - i);
    cout << ans << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:66: error: no matching function for call to 'max(int&, std::__cxx11::basic_string<char>::size_type)'
    9 |     for (int i=1 ; i<s.size(); i++) if (s[i-1] != s[i]) ans = max(i, s.size() - i);
      |                                                               ~~~^~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: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:   template argument deduction/substitution failed:
a.cc:9:66: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'})
    9 |     for (int i=1 ; i<s.size(); i++) if (s[i-1] != s[i]) ans = max(i, s.size() - i);
      |                                                               ~~~^~~~~~~~~~~~~~~~~
/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, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:9:66: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
    9 |     for (int i=1 ; i<s.size(); i++) if (s[i-1] != s[i]) ans = max(i, s.size() - i);
      |                                                               ~~~^~~~~~~~~~~~~~~~~
Language: C++

/* ***********************************************
Author        :yang12138
Created Time  :2017年12月29日 星期五 14时53分54秒
File Name     :B.cpp
************************************************ */
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <algorithm>
#include <string>
#include <math.h>
#include <cstdlib>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
#define mem(a,b) memset(a,b,sizeof(a))
typedef long long ll;
typedef pair<int,int>pii;
#define lson (root<<1)
#define rson (root<<1|1)
 
const int N=1e5+10;
char s[N];
int a[N];
 
int main(){
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
 
	scanf("%s",s);
	int len=strlen(s),ans=len;
	int cnt=0;
 
	for(int i=0;i<len;){
		int j=i+1;
		while(j<len && s[j]==s[i]) j++;
		a[cnt++]=j-i;
		i=j;
	}

	if(cnt==1){
		printf("%d\n",len);
		return 0;
	}
	else if(cnt==2){
		printf("%d\n",max(a[0],a[1]));
		return 0;
	}

	for(int i=1;i<cnt-2;i++) ans=min(ans,a[i]+a[i+1]);
	if(cnt&1) ans=min(ans,a[cnt-2]+a[cnt-1]);

	printf("%d\n",ans);
    
    return 0;


Compiler output:
a.cc: In function 'int main()':
a.cc:57:14: error: expected '}' at end of input
   57 |     return 0;
      |              ^
a.cc:28:11: note: to match this '{'
   28 | int main(){
      |           ^
Language: C++

#include <iostream>
#include <string>
using namespace std;
int centerLength(string s){
    int length=s.length();
    char c=s[length/2];
    int left=length/2;
    int right=length-left;
    int ans=-length%2;
    for(int i=0;i<=length/2;i++){
        if(c==s[left-i]&&c==s[right+i]){
            ans+=2;
        }else{
            return ans;
        }
    }
    return length;
}
int main(){
    string s;
    cin>>s;
    int w=centerLength(s);
    cout<<w+(length-w)/2<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:14: error: 'length' was not declared in this scope
   23 |     cout<<w+(length-w)/2<<endl;
      |              ^~~~~~
Language: C++

#pragma comment(linker, "/STACK:1024000000,1024000000")
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <limits.h>
#include <assert.h>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <string>
#include <bitset>
#include <vector>
using namespace std;

#define LL long long

#define fi first
#define se second
#define lson l,mid,id<<1
#define rson mid+1,r,id<<1|1
#define ls id<<1
#define rs id<<1|1
#define MID(a,b) (((a)+(b))>>1)
#define maxx(a,b) ((a)<(b)?(b):(a))
#define minx(a,b) ((a)<(b)?(a):(b))
#define absx(a) ((a)<0?-(a):(a))
#define mk(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define itr iterator
#define lowbit(x) ((x)&-(x))

typedef unsigned LL ULL;
typedef unsigned uint;
typedef map<int,int> mii;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
typedef pair<LL,LL> pLL;

template< typename T > inline void read(T &x) {
    static bool fr_f; static char fr_ch;
    fr_f=0; x=0; fr_ch=getchar();
    while(fr_ch<'0' || '9'<fr_ch) {if(fr_ch=='-') fr_f=1; fr_ch=getchar();}
    while('0'<=fr_ch && fr_ch<='9') {x=(x<<1)+(x<<3)+fr_ch-'0'; fr_ch=getchar();}
    if(fr_f) x=-x;
}

template< typename T > inline void Max (T &a, T b) {if(a<b) a=b;}
template< typename T > inline void Min (T &a, T b) {if(b<a) a=b;}
template< typename T > inline void Swap(T &a, T &b) {T c=a;a=b;b=c;}
template< typename T > inline T Abs(T &a) {if(a<0) return -a; else return a;}

const double   pi = acos(-1.0) ;
const int     MOD = (int)1e9+7 ;
const int     INF = (int)0x3f3f3f3f ;
const LL     LINF = (LL)INF<<32|INF ;
const int    SINF = (uint)(-1)>>1 ;
const LL    SLINF = (ULL)(-1)>>1 ;
const double DINF = 1e50 ;
const double  eps = 1e-5 ;
const int    maxn = (int) 1e5+20 ;
const int    maxm = (int) 25000+20 ;
const int    maxk = (int) 1000+20 ;

inline int sig(double x) {return x<-eps?-1:x>eps;}
inline LL fp(LL a,LL n,LL p) {LL res=1; for(;n;n>>=1,a=a*a%p) if(n&1) res=res*a%p; return res;}
template<typename T>inline T gcd(T a,T b) {for(T c;b;c=a%b,a=b,b=c); return a;}

//--------------------start--------------------

int n;
char s[maxn];
bool cnt[maxn];
int arr[maxn];

void work()
{
    gets(s);
    n=strlen(s);
    memset(cnt,0,sizeof(int)*n);

    for(int i=1;i<n;i++)
    {
        if(s[i-1]!=s[i])
        {
            cnt[i-1]^=1;
            cnt[i]^=1;
        }
    }

    int ans=n,m=0;

    for(int i=0;i<n;i++)
        if(cnt[i])
            arr[m++]=i;

    m>>=1;
    for(int i=0;i<m;i++) Min(ans,arr[i+m]-arr[i]);

    cout <<max(ans,n-ans) <<endl;

}

//---------------------end---------------------

int main()
{
#ifdef yukihana0416
freopen("in.txt","r",stdin);
//freopen("out.txt","w",stdout);
#endif // yukihana0416
    work();
    return 0;
}


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

#include<iostream>
#include<string>

using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, i = 0;
    string str;
    cin >> str;
    N = str.length();
    string str1 = string(N, '1');
    string str0 = string(N, '0');
    for(;str0.substr(i,N-2*i) != str.substr(i, N-2*i)) && (str1.substr(i, N-2*i) != str.substr(i, N-2*i)) && (i <= N/2);++i){}
    cout << N-i << "\n";
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:54: error: expected ';' before ')' token
   15 |     for(;str0.substr(i,N-2*i) != str.substr(i, N-2*i)) && (str1.substr(i, N-2*i) != str.substr(i, N-2*i)) && (i <= N/2);++i){}
      |                                                      ^
      |                                                      ;
a.cc:15:59: error: expected identifier before '(' token
   15 |     for(;str0.substr(i,N-2*i) != str.substr(i, N-2*i)) && (str1.substr(i, N-2*i) != str.substr(i, N-2*i)) && (i <= N/2);++i){}
      |                                                           ^
a.cc:15:124: error: expected ';' before ')' token
   15 |     for(;str0.substr(i,N-2*i) != str.substr(i, N-2*i)) && (str1.substr(i, N-2*i) != str.substr(i, N-2*i)) && (i <= N/2);++i){}
      |                                                                                                                            ^
      |                                                                                                                            ;
Language: C++

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

typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod (ll)1e9+7

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
  int s;
  cin >> s;
  int ans = 0;
  rep(i, 0, s.length()) if(s[i] == '0') ans++;
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:15: error: request for member 'length' in 's', which is of non-class type 'int'
   23 |   rep(i, 0, s.length()) if(s[i] == '0') ans++;
      |               ^~~~~~
a.cc:9:44: note: in definition of macro 'rep'
    9 | #define rep(i, a, n) for(int i = (a); i < (n); i++)
      |                                            ^
a.cc:23:29: error: invalid types 'int[int]' for array subscript
   23 |   rep(i, 0, s.length()) if(s[i] == '0') ans++;
      |                             ^
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#include <windows.h>
using namespace std;

//using ll = long long;
typedef long long ll;

//#define scanf_s scanf // 必ず消す!!

#define INF ((1LL << 31) - 1)
#define INFLL ((1LL << 62) - 1)
#define MOD int(1e9+7)
#define repi(i,j,n) for(int i = (j); i < (n); ++i)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) for(int i = n; i >= 0; --i)
#define fi first
#define se second
#define all(v) (v).begin(), (v).end()

// 4近傍のときは for(int i = 0; i < 8; i+=2) などとして使うこと
int vx[8] = { 0, 1, 1, 1, 0, -1, -1, -1 }, vy[8] = { -1, -1, 0, 1, 1, 1, 0, -1 };

// [sx, se), [sy, ey)であることに注意
inline bool check(int sx, int ex, int sy, int ey, int x, int y) {
	return (sx <= x and x < ex and sy <= y and y < ey);
}

inline bool check(int ex, int ey, int x, int y) {
	return check(0, ex, 0, ey, x, y);
}

inline void init() {
	cin.tie(0);
	ios::sync_with_stdio(false);
}

string input, s;
int ans, n;

int main() {
	cin >> s;
	int n = s.size();
	ans = n;

	for (int i = 0; i < n; ++i) {
		if (s[i] == '0') {
			if (i == 0 || i == n - 1) {
				ans = min(ans, n - 1);
			}
			else {
				ans = min(ans, max(i + 1, n - i));
			}
		}
	}

	cout << ans << endl;

	return 0;
}

Compiler output:
a.cc:14:10: fatal error: windows.h: No such file or directory
   14 | #include <windows.h>
      |          ^~~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, 
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair


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

  string s; cin >> s;
  ll ans=1000000;
  rep(i,s.size()-1){
    if(s[i]!=s[i+1])
      ans=min(ans,max(i+1,s.size()-i-1LL));
  }
 cout<<ans <<endl;
return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:22: error: no matching function for call to 'max(long long int, long long unsigned int)'
   29 |       ans=min(ans,max(i+1,s.size()-i-1LL));
      |                   ~~~^~~~~~~~~~~~~~~~~~~~
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:   template argument deduction/substitution failed:
a.cc:29:22: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long long unsigned int')
   29 |       ans=min(ans,max(i+1,s.size()-i-1LL));
      |                   ~~~^~~~~~~~~~~~~~~~~~~~
/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, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:4:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:29:22: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   29 |       ans=min(ans,max(i+1,s.size()-i-1LL));
      |                   ~~~^~~~~~~~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, 
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair


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

  string s; cin >> s;
  ll ans=1000000;
  rep(i,s.size()-1){
    if(s[i]!=s[i+1])
      ans=min(ans,max(i+1,s.size()-i-1));
  }
 cout<<ans <<endl;
return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:22: error: no matching function for call to 'max(long long int, long long unsigned int)'
   29 |       ans=min(ans,max(i+1,s.size()-i-1));
      |                   ~~~^~~~~~~~~~~~~~~~~~
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:   template argument deduction/substitution failed:
a.cc:29:22: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long long unsigned int')
   29 |       ans=min(ans,max(i+1,s.size()-i-1));
      |                   ~~~^~~~~~~~~~~~~~~~~~
/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, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:4:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:29:22: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   29 |       ans=min(ans,max(i+1,s.size()-i-1));
      |                   ~~~^~~~~~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, 
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair


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

  string s; cin >> s;
  ll ans=1000000;
  rep(i,s.size()-1){
    if(s[i]!=s[i+1])
      ans=min(ans,max(i+1,s.size()-i-1);
  }
 cout<<ans <<endl;
return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:22: error: no matching function for call to 'max(long long int, long long unsigned int)'
   29 |       ans=min(ans,max(i+1,s.size()-i-1);
      |                   ~~~^~~~~~~~~~~~~~~~~~
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:   template argument deduction/substitution failed:
a.cc:29:22: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long long unsigned int')
   29 |       ans=min(ans,max(i+1,s.size()-i-1);
      |                   ~~~^~~~~~~~~~~~~~~~~~
/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, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:4:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:29:22: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   29 |       ans=min(ans,max(i+1,s.size()-i-1);
      |                   ~~~^~~~~~~~~~~~~~~~~~
Language: C++

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include  // complex a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair


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

  string s; cin >> s;
  ll ans=1000000;
  rep(I,s.size()-1){
    if(s[i]!=s[i+1])
      ans=min(ans,max(i+1,s.size()-i-1);
  }
 cout<<and<<endl;
return 0;
}


Compiler output:
a.cc:1:10: error: #include expects "FILENAME" or <FILENAME>
    1 | #include
      |          ^
a.cc:2:10: error: #include expects "FILENAME" or <FILENAME>
    2 | #include
      |          ^
a.cc:3:10: error: #include expects "FILENAME" or <FILENAME>
    3 | #include
      |          ^
a.cc:4:10: error: #include expects "FILENAME" or <FILENAME>
    4 | #include
      |          ^
a.cc:5:10: error: #include expects "FILENAME" or <FILENAME>
    5 | #include
      |          ^
a.cc:6:10: error: #include expects "FILENAME" or <FILENAME>
    6 | #include
      |          ^
a.cc:7:10: error: #include expects "FILENAME" or <FILENAME>
    7 | #include
      |          ^
a.cc:8:10: error: #include expects "FILENAME" or <FILENAME>
    8 | #include
      |          ^
a.cc:9:60: error: #include expects "FILENAME" or <FILENAME>
    9 | #include  // complex a(1.2 , 2.3);// real(): 1.2, imag()2.3
      |                                                            ^
a.cc: In function 'int main()':
a.cc:22:3: error: 'cin' was not declared in this scope
   22 |   cin.tie(0);
      |   ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | #include
a.cc:23:3: error: 'ios' has not been declared
   23 |   ios::sync_with_stdio(false);
      |   ^~~
a.cc:25:3: error: 'string' was not declared in this scope
   25 |   string s; cin >> s;
      |   ^~~~~~
a.cc:1:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
  +++ |+#include <string>
    1 | #include
a.cc:25:20: error: 's' was not declared in this scope
   25 |   string s; cin >> s;
      |                    ^
a.cc:28:10: error: 'i' was not declared in this scope
   28 |     if(s[i]!=s[i+1])
      |          ^
a.cc:29:19: error: 'max' was not declared in this scope
   29 |       ans=min(ans,max(i+1,s.size()-i-1);
      |                   ^~~
a.cc:31:2: error: 'cout' was not declared in this scope
   31 |  cout<<and<<endl;
      |  ^~~~
a.cc:31:2: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:31:11: error: expected identifier before '<<' token
   31 |  cout<<and<<endl;
      |           ^~
a.cc:31:13: error: 'endl' was not declared in this scope
   31 |  cout<<and<<endl;
      |             ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | #include
Language: C++

#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
template bool exist(vector vec, X item){return find(all(vec), item)!=vec.end();}

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

  string s; cin >> s;
  ll ans;
  rep(I,s.size()-1){
    if(s[i]!=s[i+1])
      ans=min(and,max(i+1,s.size()-i-1)
  }
 count<


Compiler output:
a.cc:23:21: error: missing template argument list after 'std::vector'; template placeholder not permitted in parameter
   23 | template bool exist(vector vec, X item){return find(all(vec), item)!=vec.end();}
      |                     ^~~~~~
      |                           <>
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_vector.h:428:11: note: 'template<class _Tp, class _Alloc> class std::vector' declared here
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
a.cc:23:33: error: 'X' has not been declared
   23 | template bool exist(vector vec, X item){return find(all(vec), item)!=vec.end();}
      |                                 ^
a.cc:23:39: error: 'exist' is not a template function
   23 | template bool exist(vector vec, X item){return find(all(vec), item)!=vec.end();}
      |                                       ^
a.cc:23:40: error: expected ';' before '{' token
   23 | template bool exist(vector vec, X item){return find(all(vec), item)!=vec.end();}
      |                                        ^
      |                                        ;
a.cc: In function 'int main()':
a.cc:32:10: error: 'i' was not declared in this scope
   32 |     if(s[i]!=s[i+1])
      |          ^
a.cc:33:18: error: expected identifier before ',' token
   33 |       ans=min(and,max(i+1,s.size()-i-1)
      |                  ^
a.cc:35:2: error: parse error in template argument list
   35 |  count<
      |  ^~~~~~
a.cc:35:8: error: expected ';' at end of input
   35 |  count<
      |        ^
      |        ;
a.cc:35:2: error: statement cannot resolve address of overloaded function
   35 |  count<
      |  ^~~~~~
a.cc:35:8: error: expected '}' at end of input
   35 |  count<
      |        ^
a.cc:25:11: note: to match this '{'
   25 | int main(){
      |           ^
Language: C++

#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF 1<<30

int main(void){
	int i=0,n,cnt=1,ans,sz;
	string s;
	cin >> s;
	n = s.length();
	s[n] = '2';
	ans = INF;
	for(i=1; i<=n; i++){
		if(s[i] != s[i-1]){
			ans = min(ans,max(n-k,k))
		}
	}
	cout << ans << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:45: error: 'k' was not declared in this scope
   15 |                         ans = min(ans,max(n-k,k))
      |                                             ^
Language: C++

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

int main() {
    string s;
    cin >> s;
    int p = 0;
    int sum  = 0;
    int mx = 0, cnt = 0;;
    for(int i=0; i<s.size(); i++) {
        sum += s[i]-'0';
        if(p==sum) cnt++; ;
        else mx = min(cnt,mx), cnt = 0, p = sum ;
    }
    //  cerr << mx << endl;
    if(mx==0) {
        cout << s.size() << endl;
        return 0;
    }
    if(s.size()>2 && mx==1) {
        cout << 2 << endl;
    } else cout << mx << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:13:9: error: 'else' without a previous 'if'
   13 |         else mx = min(cnt,mx), cnt = 0, p = sum ;
      |         ^~~~
Language: C++

//在 POJ 和小白菜中，万能库禁用！
//在 USACO中请用文件。
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#include<string>
#define inf 2139062143   //2147483647.
#define mod 1000000007
//data:
using namespace std;
string s;
bool a[100005];
int ans,st,n;
bool OK(int k){
	int st=1,j=1,len;
	while(j<=n){
		if(n-j+1<k) return false;
		for(int l=j;l<j+k;l++){
			a[l]=1-a[l];
		}
		st=j=j+k;
	}
	return true;
}
int b_s(){
	int lft=1;rig=n;
	while(lft<rig){
		int mid=(lft+rig+1)/2;
		if(OK(mid)) lft=mid;
		else rig=mid-1;
	}
	return rig;
}
int main(){
//	freopen("ryz.in","r",stdin);
//	freopen("my.out","w",stdout);
//	ios::sync_with_stdio(false);
	cin>>s;
	n=s.size();
	a[1]=s[0]-'0';
	for(int i=2;i<=n;i++){
		a[i]=s[i-1]-'0';
		if(a[1]==0) a[i]=1-a[i];
	}
 	if(a[1]==0) a[1]=1;
 	ans=b_s();
	printf("%d\n",ans);
	return 0;
}

Compiler output:
a.cc: In function 'int b_s()':
a.cc:28:19: error: 'rig' was not declared in this scope
   28 |         int lft=1;rig=n;
      |                   ^~~
Language: C++

#include <bits/stdc++.h>

typedef long long int ll;
typedef unsigned long long int ull;
#define rep(i,n) for(ll i=0;i<(n);i++)


using namespace std;


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

    ll n = s.size();


    ll d = 1;
    if(n%2 == 0){
        ll midl = n/2-1;
        ll midr = n/2;
        if(s[midl] != s[midr]){
            d = 0;
        }
        else{
            bool end = false;
            for(; !end && d < n/2+5; d++){
                if(0 <= midl-d){
                    if(s[midl] == s[midl-d]){}
                    else end = true;
                }
                if(midr+d < n){
                    if(s[midr] == s[midr+d]){}
                    else end = true;
                }
            }
            if(end) d--;
        }
        if(end) cout << (n/2) + d << endl;
        else    cout << n << endl;
    }
    else{
        ll mid = (n-1)/2;
        bool end = false;
        for(; !end && d < n/2+5; d++){
            if(0 <= mid-d){    
                if(s[mid] == s[mid-d]){}
                else end = true;
            }
            if(mid+d < n){
                if(s[mid] == s[mid+d]){}
                else end = true;
            }
        }

        if(end) d--;

        if(end) cout << ((n+1)/2) + d - 1 << endl;
        else    cout << n << endl;
    }

    

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:15: error: cannot resolve overloaded function 'end' based on conversion to type 'bool'
   39 |         if(end) cout << (n/2) + d << endl;
      |               ^
Language: C++

#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF 1<<30

vector<int> sq;

int main(void){
	int i=0,n,cnt=1,ans,sz;
	string s;
	cin >> s;
	n = s.length();
	s[n] = '2';
	for(i=1; i<=n; i++){
		if(s[i] == s[i-1]){
			cnt++;
		}else{
			sq.push_back(cnt);
			cnt = 1;
		}
	}#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF 1<<30
 
vector<int> sq;
 
int main(void){
	int i=0,n,cnt=1,ans;
	string s;
	cin >> s;
	n = s.length();
	s[n] = '2';
	for(i=1; i<=n; i++){
		if(s[i] == s[i-1]){
			cnt++;
		}else{
			sq.push_back(cnt);
			cnt = 1;
		}
	}
	ans = INF;
	if(sq.size()>4){
		for(i=(sq.size()-1); i>1; i--){
			ans = min(ans,sq[i]+sq[i-1]+sq[i-2]);
		}
	}else if(sq.size()>2){
		for(i=(sq.size()-1); i>0; i--){
			ans = min(ans,sq[i]+sq[i-1]);
		}
	}else{
		ans = 0;
	}
	for(i=(sq.size()-1); i>=0; i--){
		ans = max(ans,sq[i]);
	}
	cout << ans << endl;
	return 0;
}
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF 1<<30

vector sq;

int main(void){
	int i=0,n,cnt=1,ans;
	string s;
	cin >> s;
	n = s.length();
	s[n] = '2';
	for(i=1; i<=n; i++){
		if(s[i] == s[i-1]){
			cnt++;
		}else{
			sq.push_back(cnt);
			cnt = 1;
		}
	}
	ans = INF;
	if(sq.size()>3){
		for(i=(sq.size()-1); i>1; i--){
			ans = min(ans,sq[i]+sq[i-1]+sq[i-2]);
		}
	}else if(sq.size()>2){
		for(i=(sq.size()-1); i>0; i--){
			ans = min(ans,sq[i]+sq[i-1]);
		}
	}else{
		ans = 0;
	}
	for(i=(sq.size()-1); i>=0; i--){
		ans = max(ans,sq[i]);
	}
	cout << ans << endl;
	return 0;
}


Compiler output:
a.cc:21:10: error: stray '#' in program
   21 |         }#include "bits/stdc++.h"
      |          ^
a.cc: In function 'int main()':
a.cc:21:11: error: 'include' was not declared in this scope
   21 |         }#include "bits/stdc++.h"
      |           ^~~~~~~
a.cc:28:15: error: a function-definition is not allowed here before '{' token
   28 | int main(void){
      |               ^
a.cc:65:8: error: conflicting declaration 'vector<...auto...> sq'
   65 | vector sq;
      |        ^~
a.cc:26:13: note: previous declaration as 'std::vector<int> sq'
   26 | vector<int> sq;
      |             ^~
a.cc:67:15: error: a function-definition is not allowed here before '{' token
   67 | int main(void){
      |               ^
a.cc:98:2: error: expected '}' at end of input
   98 | }
      |  ^
a.cc:8:15: note: to match this '{'
    8 | int main(void){
      |               ^
Language: C++

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<string>
#include<sstream>
#include<iomanip>
#include<utility>
#include<cmath>
#include<set>
#include<list>
#include<queue>
#include<stack>
#include<deque>
#include<map>
#include<set>
#include<cstring>
#include<iterator>
#include<bitset>
using namespace std;
 
struct edge {int /*from,*/to,cost;};
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;
typedef vector<int> VI;
typedef vector<long long int> VL;
typedef vector<edge> VE;
static const int MOD = 1000000007;
//static const int INF = 2147483647;
//static const long long INF = 9223372000000000000;
//static const long long INF = 9223372000000000000/2;
//static const int INF = 1000010000;
//int dx4[4] = {0,1,0,-1}, dy4[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define np next_permutation
#define pq priority_queue
#define UB upper_bound
#define LB lower_bound
#define all(x) (x).begin(),(x).end()
#define SZ(a) int((a).size())
#define LEN(a) int((a).length())
#define MAX(a,b,c) max((a),max((b),(c)))
#define MIN(a,b,c) min((a),min((b),(c)))
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REP1(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREP1(i,x) for(int i=((int)(x));i>0;i--)
//#define int ll

signed main(){
    string s;
    cin >> s;

    char a=s[0];
    bool rullonz = true;
    REP(i,LEN(s)-1){
        if(s[i+1]!=a) rullonz = false;
    }
    assert(rullonz);
    printf("%d\n",LEN(s));
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:69:5: error: 'assert' was not declared in this scope
   69 |     assert(rullonz);
      |     ^~~~~~
a.cc:21:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'
   20 | #include<bitset>
  +++ |+#include <cassert>
   21 | using namespace std;
Language: C++

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<string>
#include<sstream>
#include<iomanip>
#include<utility>
#include<cmath>
#include<set>
#include<list>
#include<queue>
#include<stack>
#include<deque>
#include<map>
#include<set>
#include<cstring>
#include<iterator>
#include<bitset>
using namespace std;
 
struct edge {int /*from,*/to,cost;};
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;
typedef vector<int> VI;
typedef vector<long long int> VL;
typedef vector<edge> VE;
static const int MOD = 1000000007;
//static const int INF = 2147483647;
//static const long long INF = 9223372000000000000;
//static const long long INF = 9223372000000000000/2;
//static const int INF = 1000010000;
//int dx4[4] = {0,1,0,-1}, dy4[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define np next_permutation
#define pq priority_queue
#define UB upper_bound
#define LB lower_bound
#define all(x) (x).begin(),(x).end()
#define SZ(a) int((a).size())
#define LEN(a) int((a).length())
#define MAX(a,b,c) max((a),max((b),(c)))
#define MIN(a,b,c) min((a),min((b),(c)))
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REP1(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREP1(i,x) for(int i=((int)(x));i>0;i--)
//#define int ll

signed main(){
    string s;
    cin >> s;
    int len = LEN(s);
    bool rull = false,onz = false;
    char a = s[0],b;
    int mm = 0;
    int nn;
    int tmp = 1;
    REP(i,len-1){
        if(!rull && s[i+1]!=a) rull = true, b = s[i+1], nn = i + 1;
        else if(rull && s[i+1]!=b) onz = true;

        if(s[i]==s[i+1]) tmp++;
        else mm = max(mm,tmp);
    }
    mm = max(mm,tmp);
  
  	assert(!rull && !onz);

    if(rull && onz) printf("%d\n",mm+1);
    else if(!rull) printf("%d\n",len);
    else printf("%d\n",max(nn,len-nn));
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:78:9: error: 'assert' was not declared in this scope
   78 |         assert(!rull && !onz);
      |         ^~~~~~
a.cc:21:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'
   20 | #include<bitset>
  +++ |+#include <cassert>
   21 | using namespace std;
Language: C++

#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
string s;
vector<int> v;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0); 
  cin >> s;
  if(s.length() == 1) {
    cout << 1 << endl;
  } else if(s.length() == 2) {
    if(s[0] == s[1]) cout << 2 < <endl;
    else cout << 1 << endl;
  } else {
    bool zero = s[0] == '0';
    int cnt = 1;
    int ans = 0;
    FOR(i, 1, s.length()) {
      if(zero) {
        if(s[i] == '0') {
          cnt++;
          zero = true;
        } else {
          ans = max(ans, cnt);
          v.push_back(cnt);
          cnt = 1;
          zero = false;
        }
      } else {
        if(s[i] == '1') {
          zero = false;
          cnt++;
        } else {
          ans = max(ans, cnt);
          v.push_back(cnt);
          cnt = 1;
          zero = true;
        }
      }
    }
    ans = max(ans, cnt);
    v.push_back(cnt);
    if(v.size()==1) {
      ans = v[0];
    }
    else if(v.size()==2) {
      ans = max(v[0], v[1]);
    }
    else {
      FOR(i,0,v.size()-2) {
        ans = max(ans, min(v[i]+v[i+1], v[i+1]+v[i+2]));
      }
    }
    cout << ans << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:34: error: expected primary-expression before '<' token
   31 |     if(s[0] == s[1]) cout << 2 < <endl;
      |                                  ^
Language: C++

#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<unordered_map>
using namespace std;
//---------------------------------------------------
//ライブラリゾーン！！！！
//#define int long long
#define str string
#define rep(i,j) for(int i=0;i<(int)(j);i++)
typedef long long ll;
typedef long double ld;
const long long inf = 4523372036854775807;
const ll Mod = 1000000007;
const ll gosenchou = 5000000000000000;
short gh[2][4] = { { 0,0,-1,1 },{ -1,1,0,0 } };
struct P {
	ll pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {//隣接リスト表現
	ll to, cost;
};
struct E {//辺の情報を入れる変数
	int from, to, cost;
};
bool operator<(E a, E b) {
	return a.cost < b.cost;
}
struct H {
	int x, y;
};
bool operator<(H a, H b) {
	if (a.x != b.x) return a.x < b.x;
	return a.y < b.y;
}
bool operator>(H a, H b) {
	if (a.x != b.x) return a.x > b.x;
	return a.y > b.y;
}
bool operator==(H a, H b) {
	return a.x == b.x&&a.y == b.y;
}
bool operator!=(H a, H b) {
	return a.x != b.x || a.y != b.y;
}
ll gcm(ll i, ll j) {//最大公約数
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcm(j%i, i);
}
ld rad(H a, H b) {
	return sqrt(pow(a.x - b.x, 2.0) + pow(a.y - b.y, 2.0));
}//rad＝座標上の2点間の距離
int ari(int a, int b, int c) {
	return (a + b)*c / 2;
}//等差数列の和
bool suf(ld a, ld b, ld c, ld d) {
	if (b <= c || d <= a) return 0;
	return 1;
}//[a,b),[c,d)
int fact(int i) {
	int sum = 1;
	for (int j = 2; j <= i; j++)
		sum = (sum* j) % Mod;
	return sum;
}//階乗(正）
//---------------------------------------------------
//+++++++++++++++++++++++++++++++++++++++++++++++++++
bool a[100000];
int main() {
	string s;
	cin >> s;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] != '0')
			a[i] = 1;
	}
	int ans = INT_MAX, n = s.size(), sum = 0;
	for (int i = 0; i < s.size() - 1; i++) {
		if (a[i] != a[i + 1]) {
			ans = min(ans, max(i + 1, (n - i - 1)));
		}
	}
	cout << ans << endl;
	getchar(); getchar();
}

Compiler output:
a.cc: In function 'int main()':
a.cc:89:19: error: 'INT_MAX' was not declared in this scope
   89 |         int ans = INT_MAX, n = s.size(), sum = 0;
      |                   ^~~~~~~
a.cc:14:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   13 | #include<cstdio>
  +++ |+#include <climits>
   14 | #include<unordered_map>
a.cc:92:52: error: 'n' was not declared in this scope
   92 |                         ans = min(ans, max(i + 1, (n - i - 1)));
      |                                                    ^
Language: C++

#include <cstdio>
#include <iostream> 
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <functional>

using namespace std;
using ll = long long;

const ll INF = 1e9;
const ll MOD = 1e9 + 7;
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };

int main()
{
	string s;
	char t;
	int c = 1, i;
	unsigned int mx = 0;

	cin >> s;
	
	t = s[0];
	for (i = 1; i < s.size(); i++) {
		if (s[i] == t) {
			c++;
		}
		else {
			if (mx < c) {
				mx = c;
			}
			t = s[i];
			c = 1;
		}
	}
	if (mx < c) {
		mx = c;
	}

	cout << max(mx, (s.size() + 1) / 2) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:49:20: error: no matching function for call to 'max(unsigned int&, std::__cxx11::basic_string<char>::size_type)'
   49 |         cout << max(mx, (s.size() + 1) / 2) << endl;
      |                 ~~~^~~~~~~~~~~~~~~~~~~~~~~~
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:2:
/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:   template argument deduction/substitution failed:
a.cc:49:20: note:   deduced conflicting types for parameter 'const _Tp' ('unsigned int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'})
   49 |         cout << max(mx, (s.size() + 1) / 2) << endl;
      |                 ~~~^~~~~~~~~~~~~~~~~~~~~~~~
/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, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:9:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:49:20: note:   mismatched types 'std::initializer_list<_Tp>' and 'unsigned int'
   49 |         cout << max(mx, (s.size() + 1) / 2) << endl;
      |                 ~~~^~~~~~~~~~~~~~~~~~~~~~~~