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

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

int main(){
    string S;
    cin >> S;
    double s_0 =, 0,s_1 = 0;
    for(int i = 0;i < S.size();i++){
    	if(i%2==0 && S.at(i)!='0'){
    	    s_0 +=1;
    	}
    	if(i%2==0 && S.at(i)!='1'){
    	    s_1 +=1;
    	}
    	if(i%2!=0 && S.at(i)!='1'){
    	    s_0 +=1;
    	}
    	if(i%2!=0 && S.at(i)!='0'){
    	    s_0 +=1;
    	}
    }
    cout << min(s_0,s_1);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:17: error: expected primary-expression before ',' token
    7 |     double s_0 =, 0,s_1 = 0;
      |                 ^
a.cc:13:13: error: 's_1' was not declared in this scope; did you mean 's_0'?
   13 |             s_1 +=1;
      |             ^~~
      |             s_0
a.cc:22:21: error: 's_1' was not declared in this scope; did you mean 's_0'?
   22 |     cout << min(s_0,s_1);
      |                     ^~~
      |                     s_0
Language: C++

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

int main(){
  string s;
  cin >> s;
  int cnt1=0, cnt2=0, now=0;
  for(int i=0; i<n; i++){
    if(s[i]!=now+'0')cnt1++;
    if(s[i]==now+'0')cnt2++;
    now=(now+1)%2;
  }
  cout << min(cnt1, cnt2);
  return 0;
}

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

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

char* gen_10_bits(int len){
	int i;
	char* bit_s;

	bit_s = (char *)malloc(sizeof(char)*len);

	for(i=0; i < len; i++){
		bit_s[i] = i%2 == 0 ? '1':'0';
	}

	return bit_s;
}

char* gen_01_bits(int len){
	int i;
	char* bit_s;

	bit_s = (char *)malloc(sizeof(char)*len);

	for(i=0; i < len; i++){
		bit_s[i] = i%2 == 0 ? '1':'0';
	}

	return bit_s;
}

int hamm_dist(char *s0, const char *s1, const char * s2){
	int n;

	if(!*s1 && !*s2){
		*s0 = '\0';
		return 0;
	}
	
	if(!*s1 || !*s2 || (n = hamm_dist(s0 + 1, s1 + 1, s2 + 1)) == -1) return -1;
	if(*s1 == *s2) *s0 = ' ';
	else{
		*s0 = '|';
		++ n;
	}
	return n;
}
 
int main(void){
	int A,B;
	int i;
	int l;
	int flag_msb_0 = 0;
	int res1,res2;

	char N[1000000];
	char s[1000000];
 
 	scanf("%s", N);

 	/*
 	if(list[0] == '0'){
 		flag_msb_0 = 1;
 	}
 	*/

 	l = strlen(N);

 	res1 = hamm_dist(s, gen_01_bits(l), N);
 	res2 = hamm_dist(s, gen_10_bits(l), N);

 	if(res1 > res2){
		printf("%d\n", res1);
	}else{
		printf("%d\n", res2);
	}
 
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:66:13: error: 'strlen' was not declared in this scope
   66 |         l = strlen(N);
      |             ^~~~~~
a.cc:4:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <math.h>
  +++ |+#include <cstring>
    4 |
Language: C++

#include <iostream>
using namespace std;
int main(){
  int N;
  cin>>N;
  int in;
  cin>>in;
  int div=1;
  int *input;
  input=new int[N];
  for(int i=0; i<N; i++){
    if(i!=0){
      for(int j=0; j<i; j++) div = div*10;
    }
    input[i]=in/div;
    in=in%div;
  }
  
  int *correct1 = new int[N];
  int *correct2 = new int[N];
  for(int i=0; i<N; i++){
   if(i%2==0){
     correct1[i]=0; 
     correct2[i]=1;  
   }
    else{
      correct1[i]=1; 
      correct2[i]=0;  
   }  
  }
  
  int correct1rate=0;
  int correct2rate=0;
  int result;
  
  for(int i=0; i<N; i++){
   if(input[i]!=0 && input[i]!=1){
     result=0;
     break;
   }
   else if(input[i]==correct1[i]) correct1rate+=1; 
   else correct2rate+=1  ;
  }
  if(correct1>=correct2) result=correct1;
  else result=correct2;
  cout<<result;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:44:33: error: invalid conversion from 'int*' to 'int' [-fpermissive]
   44 |   if(correct1>=correct2) result=correct1;
      |                                 ^~~~~~~~
      |                                 |
      |                                 int*
a.cc:45:15: error: invalid conversion from 'int*' to 'int' [-fpermissive]
   45 |   else result=correct2;
      |               ^~~~~~~~
      |               |
      |               int*
Language: C++

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

int main(){
  int S;
  cin>>S;
  int n=S.size(),c=0,d=0;
  vector<int>v(n);
  vector<int>a(n);
  vector<int>b(n);
  for (int i=0;i<n;i++){
    v.at(i)=S.at(i);
    if (i%2==0){
      a.at(i)=0;
      b.at(i)=1;
    }
    else {
      b.at(i)=0;
      a.at(i)=1;
    }
  }
  for (int i=0;i<n;i++){
    if (v.at(i)!=a.at(i)){
      c++;
    }
    if (v.at(i)!=b.at(i)){
      d++;
    }
  }
  if (c>d){
    cout<<d<<endl;
  }
  else {
    cout<<c<<endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:11: error: request for member 'size' in 'S', which is of non-class type 'int'
    7 |   int n=S.size(),c=0,d=0;
      |           ^~~~
a.cc:12:15: error: request for member 'at' in 'S', which is of non-class type 'int'
   12 |     v.at(i)=S.at(i);
      |               ^~
a.cc:24:7: error: 'c' was not declared in this scope
   24 |       c++;
      |       ^
a.cc:27:7: error: 'd' was not declared in this scope
   27 |       d++;
      |       ^
a.cc:30:7: error: 'c' was not declared in this scope
   30 |   if (c>d){
      |       ^
a.cc:30:9: error: 'd' was not declared in this scope
   30 |   if (c>d){
      |         ^
Language: C

#include <stdio.h>

int main()
{
	int i=1,how=0,len=1;
	char S[];
	scanf("%s",S);
	while(S[i]!='\0')
	{
		if(S[i]==S[i-1])
		{
			how++;
			S[i]==(S[i-1]-'0'+1)%2+'0';
		}
		len++;
	}
	if(how*2>len)
	{
		how=len-how;
	}
	printf("%d",how);
	return 0;
}


Compiler output:
main.c: In function 'main':
main.c:6:14: error: array size missing in 'S'
    6 |         char S[];
      |              ^
Language: C++

#include <iostream>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
 
using namespace std;
 
int main(void){
  int a[2],sw=0;
  a[0]= a[1] = 0;
  
  string S;
  cin >>S;
  int length = S.length(),sum=0;
  char before = S[0];
  
  for(int i=1,i<length;i++){
  	if(S[i] != before){
      a[sw]++;
    }else {
     sw = 1-sw;
    }
    before = S[i];
  }
  if( a[0] > a[1])cout<<a[0];
  else cout<<a[1];
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:16: error: expected ';' before '<' token
   15 |   for(int i=1,i<length;i++){
      |                ^
      |                ;
a.cc:15:16: error: expected primary-expression before '<' token
Language: C++

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

char* gen_10_bits(int len){
	int i;
	char* bit_s;

	bit_s = (char *)malloc(sizeof(char)*len);

	for(i=0; i < len; i++){
		bit_s[i] = i%2 == 0 ? '1':'0';
	}

	return bit_s;
}

char* gen_01_bits(int len){
	int i;
	char* bit_s;

	bit_s = (char *)malloc(sizeof(char)*len);

	for(i=0; i < len; i++){
		bit_s[i] = i%2 == 0 ? '1':'0';
	}

	return bit_s;
}

int hamm_dist(char *s0, const char *s1, const char * s2){
	int n;

	if(!*s1 && !*s2){
		*s0 = '\0';
		return 0;
	}
	
	if(!*s1 || !*s2 || (n = hamm_dist(s0 + 1, s1 + 1, s2 + 1)) == -1) return -1;
	if(*s1 == *s2) *s0 = ' ';
	else{
		*s0 = '|';
		++ n;
	}
	return n;
}
 
int main(void){
	int A,B;
	int i;
	int flag_msb_0 = 0;
	int res1,res2;

	char N[1000000];
	char s[1000000];
 
 	scanf("%s", N);

 	/*
 	if(list[0] == '0'){
 		flag_msb_0 = 1;
 	}
 	*/

 	res1 = hamm_dist(s, gen_01_bits, N);
 	res2 = hamm_dist(s, gen_10_bits, N);

 	if(res1 > res2){
		printf("%d\n", res1);
	}else{
		printf("%d\n", res2);
	}
 
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:65:25: error: cannot convert 'char* (*)(int)' to 'const char*'
   65 |         res1 = hamm_dist(s, gen_01_bits, N);
      |                ~~~~~~~~~^~~~~~~~~~~~~~~~~~~
      |                         |
      |                         char* (*)(int)
a.cc:31:37: note:   initializing argument 2 of 'int hamm_dist(char*, const char*, const char*)'
   31 | int hamm_dist(char *s0, const char *s1, const char * s2){
      |                         ~~~~~~~~~~~~^~
a.cc:66:25: error: cannot convert 'char* (*)(int)' to 'const char*'
   66 |         res2 = hamm_dist(s, gen_10_bits, N);
      |                ~~~~~~~~~^~~~~~~~~~~~~~~~~~~
      |                         |
      |                         char* (*)(int)
a.cc:31:37: note:   initializing argument 2 of 'int hamm_dist(char*, const char*, const char*)'
   31 | int hamm_dist(char *s0, const char *s1, const char * s2){
      |                         ~~~~~~~~~~~~^~
Language: C++

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

int main(){
  string S;
  cin>>S;
  int n=S.size(),c=0,d=0;
  vector<int>v(n);
  vector<int>a(n);
  vector<int>b(n);
  for (int i=0;i<n;i++){
    v.at(i)=S.at(i);
    if (i%2=0){
      a.at(i)=0;
      b.at(i)=1;
    }
    else {
      b.at(i)=0;
      a.at(i)=1;
    }
  }
  for (int i=0;i<n;i++){
    if (v.at(i)!=a.at(i)){
      c++;
    }
    if (v.at(i)!=b.at(i)){
      d++;
    }
  }
  if (c>d){
    cout<<d<<endl;
  }
  else {
    cout<<c<<endl;
  }
}

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

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

int main() {
  string s;
  int a,b;
  cin >> s;
  for (i = 0; i < s.size(); i++){
    if(i % 2 == 1){
      if(s.at(i) == '0')
        b++;
      else
        a++;
    }
    else{
      if(s.at(i) == '0')
        a++;
      else
        b++;
    }
  }
  if(a > b)
    cout << b << endl;
  else
    cout << a << endl;
}


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

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

char* gen_10_bits(int len){
	int i;
	char* bit_s;

	bit_s = (char *)malloc(sizeof(char)*len);

	for(i=0; i < len; i++){
		bit_s[i] = i%2 == 0 ? '1':'0';
	}

	return bit_s;
}

char* gen_01_bits(int len){
	int i;
	char* bit_s;

	bit_s = (char *)malloc(sizeof(char)*len);

	for(i=0; i < len; i++){
		bit_s[i] = i%2 == 0 ? '1':'0';
	}

	return bit_s;
}

int hamm_dist(char *s0, const char *s1, const char * s2){
	int n;

	if(!*s1 && !*s2){
		*s0 = '\0';
		return 0;
	}
	
	if(!*s1 || !*s2 || (n = hamm_dist(s0 + 1, s1 + 1, s2 + 1)) == -1) return -1;
	if(*s1 == *s2) *s0 = ' ';
	else{
		*s0 = '|';
		++ n;
	}
	return n;
}
 
int main(void){
	int N;
	int A,B;
	int i;
	int flag_msb_0 = 0;
	int res1,res2;

	char N[1000000];
	char s[1000000];
 
 	scanf("%s", list);

 	/*
 	if(list[0] == '0'){
 		flag_msb_0 = 1;
 	}
 	*/

 	res1 = hamm_dist(s, gen_01_bits, N);
 	res2 = hamm_dist(s, gen_10_bits, N);

 	if(res1 > res2){
		printf("%d\n", res1);
	}else{
		printf("%d\n", res2);
	}
 
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:55:14: error: conflicting declaration 'char N [1000000]'
   55 |         char N[1000000];
      |              ^
a.cc:49:13: note: previous declaration as 'int N'
   49 |         int N;
      |             ^
a.cc:58:21: error: 'list' was not declared in this scope
   58 |         scanf("%s", list);
      |                     ^~~~
a.cc:66:25: error: cannot convert 'char* (*)(int)' to 'const char*'
   66 |         res1 = hamm_dist(s, gen_01_bits, N);
      |                ~~~~~~~~~^~~~~~~~~~~~~~~~~~~
      |                         |
      |                         char* (*)(int)
a.cc:31:37: note:   initializing argument 2 of 'int hamm_dist(char*, const char*, const char*)'
   31 | int hamm_dist(char *s0, const char *s1, const char * s2){
      |                         ~~~~~~~~~~~~^~
a.cc:67:25: error: cannot convert 'char* (*)(int)' to 'const char*'
   67 |         res2 = hamm_dist(s, gen_10_bits, N);
      |                ~~~~~~~~~^~~~~~~~~~~~~~~~~~~
      |                         |
      |                         char* (*)(int)
a.cc:31:37: note:   initializing argument 2 of 'int hamm_dist(char*, const char*, const char*)'
   31 | int hamm_dist(char *s0, const char *s1, const char * s2){
      |                         ~~~~~~~~~~~~^~
Language: C++

#include <iostream>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
 
using namespace std;
 
int main(void){
  int a[2],switch=0;
  a[0]= a[1] = 0;
  
  string S;
  cin >>S;
  int length = S.length(),sum=0;
  char before = S[0];
  
  for(int i=1,i<length;i++){
  	if(S[i] != before){
      a[switch]++;
    }else {
     switch = 1-switch;
    }
    before = S[i];
  }
  if( a[0] > a[1])cout<<a[0];
  else cout<<a[1];
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:12: error: expected unqualified-id before 'switch'
    7 |   int a[2],switch=0;
      |            ^~~~~~
a.cc:15:16: error: expected ';' before '<' token
   15 |   for(int i=1,i<length;i++){
      |                ^
      |                ;
a.cc:15:16: error: expected primary-expression before '<' token
a.cc:17:9: error: expected primary-expression before 'switch'
   17 |       a[switch]++;
      |         ^~~~~~
a.cc:17:9: error: expected ']' before 'switch'
   17 |       a[switch]++;
      |         ^~~~~~
      |         ]
a.cc:19:13: error: expected '(' before '=' token
   19 |      switch = 1-switch;
      |             ^
      |             (
Language: C++

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

char* gen_10_bits(int len){
	int i;
	char* bit_s;

	bit_s = (char *)malloc(sizeof(char)*len);

	for(i=0; i < len; i++){
		bit_s[i] = i%2 == 0 ? '1':'0';
	}

	return bit_s;
}

char* gen_01_bits(int len){
	int i;
	char* bit_s;

	bit_s = (char *)malloc(sizeof(char)*len);

	for(i=0; i < len; i++){
		bit_s[i] = i%2 == 0 ? '1':'0';
	}

	return bit_s;
}

int hamm_dist(char *s0, const char *s1, const char * s2){
	int n;

	if(!*s1 && !*s2){
		*s0 = '\0';
		return 0;
	}
	
	if(!*s1 || !*s2 || (n = hamm_dist(s0 + 1, s1 + 1, s2 + 1)) == -1) return -1;
	if(*s1 == *s2) *s0 = ' ';
	else{
		*s0 = '|';
		++ n;
	}
	return n;
}
 
int main(void){
	int N;
	int A,B;
	int i;
	int flag_msb_0 = 0;
	int res1,res2;

	int N[1000000];
	int s[1000000];
 
 	scanf("%s", list);

 	/*
 	if(list[0] == '0'){
 		flag_msb_0 = 1;
 	}
 	*/

 	res1 = hamm_dist(s, gen_01_bits, N);
 	res2 = hamm_dist(s, gen_10_bits, N);

 	if(res1 > res2){
		printf("%d\n", res1);
	}else{
		printf("%d\n", res2);
	}
 
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:55:13: error: conflicting declaration 'int N [1000000]'
   55 |         int N[1000000];
      |             ^
a.cc:49:13: note: previous declaration as 'int N'
   49 |         int N;
      |             ^
a.cc:58:21: error: 'list' was not declared in this scope
   58 |         scanf("%s", list);
      |                     ^~~~
a.cc:66:26: error: cannot convert 'int*' to 'char*'
   66 |         res1 = hamm_dist(s, gen_01_bits, N);
      |                          ^
      |                          |
      |                          int*
a.cc:31:21: note:   initializing argument 1 of 'int hamm_dist(char*, const char*, const char*)'
   31 | int hamm_dist(char *s0, const char *s1, const char * s2){
      |               ~~~~~~^~
a.cc:67:26: error: cannot convert 'int*' to 'char*'
   67 |         res2 = hamm_dist(s, gen_10_bits, N);
      |                          ^
      |                          |
      |                          int*
a.cc:31:21: note:   initializing argument 1 of 'int hamm_dist(char*, const char*, const char*)'
   31 | int hamm_dist(char *s0, const char *s1, const char * s2){
      |               ~~~~~~^~
Language: Java

import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
		char[] tr = line.toCharArray();
		
		if(tr.length == 1) {
			System.out.println(0);
			System.exit(0);
		}
		
		//先頭を変換しないパターン
		int cnt1 = solNoRev(tr);
		//先頭を変換するパターン
		int cnt2 = solRev(tr);

		System.out.println(Math.min(cnt1, cnt2));
		
	}
	
	static private char rev(char c) {
		if(c == '1') {
			return '0';
		} else {
			return '1';
		}
	}
	
	static private int solNoRev(char[] tr) {
		char ptr = tr[0];
		int cnt = 0;
		for(int i=1; i<tr.length; i++) {
			if(ptr == tr[i]) {
				ptr = rev(tr[i]);
				cnt ++;
			} else {
				ptr = tr[i];
			}
		}
		return cnt;
	}

	static private int solRev(char[] tr) {
		char ptr = rev(tr[0]);
		int cnt = 1;
		for(int i=1; i<tr.length; i++) {
			if(ptr == tr[i]) {
				ptr = rev(tr[i]);
				cnt ++;
			} else {
				ptr = tr[i];
			}
		}
		return cnt;
	}


Compiler output:
Main.java:59: error: reached end of file while parsing
	}
	 ^
1 error
Language: Java

mport java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String sline = sc.next();
		int n = sline.length();
		int[] sl = new int[n];
		for (int i=0; i<n; i++){
			sl[i] = Integer.parseInt(String.valueOf(sline.charAt(i)));
		}
		int ans0 = 0;
		int ans1 = 0;
		// 010
		for(int i=0; i<n; i++){
			if(i%2==0 && sl[i]==0){
				continue;
			} else if (i%2==1 && sl[i]==1) {
				continue;
			} else {
				ans0++;
			}
		}
		// 10
		for(int i=0; i<n; i++){
			if(i%2==0 && sl[i]==1){
				continue;
			} else if (i%2==1 && sl[i]==0) {
				continue;
			} else {
				ans1++;
			}
		}
		System.out.println(Math.min(ans0, ans1));
		
	}

}

Compiler output:
Main.java:1: error: class, interface, enum, or record expected
mport java.util.Scanner;
^
1 error
Language: C++

import sys
#input=sys.stdin.readline

def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

s=input()
l=list(s)
l=list(map(int, l))
ans=0
for i in range(2, len(s)):
    if l[i] == l[i-1] and l[i] != l[i-2]:
        ans+=1
        if l[i] == 1: l[i] = 0 
        else: l[i] = 1
    elif l[i] == l[i-1] and l[i] == l[i-2]:
        ans+=1
        if l[i-1] == 1: l[i-1] = 0
        else: l[i-1] = 1
print(ans)

Compiler output:
a.cc:2:2: error: invalid preprocessing directive #input
    2 | #input=sys.stdin.readline
      |  ^~~~~
a.cc:1:1: error: 'import' does not name a type
    1 | import sys
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

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

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

	vector<char> C(S.size());
	vector<int> num(C.size());
	for (int i = 0; i < S.size(); i++) {
		C.at(i) = S.at(i);
		num.at(i) = (int)(C.at(i) - '0');
	}
	int res = 0;
	for (int i = 0; i < C.size() - 1; i++) {
		if (num.at(i) == 1 && num.at(i + 1) == 1) {
			num.at(i + 1) = 0;
			res++;
		}
		else if (num.at(i) == 0 && num.at(i + 1) == 0) {
			num.at(i + 1) = 1;
			res++;
		}
	}
	cout << res << endl;

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

#include <iostream>
#include <cstdio>
#include <cstring>

using namespace std;

int main()
{
    char s[100005];
    gets(s);
    int ans1 = 0, ans2 = 0;
    int slen = strlen(s);
    for(int i = 0; i < slen; ++i)
    {
        if(i % 2 == 0)
        {
            if(s[i] != '1')
                ans2++;
            if(s[i] != '0')
                ans1++;
        }
        else
        {
            if(s[i] != '0')
                ans2++;
            if(s[i] != '1')
                ans1++;
        }
    }
    printf("%d\n", min(ans1, ans2));
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:5: error: 'gets' was not declared in this scope; did you mean 'getw'?
   10 |     gets(s);
      |     ^~~~
      |     getw
Language: C++

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



Compiler output:
a.cc: In function 'int main()':
a.cc:15:14: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   15 |       if(s[i]=="0") {
a.cc:16:15: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   16 |         s[i+1]=="1";
a.cc:19:15: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   19 |         s[i+1]=="0";
Language: C++

#include <iostream>
using namespace std;
int main(){
  int N;
  cin>>N;
  char *input;
  input=new char[N];
  for(int i=0; i<N; i++){
    cin>>input[i];
  }
  
  char *correct1 = new char[N];
  char *correct2 = new char[N];
  for(int i=0; i<N; i++){
   if(i%2==0){
     correct1[i]='0'; 
     correct2[i]='1';  
   }
    else{
      correct1[i]='1'; 
      correct2[i]='0';  
   }  
  }
  
  int correct1rate=0;
  int correct2rate=0;
  int result;
  
  for(int i=0; i<N; i++){
   if(input[i]!='0' && input[i]!='1'){
     result=0;
     break;
   }
   else if(input[i]==correct1[i]) correct1rate+=1; 
   else correct2rate+=1  ;
  }
  if(correct1>=correct2) result=correct1;
  else result=correct2;
  cout<<result;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:33: error: invalid conversion from 'char*' to 'int' [-fpermissive]
   37 |   if(correct1>=correct2) result=correct1;
      |                                 ^~~~~~~~
      |                                 |
      |                                 char*
a.cc:38:15: error: invalid conversion from 'char*' to 'int' [-fpermissive]
   38 |   else result=correct2;
      |               ^~~~~~~~
      |               |
      |               char*
Language: C++

#include <iostream>
#include <iomanip>
#include <tuple>
#include <map>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <limits>
using namespace std;
void init();
#ifdef DEBUG_BUILD
#define DBG(expr) cout << #expr << " = " << expr << endl;
#endif
#define ECHO(expr) cout << expr << endl;
#define REP(var, num) for(ll var = 0; var < num; var++)
#define REP_FROM(var, from, num) for(ll var = from; var < num; var++)
#define MAX_OF(type) numeric_limits<type>::max()
#define MIN_OF(type) numeric_limits<type>::min()
#define SORT(vec) sort(vec.begin(), vec.end())
#define REVERSE(vec) reverse(vec.begin(), vec.end())
#define T_FIRST(tuple) (std::get<0>(tuple))
#define T_SECOND(tuple) (std::get<1>(tuple))
#define T_THIRD(tuple) (std::get<2>(tuple))
typedef signed long long ll;
typedef unsigned long long ull;

void solve() {
    string s;
    cin >> s;

    ll ans = MAX_OF(ll);
    for (int b = 0; b <= 1; b++) {
        ll flips = 0;
        for (size_t i = 0; i < s.length(); i++) {
            if (i % 2 == 0 && s[i] != '0' + b) {
                flips++;
                DBG("FLIP!");
            } else if (i % 2 != 0 && s[i] != '0' + (1-b)) {
                flips++;
                DBG("FLIP!");
            }
        }

        ans = min(ans, flips);
    }

    ECHO(ans)
}

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

#ifdef INPUT_FILE
    if (!freopen(INPUT_FILE, "r", stdin)) {
        perror("freopen");
        exit(1);
    }
#endif

    solve();
    return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:40:17: error: 'DBG' was not declared in this scope
   40 |                 DBG("FLIP!");
      |                 ^~~
a.cc:43:17: error: 'DBG' was not declared in this scope
   43 |                 DBG("FLIP!");
      |                 ^~~
Language: C++

#include <iostream>
using namespace std;
int main(){
  int N;
  cin>>N;
  int *input;
  input=new char[N];
  for(int i=0; i<N; i++){
    cin>>input[i];
  }
  
  char *correct1 = new char[N];
  char *correct2 = new char[N];
  for(int i=0; i<N; i++){
   if(i%2==0){
     correct1[i]='0'; 
     correct2[i]='1';  
   }
    else{
      correct1[i]='1'; 
      correct2[i]='0';  
   }  
  }
  
  int correct1rate=0;
  int correct2rate=0;
  int result;
  
  for(int i=0; i<N; i++){
   if(input[i]!='0' && input[i]!='1'){
     result=0;
     break;
   }
   else if(input[i]==correct1[i]) correct1rate+=1; 
   else correct2rate+=1  ;
  }
  if(correct1>=correct2) result=correct1;
  else result=correct2;
  cout<<result;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: cannot convert 'char*' to 'int*' in assignment
    7 |   input=new char[N];
      |         ^~~~~~~~~~~
      |         |
      |         char*
a.cc:37:33: error: invalid conversion from 'char*' to 'int' [-fpermissive]
   37 |   if(correct1>=correct2) result=correct1;
      |                                 ^~~~~~~~
      |                                 |
      |                                 char*
a.cc:38:15: error: invalid conversion from 'char*' to 'int' [-fpermissive]
   38 |   else result=correct2;
      |               ^~~~~~~~
      |               |
      |               char*
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main() {
  string s;
  cin >> s;
  int counter = 0;
  char present, previous;
  previous = s[0];
  for (int i = 1; i < s.length(), i++) {
    present = s[i];
    if (present == previous) {
      counter++;
      if (present == '0') previous = '1';
      else previous = '0';
    }
  }
  cout << counter;
}
      

Compiler output:
a.cc: In function 'int main()':
a.cc:11:38: error: expected ';' before ')' token
   11 |   for (int i = 1; i < s.length(), i++) {
      |                                      ^
      |                                      ;
Language: C++

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


void solve(long long S){
    int sz = S.size();
    int evencnt1, evencnt2;
    int oddcnt1, oddcnt2;
    
    for(int i=0;　i<sz; i++) {
        if(i % 2 ==0) {
            // 偶数番目の文字
            if (S[i] == '1') evencnt1++;
            else             evencnt2++; 
        } else {
            // 奇数番目の文字
            if (S[i] == '1') oddcnt1++;
            else             oddcnt2++; 
        }
    }
    // 偶数番目を1にする場合
    int t1 = evencnt2 + oddcnt1;
    // 偶数番目を0にする場合
    int t2 = evencnt1 + oddcnt2;
    cout << min(t1,t2) << endl;

}

// Generated by 1.1.3 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long S;
    scanf("%lld",&S);
    solve(S);
    return 0;
}


Compiler output:
a.cc:10:17: error: extended character 　 is not valid in an identifier
   10 |     for(int i=0;　i<sz; i++) {
      |                 ^
a.cc: In function 'void solve(long long int)':
a.cc:6:16: error: request for member 'size' in 'S', which is of non-class type 'long long int'
    6 |     int sz = S.size();
      |                ^~~~
a.cc:10:17: error: '\U00003000i' was not declared in this scope
   10 |     for(int i=0;　i<sz; i++) {
      |                 ^~~
a.cc:13:18: error: invalid types 'long long int[int]' for array subscript
   13 |             if (S[i] == '1') evencnt1++;
      |                  ^
a.cc:17:18: error: invalid types 'long long int[int]' for array subscript
   17 |             if (S[i] == '1') oddcnt1++;
      |                  ^
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main() {
  string s;
  cin >> s;
  int counter = 0;
  char present, previous;
  previous = s[0];
  for (int i = 1; i < i.length(), i++) {
    present = s[i];
    if (present == previous) {
      counter++;
      if (present == '0') previous = '1';
      else previous = '0';
    }
  }
  cout << counter;
}
      

Compiler output:
a.cc: In function 'int main()':
a.cc:11:25: error: request for member 'length' in 'i', which is of non-class type 'int'
   11 |   for (int i = 1; i < i.length(), i++) {
      |                         ^~~~~~
a.cc:11:38: error: expected ';' before ')' token
   11 |   for (int i = 1; i < i.length(), i++) {
      |                                      ^
      |                                      ;
Language: C++

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


void solve(long long S){
    int sz = S.ize();
    int evencnt1, evencnt2;
    int oddcnt1, oddcnt2;
    
    for(int i=0;　i<sz; i++) {
        if(i % 2 ==0) {
            // 偶数番目の文字
            if (S[i] == '1') evencnt1++;
            else             evencnt2++; 
        } else {
            // 奇数番目の文字
            if (S[i] == '1') oddcnt1++;
            else             oddcnt2++; 
        }
    }
    // 偶数番目を1にする場合
    int t1 = evencnt2 + oddcnt1;
    // 偶数番目を0にする場合
    int t2 = evencnt1 + oddcnt2;
    cout << min(t1,t2) << endl;

}

// Generated by 1.1.3 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long S;
    scanf("%lld",&S);
    solve(S);
    return 0;
}


Compiler output:
a.cc:10:17: error: extended character 　 is not valid in an identifier
   10 |     for(int i=0;　i<sz; i++) {
      |                 ^
a.cc: In function 'void solve(long long int)':
a.cc:6:16: error: request for member 'ize' in 'S', which is of non-class type 'long long int'
    6 |     int sz = S.ize();
      |                ^~~
a.cc:10:17: error: '\U00003000i' was not declared in this scope
   10 |     for(int i=0;　i<sz; i++) {
      |                 ^~~
a.cc:13:18: error: invalid types 'long long int[int]' for array subscript
   13 |             if (S[i] == '1') evencnt1++;
      |                  ^
a.cc:17:18: error: invalid types 'long long int[int]' for array subscript
   17 |             if (S[i] == '1') oddcnt1++;
      |                  ^
Language: C++

#include <iostream>
#include <cstdio>
#include <cstdlib>

using namespace std;

int main()
{
    char S[100001];
    while(gets(S)!=NULL)
    {
        int i,l1=0,l2=0;
        char s[3]="10",a[3]="01";
        for(i=0;S[i];i++)
        {
            if(S[i]!=s[i%2])
                l1++;
        }
        for(i=0;S[i];i++)
        {
            if(S[i]!=a[i%2])
                l2++;
        }
        cout<<(l1>l2?l2:l1)<<endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:11: error: 'gets' was not declared in this scope; did you mean 'getw'?
   10 |     while(gets(S)!=NULL)
      |           ^~~~
      |           getw
Language: C++

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

int main()
{
	int ans, n;
	int cnt[2];
	string a;
	cnt[0] = 0;
	cnt[1] = 0;
	getline(cin,a);
	n = a.length();
	for (int i = 0; i < n; i++) {
		if (a[i] == '0') cnt[i%2]++;
		else cnt[(i + 1 )% 2]++;
	}
	if (cnt[0] < cnt[1]) ans = cnt[0];
	else ans = cnt[1];
	cout << ans;
}

Compiler output:
a.cc:3:10: fatal error: conio.h: No such file or directory
    3 | #include <conio.h>
      |          ^~~~~~~~~
compilation terminated.
Language: C++

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

int main(){
  vector<char> S;
  for(int i=0;i<100000; ++i){
    char a;
    cin>>a;
    S.push_back(a);
  }
  
  int A=0,B=0;
  for(int i=0; i<S.size(); ++i){
    if(i%2==0){
      if(S[i]=='0') A++;
      else B++;
    }
    else{
      if(S[i]=='1') A++;
      else B++
    }
  }
  
  cout<<min(A,B)<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:15: error: expected ';' before '}' token
   22 |       else B++
      |               ^
      |               ;
   23 |     }
      |     ~
Language: C++

#include<stdio.h>
#include<iostream>
#include<cstring>
using namespace std;
char s[100005];
int main()
{
	gets(s);
	bool b=1;
	int ans1=0,ans2=0,i;
	for(i=0;s[i];i++)
	{
		if(s[i]-48!=b)
		ans1++;
		b=!b;
	}
	b=0;
	for(i=0;s[i];i++)
	{
		if(s[i]-48!=b)
		ans2++;
		b=!b;
	}
	printf("%d",ans1>ans2?ans2:ans1);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
    8 |         gets(s);
      |         ^~~~
      |         getw
Language: C++

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

static void C_ColoringColorfully();

int main()
{

	C_ColoringColorfully();

	fflush(stdout);
	return 0;
}


static void C_ColoringColorfully()
{
	static char szS[100000] = { 0 };

	scanf(" %s", szS);
	int N = strlen(szS); 
	
	int wStart = 0;
	int bStart = 0;
	for (int i = 0; i < N; i++) {
		// 白はじまり
		if (i % 2) {
			if (szS[i] != '1') {
				wStart++;
			}
			else {
				bStart++;
			}
		}
		else {
			if (szS[i] != '0') {
				wStart++;
			}
			else {
				bStart++;
			}
		}
	}

	printf("%d\n", (wStart < bStart) ? wStart : bStart);
}


Compiler output:
a.cc: In function 'void C_ColoringColorfully()':
a.cc:23:17: error: 'strlen' was not declared in this scope
   23 |         int N = strlen(szS);
      |                 ^~~~~~
a.cc:5:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include <vector>
  +++ |+#include <cstring>
    5 |
Language: C

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

#define MAX 100001

int main()
{
  char s[MAX];
  int ans1 = 0, ans2 = 0, i;

  scanf("%s", s);

  for (i = 0; i < strlen(s); i++) {
    if (i % 2 == 0 && s[i] == '0' || i % 2 == 1 && s[i] == '1') {
      ans1++;
    }
    

Compiler output:
main.c: In function 'main':
main.c:16:5: error: expected declaration or statement at end of input
   16 |     }
      |     ^
main.c:16:5: error: expected declaration or statement at end of input
Language: C++

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

int main(){
    //入力
    string s;
    cin >> s;

    //処理
    //１だったら加算
    int gu_color_zero=0;
    int ki_color_zero=0;
    int gu_color_one=0;
    int ki_color_one=0;
    for(int i=0;i<n;i++)
    {
        if(i%2==0&&s[i]=='1')
        {
            gu_color_one++;
        }
        else if(i%2==0&&'0')
        {
            gu_color_zero++;
        }
        if(i%2==1&&s[i]=='1')
        {
            ki_color_one++;
        }
        else if(i%2==1&&s[i]=='0')
        {
            ki_color_zero++;
        }
    }
    int ans=0;
    ans+=min(gu_color_one,gu_color_zero);
    ans+=min(ki_color_one,ki_color_zero);

    cout << ans << endl;
}

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

#include <bits/stdc++.h>

using namespace std;

#define REP(i, n) for(int i = 0; i < (n); i++)
#define SORT(v, n) sort(v, v+n);
#define SSORT(v, n) sort(v, v+n, greater<int>())

int main(){
	string s,s2;
	cin >> s;
	s2=s;

	int ans1 = 0;
	int ans2 = 0;
	if(s.length != 0){
		for(int i=1; i<s.length(); i++){
			if(s[i-1] == s[i] && s[i] == 0){
				s[i] = 1;
				ans1++;
			}
			if(s[i-1] == s[i] && s[i] == 1){
				s[i] = 0;
				ans1++;
			}
		}

		if(s2[0]==0) s2[0]=1;
		else s2[0]=0; 
		for(int i=1; i<s2.length(); i++){
			if(s2[i-1] == s2[i] && s2[i] == 0){
				s2[i] = 1;
				ans2++;
			}
			if(s2[i-1] == s2[i] && s2[i] == 1){
				s2[i] = 0;
				ans2++;
			}
		}
	}

	cout << min(ans1,ans2) << endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:14: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
   16 |         if(s.length != 0){
      |            ~~^~~~~~
      |                    ()
Language: C++

#include <algorithm>
#include <cstdio>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <queue>
#include <sstream>
#include <stack>
#include <time.h>
#include <vector>
#include <complex>
#include <map>
#include <set>
#include <iomanip>
#include <math.h>
#include <stdlib.h>
#include <list>
#include <utility>
#include <memory>
#include <cstring>
#include <fstream>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <ios> 
#include <bits/stdc++.h>
using namespace std;
string s;
int main(){
	int now=0;
	cin>>s;
	int ans[2];
	for (int i=0;i<s.size();i++){
		s[i]-='0';
		if (s[i]==now) ans[0]++;
		else ans[1]++;000
		now^=1;
	}
	cout<<min(ans[0],ans[1]);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:34: error: expected ';' before 'now'
   39 |                 else ans[1]++;000
      |                                  ^
      |                                  ;
   40 |                 now^=1;
      |                 ~~~
Language: C++


#include<stdio.h>
int main(void)
{
	char s[100000];
	scanf("%s",s);
	int counta=0,countb=0;
	for (int i=0;i<100000;i++)
	{
		if(s[i]!='')
		{
			if(i%2==0&&s[i]=='1')counta++;
			if(i%2==1&&s[i]=='0')counta++;
			if(i%2==0&&s[i]=='0')countb++;
			if(i%2==1&&s[i]=='1')countb++;
		}
		else break;
	}
	if(counta>countb)printf("%d",counta);
	else printf("%d",countb);
}

Compiler output:
a.cc:10:26: error: empty character constant
   10 |                 if(s[i]!='')
      |                          ^~
Language: C++

#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define mk make_pair
#define fi first
#define se second
#define vll vector<ll>
#define pii pair<ll,ll>
#define vvll vector< vector<ll> >
#define pb push_back
#define inf 1e16
#define M 1000000007
#define all(v) (v).begin(),(v).end()
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
#define mx 1000010

int main(){
	IOS;
	string s;cin>>s;
	ll c1=0,c2=0;
	rep(i,0,s.length()){
		if(i%2==0){
			if(s[i]=='0')c1++
			else c2++;
		}
		else{
			if(s[i]=='1')c1++;
			else c2++;
		}
	}
	ll ans=min(c1,c2);
	cout<<ans;
	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:25:42: error: expected ';' before 'else'
   25 |                         if(s[i]=='0')c1++
      |                                          ^
      |                                          ;
   26 |                         else c2++;
      |                         ~~~~
Language: C++

#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back

using namespace std;
const long long MOD = (long long)1e9 + 7;

int s, len, ans, t1, t2;

int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> s;
    len = s.length();
    for (int i = 0; i < len; i++) {
        if (i%2) {
            if (s[i] == '0') t1++;
        }
        else {
            if (s[i] == '1') t1++;
        }
        if (i%2) {
            if (s[i] == '1') t2++;
        }
        else {
            if (s[i] == '0') t2++;
        }
    }
    ans = min(t1, t2);
    cout << ans << "\n";
    //system("pause");
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:13: error: request for member 'length' in 's', which is of non-class type 'int'
   16 |     len = s.length();
      |             ^~~~~~
a.cc:19:18: error: invalid types 'int[int]' for array subscript
   19 |             if (s[i] == '0') t1++;
      |                  ^
a.cc:22:18: error: invalid types 'int[int]' for array subscript
   22 |             if (s[i] == '1') t1++;
      |                  ^
a.cc:25:18: error: invalid types 'int[int]' for array subscript
   25 |             if (s[i] == '1') t2++;
      |                  ^
a.cc:28:18: error: invalid types 'int[int]' for array subscript
   28 |             if (s[i] == '0') t2++;
      |                  ^
Language: C++

        if(a < b) return a;
        else return b;}

int main(int argc, char const *argv[]) {
    string S;
    cin >> S;
    int count0 = 0;
    int count1 = 0;
    for (int i=0; i<S.length();i=i+2){
        if(S[i]=='1') count1++;
    }
    for (int i=1;i<S.length();i=i+2){
        if(S[i]=='0') count0++;
    }
    int count = count0+count1;
    cout << min2(count, S.length()-count)<<endl;

}


Compiler output:
a.cc:1:9: error: expected unqualified-id before 'if'
    1 |         if(a < b) return a;
      |         ^~
a.cc:2:9: error: expected unqualified-id before 'else'
    2 |         else return b;}
      |         ^~~~
a.cc:2:23: error: expected declaration before '}' token
    2 |         else return b;}
      |                       ^
a.cc: In function 'int main(int, const char**)':
a.cc:5:5: error: 'string' was not declared in this scope
    5 |     string S;
      |     ^~~~~~
a.cc:6:5: error: 'cin' was not declared in this scope
    6 |     cin >> S;
      |     ^~~
a.cc:6:12: error: 'S' was not declared in this scope
    6 |     cin >> S;
      |            ^
a.cc:16:5: error: 'cout' was not declared in this scope; did you mean 'count'?
   16 |     cout << min2(count, S.length()-count)<<endl;
      |     ^~~~
      |     count
a.cc:16:13: error: 'min2' was not declared in this scope
   16 |     cout << min2(count, S.length()-count)<<endl;
      |             ^~~~
a.cc:16:44: error: 'endl' was not declared in this scope
   16 |     cout << min2(count, S.length()-count)<<endl;
      |                                            ^~~~
Language: C++

#include <iostream>
#include <cstdio>

using namespace std;

const int MAXN = 1e5 + 1;
char S[MAXN];

int main() {
    cin >> S;
    int N = strlen(S);
    
    int a = 0, b = 0;
    for (int i=0; i < N; ++i) {
        if ((S[i] == '0' && i%2 == 0) || (S[i] == '1' && i%2)) {
            a++;
        }
        
        if ((S[i] == '0' && i%2) || (S[i] == '1' && i%2 == 0)) {
            b++;
        }
    }
    
    cout << min(N-a, N-b) << endl;
    
    return 0;
}


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

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

even = s[::2]
odd = s[1::2]

a = even.count(0) + odd.count(1)
b = even.count(1) + odd.count(0)

print(min(a, b))

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

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

int main(){
  char S[100001];
  for(int i=1; i<100002; ++i){
    S[i]="A";
    cin>>S[i];
    
  }
  
  int A=0,B=0;
  for(int i=1; i<100002; ++i){
    if(i%2==0){
      if(S[i]=='0') A++;
    }
    else{
      if(S[i]=='1') A++;
    }
  }
  
  for(int i=1; i<100002; ++i){
    if(i%2==0){
      if(S[i]=='1') B++;
    }
    else{
      if(S[i]=='0') B++;
    }
  }
  
  
  cout<<min(A,B)<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:10: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
    8 |     S[i]="A";
      |          ^~~
      |          |
      |          const char*
Language: C++

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

int main(){
  char S[100001];
  for(int i=1; i<100002; ++i){
    S[i]=a;
    cin>>S[i];
    
  }
  
  int A=0,B=0;
  for(int i=1; i<100002; ++i){
    if(i%2==0){
      if(S[i]=='0') A++;
    }
    else{
      if(S[i]=='1') A++;
    }
  }
  
  for(int i=1; i<100002; ++i){
    if(i%2==0){
      if(S[i]=='1') B++;
    }
    else{
      if(S[i]=='0') B++;
    }
  }
  
  
  cout<<min(A,B)<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:10: error: 'a' was not declared in this scope
    8 |     S[i]=a;
      |          ^
Language: C++

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

int main(){
  char S[100001];
  for(int i=1; i<100002; ++i) cin>>S[i];
  
  int A=0,B=0;
  for(int i=1; i<100002; ++i){
    if(i%2==0){
      if(S[i]=='0') A++;
    }
    else{
      if(S[i]=='1') A++;
    }
  }
  
  for(int i=1; i<100002; ++i){
    if(i%2==0){
      if(S[i]=='1') B++;
    }
    else{
      if(S[i]=='0') B++;
    }
  }
  
  
  cout<<max(A,B)<<endl;
}

Compiler output:
a.cc:2:9: fatal error: algotihm: No such file or directory
    2 | #include<algotihm>
      |         ^~~~~~~~~~
compilation terminated.
Language: C++

#include<iostream>
#include<string>
using namespace std;
int main(){
  string s,sc;
  int cnt=0,c_cnt=0;
  cin >> s;
  sc = s;
  if(s[0]=='1'){
    s[0]='0';
    cnt++;
  }
  for(int i=1;i<s.length();i++){
    if(s[i]==s[i-1]){
      s[i] = (s[i-1]=='0') ? '1':'0';
      cnt ++;
    }
  }
  s = sc;
  if(s[0]=='0'){
    s[0]='1';
    c_cnt++;
  }
  for(int i=1;i<s.length();i++){
    if(s[i]==s[i-1]){
      s[i] = (s[i-1]=='0') ? '1':'0';
      c_cnt ++;
    }
  }
  cnt = min(cnt,c_cnt);
  cout << cnt << endl;
}
shoo_o

Compiler output:
a.cc:33:1: error: 'shoo_o' does not name a type
   33 | shoo_o
      | ^~~~~~
Language: C++

#include <bits/stdc++.h>

using namespace std ;

const int N=1e5+100 ;

char s[N] ;
int n ;

int main ()
{
	int i , ans , res ;
	gets(s+1),n=strlen(s+1);
	ans=0 ;
	for ( i=1 ; i<=n ; i++ ) ans+=(s[i]!=((i&1)+'0'));
	res=ans,ans=0;
	for ( i=1 ; i<=n ; i++ ) ans+=(s[i]!=((~i&1)+'0'));
	res=min(res,ans);
	printf("%d\n",res);
	return 0 ;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
   13 |         gets(s+1),n=strlen(s+1);
      |         ^~~~
      |         getw
Language: C++

#include <bits/stdc++.h>
using namespace std;
const long long mod = pow(10, 9) + 7;
const long long INF = 1LL << 60;
template <class T> bool chmin(T& a, T b){if (a > b) {a = b; return true;} return false;}
template <class T> bool chmax(T& a, T b){if (a < b) {a = b; return true;} return false;}
int divCeil(int A, int B) {return (A + (B - 1)) / B;}
long long divCeil(long long A, int B) {return (A + (B - 1)) / B;}
long long divCeil(int A, long long B) {return (A + (B - 1)) / B;}
long long divCeil(long long A, long long B) {return (A + (B - 1)) / B;}

int main()
{
  string S;
  cin >> S;
  int N = S.size();
  
  string T = S.at(0);
  for (int i = 1; i < N; i++)
  {
    if (T.at(i - 1) == '0') T += '1';
    else T += '0';
  }
  
  int ans = 0;
  for (int i = 0; i < N; i++)
  {
    if (S.at(i) != T.at(i)) ans++;
  }
  
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:18: error: conversion from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
   18 |   string T = S.at(0);
      |              ~~~~^~~