stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}


// Optimized solution to the same problem (faster):
#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;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#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);

}

        

// Optimized solution to the same problem (faster):
#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);

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}


// Optimized solution to the same problem (faster):
#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;



}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

/**

*/


// Optimized solution to the same problem (faster):
#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;

}

/**

*/


// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#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));

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;



}

// Optimized solution to the same problem (faster):
#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));

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}


// Optimized solution to the same problem (faster):
#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));

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<bitset>

#include<cstring>

using namespace std;

const int maxn = 1e5+5;



int main(){

	string s;

	cin >> s;

    bitset<maxn>bit (s);

    string s1,s2;

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

    	if (i%2) {

    		s1 += '0';

    		s2 += '1';

    	}else{

    		s1 += '1';

    		s2 += '0';

    	}

    }

    bitset<maxn>tar1 (s1);

    bitset<maxn>tar2 (s2);

    tar1 = tar1^bit;

    tar2 = tar2^bit;

    int a = tar1.count();

    int b = tar2.count();

    cout << min(a,b);

    return 0;

}

// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;

 

int main()

{

    string s;

    cin >> s;

 

    long int N = s.size();

 

    long int m1ve = 0;

    long int m2ve = 0;

 

    for(long int n=0; n<N; n++)

    {

        if(n % 2)

        {

            if(s[n] == '1')

            {

                m1ve++;

            }

 

            else

            {

                m2ve++;

            }

        }

 

        else

        {

            if(s[n] == '1')

            {

                m2ve++;

            }

 

            else

            {

                m1ve++;

            }

        }

    }

 

    cout << min(m1ve,m2ve);

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h> 



using namespace std; 



int main(){

	string s;

	cin >> s;

	int cnt=0;



	int x=s[0];



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

		if(x=='0'){

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

				// flag=1;

			}else{

				s[i]='1';

				cnt++;

			}

		}else{

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

				// flag==2;

			}else{

				s[i]='0';

				cnt++;

			}

		}

		x=s[i];

	}



	cout << cnt;



return 0;



}





















// int main()

// {		

// 	float a,b,c;

// 	cin >> a >> b >> c;



// 	float n = ((b-a)/c)+1;





// 	if(c==0 && a==b)

// 		cout << "YES";

// 	else if(c==0 && a!=b)

// 		cout << "NO";

// 	else if((b<0 && c>=0) || (b>=0 && c<0))

// 		cout << "NO";

// 	else{

// 		if(floor(n)==ceil(n))

// 		cout << "YES";

// 	else

// 		cout << "NO";

// 	}



// }


// Optimized solution to the same problem (faster):
#include <stdio.h>

int main (){

	

	char s[100000];

	int count = 0;

	



		scanf("%s", &s);

	

	

	for (int j = 0; s[j+1] != '\0'; j++){

		if(s[j] == s[j+1] && s[j] == s[j-1]){

//		if(s[j] == s[j+1]){

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

				s[j] = '1';

			}

			else{

				s[j] = '0';

			}

			count++;

		}

		else if(s[j] == s[j+1] && s[j] != s[j-1]){

			if(s[j+1] == '0'){

				s[j+1] = '1';

			}

			else{

				s[j+1] = '0';

			}

			count++;

	   	}

	}

	

	

	printf("%d", count);

	

	

	

	

	

	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



#define trace(...) __f( #__VA_ARGS__ , __VA_ARGS__ )

template <typename Arg1>

void __f( const char* name , Arg1&& arg1 ) {

        cerr << name << " : " << arg1 << "\n";

}

template <typename Arg1, typename... Args>

void __f( const char* na , Arg1&& arg1 , Args&&... args ) {

        const char* c = strchr( na + 1 , ',' );

        cerr.write( na , c - na ) << " : " << arg1 << " , ";

        __f( c + 1 , args... );

}

#define endl "\n"

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

#define Unique(V) sort(all(V)),V.erase(unique(all(V)),V.end())

#define IO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long int LL;

typedef pair <int,int> pii;

const int MOD = 1e9 + 7;

const int inf = 1e9;

const double EPS = 1e-9;

const double PI = acos(-1.0);

const long long INF = 1e18;

const int N = 1e5 + 5;



int main( ) {

        IO;

        #ifdef LOCAL

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

        #endif // LOCAL

        string s;

        cin >> s;

        int ans = 0;

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

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

                        if( s[i] == '1' ) s[i] = '0';

                        else s[i] = '1';

                        ans++;

                }

        }

        cout << ans << endl;

        return 0;

}




















// Optimized solution to the same problem (faster):
#include <stdio.h>

int main (){

	

	char s[100000];

	int count = 0;

	



		scanf("%s", &s);

	

	

	for (int j = 0; s[j+1] != '\0'; j++){

		if(s[j] == s[j+1] && s[j] == s[j-1]){

//		if(s[j] == s[j+1]){

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

				s[j] = '1';

			}

			else{

				s[j] = '0';

			}

			count++;

		}

		else if(s[j] == s[j+1] && s[j] != s[j-1]){

			if(s[j+1] == '0'){

				s[j+1] = '1';

			}

			else{

				s[j+1] = '0';

			}

			count++;

	   	}

	}

	

	

	printf("%d", count);

	

	

	

	

	

	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

using namespace std;

int main(){

	char brick[100010];

	int cnt1=0,cnt2=0;

	int l=0;

	int flag=0;

	cin>>brick;

	while(brick[l])l++;

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

		if(brick[i]-'0'!=flag)cnt1++;

		flag=1-flag;

	} 

	flag=1;

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

		if(brick[i]-'0'!=flag)cnt2++;

		flag=1-flag;

	} 

	cout<<(cnt1>cnt2?cnt2:cnt1);

	return 0;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>

int main (){

	

	char s[100000];

	int count = 0;

	



		scanf("%s", &s);

	

	

	for (int j = 0; s[j+1] != '\0'; j++){

		if(s[j] == s[j+1] && s[j] == s[j-1]){

//		if(s[j] == s[j+1]){

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

				s[j] = '1';

			}

			else{

				s[j] = '0';

			}

			count++;

		}

		else if(s[j] == s[j+1] && s[j] != s[j-1]){

			if(s[j+1] == '0'){

				s[j+1] = '1';

			}

			else{

				s[j+1] = '0';

			}

			count++;

	   	}

	}

	

	

	printf("%d", count);

	

	

	

	

	

	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
/**

     **author : _KMS_

     **created : 12-03-2020

**/

#include<bits/stdc++.h>

using namespace std;

const long long M =1e5+100,MOD=2e9;

typedef long long ll;

string s;

int main() 

{ 

      

 ios::sync_with_stdio(false);

 cin.tie(0);

 cin>>s;

 int cnt=0,cnt2=0;

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

 {

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

       else if(i%2==1&&s[i]=='1')cnt++;

 }

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

 {

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

       else if(i%2==1&&s[i]=='0')cnt2++;

 }

 cout<<min(cnt,cnt2)<<"\n";

 



 

	return 0; 

} 

// Optimized solution to the same problem (faster):
#include <stdio.h>

int main (){

	

	char s[100000];

	int count = 0;

	



		scanf("%s", &s);

	

	

	for (int j = 0; s[j+1] != '\0'; j++){

		if(s[j] == s[j+1] && s[j] == s[j-1]){

//		if(s[j] == s[j+1]){

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

				s[j] = '1';

			}

			else{

				s[j] = '0';

			}

			count++;

		}

		else if(s[j] == s[j+1] && s[j] != s[j-1]){

			if(s[j+1] == '0'){

				s[j+1] = '1';

			}

			else{

				s[j+1] = '0';

			}

			count++;

	   	}

	}

	

	

	printf("%d", count);

	

	

	

	

	

	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>



using namespace std;



int notnumber(int a) {

  if(a == 48) return 49;

  else return 48;

}



int main() {

  string s;

  cin >> s;



  int cont = 0;

  int ant = s[0];



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

    if(s[i] == ant) {

      ant = notnumber(s[i]);

      cont++;

    } else ant = s[i];

  }



  ant = s[s.length()-1];

  int cont2 = 0;



  for(int i = s.length()-2; i >= 0; i--) {

    if(s[i] == ant) {

      ant = notnumber(s[i]);

      cont2++;

    } else ant = s[i];

  }



  cout << min(cont, cont2) << endl;



  return 0;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>

int main (){

	

	char s[100000];

	int count = 0;

	



		scanf("%s", &s);

	

	

	for (int j = 0; s[j+1] != '\0'; j++){

		if(s[j] == s[j+1] && s[j] == s[j-1]){

//		if(s[j] == s[j+1]){

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

				s[j] = '1';

			}

			else{

				s[j] = '0';

			}

			count++;

		}

		else if(s[j] == s[j+1] && s[j] != s[j-1]){

			if(s[j+1] == '0'){

				s[j+1] = '1';

			}

			else{

				s[j+1] = '0';

			}

			count++;

	   	}

	}

	

	

	printf("%d", count);

	

	

	

	

	

	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>



// # DEFINES # //

#define ll long long

#define M (ll)1e9+7

#define EPS 1e-9



using namespace std;



int main(){

    ios::sync_with_stdio(0);

    cin.tie(0);

    cout.tie(0);



    string s;



    cin >> s;



    size_t n = s.size();

    

    // primeiro 1

    int n1 = 0;

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

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

            n1++;

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

            n1++;

    }



    // primeiro 0

    int n2 = 0;    

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

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

            n2++;

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

            n2++;

    }



    if(n == 1)

        cout << 0 << endl;

    else 

        cout << min(n1, n2) << endl;



    return 0;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>

int main (){

	

	char s[100000];

	int count = 0;

	



		scanf("%s", &s);

	

	

	for (int j = 0; s[j+1] != '\0'; j++){

		if(s[j] == s[j+1] && s[j] == s[j-1]){

//		if(s[j] == s[j+1]){

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

				s[j] = '1';

			}

			else{

				s[j] = '0';

			}

			count++;

		}

		else if(s[j] == s[j+1] && s[j] != s[j-1]){

			if(s[j+1] == '0'){

				s[j+1] = '1';

			}

			else{

				s[j+1] = '0';

			}

			count++;

	   	}

	}

	

	

	printf("%d", count);

	

	

	

	

	

	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>



using namespace std;



#define ll long long

#define ull unsigned long long

#define PI acos(-1.0)

#define eps 1e-12

#define fi first

#define se second

#define pb push_back

#define MEM(a,b) memset((a),(b),sizeof(a))

#define mod(x) ((x)%MOD)

#define pii pair<int,int>

#define wz cout<<"-----"<<endl;

const int INF_INT = 2147483647;

const ll INF_LL = 9223372036854775807LL;

const ull INF_ULL = 18446744073709551615Ull;

const ll P = 92540646808111039LL;



const ll maxn = 1e5 + 10, MOD = 1e9 + 7;

const int Move[4][2] = {-1,0,1,0,0,1,0,-1};

const int Move_[8][2] = {-1,-1,-1,0,-1,1,0,-1,0,1,1,-1,1,0,1,1};



inline int read(){

    int x=0,f=1;char ch=getchar();

    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}

    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}

    return x*f;

}





void init() {



}



vector<int>E[maxn];





int main(){

//    freopen("C:\\Users\\Administrator\\Desktop\\in.txt","r",stdin);

//    freopen("C:\\Users\\Administrator\\Desktop\\out.txt","w",stdout);

//    ios_base::sync_with_stdio(0);

    init();

    int n,m; cin >>n >>m;

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

        int x, y; cin >> x >> y;

        E[x].pb(y);

        E[y].pb(x);

    }

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

        cout << E[i].size() << endl;

    }

    return 0;

}


// Optimized solution to the same problem (faster):
#include<iostream>

using namespace std;

int num[1000010];

int main()

{

    int n,m;

    cin>>n>>m;

    while(m--)

    {

        int a,b;

        cin>>a>>b;

        num[a]++;

        num[b]++;

    }

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

    {

        cout<<num[i]<<endl;

    }

}

// Fastest known solution for this problem: