stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include <iostream>

#include <algorithm>

#include <vector>

#include <string>

#include <stack>

#include <cstdio>

#define rep(i, j) for(int i = 0; i < j; i++)

#define all(i) i.begin(), i.end()

using namespace std;

int main()

{

	int e; while (cin >> e , e)

	{

		int m = 214214, x = 0;

		rep(y, 1001) rep(z, 101)

		{

			x = e - (y * y + z * z * z);

			if (e == x + (y * y) + (z * z * z) && x >= 0 ) 

			{ m = min(x + y + z, m); }

			else if (e > x + (y * y) + (z * z * z)) { break; }

		}

		printf("%d\n", m);

	}

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.234229373296131x):
#include <iostream>

#include <algorithm>

#include <vector>

#include <string>

#include <stack>

#include <cstdio>

#define rep(i, j) for(int i = 0; i < j; i++)

#define all(i) i.begin(), i.end()

using namespace std;

int main()

{

	int e; while (cin >> e , e)

	{

		int m = 214214, x = 0;

		rep(z, 101) rep(y, 1001)

		{

			x = e - (y * y + z * z * z);

			if (e == x + (y * y) + (z * z * z) && x >= 0 ) 

			{ m = min(x + y + z, m); }

		}

		printf("%d\n", m);

	}

	return 0;

}
// Slower C++ solution:
#include <iostream>

#include <string>

#include <vector>

#include <algorithm>

#include <cmath>

#include <cstdio>

#include <functional>

#include <numeric>

#include <stack>

#include <queue>

#include <map>

#include <set>

#include <utility>

#include <sstream>

#include <complex>



using namespace std;



#define FOR(i,a,b) for(long long i=(a);i<(b);i++)

#define REP(i,N) for(long long i=0;i<(N);i++)

#define ALL(s) (s).begin(),(s).end()

#define fi first

#define se second



#define PI acos(-1.0)

#define INF 1000000007

#define EPS 1e-10

#define MAX_N 20000

#define MAX_M 16



typedef long long ll;

typedef pair<ll, ll> P;

typedef pair<double, double> PD;

typedef pair<string, ll> PS;

typedef vector<ll> V;

typedef pair<P, char> PC;



int e, m;



int main(){

	while (cin >> e&&e){

		int m = 1000001;

		for (int i = 0; i <= 100; i++){

			for (int j = 0; j <= 1000; j++){

				int x = e - i*i*i - j*j;

				if (x >= 0){

					m = min(m, x + i + j);

				}

			}

		}

		cout << m << endl;

	}

}

// Faster C++ solution for the same problem (measured speedup: 2.1430323350978413x):
#include <iostream>

#include <string>

#include <vector>

#include <algorithm>

#include <cmath>

#include <cstdio>

#include <functional>

#include <numeric>

#include <stack>

#include <queue>

#include <map>

#include <set>

#include <utility>

#include <sstream>

#include <complex>

#include <fstream>

#include <bitset>

#include <time.h>

#include <tuple>

#include <iomanip>



using namespace std;



typedef long long ll;

typedef pair<ll, ll> P;

typedef vector<ll> V;

typedef complex<double> Point;



#define PI acos(-1.0)

#define EPS 1e-10

const ll INF = 1e12;

const ll MOD = 1e9 + 7;



#define FOR(i,a,b) for(int i=(a);i<(b);i++)

#define rep(i,N) for(int i=0;i<(N);i++)

#define ALL(s) (s).begin(),(s).end()

#define EQ(a,b) (abs((a)-(b))<EPS)

#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )

#define fi first

#define se second

#define N_SIZE 100100

#define NIL -1

#define MAX_N 100100



double sq(double num) { return num*num; }

ll mod_pow(ll x, ll n) {

	if (n == 0)return 1;

	if (n == 1)return x%MOD;

	ll res = sq(mod_pow(x, n / 2));

	res %= MOD;

	if (n % 2 == 1) {

		res *= x;

		res %= MOD;

	}

	return res;

}

ll mod_add(ll a, ll b) { return (a + b) % MOD; }

ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }

ll mod_mul(ll a, ll b) { return a*b % MOD; }



ll e;



int main(){

	while (cin >> e&&e) {

		ll sum = INF;

		for (ll k = 0; k*k*k <= e;k++) {

			for (ll j = 0; j*j + k*k*k <= e; j++) {

				ll i = e - (j*j + k*k*k);

				if (sum > i + j + k)sum = i + j + k;

			}

		}

		cout << sum << endl;

	}

}
// Slower C++ solution:
#include <iostream>

using namespace std;



int main()

{

  int e, x;

  while(cin >> e && e > 0){

    int m = 1e6;

    for(int z=0; z<=1e2; z++){

      for(int y=0; y<=1e3; y++){

        x = e - z*z*z - y*y;

        if(x < 0){

          continue;

        }

        if(x+y+z<m){

          m = x + y + z;

        }

      }

    }

    cout << m << endl;

  }

  return 0;

}

// Faster C++ solution for the same problem (measured speedup: 2.141853349512067x):
#include <iostream>

using namespace std;

int E;



int main(int argc, char const* argv[])

{

    while ( cin >> E and E > 0 ) {

        int m = E;

        for (int z = 0; z * z * z <= E ; z++) {

            for (int y = 0; y * y <= E - z * z * z; y++) {

                int x = E - z * z * z - y * y;

                if ( x + y + z < m) m = x + y + z;

            }

        }

        cout << m << endl;

    }

    return 0;

}
// Slower C++ solution:
#include <iostream>

#include <math.h>

using namespace std;

int N, S, y_max, z_max, ans;



int main(){

  while( cin >> N && N > 0){

    for(int i = 0; i <= 1000; i++){

      for(int j = 0; j <= 100; j++){

        if(i == 0 && j == 0) ans = N;

        if(ans > (i + j +(N-i*i-j*j*j)) && N-i*i-j*j*j >= 0) ans = i + j +(N-i*i-j*j*j);

      }

    }





    cout << ans << endl;





  }









}


// Faster C++ solution for the same problem (measured speedup: 3.757695487033062x):
#include<iostream>

#include<map>

#include<vector>

#include<algorithm>

#include<cmath>

#include<climits>

#include<ctime>

#include<cstring>

#include<numeric>



#define ALL(v) (v).begin(),(v).end()

#define REP(i,p,n) for(int i=p;i<(int)(n);++i)

#define rep(i,n) REP(i,0,n)

#define dump(a) (cerr << #a << "=" << (a) << endl)

#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;



using namespace std;



int main(){

  int N, k;

  while(cin >> N && N > 0){

    int ans = -1;

    rep(i, 101){

      rep(j, 1001){

        k = N - j*j - i*i*i;

        if (k < 0) break;

        if(ans == -1) {

          ans = i + j + k;

        } else{

          if (ans > i + j + k) ans = i + j + k;

        }



      }

    }

    cout << ans << endl;

  }



  return 0;

}
// Slower C++ solution:
#include <iostream>

#include <vector>

#include <algorithm>

#include <set>

#include <queue>

#include <stack>

#include <string>

#include <map>

#include <cstdio>

#include <cstdlib>

#include <cstring>

#include <cmath>



#define rep(i, n) for(int i = 0; i < n; i ++)

#define ALL(T) T.begin(), T.end()

#define mp make_pair

#define pb push_back



using namespace std;



typedef pair<int, int> pii;

typedef unsigned long long ull;

typedef vector<int> vi;

typedef vector<string> vs;



const int INF = 1 << 24;

const int N = (int)1e6 + 1;



int main(void){

    for(int e, res; res = INF, cin >> e, e; cout << res << endl)

        for(int z = 0; z * z * z < N; z ++)

            for(int y = 0; y * y < N; y ++)

                if(y * y + z * z * z <= e)

                    res = min(res, y + z + e - y * y - z * z * z);



    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.8718711370277201x):
#include <iostream>

#include <vector>

#include <list>

#include <algorithm>

#include <set>

#include <queue>

#include <stack>

#include <string>

#include <sstream>

#include <map>

#include <cstdio>

#include <cstdlib>

#include <cmath>

#include <cstring>



#define rep(i, n) for(int i = 0; i < n; i ++)

#define COUNT(i, n) for(int i = 1; i <= n; i ++)

#define ITER(c) __typeof((c).begin())

#define each(c, it) for(ITER(c) it =(c).begin(); it!=(c).end(); it++)

#define ALL(c) c.begin(), c.end()

#define mp make_pair

#define pb push_back

#define MEMSET(v, h) memset((v), h, sizeof(v))

 

using namespace std; 



typedef pair<int, int> pii;

typedef long long ll;

typedef vector<int> vi;

typedef vector<string> vs;



const int INF = 1 << 24;



int main(void){

    for(int e, m; m = INF, cin >> e, e; cout << m << endl)

        for(int z = 0; z * z * z <= e; z++)

            for(int y = 0; y * y <= e - z * z * z; y++){

                int x = e - z * z * z - y * y;

                m = min(m, x + y + z);

            }



    return 0;

}
// Slower C++ solution:
#include <cstdio>

#include <algorithm>

using namespace std;



int memo[101][10001],v[1001],w[1001];

int dp(int i,int j){

    if(i == 0)return 0;

    if(memo[i][j] >= 0)return memo[i][j];

    if(j - w[i - 1] < 0)return memo[i][j] = dp(i - 1,j);



    return memo[i][j] = max(dp(i - 1,j),dp(i,j - w[i - 1]) + v[i - 1]);

}



int main(){

    int N,W;

    scanf("%d %d",&N,&W);

    for(int i = 0; i < N; i++){

        scanf("%d %d",&v[i],&w[i]);

    }

    for(int i = 0; i < 101; i++){

        for(int j = 0; j < 10001; j++){

            memo[i][j] = -1;

        }

    }

    printf("%d\n",dp(N,W));

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 22.422901870342706x):
#include<cstdio>

#include <algorithm>

using namespace std;



int v[1001],w[1001];

int N,W,i,j;

int dp[101][10001];

int main(){

    scanf("%d %d",&N,&W);

    for(j = 0; j < W; j++)dp[0][j] = 0;

    for(i = 1;i <= N;i++){

        scanf("%d %d",&v[i - 1],&w[i - 1]);

        for(j = 0;j <= W;j++){

            if(j - w[i - 1] < 0) dp[i][j] = dp[i - 1][j];

		    else dp[i][j] = max(dp[i - 1][j],dp[i][j - w[i - 1]] + v[i - 1]);

        }

    }

    printf("%d\n",dp[N][W]);

    return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

typedef pair < int , int > Pi;

int main()

{

    set < Pi > st; //y order

    Pi data[100005]; // x order

    int W, H, N;

    cin >> W >> H >> N;

    st.insert(Pi(0, -1));

    for(int i = 0; i < N; i++) {

        cin >> data[i].first >> data[i].second;

        st.insert(Pi(data[i].second, data[i].first));

    }

    sort(data, data + N);

    

    int minv = (--st.end()) -> first;

    int i;

    while(i < N) {

        int val = data[i].first;

        while(data[i].first == val) {

            st.erase(Pi(data[i].second, data[i].first));

            i++;

        }

        minv = min(minv, val + (--st.end()) -> first);

    }

    cout << minv << endl;

    return (0);

}

        

// Faster C++ solution for the same problem (measured speedup: 1.3098493182446747x):
#include <bits/stdc++.h>

using namespace std;

int main()

{

    int W, H, N;

    int ymax[100005] = {};



    cin >> W >> H >> N;

    for(int i = 0; i < N; i++) {

        int x, y;

        cin >> x >> y;

        ymax[x] = max(ymax[x], y);

    }

    

    int minv = 1 << 28;

    int mm = 0;

    for(int i = W - 1; i >= 0; i--) {

        minv = min(i + mm, minv);

        mm = max(ymax[i], mm);

    }



    cout << minv << endl;

    return (0);

}
// Slower C++ solution:
#include<bits/stdc++.h>



using namespace std;



typedef long long ll;

typedef long double ld;



const int N = 1e5 + 5;

int dp[N][2];

string s;



int solve(int idx, int prv){

	if(idx == s.size())

		return 0;

	int &ans = dp[idx][prv];

	if(~ans)

		return ans;

	if(s[idx] - '0' == prv)

		return ans = solve(idx + 1, !prv) + 1;

	else

		return ans = solve(idx + 1, !prv);

}

int main() {

	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

#ifdef ONLINE_JUDGE

    // freopen("", "r", stdin);

    // freopen("", "w", stdout);

#endif

	cin >> s;

	memset(dp, -1, sizeof dp);

	cout << min(solve(0, 0), solve(0, 1));

	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 1.7820526172529458x):
#include <bits/stdc++.h>

using namespace std;

#define ll long long

#define pb push_back

#define F first

#define S second

const int mod = 1e9 + 7, A = 1e3 + 2;



int main() {

    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);

    string s;

    cin >> s;

    int cnt = 0, type = s[0] == '1' ? 1 : 0;

    for (int i = 1; i < (int)s.size(); i++) {

        if (s[i] == '1') {

            if (type == 1)

                cnt++, type = 0;

            else type = 1;

        }

        else if (s[i] == '0') {

            if (type == 0)

                cnt++, type = 1;

            else type = 0;

        }

    }

    cout << cnt;

    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>



using namespace std;



typedef long long ll;

typedef long double ld;



const int N = 1e5 + 5;

int dp[N][2];

string s;



int solve(int idx, int prv){

	if(idx == s.size())

		return 0;

	int &ans = dp[idx][prv];

	if(~ans)

		return ans;

	if(s[idx] - '0' == prv)

		return ans = solve(idx + 1, !prv) + 1;

	else

		return ans = solve(idx + 1, !prv);

}

int main() {

	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

#ifdef ONLINE_JUDGE

    // freopen("", "r", stdin);

    // freopen("", "w", stdout);

#endif

	cin >> s;

	memset(dp, -1, sizeof dp);

	cout << min(solve(0, 0), solve(0, 1));

	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 1.7922459931329349x):
#include<bits/stdc++.h>

using namespace std;



#define FastRead        ios_base::sync_with_stdio(false);cin.tie(NULL);

#define endl            "\n"

#define sq(x)           ((x)*(x))

#define pi              acos(-1.0)

#define NUM             1000005



typedef long long ll;





int main()

{

    FastRead



    string s;

    ll cnt1=0,cnt2=0;

    

    cin>>s;

    

    for(ll i=0; i<s.size(); i++)

    {

        if(i%2==0 && s[i]=='0')

        {

            cnt1++;

        }

        if(i%2==1 && s[i]=='1')

        {

            cnt1++;

        }

    }

    

    for(ll i=0; i<s.size(); i++)

    {

        if(i%2==1 && s[i]=='0')

        {

            cnt2++;

        }

        if(i%2==0 && s[i]=='1')

        {

            cnt2++;

        }

    }

    

    cout<<min(cnt1,cnt2)<<endl;

}
// Slower C++ solution:
#include<bits/stdc++.h>



using namespace std;



typedef long long ll;

typedef long double ld;



const int N = 1e5 + 5;

int dp[N][2];

string s;



int solve(int idx, int prv){

	if(idx == s.size())

		return 0;

	int &ans = dp[idx][prv];

	if(~ans)

		return ans;

	if(s[idx] - '0' == prv)

		return ans = solve(idx + 1, !prv) + 1;

	else

		return ans = solve(idx + 1, !prv);

}

int main() {

	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

#ifdef ONLINE_JUDGE

    // freopen("", "r", stdin);

    // freopen("", "w", stdout);

#endif

	cin >> s;

	memset(dp, -1, sizeof dp);

	cout << min(solve(0, 0), solve(0, 1));

	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 1.810826538493473x):
#include<bits/stdc++.h>

using namespace std;



int main()

{

    long long int i,n,tiles=0;

    string s;

    cin>>s;

   if(s[0]=='0')

   {

       for(i=0;i<s.size();i++)

       {

           if(i%2==0)

           {

               if(s[i]!='0')

                tiles++;

           }

           else if(i%2!=0)

                if(s[i]!='1')

                tiles++;

       }

   }

   else if(s[0]=='1')

   {

       for(i=0;i<s.size();i++)

       {

           if(i%2==0)

           {

               if(s[i]!='1')

                tiles++;

           }

           else if(i%2!=0)

                if(s[i]!='0')

                tiles++;

       }

   }

   cout<<tiles;



}
// Slower C++ solution:
#include<bits/stdc++.h>



using namespace std;



typedef long long ll;

typedef long double ld;



const int N = 1e5 + 5;

int dp[N][2];

string s;



int solve(int idx, int prv){

	if(idx == s.size())

		return 0;

	int &ans = dp[idx][prv];

	if(~ans)

		return ans;

	if(s[idx] - '0' == prv)

		return ans = solve(idx + 1, !prv) + 1;

	else

		return ans = solve(idx + 1, !prv);

}

int main() {

	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

#ifdef ONLINE_JUDGE

    // freopen("", "r", stdin);

    // freopen("", "w", stdout);

#endif

	cin >> s;

	memset(dp, -1, sizeof dp);

	cout << min(solve(0, 0), solve(0, 1));

	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 1.7820180295932806x):
#include <bits/stdc++.h>



using namespace std;



using ll = long long;

using ull = unsigned long long;



const long long MOD = 1e9 + 7;





#define INPUT(x)                freopen(x,"r",stdin)

#define OUTPUT(x)               freopen (x,"w",stdout)





#define pb                      push_back

#define endl                    '\n'

#define LCM(a,b)                (a/__gcd(a,b))*b

#define GCD(a,b)                __gcd(a,b)

#define SP(x,y)                 fixed<<setprecision((y))<<(x)

#define PI                      acos(-1.0)

#define distance(x1,y1,x2,y2)   sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1))

#define MAX                     1e9 + 9



#define taratari                ios_base::sync_with_stdio(0);cin.tie(NULL);





int main()

{

    taratari



    string a;

    cin >> a;



    int x=0;

    int y=0;



    for(int i=0;i<a.size();i++)

    {

        if(i%2==0 && a[i]=='0')

        {

            x++;

        }

        if(i%2==1 && a[i]=='1')

        {

            x++;

        }

        if(i%2==0 && a[i]=='1')

        {

            y++;

        }

        if(i%2==1 && a[i]=='0')

        {

            y++;

        }



    }





    cout << min(x,y);



    return 0;



}
// Slower C++ solution:
#include<bits/stdc++.h>



using namespace std;



#define FOR(i, j, k) for(int i = j; i <= k; i++)

#define SZ 110000

#define PB push_back

#define MEM(n, val) memset((n), val, sizeof(n))

#define INF 1000000000

#define F first

#define S second

#define MP make_pair

#define LL long long



string s;

int dp[100010][3];



int func(int pos, int past)  {

    if(pos == s.size())    {

        return 0;

    }

    if(dp[pos][past] != -1)    {

        return dp[pos][past];

    }

    int ans = 1000000000;

    if(past == 1)    {

        ///current ta 0 boshbe

        int cc = 0;

        if((s[pos] - '0') == 1)    {

            cc = 1;

        }

        ans = min(ans, cc + func(pos + 1, 0));

    }

    else if(past == 0)    {

        ///current ta 1 boshbe

        int cc = 0;

        if((s[pos] - '0') == 0)    {

            cc = 1;

        }

        ans = min(ans, cc + func(pos + 1, 1));

    }

    else    {

        ///current ta boshiye

        ans = min(ans, func(pos + 1, s[pos] - '0'));



        ///current ta na boshiye

        ans = min(ans, 1 + func(pos + 1, !(s[pos] - '0')));

    }

    return dp[pos][past] = ans;

}



int main()  {

//    freopen("in.txt", "r", stdin);



    cin >> s;

    MEM(dp, -1);

    cout << func(0, 2) << "\n";



    return 0;

}

/**

*/


// Faster C++ solution for the same problem (measured speedup: 2.2106322329884245x):
#include<bits/stdc++.h>



using namespace std;



#define FOR(i, j, k) for(int i = j; i <= k; i++)

#define SZ 110000

#define PB push_back

#define MEM(n, val) memset((n), val, sizeof(n))

#define INF 1000000000

#define F first

#define S second

#define MP make_pair

#define LL long long



string s;



int func(int pos, int past)  {

    if(pos == s.size())    {

        return 0;

    }

    int ans = 1000000000;

    if(past == 1)    {

        ///current ta 0 boshbe

        int cc = 0;

        if((s[pos] - '0') == 1)    {

            cc = 1;

        }

        ans = min(ans, cc + func(pos + 1, 0));

    }

    else if(past == 0)    {

        ///current ta 1 boshbe

        int cc = 0;

        if((s[pos] - '0') == 0)    {

            cc = 1;

        }

        ans = min(ans, cc + func(pos + 1, 1));

    }

    else    {

        ///current ta boshiye

        ans = min(ans, func(pos + 1, s[pos] - '0'));



        ///current ta na boshiye

        ans = min(ans, 1 + func(pos + 1, !(s[pos] - '0')));

    }

    return ans;

}



int main()  {

//    freopen("in.txt", "r", stdin);



    cin >> s;

    cout << func(0, 2) << "\n";



    return 0;

}

/**

*/
// Slower C++ solution:
#include <iostream>

#include <string>

using namespace std;

string s;

int n;



int min(int x,int y){

	if (x<y) return x;

	else return y;

}



int ans0(string s0){

	int ans=0;

	if (s0[0]!='0'){

		s0[0]='0';

		ans++;

	}

	for (int i=1;i<n;i++){

		if (s0[i]==s0[i-1]){

			if (s0[i-1]=='0'){

				s0[i]='1';ans++;

			}else{

				s0[i]='0';ans++;

			}

		}

	}

	return ans;

}

int ans1(string s0){

	int ans=0;

	if (s0[0]!='1'){

		s0[0]='1';

		ans++;

	}

	for (int i=1;i<n;i++){

		if (s0[i]==s0[i-1]){

			if (s0[i-1]=='0'){

				s0[i]='1';ans++;

			}else{

				s0[i]='0';ans++;

			}

		}

	}

	return ans;

}



int main(){

	cin>>s;

	n=s.size();

	int ans=min(ans0(s),ans1(s));

	cout<<ans<<endl;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.307596325278391x):
#include <cstdio>

#include <cstring>

#include <algorithm>

#ifdef sahdsg

#define DBG(...) printf(__VA_ARGS__)

#else

#define DBG(...) (void)0

#endif // sahdsg



using namespace std;

typedef long long LL;

char s[100007];

char k[100007];

char p[100007];

int main()

{

    scanf("%s",s);

    int l=strlen(s);

    for(int i=0; i<=l/2+2; i++) {

        k[i*2]='0',k[i*2+1]='1';

        p[i*2]='1',p[i*2+1]='0';

    }

    int ans1=0, ans2=0;

    for(int i=0; i<l; i++) {

        if(s[i]!=k[i]) ans1++;

        if(s[i]!=p[i]) ans2++;

    }

    printf("%d\n", min(ans1,ans2));

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

vector<char>mp;

int main(){

	string s;

	cin>>s;

	int final=0;

	char lastchar=s[0];

	for (int x=1;x<s.length();x++){

		char a=s[x];

		if (a=='0'){

			if (lastchar=='0'){

				final++;

				lastchar='1';

			}

			else lastchar='0';

		}

		else if (a=='1'){

			if (lastchar=='1'){

				final++;

				lastchar='0';

			}

			else lastchar='1';

		}

	}

	cout<<final<<endl;



}

// Faster C++ solution for the same problem (measured speedup: 5.305250704576949x):
#include <cstdio>

#include <cstring>

#include <algorithm>

#ifdef sahdsg

#define DBG(...) printf(__VA_ARGS__)

#else

#define DBG(...) (void)0

#endif // sahdsg



using namespace std;

typedef long long LL;

char s[100007];

char k[100007];

char p[100007];

int main()

{

    scanf("%s",s);

    int l=strlen(s);

    for(int i=0; i<=l/2+2; i++) {

        k[i*2]='0',k[i*2+1]='1';

        p[i*2]='1',p[i*2+1]='0';

    }

    int ans1=0, ans2=0;

    for(int i=0; i<l; i++) {

        if(s[i]!=k[i]) ans1++;

        if(s[i]!=p[i]) ans2++;

    }

    printf("%d\n", min(ans1,ans2));

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N = 2e5 + 5;

string s;

int main() {

    ios::sync_with_stdio(false); cin.tie(0);

    cin >> s;

    int n = s.length();

    string t = "";

    for(int i = 0; i < n; i++) {

        if(i & 1) t += "0";

        else t += "1";

    }

    int ans = n + 1;

    int cur = 0;

    for(int i = 0; i < n; i++) {

        if(s[i] != t[i]) ++cur;

    }

    ans = cur;

    cur = 0;

    t = "";

    for(int i = 0; i < n; i++) {

        if(i & 1) t += "1";

        else t += "0";

    }

    for(int i = 0; i < n; i++) {

        if(s[i] != t[i]) ++cur;

    }

    ans = min(ans, cur);

    cout << ans;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.390966919278956x):
#include <cstdio>

#include <cstring>

#include <algorithm>

#ifdef sahdsg

#define DBG(...) printf(__VA_ARGS__)

#else

#define DBG(...) (void)0

#endif // sahdsg



using namespace std;

typedef long long LL;

char s[100007];

char k[100007];

char p[100007];

int main()

{

    scanf("%s",s);

    int l=strlen(s);

    for(int i=0; i<=l/2+2; i++) {

        k[i*2]='0',k[i*2+1]='1';

        p[i*2]='1',p[i*2+1]='0';

    }

    int ans1=0, ans2=0;

    for(int i=0; i<l; i++) {

        if(s[i]!=k[i]) ans1++;

        if(s[i]!=p[i]) ans2++;

    }

    printf("%d\n", min(ans1,ans2));

}