Language: C++

#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
#define int ll
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define IN(a, b, x) (a<=x&&x<b)
#define MP make_pair
#define PB push_back
#ifdef int
const ll INF = (1LL<<60);
#else
const int INF = (1LL<<30);
#endif
const double PI = 3.14159265359;
const double EPS = 1e-12;
const int MOD = 1000000007;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')';
  return out;
}

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

string s;

signed main(void)
{
  cin >> s;
  string t = s;

  if(s[0] == '1') {
    REP(i, s.size()) {
      if(s[i] == '0') s[i] = '1';
      else s[i] = '0';
    }
  }

  int flip = 0;
  int ans = s.size();
  REP(i, s.size()) {
    if(flip%2) {
      if(s[i] == '0') s[i] = '1';
      else s[i] = '0';
    }
    if(s[i] == '1') {
      flip++;
      ans = s.size() - i;
    }
  }
  ans = max(ans, s.size() - ans);

  if(t[0] == '0') {
    REP(i, s.size()) {
      if(t[i] == '0') t[i] = '1';
      else t[i] = '0';
    }
  }

  flip = 0;
  int ret = t.size();
  REP(i, s.size()) {
    if(flip%2) {
      if(t[i] == '0') t[i] = '1';
      else t[i] = '0';
    }
    if(t[i] == '0') {
      flip++;
      ret = t.size() - i;
    }
  }
  ret = max(ret, t.size() - ret);

  cout << max(ret, ans) << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:64:12: error: no matching function for call to 'max(ll&, long long unsigned int)'
   64 |   ans = max(ans, s.size() - ans);
      |         ~~~^~~~~~~~~~~~~~~~~~~~~
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: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:64:12: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long long unsigned int')
   64 |   ans = max(ans, s.size() - ans);
      |         ~~~^~~~~~~~~~~~~~~~~~~~~
/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:64:12: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   64 |   ans = max(ans, s.size() - ans);
      |         ~~~^~~~~~~~~~~~~~~~~~~~~
a.cc:85:12: error: no matching function for call to 'max(ll&, long long unsigned int)'
   85 |   ret = max(ret, t.size() - ret);
      |         ~~~^~~~~~~~~~~~~~~~~~~~~
/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:85:12: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long long unsigned int')
   85 |   ret = max(ret, t.size() - ret);
      |         ~~~^~~~~~~~~~~~~~~~~~~~~
/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
/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:85:12: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   85 |   ret = max(ret, t.size() - ret);
      |         ~~~^~~~~~~~~~~~~~~~~~~~~