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

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
string s;
int ans;
int main(){
	cin>>s;
	rep(i,s.size()){
		if(i&&s[i]!=s[i-1]){
			ans=max(ans,max(i,s.size()-i));
		}
	}
	cout<<ans<<endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:40: error: no matching function for call to 'max(int&, std::__cxx11::basic_string<char>::size_type)'
   10 |                         ans=max(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:10:40: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'})
   10 |                         ans=max(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:10:40: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   10 |                         ans=max(ans,max(i,s.size()-i));
      |                                     ~~~^~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
string s;
int ans;
signed main(){
	cin>>s;
	rep(i,s.size()){
		if(i&&s[i]!=s[i-1]){
			ans=max(ans,max(i,s.size()-i));
		}
	}
	cout<<ans<<endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:40: error: no matching function for call to 'max(int&, std::__cxx11::basic_string<char>::size_type)'
   10 |                         ans=max(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:10:40: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'})
   10 |                         ans=max(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:10:40: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   10 |                         ans=max(ans,max(i,s.size()-i));
      |                                     ~~~^~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
string s;
int ans;
signed main(){
	cin>>s;
	rep(i,s.size()){
		if(i&&s[i]!=s[i-1]){
			ans=max(ans,max(i,s.size()-i));
		}
	}
	cout<<ans<<endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:40: error: no matching function for call to 'max(long long int&, long long unsigned int)'
   11 |                         ans=max(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:11:40: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long long unsigned int')
   11 |                         ans=max(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:11:40: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   11 |                         ans=max(ans,max(i,s.size()-i));
      |                                     ~~~^~~~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define MM 1000000000
#define mod MM+7
#define INF (ll)1e18
#define PI acos(-1.0)
#define NIL -1
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
int main(){
    string s; cin >> s;
    int n = s.size();
    vector<int> v(0);
    for(int i = 0; i < n-1; i++){
        if(s[i] != s[i+1]){
            int t = max(i+1,n-i-1);
            v.push_back(t);
        }
    }
    if(v.size() == 0){
        if(s[i] == '0'){
            cout << 0 << endl;
            return 0;
        } else {
            cout << n << endl;
            return 0;
        }
    }
    sort(v.begin(),v.end());
    cout << v[0] << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:14: error: 'i' was not declared in this scope
   22 |         if(s[i] == '0'){
      |              ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  int m=1000000;
  for(int i=1;i<s.size();i++){
    if(s[i]!=s[i-1]) m=min(m,max(i,s.size()-i));
  }
  cout<<(m==1000000?s.size():m);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:33: error: no matching function for call to 'max(int&, std::__cxx11::basic_string<char>::size_type)'
    8 |     if(s[i]!=s[i-1]) m=min(m,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:8:33: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'})
    8 |     if(s[i]!=s[i-1]) m=min(m,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:8:33: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
    8 |     if(s[i]!=s[i-1]) m=min(m,max(i,s.size()-i));
      |                              ~~~^~~~~~~~~~~~~~
Language: C++

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

string s;
vector<long long> v;

long long solve();
bool ch(long long k);

int main() {
  cin >> s;

  cout << solve() << endl;
  return 0;
}

long long solve() {
  long long ans = 10000000000;
  for(int i = 0; i < s.size(); ++i) {
    long long cnt = 1;
    while(i + 1 < s.size() && s[i] == s[i + 1]) ++cnt, ++i;
    v.push_back(cnt);
  }
  for(int i = 1; i < v.size(); ++i) v[i] += v[i - 1];
  for(int i = 0; i < v.size(); ++i)
    ans = min(ans, max(v[i], s.size() - v[i]));
  return ans;
}

Compiler output:
a.cc: In function 'long long int solve()':
a.cc:26:23: error: no matching function for call to 'max(__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type&, long long unsigned int)'
   26 |     ans = min(ans, max(v[i], s.size() - v[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:26:23: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long long unsigned int')
   26 |     ans = min(ans, max(v[i], s.size() - v[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:26:23: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   26 |     ans = min(ans, max(v[i], s.size() - v[i]));
      |                    ~~~^~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
typedef pair<ll,ll> p;
const int inf=(1<<30);
#define rep(i,a,n)	for(int i=a;i<n;i++)
#define rrep(i,a,n) for(int i=(a-1);i>=n;i--)
	
bool pairComparesecond(const p& firstElof, const p& secondElof)
{
    return firstElof.second > secondElof.second;
}

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

Compiler output:
a.cc: In function 'int main()':
a.cc:20:40: error: no matching function for call to 'max(int&, std::__cxx11::basic_string<char>::size_type)'
   20 |                         ans=min(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:20:40: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'})
   20 |                         ans=min(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:20:40: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   20 |                         ans=min(ans,max(i,s.size()-i));
      |                                     ~~~^~~~~~~~~~~~~~
Language: C++

#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
char c[100005];
int ans;
int main()
{
    scanf("%s",c+1);
    ans=strlen(c+1);
    for(int i=2;i<=strlen(c+1);i++)
        if(c[i]!=c[i-1])ans=min(ans,min(i,strlen(c+1)-i));
    printf("%d",ans);
}



Compiler output:
a.cc: In function 'int main()':
a.cc:12:40: error: no matching function for call to 'min(int&, size_t)'
   12 |         if(c[i]!=c[i-1])ans=min(ans,min(i,strlen(c+1)-i));
      |                                     ~~~^~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:12:40: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'size_t' {aka 'long unsigned int'})
   12 |         if(c[i]!=c[i-1])ans=min(ans,min(i,strlen(c+1)-i));
      |                                     ~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:12:40: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   12 |         if(c[i]!=c[i-1])ans=min(ans,min(i,strlen(c+1)-i));
      |                                     ~~~^~~~~~~~~~~~~~~~~
Language: C++

s = list(map(int, list(input())))

ans = 0
n = len(s)
for i in range(n - 1):
    if s[i] != s[i + 1]:
        ans = max(ans, i + 1, n - i - 1)

print(ans)

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

#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <climits>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int n = s.size();
    int mid_dist = 0;
    int mid_index = -1;
    REP(i, n) {
        int dist = min(i, abs(n - i - 1));
        if(s[i] == '1' and mid_dist <= dist) {
            mid_dist = dist;
            mid_index = i;
        }
    }

    if(mid_index == -1) {
        cout << n << endl;
        return 0;
    }
    
    cout << max(mid_index, n - mid_index - 1, 2) << endl;
    return 0;
}


Compiler output:
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: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:47:16:   required from here
   47 |     cout << max(mid_index, n - mid_index - 1, 2) << endl;
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:306:17: error: '__comp' cannot be used as a function
  306 |       if (__comp(__a, __b))
      |           ~~~~~~^~~~~~~~~~
Language: C++

#include"stdafx.h"
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include <numeric>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999

using namespace std;


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





ll gcd(ll x, ll y) {
	ll m = max(x, y), n = min(x, y);
	if (m%n == 0)return n;
	else return gcd(m%n, n);
}

int main() {
	string S;
	cin >> S;
	ll l = S.length();
	int h = l / 2;
	bool ok = true;
	int cnt = 1;
	while (ok) {
		if (l % 2 == 1){
			char a = S[h];
			int k = 1;
			while(k<=h){
				if (S[h - k] != a || S[h + k] != a) {
					cout << h + k << endl;
					return 0;
				}
				k++;
			}
			cout << l << endl;
			return 0;
		}
		if (l % 2 == 0) {
			char a = S[h];
			char b = S[h - 1];
			if (a != b) {
				cout << h << endl;
				return 0;
			}
			int k = 1;
			while (k <= h) {
				if (S[h - 1] != S[h - 1 - k] || S[h] != S[h + k]) {
					cout << h + k << endl;
					return 0;
				}
			}
			cout << l << endl;
			return 0;
		}
	}
}

Compiler output:
a.cc:1:9: fatal error: stdafx.h: No such file or directory
    1 | #include"stdafx.h"
      |         ^~~~~~~~~~
compilation terminated.
Language: C++

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

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

    vector<int> v;

    int cnt = 0;
    char car = s[0];
    for(char c : s) {
        if(car != c) {
            v.push_back(cnt);
            cnt = 0;
            car = c;
        }
        cnt++;
    }
    v.push_back(cnt);

    int mx = -1;
    for(int i = 2; i < v.size(); i++) {
        if(v[i] == v[i-2]) mx = max(mx, v[i] + v[i-1]);
    }
    int ans = *max_element(v.begin(), v.end());
    ans = max(ans, mx);

    cout << ans << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:16: error: 'max_element' was not declared in this scope
   28 |     int ans = *max_element(v.begin(), v.end());
      |                ^~~~~~~~~~~
Language: C++

#include <stack>
#include <queue>
#include <cstdio>
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <string>
 
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n0,n) for(int i=n0;i<n;i++)
#define Com(i,j,n) for(int i=0;i<n-1;i++)for(int j=i+1;j<n;j++)
#define INF (1<<29)
#define test cout << "test" << endl;
#define NNN_MAX 100010
typedef pair<int,int> P;

int min(int a, int b){
	return (a>b)? b:a;
}

int max(int a,int b){
	return (a>b)? a:b;
}

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

	if(str.size()==1){
		cout << (str[0]=='1')? 1:0 << endl;
		return 0;
	}

	int bits[str.size()];
	rep(i,str.size()){
		bits[i]=str[i];
	}

	int minimum=10000000;
	rep(i,str.size()-1){
		if(bits[i]!=bits[i+1]){
			minimum = min(minimum,max((str.size()-i-1),i+1));
		}
	}

	cout<< minimum << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:44: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
   33 |                 cout << (str[0]=='1')? 1:0 << endl;
      |                                          ~~^~~~~~~
Language: C++

#include <stack>
#include <queue>
#include <cstdio>
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <string>
 
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n0,n) for(int i=n0;i<n;i++)
#define Com(i,j,n) for(int i=0;i<n-1;i++)for(int j=i+1;j<n;j++)
#define INF (1<<29)
#define test cout << "test" << endl;
#define NNN_MAX 100010
typedef pair<int,int> P;

int min(int a, int b){
	return (a>b)? b:a;
}

int max(int a,int b){
	return (a>b)? a:b;
}

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

	if(str.size()==1){
		cout << (str[0]==1)? 1:0 << endl;
		return 0;
	}

	int bits[str.size()];
	rep(i,str.size()){
		bits[i]=str[i];
	}

	int minimum=10000000;
	rep(i,str.size()-1){
		if(bits[i]!=bits[i+1]){
			minimum = min(minimum,max((str.size()-i-1),i+1));
		}
	}

	cout<< minimum << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:42: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
   33 |                 cout << (str[0]==1)? 1:0 << endl;
      |                                        ~~^~~~~~~
Language: C++

#include <stack>
#include <queue>
#include <cstdio>
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <string>
 
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n0,n) for(int i=n0;i<n;i++)
#define Com(i,j,n) for(int i=0;i<n-1;i++)for(int j=i+1;j<n;j++)
#define INF (1<<29)
#define test cout << "test" << endl;
#define NNN_MAX 100010
typedef pair<int,int> P;

int min(int a, int b){
	return (a>b)? b:a;
}

int max(int a,int b){
	return (a>b)? a:b;
}

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

	if(str.size()==1){
		cout << (str[0]==1)? 1:0 << endl;
	}

	int bits[str.size()];
	rep(i,str.size()){
		bits[i]=str[i];
	}

	int minimum=10000000;
	rep(i,str.size()-1){
		if(bits[i]!=bits[i+1]){
			minimum = min(minimum,max((str.size()-i-1),i+1));
		}
	}

	cout<< minimum << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:42: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
   33 |                 cout << (str[0]==1)? 1:0 << endl;
      |                                        ~~^~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
string s;
cin>>s;
ll c0 =0;c1=1;
for(int i =0;i<s.length();i++)
{
    if(s[i]=='0') c0++;
    else c1++;
}
cout<<max(c0,c1);
return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:10: error: 'c1' was not declared in this scope; did you mean 'c0'?
    8 | ll c0 =0;c1=1;
      |          ^~
      |          c0
Language: C++

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

int same (int *S, int size, int K) {
  int i, start = size - K, end = K - 1;
  for (i = start; i < end; i++) {
    if (S[i] != S[i+1]) {
      return 0;
    }
  }
  return 1;
}

int main () {
  int K, Ssize;
  string S;
  cin >> S;
  Ssize = S.size();
  int Sarr[Ssize];
  for (int i = 0; i < Ssize - 1; i++) {
    Sarr[i] = S[i] - '0';
  }
  for (K = Ssize / 2 + 1; K <= Ssize; K++) {
    if (!same(Sarr, Ssize, K)) {
      K--;
      break;
    }
  }
  cout << K << endl;
  return 0;

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

// ConsoleApplication19.cpp : アプリケーションのエントリ ポイントを定義します。
//

#include "stdafx.h"
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<string>
#include<cstring>
using namespace std;


int main()
{
	int i, j, k,l, H, W, D, Q,sum1,sum2;
	char S[100001];
	cin >> S;
	int setsu[100000];
	int ans[100000] = {};
	k = 1;
	setsu[0] = 0;
	sum1 = sum2 = 0;
	l = strlen(S);
	for (i = 1; i < l; i++) {
		if (S[i] != S[i - 1]) {
			setsu[k] = i;
			k++;
		}
	}
	setsu[k] = strlen(S);

	if (k == 1) {
		cout << strlen(S) << endl;
	}
	else {
		for (i = 1; i <= k-1 ; i++) {
			ans[i] = fmax(setsu[i], setsu[k] - setsu[i]);
			
		}
	}
	sort(ans, ans + 100000);
	cout << ans[99999] << endl;
    return 0;
}



Compiler output:
a.cc:4:10: fatal error: stdafx.h: No such file or directory
    4 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<string>
using namespace std;


int main()
{
	int i, j, k,l, H, W, D, Q,sum1,sum2;
	char S[10001];
	cin >> S;
	int setsu[10000];
	int ans[10000] = {};
	k = 1;
	setsu[0] = 0;
	sum1 = sum2 = 0;
	for (i = 1; i < strlen(S); i++) {
		if (S[i] != S[i - 1]) {
			setsu[k] = i;
			k++;
		}
	}
	setsu[k] = strlen(S);

	if (k == 1) {
		cout << strlen(S) << endl;
	}
	else {
		for (i = 1; i <= k ; i++) {
			ans[i] = fmin(setsu[i], setsu[k] - setsu[i - 1]);
			
		}
	}
	sort(ans, ans + 10000);
	cout << ans[9999] << endl;
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:20:25: error: 'strlen' was not declared in this scope
   20 |         for (i = 1; i < strlen(S); i++) {
      |                         ^~~~~~
a.cc:6:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    5 | #include<vector>
  +++ |+#include <cstring>
    6 | #include<string>
a.cc:26:20: error: 'strlen' was not declared in this scope
   26 |         setsu[k] = strlen(S);
      |                    ^~~~~~
a.cc:26:20: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
Language: C++


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


int main()
{
	int i, j, k,l, H, W, D, Q,sum1,sum2;
	char S[10001];
	cin >> S;
	int setsu[10000];
	int ans[10000] = {};
	k = 1;
	setsu[0] = 0;
	sum1 = sum2 = 0;
	for (i = 1; i < strlen(S); i++) {
		if (S[i] != S[i - 1]) {
			setsu[k] = i;
			k++;
		}
	}
	setsu[k] = strlen(S);

	if (k == 1) {
		cout << strlen(S) << endl;
	}
	else {
		for (i = 1; i <= k ; i++) {
			ans[i] = fmin(setsu[i], setsu[k] - setsu[i - 1]);
			
		}
	}
	sort(ans, ans + 10000);
	cout << ans[9999] << endl;
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:20:25: error: 'strlen' was not declared in this scope
   20 |         for (i = 1; i < strlen(S); i++) {
      |                         ^~~~~~
a.cc:6:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    5 | #include<vector>
  +++ |+#include <cstring>
    6 | #include<string>
a.cc:26:20: error: 'strlen' was not declared in this scope
   26 |         setsu[k] = strlen(S);
      |                    ^~~~~~
a.cc:26:20: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
Language: C++

/*  AC祈願アンコウ
   　／￣＼
   ○    ／￣￣￣＼ヘ
    　 /・　 ・　 ＼>   
    ／￣￣￣＼　　  Ｖ| 
   ｜  ―――  ｜      ｜|
    ＼＿＿＿／　　  ∧|
    　　＼　　　　／
    　　　￣￣￣￣
*/

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

typedef int64_t ll;
//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 EB emplace_back
#define MP make_pair
#define MT make_tuple
#define FI first
#define SE second
#define NP next_permutation
#define PQ priority_queue
#define UB upper_bound
#define LB lower_bound
#define SZ(a) int((a).size())
#define LEN(a) int((a).length())
#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 ALL(x) (x).begin(),(x).end()
#define YESNO(x) puts((x)?"YES":"NO")
#define YesNo(x) puts((x)?"Yes":"No")

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

    int ans = 114514;

    REP(i,LEN(s)-1){
        if(s[i]!=s[i+1]) ans = min(ans,max(i+1,LEN(s)-i-1));
    }

    printf("%d\n",min(ans,SZ(s));

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:59:33: error: expected ')' before ';' token
   59 |     printf("%d\n",min(ans,SZ(s));
      |           ~                     ^
      |                                 )
Language: C

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define LL long long
#define CLR(a,b) memset(a,b,sizeof(a,b))
#define INF 0x3f3f3f3f
using namespace std;
const int maxn = 100010;
char s[maxn];
int n[maxn];
int num = 0;
int main()
{
    cin>>s;
    int len = strlen(s);

    if(s[0]=='1'){
        for(int i=0;i<len;i++){
            if(s[i]=='1') s[i]='0';
            else if(s[i]=='0') s[i]='1';
        }
    }
    int cnt = 1;
    for(int i=1;i<len;i++){
        if(s[i] == s[i-1])
            cnt = cnt+1;
        else{
            n[++num] = cnt;
            cnt = 1;
        }
    }
    n[++num] = cnt;
    int ans = 0;

    for(int i=1;i<=num;i++){
        if(i%2 == 1 && n[i+2]!=0){
            ans = max(ans,min(n[i],n[i+2])+n[i+1]);
        }
        else
            ans = max(ans,n[i]);
    }
    cout<<ans<<endl;
    return 0;
}


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

// ------------------------------------
// Date:2018/ 3/ 5
// Problem:ABC 083 WideFlip d.cpp
//
// ------------------------------------

#include <bits/stdc++.h>

using namespace std;

#define EACH(i,a) for (auto&& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl

typedef long long ll;

static const int MOD = 1000000007;

// dp[0:raw, 1:invert][見ている桁]
int dp[2][101010];

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

  string inputStr;
  cin >> inputStr;
  int zCnt, oCnt, zMax, oMax;
  char last = inputStr[0];
  zCnt = oCnt =zMax = oMax = 0;
  FOR(i, 1, inputStr.size()) {
    if (last == inputStr[i]) {
      if (last == '0') {
	zCnt++:
      } else {
	oCnt++;
      }    
    } else {
      if (last == '0') {
	zMax = max(zCnt, zMax);
	zCnt = 0;
	oCnt = 1;
      } else {
	oMax = max(oCnt, oMax);
	zCnt = 1;
	oCnt = 0;
      }
    }
  }
  zMax = max(zCnt, zMax);
  oCnt = max(oCnt, oMax);
  ans = max(zMax, oMax, 2);
  cout << ans << endl;
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:39:15: error: expected ';' before ':' token
   39 |         zCnt++:
      |               ^
      |               ;
a.cc:57:3: error: 'ans' was not declared in this scope; did you mean 'abs'?
   57 |   ans = max(zMax, oMax, 2);
      |   ^~~
      |   abs
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:7:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:57:12:   required from here
   57 |   ans = max(zMax, oMax, 2);
      |         ~~~^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:306:17: error: '__comp' cannot be used as a function
  306 |       if (__comp(__a, __b))
      |           ~~~~~~^~~~~~~~~~
Language: C++

// ------------------------------------
// Date:2018/ 3/ 5
// Problem:ABC 083 WideFlip d.cpp
//
// ------------------------------------

#include <bits/stdc++.h>

using namespace std;

#define EACH(i,a) for (auto&& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl

typedef long long ll;

static const int MOD = 1000000007;

// dp[0:raw, 1:invert][見ている桁]
int dp[2][101010];

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

  string inputStr;
  cin >> inputStr;
  int zCnt, oCntm, zMax, oMax;
  char last = inputStr[0];
  zCnt = oCnt =zMax = oMax = 0;
  FOR(i, 1, inputStr.size()) {
    if (last == inputStr[i]) {
      if (last == '0') {
	zCnt++:
      } else {
	oCnt++;
      }    
    } else {
      if (last == '0') {
	zMax = max(zCnt, zMax);
	zCnt = 0;
	oCnt = 1;
      } else {
	oMax = max(oCnt, oMax);
	zCnt = 1;
	oCnt = 0;
      }
    }
  }
  zMax = max(zCnt, zMax);
  oCnt = max(oCnt, oMax);
  ans = max(zMax, oMax, 2);
  cout << ans << endl;
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:35:10: error: 'oCnt' was not declared in this scope; did you mean 'oCntm'?
   35 |   zCnt = oCnt =zMax = oMax = 0;
      |          ^~~~
      |          oCntm
a.cc:39:15: error: expected ';' before ':' token
   39 |         zCnt++:
      |               ^
      |               ;
a.cc:57:3: error: 'ans' was not declared in this scope; did you mean 'abs'?
   57 |   ans = max(zMax, oMax, 2);
      |   ^~~
      |   abs
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:7:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:57:12:   required from here
   57 |   ans = max(zMax, oMax, 2);
      |         ~~~^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:306:17: error: '__comp' cannot be used as a function
  306 |       if (__comp(__a, __b))
      |           ~~~~~~^~~~~~~~~~
Language: C++

#include<stdio.h>
#include<string.h>
int main()
{
	char s[1000];
	gets_s(s);
	int l =strlen(s), a = 1,d,b=0;
	d = l;
	for (int t = 1;t <l;t++)
	{
		while((s[t] == s[t- 1])&&(t++))
			a++;
		if (a > 1 && a < d)
			d = a;
		else if (a == d)
			b = 1;
		a = 1;
	}
	if (b == 0)
		printf("%d", (d == l) ? 2 : d);
	else
		printf("%d", d);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:9: error: 'gets_s' was not declared in this scope
    6 |         gets_s(s);
      |         ^~~~~~
Language: C++

#include<stdio.h>
int main()
{
	char s[1000];
	gets_s(s);
	int l =strlen(s), a = 1,d,b=0;
	d = l;
	for (int t = 1;t <l;t++)
	{
		while((s[t] == s[t- 1])&&(t++))
			a++;
		if (a > 1 && a < d)
			d = a;
		else if (a == d)
			b = 1;
		a = 1;
	}
	if (b == 0)
		printf("%d", (d == l) ? 2 : d);
	else
		printf("%d", d);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:9: error: 'gets_s' was not declared in this scope
    5 |         gets_s(s);
      |         ^~~~~~
a.cc:6:16: error: 'strlen' was not declared in this scope
    6 |         int l =strlen(s), a = 1,d,b=0;
      |                ^~~~~~
a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include<stdio.h>
  +++ |+#include <cstring>
    2 | int main()
a.cc:7:9: error: 'd' was not declared in this scope
    7 |         d = l;
      |         ^
a.cc:11:25: error: 'a' was not declared in this scope
   11 |                         a++;
      |                         ^
a.cc:12:21: error: 'a' was not declared in this scope
   12 |                 if (a > 1 && a < d)
      |                     ^
a.cc:15:25: error: 'b' was not declared in this scope
   15 |                         b = 1;
      |                         ^
a.cc:16:17: error: 'a' was not declared in this scope
   16 |                 a = 1;
      |                 ^
a.cc:18:13: error: 'b' was not declared in this scope
   18 |         if (b == 0)
      |             ^
Language: C++

#include<stdio.h>
int main()
{
	char s[100];
	gets(s);
	int l =strlen(s), a = 1,d,b=0;
	d = l;
	for (int t = 1;t <l;t++)
	{
		while((s[t] == s[t- 1])&&(t++))
			a++;
		if (a > 1 && a < d)
			d = a;
		else if (a == d)
			b = 1;
		a = 1;
	}
	if (b == 0)
		printf("%d", (d == l) ? 2 : d);
	else
		printf("%d", d);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
    5 |         gets(s);
      |         ^~~~
      |         getw
a.cc:6:16: error: 'strlen' was not declared in this scope
    6 |         int l =strlen(s), a = 1,d,b=0;
      |                ^~~~~~
a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include<stdio.h>
  +++ |+#include <cstring>
    2 | int main()
a.cc:7:9: error: 'd' was not declared in this scope
    7 |         d = l;
      |         ^
a.cc:11:25: error: 'a' was not declared in this scope
   11 |                         a++;
      |                         ^
a.cc:12:21: error: 'a' was not declared in this scope
   12 |                 if (a > 1 && a < d)
      |                     ^
a.cc:15:25: error: 'b' was not declared in this scope
   15 |                         b = 1;
      |                         ^
a.cc:16:17: error: 'a' was not declared in this scope
   16 |                 a = 1;
      |                 ^
a.cc:18:13: error: 'b' was not declared in this scope
   18 |         if (b == 0)
      |             ^
Language: C++

#include<stdio.h>
int main()
{
	char s[100000];
	gets(s);
	int l =strlen(s), a = 1,d,b=0;
	d = l;
	for (int t = 1;t <l;t++)
	{
		while((s[t] == s[t- 1])&&(t++))
			a++;
		if (a > 1 && a < d)
			d = a;
		else if (a == d)
			b = 1;
		a = 1;
	}
	if (b == 0)
		printf("%d", (d == l) ? 2 : d);
	else
		printf("%d", d);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
    5 |         gets(s);
      |         ^~~~
      |         getw
a.cc:6:16: error: 'strlen' was not declared in this scope
    6 |         int l =strlen(s), a = 1,d,b=0;
      |                ^~~~~~
a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include<stdio.h>
  +++ |+#include <cstring>
    2 | int main()
a.cc:7:9: error: 'd' was not declared in this scope
    7 |         d = l;
      |         ^
a.cc:11:25: error: 'a' was not declared in this scope
   11 |                         a++;
      |                         ^
a.cc:12:21: error: 'a' was not declared in this scope
   12 |                 if (a > 1 && a < d)
      |                     ^
a.cc:15:25: error: 'b' was not declared in this scope
   15 |                         b = 1;
      |                         ^
a.cc:16:17: error: 'a' was not declared in this scope
   16 |                 a = 1;
      |                 ^
a.cc:18:13: error: 'b' was not declared in this scope
   18 |         if (b == 0)
      |             ^
Language: C++

#include "stdafx.h"
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
using namespace std;
vector<int>sosuu2(100001, 0);
vector<int>sosuu3(100001, 0);
vector<int>sosuu;
int main(void)
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	string S; cin >> S;
	int b = 0;
	for (int i = 1; i < S.size(); i++)
	{
		if (S[i - 1] != S[i])
		{
			int a = 1000000;
			a = max(i - 1, (int)S.size() - i);
			b = min(b, a);
		}
	}
	cout << b << "\n";
}

Compiler output:
a.cc:1:10: fatal error: stdafx.h: No such file or directory
    1 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <string.h>
typedef long long ll;

#define MAX(x, y)	(((x) > (y))? (x) : (y))
#define MAX(x, y)	(((x) < (y))? (x) : (y))
#define ABS(x)		(((x) < 0)? (-1*(x)) : (x))
#define REPI(x,y)	for (i=(x);i<(y);i++)
#define REPJ(x,y)	for (j=(x);i<(y);i++)
#define MEMCLR(X)	memset((X),0,sizeof((X)))

using namespace std;

string S;
int i,n=100000,w;

int main() {
	cin >> S;
	REPI(1,S.size()) {
		if (S[i] != S[i-1]) {
			w = MAX(i,S.size()-i);
			n = MIN(w,n);
		}
	}
	cout << n;

	return 0;
}


Compiler output:
a.cc:8:9: warning: "MAX" redefined
    8 | #define MAX(x, y)       (((x) < (y))? (x) : (y))
      |         ^~~
a.cc:7:9: note: this is the location of the previous definition
    7 | #define MAX(x, y)       (((x) > (y))? (x) : (y))
      |         ^~~
a.cc: In function 'int main()':
a.cc:24:29: error: 'MIN' was not declared in this scope
   24 |                         n = MIN(w,n);
      |                             ^~~
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int lld;

const lld mod = 1e9+7;
const lld INF = 1e9;
//const lld MAXN = 1e9;

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

    lld n = s.size();
    lld sol = 0;

    for(lld i = 0; i < n-1; i++)
    {
        if (s[i] != s[i+1])
        {
            x = max(i+1,n-i-1);

            if (sol > x)
            {
                sol = x;
            }
        }
    }

    cout << sol << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:13: error: 'x' was not declared in this scope
   31 |             x = max(i+1,n-i-1);
      |             ^
Language: C++

#include <stdio.h>
#include <string>

using namespace std;

int main() {

    char* S;
    scanf("%s", S);

    int c = 0;
    for (int i = 0; i < (int)strlen(S); ++i) {
        if (S[i] == '0') c++;
    }
    printf("%d\n", c);

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:30: error: 'strlen' was not declared in this scope
   12 |     for (int i = 0; i < (int)strlen(S); ++i) {
      |                              ^~~~~~
a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <string>
  +++ |+#include <cstring>
    3 |
Language: C++

#include <iostream>

using namespace std;

int main() {

    char* S;
    scanf("%s", S);

    int c = 0;
    for (int i = 0; i < (int)strlen(S); ++i) {
        if (S[i] == '0') c++;
    }
    printf("%d\n", c);

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:30: error: 'strlen' was not declared in this scope
   11 |     for (int i = 0; i < (int)strlen(S); ++i) {
      |                              ^~~~~~
a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <iostream>
  +++ |+#include <cstring>
    2 |