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

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

int main() {
  string tail;
  cin >> tail;
  
  int count1=0;
  int count2=0;
  int min_c;
  for(int i=0;i<tail.size();i++){
     
    if(tail.at(i)==tail.at(i+1)){ tail.at(i)='0';
                                 count1++;
                                }
    
    if(tail.at(i)==tail.at(i+1)){ tail.at(i)='1';
                                 count 2++;
                                 
    
  }
    
    min_c=min(count1,count2);
    
    cout << min_c << endl;
    return 0;
  }
  
        

Compiler output:
a.cc: In function 'int main()':
a.cc:18:39: error: expected ';' before numeric constant
   18 |                                  count 2++;
      |                                       ^~
      |                                       ;
a.cc:18:43: error: statement cannot resolve address of overloaded function
   18 |                                  count 2++;
      |                                           ^
a.cc:27:4: error: expected '}' at end of input
   27 |   }
      |    ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C++

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

int main() {
  string tail;
  cin >> tail;
  
  int count1=0;
  int count2=0;
  int min_c;
  for(int i=1;i<tail.size();i++){
     
      if(i%2==1){
        if(tail.at(i)!='0'){
          tail.at(i)='0';
          count1++;
        }
      }
    if(i%2==0){
      if(tail.at(i)!='1'){
        tail.at(i)='1';
        count1++;
      }
    }
    
    if(i%2==1){
        if(tail.at(i)!='1'){
          tail.at(i)='1';
          count2++;
        }
      }
    if(i%2==0){
      if(tail.at(i)!='0'){
        tail.at(i)='0';
        count2++;
      }
    }
    
    min_c=min(count1,count2);
    
    cout << min_c << endl;
    
  }
  
        

Compiler output:
a.cc: In function 'int main()':
a.cc:43:4: error: expected '}' at end of input
   43 |   }
      |    ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C++

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

int main() {
  string tail;
  cin >> tail;
  
  int count1=0;
  int count2=0;
  int min_c;
  for(int i=1;i<tail.size();i++){
     
      if(i%2==1){
        if(tail.at(i)!="0"){
          tail.at(i)="0";
          count1++;
        }
      }
    if(i%2==0){
      if(tail.at(i)!="1"){
        tail.at(i)="1";
        count1++;
      }
    }
    
    if(i%2==1){
        if(tail.at(i)!="1"){
          tail.at(i)="1";
          count2++;
        }
      }
    if(i%2==0){
      if(tail.at(i)!="0"){
        tail.at(i)="0";
        count2++;
      }
    }
    
    min_c=min(count1,count2);
    
    cout << min_c << endl;
    
  }
  
        

Compiler output:
a.cc: In function 'int main()':
a.cc:14:22: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   14 |         if(tail.at(i)!="0"){
      |            ~~~~~~~~~~^~~~~
a.cc:15:22: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive]
   15 |           tail.at(i)="0";
      |                      ^~~
      |                      |
      |                      const char*
a.cc:20:20: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   20 |       if(tail.at(i)!="1"){
      |          ~~~~~~~~~~^~~~~
a.cc:21:20: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive]
   21 |         tail.at(i)="1";
      |                    ^~~
      |                    |
      |                    const char*
a.cc:27:22: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   27 |         if(tail.at(i)!="1"){
      |            ~~~~~~~~~~^~~~~
a.cc:28:22: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive]
   28 |           tail.at(i)="1";
      |                      ^~~
      |                      |
      |                      const char*
a.cc:33:20: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   33 |       if(tail.at(i)!="0"){
      |          ~~~~~~~~~~^~~~~
a.cc:34:20: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive]
   34 |         tail.at(i)="0";
      |                    ^~~
      |                    |
      |                    const char*
a.cc:43:4: error: expected '}' at end of input
   43 |   }
      |    ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C++

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

int main(){
  int one=0;
  string S;
  cin >> S;
  
  for(int i=0; i<S.length(); i++){
    if(i%2 == 0 && S[i] == '1') one++;
    if(i%2 == 1 && S[i] == '0') one++;
  }
  
  int another = S.length() - tile;
  cout << min(one, another) << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:30: error: 'tile' was not declared in this scope; did you mean 'time'?
   14 |   int another = S.length() - tile;
      |                              ^~~~
      |                              time
Language: C++

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

int main(){
  int tile=0;
  string S;
  cin >> S;
  
  for(int i=0; i<S.length(); i++){
    if(i%2 == 0 && S[i] == '1') tile++;
    if(i%2 == 1 && S[i] == '0') tile++;
  }
  
  cout << min(tile, S.length() - tile) << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:14: error: no matching function for call to 'min(int&, std::__cxx11::basic_string<char>::size_type)'
   14 |   cout << min(tile, S.length() - tile) << endl;
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~
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: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:14:14: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'})
   14 |   cout << min(tile, S.length() - tile) << endl;
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/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:14:14: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   14 |   cout << min(tile, S.length() - tile) << endl;
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

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

int main(){
  int tile=0;
  string S;
  cin >> S;
  
  for(int i=0; i<S.length(); i++){
    if(i%2 == 0 && S[i] == '1') tile++;
    if(i%2 == 1 && S[i] == '0') tile++;
  }
  
  int other=S.length();
  other-=tile
  
  cout << min(tile,other) << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:14: error: expected ';' before 'cout'
   15 |   other-=tile
      |              ^
      |              ;
   16 | 
   17 |   cout << min(tile,other) << endl;
      |   ~~~~
Language: C++

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

int main(){
  int tile=0;
  string S;
  cin >> S;
  
  for(int i=0; i<S.length(); ++i){
    if(i%2 == 0 && S[i] == '1') tile++;
    if(i%2 == 1 && S[i] == '0') tile++;
  }
  
  cout << max(tile, (int S.length())-tile) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:22: error: expected primary-expression before 'int'
   14 |   cout << max(tile, (int S.length())-tile) << endl;
      |                      ^~~
a.cc:14:22: error: expected ')' before 'int'
   14 |   cout << max(tile, (int S.length())-tile) << endl;
      |                     ~^~~
      |                      )
Language: C++

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

int main(){
  int tile=0;
  string S;
  cin >> S;
  
  for(int i=0; i<S.length(); ++i){
    if(i%2 == 0 && S[i] == '1') tile++;
    if(i%2 == 1 && S[i] == '0') tile++;
  }
  
  cout << max(tile, S.length()-tile) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:14: error: no matching function for call to 'max(int&, std::__cxx11::basic_string<char>::size_type)'
   14 |   cout << max(tile, S.length()-tile) << endl;
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~~
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:14:14: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'})
   14 |   cout << max(tile, S.length()-tile) << endl;
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/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:14:14: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   14 |   cout << max(tile, S.length()-tile) << endl;
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  n=s.size();
  int c=0;
  for (int i=0; i<n; i++){
    if (s[i] == i%2) c++;
  }
  cout << min(c,n-c) << endl;
}

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

include "bits/stdc++.h"
#define ed cout<<"\n";
#define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

using namespace std;

int main() {
	SPEED;

	string s;
	cin >> s;
	int n = s.length();
	int l=0;
	int k = 0;
	for (int i = 0; i < n; i++) {
		if (s[i] - '0' != (i % 2))l++;
		else k++;
	}
	cout << min(l, k);
	ed;

	return 0;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include "bits/stdc++.h"
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:3:15: error: 'ios_base' has not been declared
    3 | #define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
      |               ^~~~~~~~
a.cc:8:9: note: in expansion of macro 'SPEED'
    8 |         SPEED;
      |         ^~~~~
a.cc:3:48: error: 'cin' was not declared in this scope
    3 | #define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
      |                                                ^~~
a.cc:8:9: note: in expansion of macro 'SPEED'
    8 |         SPEED;
      |         ^~~~~
a.cc:3:56: error: 'NULL' was not declared in this scope
    3 | #define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
      |                                                        ^~~~
a.cc:8:9: note: in expansion of macro 'SPEED'
    8 |         SPEED;
      |         ^~~~~
a.cc:1:1: note: 'NULL' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
  +++ |+#include <cstddef>
    1 | include "bits/stdc++.h"
a.cc:3:62: error: 'cout' was not declared in this scope
    3 | #define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
      |                                                              ^~~~
a.cc:8:9: note: in expansion of macro 'SPEED'
    8 |         SPEED;
      |         ^~~~~
a.cc:10:9: error: 'string' was not declared in this scope
   10 |         string s;
      |         ^~~~~~
a.cc:11:16: error: 's' was not declared in this scope
   11 |         cin >> s;
      |                ^
a.cc:19:17: error: 'min' was not declared in this scope; did you mean 'main'?
   19 |         cout << min(l, k);
      |                 ^~~
      |                 main
Language: C++

#include <stdio.h>
#include <math.h>
#include <string.h>
#include <iostream>
using namespace std;

int main(){
    int wb = 0, bw = 0;
    string s;
    cin>>s;
    int n = s.size();
    int guki = 0;
    int guki2 = 0;
    for(i = 0; i<n; i++){
        if(s[i] == '0' && guki == 0){
            wb++;
        }
        else if(s[i] == '1' && guki == 1){
            wb++;
        }
        if(s[i] == '1' && guki2 == 0){
            bw++;
        }
        else if(s[i] == '0' && guki2 == 1){
            bw++;
        }
        if(guki == 0){
            guki++;
        }
        else{
            guki = 0;
        }
        if(guki2 == 0){
            guki2++;
        }
        else{
            guki2 = 0;
        }
    }

    if(bw<wb){
        cout<<bw<<endl;
    }
    else{
        cout<<wb<<endl;
    }
   
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:9: error: 'i' was not declared in this scope
   14 |     for(i = 0; i<n; i++){
      |         ^
Language: C++

#include <stdio.h>
#include <math.h>
#include <string.h>
#include <iostream>
using namespace std;

int main(){
    int wb = 0, bw = 0;
    char c;
    int guki = 0;
    int guki2 = 0;
    while(1){
        cin>>c;
        if(c == '0' && guki == 0){
            wb++;
        }
        else if(c == '1' && guki == 1){
            wb++;
        }
        if(c == '1' && guki2 == 0){
            bw++;
        }
        else if(c == '0' && guki2 == 1){
            bw++;
        }
        else{
            break;
        }
        if(guki == 0){
            guki++;
        }
        else{
            guki = 0
        }
        if(guki2 == 0){
            guki2++;
        }
        else{
            guki = 0;
        }
    }

    if(bw<wb){
        cout<<bw<<endl;
    }
    else{
        cout<<wb<<endl;
    }
   
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:21: error: expected ';' before '}' token
   33 |             guki = 0
      |                     ^
      |                     ;
   34 |         }
      |         ~
Language: C++

#include <stdio.h>
#include <math.h>
#include <string.h>
using namespace std;

int main(){
    int wb = 0, bw = 0;
    char c;
    int guki = 0;
    int guki2 = 0;
    while(1){
        cin>>c;
        if(c == '0' && guki == 0){
            wb++;
            guki++;
        }
        else if(c == '1' && guki == 1){
            wb++;
            guki = 0;
        }
        else if(c == '1' && guki2 == 0){
            bw++;
            guki++;
        }
        else if(c == '0' && guki2 == 1){
            bw++;
            guki = 0;
        }
        else{
            break;
        }
    }

    if(bw<wb){
        cout<<bw<<endl;
    }
    else{
        cout<<wb<<endl;
    }
   
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:9: error: 'cin' was not declared in this scope
   12 |         cin>>c;
      |         ^~~
a.cc:4:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    3 | #include <string.h>
  +++ |+#include <iostream>
    4 | using namespace std;
a.cc:35:9: error: 'cout' was not declared in this scope
   35 |         cout<<bw<<endl;
      |         ^~~~
a.cc:35:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:35:19: error: 'endl' was not declared in this scope
   35 |         cout<<bw<<endl;
      |                   ^~~~
a.cc:4:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    3 | #include <string.h>
  +++ |+#include <ostream>
    4 | using namespace std;
a.cc:38:9: error: 'cout' was not declared in this scope
   38 |         cout<<wb<<endl;
      |         ^~~~
a.cc:38:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:38:19: error: 'endl' was not declared in this scope
   38 |         cout<<wb<<endl;
      |                   ^~~~
a.cc:38:19: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
Language: C++

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

int main(){
    int wb = 0, bw = 0;
    char c;
    int guki = 0;
    int guki2 = 0;
    while(1){
        cin>>c;
        if(c == '0' && guki == 0){
            wb++;
            guki++;
        }
        else if(c == '1' && guki == 1){
            wb++;
            guki = 0;
        }
        else if(c == '1' && guki2 == 0){
            bw++;
            guki++;
        }
        else if(c == '0' && guki2 == 1){
            bw++;
            guki = 0;
        }
        else{
            break;
        }
    }

    if(bw<wb){
        cout<<bw<<endl;
    }
    else{
        cout<<wb<<endl;
    }
   
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:9: error: 'cin' was not declared in this scope; did you mean 'sin'?
   11 |         cin>>c;
      |         ^~~
      |         sin
a.cc:34:9: error: 'cout' was not declared in this scope
   34 |         cout<<bw<<endl;
      |         ^~~~
a.cc:34:19: error: 'endl' was not declared in this scope
   34 |         cout<<bw<<endl;
      |                   ^~~~
a.cc:37:9: error: 'cout' was not declared in this scope
   37 |         cout<<wb<<endl;
      |         ^~~~
a.cc:37:19: error: 'endl' was not declared in this scope
   37 |         cout<<wb<<endl;
      |                   ^~~~
Language: C++

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

int main(){
    int wb = 0, bw = 0;
    char c;
    guki = 0;
    guki2 = 0;
    while(1){
        cin>>c;
        if(c == '0' && guki == 0){
            wb++;
            guki++;
        }
        else if(c == '1' && guki == 1){
            wb++;
            guki = 0;
        }
        else if(c == '1' && guki2 == 0){
            bw++;
            guki++;
        }
        else if(c == '0' && guki2 == 1){
            bw++;
            guki = 0;
        }
        else{
            break;
        }
    }

    if(bw<wb){
        cout<<bw<<endl;
    }
    else{
        cout<<wb<<endl;
    }
   
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:5: error: 'guki' was not declared in this scope
    8 |     guki = 0;
      |     ^~~~
a.cc:9:5: error: 'guki2' was not declared in this scope
    9 |     guki2 = 0;
      |     ^~~~~
a.cc:11:9: error: 'cin' was not declared in this scope; did you mean 'sin'?
   11 |         cin>>c;
      |         ^~~
      |         sin
a.cc:34:9: error: 'cout' was not declared in this scope
   34 |         cout<<bw<<endl;
      |         ^~~~
a.cc:34:19: error: 'endl' was not declared in this scope
   34 |         cout<<bw<<endl;
      |                   ^~~~
a.cc:37:9: error: 'cout' was not declared in this scope
   37 |         cout<<wb<<endl;
      |         ^~~~
a.cc:37:19: error: 'endl' was not declared in this scope
   37 |         cout<<wb<<endl;
      |                   ^~~~
Language: C++

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

int main(){
	string str;
  cin >> str;
  int s1 =0, s2 = 0;
  char c;
  for(int i =0 ;i<str.size();i++){
    if(i&1)
      c = '1';
   else
     c='0';
    if(str[i]!=c)
      	s1++;
   	if(str[i]==c)
      	s2++;
  }
  cout<<min(s1,s2);
}

Compiler output:
a.cc:1:9: fatal error: bits/stc++.h: No such file or directory
    1 | #include<bits/stc++.h>
      |         ^~~~~~~~~~~~~~
compilation terminated.
Language: C++

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

int main() {
  int n, x;
  string S;
  cin >> S;
  x = 0;
  n = S.size();
  for (int i = 0; i < n / 2; i++) {
    if (S.at(2 * i) = '1') {
      x++;
    }
    if (S.at(2 * i + 1) = '0') {
      x++;
    }
  }
  if (n % 2 = 1) {
    if (S.at(n - 1) = '1') {
      x++;
    }
  }
  if (x <= n / 2) {
    cout << x << endl;
  }
  else {
    cout << n - x << endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:9: error: lvalue required as left operand of assignment
   18 |   if (n % 2 = 1) {
      |       ~~^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  string S;
  cin >> S;
  
  int N=S.size();
  vector<int> T(N);
  for(int i=0;i<N;i++){
  if(S.at(i)=="0")T.at(i)=0;
  else T.at(i)=1;
  }
  
  int Ans1=0,Ans2=0;
  
  for(int i=0;i<N;i++){
  if(T.at(i)!=i%2) Ans1++;
  if(T.at(i)!=1-(i%2)) Ans2++;
  }
  
  int Answer=min(Ans1,Ans2);
  
  cout << Answer << endl;
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:13: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   12 |   if(S.at(i)=="0")T.at(i)=0;
      |      ~~~~~~~^~~~~
Language: C

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

int main(void){
    char s[10];
    char c;
    int i, cnt;

    scanf("%s", &s);
    len = strlen(s);
    c = s[0];

    cnt = 0;
    for(i = 1; i < strlen; i++){
        if(c == s[i]){
            cnt++;
            if(s[i] =='0'){
                c = '1';
            }
            else{
                c = '0';
            }
        }
        else{
            c = s[i];
        }
    }

    printf("%d", cnt);

    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:10:5: error: 'len' undeclared (first use in this function)
   10 |     len = strlen(s);
      |     ^~~
main.c:10:5: note: each undeclared identifier is reported only once for each function it appears in
main.c:14:18: warning: comparison between pointer and integer
   14 |     for(i = 1; i < strlen; i++){
      |                  ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
    string number;
    cin >> number;
    int count=0;
    for(int j=0;j<number.size()-1,j++){
        if(number.at(j)==number.at(j+1)){
            count ++;
            if(number.at(j+1)=='0'){
                number.at(j+1)='1';
            }else{
                number.at(j+1)='0';
            }
        }
    cout << count;
    }
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:38: error: expected ';' before ')' token
    7 |     for(int j=0;j<number.size()-1,j++){
      |                                      ^
      |                                      ;
Language: C++

#include <iostream>
#include <numeric>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <map>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
#define rep(i,a,b) for(ll i=a;i<b;i++)

int main(){
    string s;
    cin>>s;
    ll ans=0;
    rep(i,0,s.size()){
        if((s[i]^i)&1) ans++;
    }
    cout<<min(ans,s.size()-ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:14: error: no matching function for call to 'min(ll&, long long unsigned int)'
   21 |     cout<<min(ans,s.size()-ans);
      |           ~~~^~~~~~~~~~~~~~~~~~
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: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:21:14: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long long unsigned int')
   21 |     cout<<min(ans,s.size()-ans);
      |           ~~~^~~~~~~~~~~~~~~~~~
/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,
                 from a.cc:6:
/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:21:14: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   21 |     cout<<min(ans,s.size()-ans);
      |           ~~~^~~~~~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>

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

	bool flag = false;
	unsigned int count = 0;
	for (int i = 0; i < s.length(); i++)
	{
		const bool bit = (s[i] != '0');
		if (bit == flag)
		{
			count++;
		}

		flag = !flag;
	}

	count = std::min(count, s.length() - count);
	std::cout << count << std::endl;
	return 0;
}

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

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

#define MAX_SIZE 100000

int main(){

    int i,j;

	char* str;
    int cnt_zero_start,cnt_nonzero_start;

    cnt_zero_start = 0;    //010101...
    cnt_nonzero_start = 0; //101010...

    str = malloc(sizeof(char *) * 10);

    scanf("%s",str);

    for(i = 0; str[i] != '\0' ; i++){
        if(i%2){//even
            if(str[i] == '0'){//0
                cnt_zero_start++;
            }else{//1
                cnt_nonzero_start++;
            }
        }else{//odd
            if(str[i] == '0'){//0
                cnt_nonzero_start++;
            }else{//1
                cnt_zero_start++;
            }
        }
    }

    if(cnt_zero_start<cnt_nonzero_start)
        printf("%d\n",cnt_zero_start);
    else
        printf("%d\n",cnt_nonzero_start);    

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:17: error: invalid conversion from 'void*' to 'char*' [-fpermissive]
   17 |     str = malloc(sizeof(char *) * 10);
      |           ~~~~~~^~~~~~~~~~~~~~~~~~~~~
      |                 |
      |                 void*
Language: C++

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

#define MAX_SIZE 100000

int main(){

    int i,j;

	char* str;
    int cnt_zero_start,cnt_nonzero_start;

    cnt_zero_start = 0;    //010101...
    cnt_nonzero_start = 0; //101010...

    str = malloc(sizeof(char *) * MAX_SIZE);

    scanf("%s",str);

    for(i = 0; str[i] != '\0' ; i++){
        if(i%2){//even
            if(str[i] == '0'){//0
                cnt_zero_start++;
            }else{//1
                cnt_nonzero_start++;
            }
        }else{//odd
            if(str[i] == '0'){//0
                cnt_nonzero_start++;
            }else{//1
                cnt_zero_start++;
            }
        }
    }

    if(cnt_zero_start<cnt_nonzero_start)
        printf("%d\n",cnt_zero_start);
    else
        printf("%d\n",cnt_nonzero_start);    

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:17: error: invalid conversion from 'void*' to 'char*' [-fpermissive]
   17 |     str = malloc(sizeof(char *) * MAX_SIZE);
      |           ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                 |
      |                 void*
Language: C++

#include <stdio.h>
#include <iostream>
using namespace std;
int main()
{
  int n, count = 0;
  cin >> n;
  int i;
  for(i = 0; i < n; ; i++)
  {
    char a;
    cin >> a;
    if((a == '0') ^ (i % 2 == 0))
    {
      count++;
    }
  }
  if(count > n - count)
  {
    count = n-count;
  }
  cout << count << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:21: error: expected primary-expression before ';' token
    9 |   for(i = 0; i < n; ; i++)
      |                     ^
a.cc:9:20: error: expected ')' before ';' token
    9 |   for(i = 0; i < n; ; i++)
      |      ~             ^~
      |                    )
a.cc:9:26: error: expected ';' before ')' token
    9 |   for(i = 0; i < n; ; i++)
      |                          ^
      |                          ;
Language: C++

#include <bits/stdc++.h>

int main() {
	string S, x="";
	cin >> S;
	int n = S.size();

	for (int i = 0;i < n;i++) { //1010…の作成
		if (i % 2 == 0) {
			x += "1";
		}
		else {
			x += "0";
		}
	}

	int countx=0;
	for (int i = 0;i < n;i++) {
		if (S.at(i) == x.at(i)) {
			countx++;
		}
	}
	if (countx < S.size()-countx) {
		cout << countx;
	}
	else {
		cout << S.size() - countx;
	}



	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:9: error: 'string' was not declared in this scope
    4 |         string S, x="";
      |         ^~~~~~
a.cc:4:9: note: suggested alternatives:
In file included from /usr/include/c++/14/string:41,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/stringfwd.h:77:33: note:   'std::string'
   77 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
/usr/include/c++/14/string:76:11: note:   'std::pmr::string'
   76 |     using string    = basic_string<char>;
      |           ^~~~~~
a.cc:5:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    5 |         cin >> S;
      |         ^~~
      |         std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:5:16: error: 'S' was not declared in this scope
    5 |         cin >> S;
      |                ^
a.cc:10:25: error: 'x' was not declared in this scope
   10 |                         x += "1";
      |                         ^
a.cc:13:25: error: 'x' was not declared in this scope
   13 |                         x += "0";
      |                         ^
a.cc:19:32: error: 'x' was not declared in this scope
   19 |                 if (S.at(i) == x.at(i)) {
      |                                ^
a.cc:24:17: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   24 |                 cout << countx;
      |                 ^~~~
      |                 std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:27:17: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   27 |                 cout << S.size() - countx;
      |                 ^~~~
      |                 std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
Language: C

#include <stdio.h>

int main(void) {
	char x;
	int S[10000];
	int i = 0, cnt = 0;
	int str_length;

	while (1) {
		scanf_s("%c", &x);
		if (x == '0') {
			S[i] = 0;
		}
		else if (x == '1') {
			S[i] = 1;
		}
		else {
			break;
		}
		i++;
	}

	str_length = i;

	printf("前:");
	for (i = 0; i < str_length; i++) {
		printf("%d", S[i]);
	}
	printf("\n");

	for (i = 1; i < str_length; i++) {
		if (S[i - 1] == 0 && S[i] == 0) {
			S[i] = 1;
			cnt++;
		}
		if (S[i - 1] == 1 && S[i] == 1) {
			S[i] = 0;
			cnt++;
		}
	}

	printf("後:");
	for (i = 0; i < str_length; i++) {
		printf("%d", S[i]);
	}
	printf("\n");

	if (cnt > str_length - cnt) {
		printf("%d\n", str_length - cnt);
	}
	else {
		printf("%d\n", cnt);
	}
	return 0;

}

Compiler output:
main.c: In function 'main':
main.c:10:17: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration]
   10 |                 scanf_s("%c", &x);
      |                 ^~~~~~~
      |                 scanf
Language: C

#include<stdio.h>

int main(){
  char a[];
  scanf("%s",a);
  int zerokara=0,ichikara=0,i,len;
  len=strlen(a);
  for(i=0;i<len;i++){
    if(i%2==1){
      if(a[i]=0){
        ichikara++;
      }else{
        zerokara++;
      }
    }
    if(i%2==0){
      if(a[i]=1){
        ichikara++;
      }else{
        zerokara++;
      }
    } 
  }
  if(zerokara>ichikara){
    printf("%d",ichikara);
  }else{
    printf("%d",zerokara);
  }
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:4:8: error: array size missing in 'a'
    4 |   char a[];
      |        ^
main.c:7:7: error: implicit declaration of function 'strlen' [-Wimplicit-function-declaration]
    7 |   len=strlen(a);
      |       ^~~~~~
main.c:2:1: note: include '<string.h>' or provide a declaration of 'strlen'
    1 | #include<stdio.h>
  +++ |+#include <string.h>
    2 | 
main.c:7:7: warning: incompatible implicit declaration of built-in function 'strlen' [-Wbuiltin-declaration-mismatch]
    7 |   len=strlen(a);
      |       ^~~~~~
main.c:7:7: note: include '<string.h>' or provide a declaration of 'strlen'
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int i;
  int out = 0;
  char lastTile = ' ';
  char tiles[25];
  cin>>tiles;
  for(i = 0;tiles[i] != null;i++){
    if(lastTile == tiles[i]){
      out++;
      if(tiles[i] == '0'){
        tiles[i] = '1';
      }else{
        tiles[i] = '0';
      }
    }
    lastTile = tiles[i];
  }
  cout<<out;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:25: error: 'null' was not declared in this scope
    9 |   for(i = 0;tiles[i] != null;i++){
      |                         ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int i;
  int out = 0;
  char lastTile = ' ';
  char tiles[25] = {' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' '};
  cin>>tiles;
  for(i = 0;tiles[i] != ' ';i++){
    if(lastTile == tiles[i]){
      out++;
      if(tile[i] == '0'){
        tile[i] = '1';
      }else{
        tile[i] = '0';
      }
    }
    lastTile = tile[i];
  }
  cout<<out;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:10: error: 'tile' was not declared in this scope; did you mean 'tiles'?
   12 |       if(tile[i] == '0'){
      |          ^~~~
      |          tiles
a.cc:18:16: error: 'tile' was not declared in this scope; did you mean 'tiles'?
   18 |     lastTile = tile[i];
      |                ^~~~
      |                tiles
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int out = 0;
  char lastTile = ' ';
  char tiles[25] = {' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' '};
  cin>>tiles;
  for(i=0;tiles[i]!=' ';i++){
    if(lastTile == tiles[i]){
      out++;
      if(tile[i]=='0'){
        tile[i]='1';
      }else{
        tile[i]='0';
      }
    }
    lastTile=tile[i];
  }
  cout<<out;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:7: error: 'i' was not declared in this scope
    8 |   for(i=0;tiles[i]!=' ';i++){
      |       ^
a.cc:11:10: error: 'tile' was not declared in this scope; did you mean 'tiles'?
   11 |       if(tile[i]=='0'){
      |          ^~~~
      |          tiles
a.cc:17:14: error: 'tile' was not declared in this scope; did you mean 'tiles'?
   17 |     lastTile=tile[i];
      |              ^~~~
      |              tiles
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int out;
  char lastTile = ' ';
  char tiles[25] = {' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' '};
  cin>>tiles;
  for(i=0;tiles[i]!=' ';i++){
    if(lastTile == tiles[i]){
      out++;
      if(tile[i]=='0'){
        tile[i]='1';
      }else{
        tile[i]='0';
      }
    }
    lastTile=tile[i];
  }
  cout<<out;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:7: error: 'i' was not declared in this scope
    8 |   for(i=0;tiles[i]!=' ';i++){
      |       ^
a.cc:11:10: error: 'tile' was not declared in this scope; did you mean 'tiles'?
   11 |       if(tile[i]=='0'){
      |          ^~~~
      |          tiles
a.cc:17:14: error: 'tile' was not declared in this scope; did you mean 'tiles'?
   17 |     lastTile=tile[i];
      |              ^~~~
      |              tiles
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int out;
  char lastTile = ' ';
  char tiles[25];
  cin>>tiles;
  for(i=0;tiles[i]!=null;i++){
    if(lastTile == tiles[i]){
      out++;
      if(tile[i]=='0'){
        tile[i]='1';
      }else{
        tile[i]='0';
      }
    }
    lastTile=tile[i];
  }
  cout<<out;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:7: error: 'i' was not declared in this scope
    8 |   for(i=0;tiles[i]!=null;i++){
      |       ^
a.cc:8:21: error: 'null' was not declared in this scope
    8 |   for(i=0;tiles[i]!=null;i++){
      |                     ^~~~
a.cc:11:10: error: 'tile' was not declared in this scope; did you mean 'tiles'?
   11 |       if(tile[i]=='0'){
      |          ^~~~
      |          tiles
a.cc:17:14: error: 'tile' was not declared in this scope; did you mean 'tiles'?
   17 |     lastTile=tile[i];
      |              ^~~~
      |              tiles
Language: C++

#include<ios#include<iostream>
using namespace std;
 
int main() {
  string s;
  int cnt = 0;
  
  cin >> s;
  cout << s << " " << s.size() << endl;
  for (int i=1;i<(int)s.size();i++) {
  	if (s[i-1]=='0' and s[i]=='0') { cnt++; s[i]='1';}
    else if (s[i-1]=='1' and s[i]=='1') { cnt++; s[i]='0';}
  }
  
  cout << cnt;
  return 0;
}

Compiler output:
a.cc:1:9: fatal error: ios#include<iostream: No such file or directory
    1 | #include<ios#include<iostream>
      |         ^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: Java

import java.lang.Math;
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final string S = scanner.nextLine();
      
      	final char[] order1 = { '0', '1' };
      	final char[] order2 = { '1', '0' };
      
      	int count1 = 0;
      	int count2 = 0;
      
      	final int n = S.length();
      	for (int i = 0; i < n; i++) {
          	int c = S.charAt(i);
         	int c1 = order1[i % 2];
          	int c2 = order2[i % 2];
          	if (c1 != c) {
            	count1++;
            }
          	if (c2 != c) {
            	count2++;
            }
        }
      
      	System.out.println(Math.min(count1, count2));
    }
}

Compiler output:
Main.java:7: error: cannot find symbol
        final string S = scanner.nextLine();
              ^
  symbol:   class string
  location: class Main
1 error
Language: C

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

int main(){
	char S[100000];
	scanf("%s",S);
	int n=1,s=0,i,a=0;
	for(i=0;i<100000;i++){
		if(S[i+1]=='\0'){
			if(n%2==1){
				s+=n/2;
			}
			else{
				a++;
				s+=n/2;
			}
			s+=a/2;
			break;
		}
		if(S[i]==S[i+1]){
			n++;
		}
		else{
			if(n%2==0){
				a++;
			}
			s+=n/2;
			n=1;
		}
	}
	printf("%d\n",s);
	return 0;


Compiler output:
main.c: In function 'main':
main.c:33:9: error: expected declaration or statement at end of input
   33 |         return 0;
      |         ^~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s,t;
  cin>> s;
  
  
  int n=s.size();
  
  int c1=0;  
  for(int i=0;i<n-1;i++){
    if (s.at(i)==s.at(i+1)){
      c1++;
      if (s.at(i)=='0'){
        s.at(i+1)='1';
      }else if{
        s.at(i+1)='0';
      }
    }
  }
  
  int c2=0;
  for(int i=0;i<n-1;i++){
    if (t.at(n-1-i)==t.at(n-1-i-1)){
      c2++;
      if (t.at(n-1-i)=='0'){
        t.at(n-1-i-1)='1';
      }else if{
        t.at(n-1-i-1)='0';
      }
    }
  }
  cout << min(c1,c2)<<endl;
}
  
    

Compiler output:
a.cc: In function 'int main()':
a.cc:17:15: error: expected '(' before '{' token
   17 |       }else if{
      |               ^
      |               (
a.cc:29:15: error: expected '(' before '{' token
   29 |       }else if{
      |               ^
      |               (
Language: C++

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

int main(){
    string S;
    cin>>S;
    int size=S.size();
    int count01=0;
    int col=0;
    int B=count(S.cbegin(),S.cend(),'0');
    int halfsize;
    for(int i=0;i<size;i+=2){
        if(S[i]=='0'){
            count01+=1;
        }
    }
    if(size%2==0){
        halfsize=size/2;
    }else{
        halfsize=(size+1)/2;
    }
    cout<<min(B+halfsize-2*count01,size-halfsize-B+2*count01)<<endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:11: error: 'count' was not declared in this scope; did you mean 'count01'?
   11 |     int B=count(S.cbegin(),S.cend(),'0');
      |           ^~~~~
      |           count01
Language: C++

#include <iostream>                                                                                     #include <vector>
#include <algorithm>
#include <map>
#include <string.h>                                                                                                                                                                                             using namespace std;

int main() {
    std::string s;
    cin >> s;
    int pos = 0;
    int pos_pre = 0;
    int count=0;
    int zero= 0;                                                                                            int one= 0;
    for (int i = 0; i < s.size(); i++) {
        if (s.at(i) == '0') {
            pos = 0;
        } else {
            pos = 1;
        }
        if (i != 0 ) {
            if (pos_pre == pos) {
                count++;
                if (pos == 0) {
                    pos = 1;
                } else {
                    pos = 0;
                }
            }
        }
        pos_pre = pos;
    }
    cout << count;
}


Compiler output:
a.cc:1:105: warning: extra tokens at end of #include directive
    1 | #include <iostream>                                                                                     #include <vector>
      |                                                                                                         ^
a.cc:4:209: warning: extra tokens at end of #include directive
    4 | #include <string.h>                                                                                                                                                                                             using namespace std;
      |                                                                                                                                                                                                                 ^~~~~
a.cc: In function 'int main()':
a.cc:8:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    8 |     cin >> s;
      |     ^~~
      |     std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:31:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   31 |     cout << count;
      |     ^~~~
      |     std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~