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

#include <iostream>
#include <string>
using namespace std;
 
int main(int argc, char const *argv[]) {
  string S;
  cin >> S;
  int ans = 0;
 
  int length = S.length();
  if (length == 1) {
    cout << 0 << "\n";
  }
 
  for (int i = 0; i < length - 1; i++) {
    if (S[i] == S[i + 1]) {
      ans++;
      S[i + 1] = S[i + 1] == '0' ? '1' : '0';
    }
  }
 
  cout << ans << "\n";
  return 0;
}
#include <iostream>
#include <string>
using namespace std;

int main(int argc, char const *argv[]) {
  string S;
  cin >> S;
  int ans = 0;

  int length = S.length();
  if (length == 1) {
    cout << 0 << "\n";
    return 0;
  }

  for (int i = 0; i < length - 1; i++) {
    if (S[i] == S[i + 1]) {
      ans++;
      S[i + 1] = S[i + 1] == '0' ? '1' : '0';
    }
  }

  cout << ans << "\n";
  return 0;
}
提出情報

Compiler output:
a.cc:29:5: error: redefinition of 'int main(int, const char**)'
   29 | int main(int argc, char const *argv[]) {
      |     ^~~~
a.cc:5:5: note: 'int main(int, const char**)' previously defined here
    5 | int main(int argc, char const *argv[]) {
      |     ^~~~
a.cc:50:1: error: '\U000063d0\U000051fa\U000060c5\U00005831' does not name a type
   50 | 提出情報
      | ^~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define fi first
#define se second
#define co(a) cout<<a<<endl
#define sz size()
#define bgn begin()
#define en end()
#define pb(a) push_back(a)
#define pp() pop_back()
#define V vector
#define P pair
#define V2(a,b,c) V<V<int>> a(b,V<int>(c))
#define V2a(a,b,c,d) V<V<int>> a(b,V<int>(c,d))
#define incin(a) int a; cin>>a
#define yuko(a) setprecision(a)
#define uni(a) a.erase(unique(a.begin(),a.end()),a.end())

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



Compiler output:
a.cc: In function 'int main()':
a.cc:29:19: error: expected ';' before ')' token
   29 |   for(int i=0; i<c){
      |                   ^
      |                   ;
a.cc:39:19: error: expected ';' before ')' token
   39 |   for(int i=0; i<c){
      |                   ^
      |                   ;
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define fi first
#define se second
#define co(a) cout<<a<<endl
#define sz size()
#define bgn begin()
#define en end()
#define pb(a) push_back(a)
#define pp() pop_back()
#define V vector
#define P pair
#define V2(a,b,c) V<V<int>> a(b,V<int>(c))
#define V2a(a,b,c,d) V<V<int>> a(b,V<int>(c,d))
#define incin(a) int a; cin>>a
#define yuko(a) setprecision(a)
#define uni(a) a.erase(unique(a.begin(),a.end()),a.end())

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



Compiler output:
a.cc: In function 'int main()':
a.cc:28:26: error: expected ';' before ')' token
   28 |   for(int i=0; i<s.size()){
      |                          ^
      |                          ;
a.cc:38:26: error: expected ';' before ')' token
   38 |   for(int i=0; i<s.size()){
      |                          ^
      |                          ;
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i < (int)(n); i++)
#define INF 1e9
#define all(v) v.begin(), v.end()
typedef long long ll;

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

  string s0, s1;
  rep(i, s.size()/2){
    s0 += '0';
    s0 += '1';
  }
  if(s.size()%2 == 1) s0 += '0';
  rep(i, s.size()/2){
    s1 += '1';
    s1 += '0';
  }
  if(s.size()%2 == 1) s1 += '1';

  int c0, c1;
  rep(i, s.size()){
    if(s.[i] != s0.[i]){
      c0++;
    }
    if(s.[i] != s1.[i]){
      c1++;
    }
  }

  cout << min(c0, c1) << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:10: error: expected unqualified-id before '[' token
   28 |     if(s.[i] != s0.[i]){
      |          ^
a.cc:28:20: error: expected unqualified-id before '[' token
   28 |     if(s.[i] != s0.[i]){
      |                    ^
a.cc:31:10: error: expected unqualified-id before '[' token
   31 |     if(s.[i] != s1.[i]){
      |          ^
a.cc:31:20: error: expected unqualified-id before '[' token
   31 |     if(s.[i] != s1.[i]){
      |                    ^
Language: C++

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

int main() {
    string s;cin>>s;
    int n=s.size();
    int c=0;
    for (int i=0;i<n;i++) {
        if (i%2==0&&s[i]=='1'||i%2==1&&s[i]=='0')
            c++;
    cout<<min(c,n-c)<<endl;
    return 0;
}

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

#include<bits/stdc++.h>
using namespace std;
int main()
{
	char c[200000];
	gets(c);
	int s=0;
	for(int i=0;i<strlen(c);i++)
	{
		if(c[i]==c[i+1])
		{
		c[i+1]='1'-c[i+1]+'0';
		s++;
		}
	}
	printf("%d",s);
}


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

#include<bits/stdc++.h>
using namespace std;
int main(){
  char s[1000000];
  cin >> s;
  int x=0;y=0;
  for(int i=0;i<strlen(s);i++){
	if(i%2==0){
	  if(s[i]='0'){
		x++;
      }
    }
	if(i%2==1){
	  if(s[i]='1'){
		x++;
      }
    }
  }
  for(int i=0;i<strlen(s);i++){
	if(i%2==0){
	  if(s[i]='1'){
		y++;
      }
    }
	if(i%2==1){
	  if(s[i]='0'){
		y++;
      }
    }
  }
  if(y<x){
	x=y;
  }
  cout << x;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:11: error: 'y' was not declared in this scope
    6 |   int x=0;y=0;
      |           ^
Language: C++

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

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

int binary(int bina) {
    int ans = 0;
    for (int i = 0; bina > 0; i++)
    {
        ans = ans + (bina % 2) * pow(10, i);
        bina = bina / 2;
    }
    return ans;
}

int main() {
    string S;
    cin >> S;
    if (S == "0") {
        cout << 0 << endl;
        exit(0);
    }
    int length = S.length();
    string versus = "";
    // 比較対象作成
    for (int i = 0; i < length / 2; i++) {
        versus = versus + "10";
    }
    int versusBi = stoi(versus, 0, 2);

    int v = stoi(S, 0, 2);
    int aaa = v ^ versusBi;

    string tmp = to_string(binary(aaa));
    int res = 0;
    for (int i = 0; i < tmp.length(); i++) {
        if (tmp[i] == '1') {
            ++res;
        }
    }

    if (res > length / 2) {
        res = length - res;
    }
    cout << res << endl;
}

Compiler output:
a.cc: In function 'int binary(int)':
a.cc:15:34: error: 'pow' was not declared in this scope
   15 |         ans = ans + (bina % 2) * pow(10, i);
      |                                  ^~~
Language: C++

#include<iostream>
//#include<>
using namespace std;
int main(){
	string s;
  	cin >> s;
  int count = 0;
  	for (int i = 0; i < n; i++){
    	if(i%2 == 0 && s[i]=='0' ) count += 1;
      	else if(s[i]=='1') count += 1;
    }
  if(count < n/2 +1) cout<< count <<'\n';
  else cout << n-count <<'\n';

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:29: error: 'n' was not declared in this scope
    8 |         for (int i = 0; i < n; i++){
      |                             ^
a.cc:12:14: error: 'n' was not declared in this scope
   12 |   if(count < n/2 +1) cout<< count <<'\n';
      |              ^
Language: Java

import java.util.Scanner;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   char[] c = sc.next()toCharArray();

   char[] each1 = new char[c.length];
   char[] each2 = new char[c.length];
   for(int i = 0; i<c.length;i+=2)
   {
	 each1[i] = '0';
     each2[i] = '1';  
   }
   for(int i = 1; i<c.length;i+=2)
   {
	 each1[i] = '1';
     each2[i] = '0';  
   }
   
   int ans1 =0;
   int ans2 =0;
   for(int i=0;i<c.length;i++)
   {
     if(each1[i]!=c[i]) ans1++;
     if(each2[i]!=c[i]) ans2++;
   }

   if(ans1>ans2;) System.out.println(ans2);
   else System.out.println(ans1);
 }
}

Compiler output:
Main.java:5: error: ';' expected
   char[] c = sc.next()toCharArray();
                       ^
Main.java:28: error: ')' expected
   if(ans1>ans2;) System.out.println(ans2);
               ^
Main.java:28: error: illegal start of expression
   if(ans1>ans2;) System.out.println(ans2);
                ^
Main.java:29: error: 'else' without 'if'
   else System.out.println(ans1);
   ^
4 errors
Language: C++

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

int main() {
  string S;
  cin >> S;
  int count_1 = 0;
  //even = 0, odd = 1
  for (int i = 0; i < S.size(); i++) {
    if ((i%2=0) && (S.at(i) != '0')) {
      count_1++;
    }
    else if ((i%2=1) && (S.at(i) != '1')) {
      count_1++;
    }
  }
  
  int count_2 = 0;
  //even = 1, odd = 0
  for (int i = 0;i < S.size(); i++) {
    if ((i%2=0) && (S.at(i) != '1')) {
      count_2++;
    }
    else if ((i%2=1) && (S.at(i) != '0')) {
      count_2++;
    }
  }
  cout << min(count_1,count_2) << endl;
  
      
      
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:11: error: lvalue required as left operand of assignment
   10 |     if ((i%2=0) && (S.at(i) != '0')) {
      |          ~^~
a.cc:13:16: error: lvalue required as left operand of assignment
   13 |     else if ((i%2=1) && (S.at(i) != '1')) {
      |               ~^~
a.cc:21:11: error: lvalue required as left operand of assignment
   21 |     if ((i%2=0) && (S.at(i) != '1')) {
      |          ~^~
a.cc:24:16: error: lvalue required as left operand of assignment
   24 |     else if ((i%2=1) && (S.at(i) != '0')) {
      |               ~^~
Language: C++

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

typedef long long ll;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl

const int maxn = 1e6 + 5;
string s;

int go(int x) {
  int n = s.length();
  int cnt=0;
  for (int i=0; i<n; i++) {
    int d = s[i]-'0';
    if (i%2==0 && d!=x) cnt++;
    if (i%2==1 && d==x) cnt++;
  }
  return cnt;
}

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);
cin>>s;
	cout<< (min(go(0),go(1)) <<endl;

  

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:34: error: invalid operands of types 'const int' and '<unresolved overloaded function type>' to binary 'operator<<'
   27 |         cout<< (min(go(0),go(1)) <<endl;
      |                 ~~~~~~~~~~~~~~~~~^~~~~~
a.cc:27:40: error: expected ')' before ';' token
   27 |         cout<< (min(go(0),go(1)) <<endl;
      |                ~                       ^
      |                                        )
Language: C++

#include<bits/stdc++.h.
using namespace std;
signed main(){
  string a,c;
  int b=0,d=0;
  cin>>a;
  c=a;
  for(int i=1;i<a.size();i++){
    if(a[i-1]==a[i]){
      b++;
      if(a[i]=='0') a[i]='1';
      else a[i]='0';
    }
  }
  for(int i=c.size()-1;i>0;i--){
    if(c[i-1]==c[i]){
      d++;
      if(c[i]=='0') c[i]='1';
      else c[i]='0';
    }
  }
  cout<<b<<"\n";
}

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

#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_map>
#include <map>
using namespace std ;

int main(){
    string s,t;
    cin >> s;
    int n = s.size();
    int count = 0;
    int count2 = 0;
    int ans = 0;

    for(int i = 0; i < n; i++){
        if(s[i]%2 == 0){
            if(s[i] == 0){
                count = count+1;
            }else{
                if(s[i] == 1){
                count = count+1;
            }     
    }
    for(int i = 0; i < n; i++){
        if(s[i]%2 == 0){
            if(s[i] == 0){
                count2 = count2+1;
            }else{
                if(s[i] == 1){
                count2 = count2+1;
            }     
    }
    if(count < count2){
        ans = count;
    }else{
        ans = count2;
    }
    cout << ans << endl;
    return 0 ;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:46:2: error: expected '}' at end of input
   46 | }
      |  ^
a.cc:30:31: note: to match this '{'
   30 |     for(int i = 0; i < n; i++){
      |                               ^
a.cc:46:2: error: expected '}' at end of input
   46 | }
      |  ^
a.cc:22:24: note: to match this '{'
   22 |         if(s[i]%2 == 0){
      |                        ^
a.cc:46:2: error: expected '}' at end of input
   46 | }
      |  ^
a.cc:21:31: note: to match this '{'
   21 |     for(int i = 0; i < n; i++){
      |                               ^
a.cc:46:2: error: expected '}' at end of input
   46 | }
      |  ^
a.cc:13:11: note: to match this '{'
   13 | int main(){
      |           ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main
{
    string S;
    cin >> S;
    vector<char> S1(S.size());
    vector<char> S2(S.size());    
    for(int i=0; i<S.size(); i++){
        if(i%2==0){
            S1.at(i)=0;
            S2.at(i)=1;
        }
        else{
            S1.at(i)=1;
            S2.at(i)=0;
        }
    }
    int countS1=0;
    int countS2=0;
    for(int i=0; i<S.size(); i++){
        if(S.at(i)!=S1.at(i)){
            countS1++;
        }
        if(S.at(i)!=S2.at(i)){
            countS2++;
        }
    }
    count << min(countS1,countS2) << endl;
}

Compiler output:
a.cc:3:5: error: cannot declare '::main' to be a global variable
    3 | int main
      |     ^~~~
a.cc:5:12: error: expected primary-expression before 'S'
    5 |     string S;
      |            ^
a.cc:5:12: error: expected '}' before 'S'
a.cc:4:1: note: to match this '{'
    4 | {
      | ^
a.cc:6:5: error: 'cin' does not name a type
    6 |     cin >> S;
      |     ^~~
a.cc:7:21: error: 'S' was not declared in this scope; did you mean 'S1'?
    7 |     vector<char> S1(S.size());
      |                     ^
      |                     S1
a.cc:8:21: error: 'S' was not declared in this scope; did you mean 'S2'?
    8 |     vector<char> S2(S.size());
      |                     ^
      |                     S2
a.cc:9:5: error: expected unqualified-id before 'for'
    9 |     for(int i=0; i<S.size(); i++){
      |     ^~~
a.cc:9:18: error: 'i' does not name a type
    9 |     for(int i=0; i<S.size(); i++){
      |                  ^
a.cc:9:30: error: 'i' does not name a type
    9 |     for(int i=0; i<S.size(); i++){
      |                              ^
a.cc:21:5: error: expected unqualified-id before 'for'
   21 |     for(int i=0; i<S.size(); i++){
      |     ^~~
a.cc:21:18: error: 'i' does not name a type
   21 |     for(int i=0; i<S.size(); i++){
      |                  ^
a.cc:21:30: error: 'i' does not name a type
   21 |     for(int i=0; i<S.size(); i++){
      |                              ^
a.cc:29:5: error: 'count' does not name a type
   29 |     count << min(countS1,countS2) << endl;
      |     ^~~~~
a.cc:30:1: error: expected declaration before '}' token
   30 | }
      | ^
Language: C++

s = input()
n = len(s)
ans = n
for j in range(2):
    cnt = 0
    for i in range(n):
        if((i%2==j and s[i]=="0") or (i%2!=j and s[i]=="1")):
            cnt += 1
    ans = min(ans,cnt)
print(ans)
        

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

#include<iostream>
#include<string>
using namespace std;
int main(){
	string s;
	cin >> s;
	int i;
	int n = s.length();
	int cnt[2] = {};
	for(i=0;i<n;i++){
		if(s[i] == "0") cnt[i%2]++;
		else cnt[(i+1)%2]++;
	}
	if(cnt[0]>cnt[1]) cout << cnt[1];
	else cout << cnt[0];
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:11:25: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   11 |                 if(s[i] == "0") cnt[i%2]++;
Language: C++

#include<iostream>
#include<string>
using namespace std;
int main(){
	string s;
	cin >> s;
	int i;
	int n = s.length();
	int cnt[2] = {};
	for(i=0;i<n;i++){
		if(s[i] == '0') cnt[i%2]++;
		else cnt[(i+1)%2]++;
	}
	if(cnt[0]>cnt[1]) cout <<　cnt[1];
	else cout << cnt[0];
} 

Compiler output:
a.cc:14:34: error: extended character 　 is not valid in an identifier
   14 |         if(cnt[0]>cnt[1]) cout <<　cnt[1];
      |                                  ^
a.cc: In function 'int main()':
a.cc:14:34: error: '\U00003000cnt' was not declared in this scope
   14 |         if(cnt[0]>cnt[1]) cout <<　cnt[1];
      |                                  ^~~~~
Language: C++

#include<iostream>
#include<string>
using namespace std;
int main(){
	string s;
	cin >> s;
	int n = (int)s.length();
	int i;
	int cnt[2] = {};
	for(i=0;i<n;i++){
		if((int)s[i] == i%2) cnt[0]++;
		else cnt[1] ++;
	}
	if(cnt[1] > cnt[0] cout << cnt[0];
	else cout << cnt[1];
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:27: error: expected ';' before 'cout'
   14 |         if(cnt[1] > cnt[0] cout << cnt[0];
      |                           ^~~~~
      |                           ;
a.cc:15:9: error: expected primary-expression before 'else'
   15 |         else cout << cnt[1];
      |         ^~~~
a.cc:14:43: error: expected ')' before 'else'
   14 |         if(cnt[1] > cnt[0] cout << cnt[0];
      |           ~                               ^
      |                                           )
   15 |         else cout << cnt[1];
      |         ~~~~
Language: C++

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


Compiler output:
a.cc: In function 'int main()':
a.cc:17:11: error: expected ';' before '}' token
   17 |        b++
      |           ^
      |           ;
   18 |   }
      |   ~
Language: C++

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

int main()
{
	char S[100000];
	cin >> S;
	int count = 0;
	for (int i = 0; i < strlen(S); i++) {
		
		if (S[0] == '1') {
			if (i % 2 != 0 && S[i] == '1') {
				S[i] = '0';
				count++;
			}
			if (i % 2 == 0 && S[i] == '0') {
				S[i] = '1';
				count++;
			}
		}
		else {

			if (i % 2 != 0 && S[i] == '0') {
				S[i] = '1';
				count++;
			}
			if (i % 2 == 0 && S[i] == '1') {
				S[i] = '0';
				count++;
			}
		}

	}
	cout << count << endl;


	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:29: error: 'strlen' was not declared in this scope
   12 |         for (int i = 0; i < strlen(S); i++) {
      |                             ^~~~~~
a.cc:4:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <vector>
  +++ |+#include <cstring>
    4 | #include <string>
Language: C++

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

int main()
{
	char S[100000];
	cin >> S;
	int count = 0;
	for (int i = 0; i < strlen(S); i++) {
		
		if (S[0] == '1') {
			if (i % 2 != 0 && S[i] == '1') {
				S[i] = '0';
				count++;
			}
			if (i % 2 == 0 && S[i] == '0') {
				S[i] = '1';
				count++;
			}
		}
		else {

			if (i % 2 != 0 && S[i] == '0') {
				S[i] = '1';
				count++;
			}
			if (i % 2 == 0 && S[i] == '1') {
				S[i] = '0';
				count++;
			}
		}

	}
	cout << count << endl;


	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:29: error: 'strlen' was not declared in this scope
   11 |         for (int i = 0; i < strlen(S); i++) {
      |                             ^~~~~~
a.cc:4:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <vector>
  +++ |+#include <cstring>
    4 | using namespace std;
Language: C++

#include "pch.h"
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int main()
{
	char S[100000];
	cin >> S;
	int count = 0;
	for (int i = 0; i < strlen(S); i++) {
		
		if (S[0] == '1') {
			if (i % 2 != 0 && S[i] == '1') {
				S[i] = '0';
				count++;
			}
			if (i % 2 == 0 && S[i] == '0') {
				S[i] = '1';
				count++;
			}
		}
		else {

			if (i % 2 != 0 && S[i] == '0') {
				S[i] = '1';
				count++;
			}
			if (i % 2 == 0 && S[i] == '1') {
				S[i] = '0';
				count++;
			}
		}

	}
	cout << count << endl;


	return 0;
}


Compiler output:
a.cc:1:10: fatal error: pch.h: No such file or directory
    1 | #include "pch.h"
      |          ^~~~~~~
compilation terminated.
Language: C++

S = input()
p1 = ["1" if i%2==0 else "0" for i in range(len(S))]
p2 = ["0" if i%2==0 else "1" for i in range(len(S))]
print(min(bin((int(S,2)^int("".join(p1),2))).count("1"),bin((int(S,2)^int("".join(p2),2))).count("1")))

Compiler output:
a.cc:1:1: error: 'S' does not name a type
    1 | S = input()
      | ^
Language: C++

s = input()
lb0 = 0
lb1 = 0
lw0 = 0
lw1 = 0
for i in range(0,len(s)-1,2):
    if s[0] == '0':
        if s[i] == '1':
            lb0 += 1
        if s[i+1] == '0':
            lb0 += 1
        if s[i] == '0':
            lb1 += 1
        if s[i+1] == '1':
            lb1 += 1
    else:
        if s[i] == '1':
            lw0 += 1
        if s[i+1] == '0':
            lw0 += 1
        if s[i] == '0':
            lw1 += 1
        if s[i+1] == '1':
            lw1 += 1
ans1 = max(lb0,lw0)
ans2 = max(lb1,lw1)
print(min(ans1,ans2))

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

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, n) for (int i = (a); i < (n); i++)
#define repb(i, n, a) for (int i = (n - 1); i >= (a); i--)
#define all(x) x.begin(), x.end()
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define pb push_back
#define mp make_pair
#define fir first
#define sec second

void change(char &pre, char &now) {
    if (now == '0') {
        pre = '1';
    } else {
        pre = '0';
    }
}

int main() {
    string S;
    cin >> S;
    int len = S.size();
    char now, pre = S[0];
    int ans1 = 0, ans2 = 0;
    rep(i, 1, len) {
        now = S[i];
        if (pre == now) {
            change(pre, now);
            ans1++;
        } else {
            pre = now;
        }
    }
    pre = S[len - 1];
    repb(i, len - 1, 0) {
        now = S[i];
        if (pre == now) {
            change(pre, now);
            ans2++;
        } else {
            pre = now;
        }
    }
    cout << min({ans1, ans2})
}

Compiler output:
a.cc: In function 'int main()':
a.cc:47:30: error: expected ';' before '}' token
   47 |     cout << min({ans1, ans2})
      |                              ^
      |                              ;
   48 | }
      | ~
Language: C++

S = input()
N = len(S)
res1 = 0
sample = "0"
tmp = "1"
for i in range(N):
    if S[i] != sample:
        res1 += 1
    sample, tmp = tmp, sample

res2 = 0
sample = "1"
tmp = "0"
for i in range(N):
    if S[i] != sample:
        res2 += 1
    sample, tmp = tmp, sample


print(min(res1, res2))

Compiler output:
a.cc:1:1: error: 'S' does not name a type
    1 | S = input()
      | ^
Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

int main(void) {
	string s;
	cin >> s;
	int ans = s.size();
	for (int i = 0; i < 2; i++) {
		int cnt = 0;
		for (int j = 0; j < s.size(); j++) {
			if (j % 2 == 0 && s[j] != (char)(i + '0')) cnt++;
			if (j % 2 == 1 && s[j] == (char)(i + '0')) cnt++; 
		}
	}
	ans = min(ans, cnt);
	cout << ans << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:24: error: 'cnt' was not declared in this scope; did you mean 'int'?
   16 |         ans = min(ans, cnt);
      |                        ^~~
      |                        int
Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

int main(void) {
	string s;
	cin >> s;
	int n = s.size();
	for (int i = 0; i < 2; i++) {
		int cnt = 0;
		for (int j = 0; j < s.size(); j++) {
			if (j % 2 == 0 && s[j] != (char)(i + '0')) cnt++;
			if (j % 2 == 1 && s[j] == (char)(i + '0')) cnt++; 
		}
	}
	ans = min(ans, cnt);
	cout << ans << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   16 |         ans = min(ans, cnt);
      |         ^~~
      |         abs
a.cc:16:24: error: 'cnt' was not declared in this scope; did you mean 'int'?
   16 |         ans = min(ans, cnt);
      |                        ^~~
      |                        int
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  string S;
  cin >> S;
  
  int ans = S.size();
  
  for (int = 0; i < 2; i++){
    
    
    int cnt = 0;
    for (int j = 0; j < S.size(); j++){
      if ( j % 2 == 0 && S[j] != (char)(i + '0') )cnt++;
      if ( j % 2 == 1 && S[j] == (char)(i + '0') )cnt++;
    }
    ans = (ans, cnt)
  }
  cout << ans << endl;
}
  
      
    
    

Compiler output:
a.cc: In function 'int main()':
a.cc:9:12: error: expected unqualified-id before '=' token
    9 |   for (int = 0; i < 2; i++){
      |            ^
a.cc:9:11: error: expected ';' before '=' token
    9 |   for (int = 0; i < 2; i++){
      |           ^~
      |           ;
a.cc:9:12: error: expected primary-expression before '=' token
    9 |   for (int = 0; i < 2; i++){
      |            ^
a.cc:9:17: error: 'i' was not declared in this scope
    9 |   for (int = 0; i < 2; i++){
      |                 ^
a.cc:9:22: error: expected ')' before ';' token
    9 |   for (int = 0; i < 2; i++){
      |       ~              ^
      |                      )
a.cc:9:24: error: 'i' was not declared in this scope
    9 |   for (int = 0; i < 2; i++){
      |                        ^
Language: C++

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

int main(){
    string s;
    int evenzero = 0, evenone = 0,oddzero=0,oddone=0;
    int ans = 0;
    int odd=0,even=0;
    cin >> s;
     for(int i = 0; i < s.size(); i++){
        if(i % 2 == 0 && s[i] == '0'){
            odd += 1;
        } else if(i % 2 == 0 && s[i] == '1'){
            even += 1;
        } else if(i % 2 == 1 && s[i] == '0'){
            even += 1;
        } else{
            odd += 1;
        }
        ans = min(odd,even);
    cout << ans << endl;
    return 0;
}

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

#include <bits/stdc++.h>
using namespace std;
int main(){
  string S;
  cin >> S;
  
  int ans = S.size();
  
  for (int = 0; i < 2; i++){
    
    
    int cnt = 0;
    for (int j = 0; j < S.size(); j++){
      
    
    

Compiler output:
a.cc: In function 'int main()':
a.cc:9:12: error: expected unqualified-id before '=' token
    9 |   for (int = 0; i < 2; i++){
      |            ^
a.cc:9:11: error: expected ';' before '=' token
    9 |   for (int = 0; i < 2; i++){
      |           ^~
      |           ;
a.cc:9:12: error: expected primary-expression before '=' token
    9 |   for (int = 0; i < 2; i++){
      |            ^
a.cc:9:17: error: 'i' was not declared in this scope
    9 |   for (int = 0; i < 2; i++){
      |                 ^
a.cc:9:22: error: expected ')' before ';' token
    9 |   for (int = 0; i < 2; i++){
      |       ~              ^
      |                      )
a.cc:9:24: error: 'i' was not declared in this scope
    9 |   for (int = 0; i < 2; i++){
      |                        ^
a.cc:13:40: error: expected '}' at end of input
   13 |     for (int j = 0; j < S.size(); j++){
      |                                        ^
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <string>
#include <unordered_map>
#include <cstdlib>
using namespace std;


int main(){
    char s[100000];
    cin.getline(s, sizeof(s));
    int result[2];
    result[0] = 0;
    result[1] = 0;
    for (int i = 0; i < strlen(s); i++){
        char tmp = (int)'0' + i % 2;
        if (tmp == s[i]){
            result[0]++;
        }
        else{
            result[1]++;
        }
    }
    cout << min(result[0], result[1]) << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:25: error: 'strlen' was not declared in this scope
   18 |     for (int i = 0; i < strlen(s); i++){
      |                         ^~~~~~
a.cc:9:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    8 | #include <cstdlib>
  +++ |+#include <cstring>
    9 | using namespace std;
Language: C++

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

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

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:34:4: error: expected '}' at end of input
   34 |   }
      |    ^
a.cc:7:33: note: to match this '{'
    7 | int main(int argc, char *argv[]){
      |                                 ^
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:26:3: error: 'retrun' was not declared in this scope
   26 |   retrun 0;
      |   ^~~~~~
Language: C

#include<stdio.h>

int main()
{
   char a[100000];
   int i=0,j,x=0,y=0;
   scanf("%s",&a[0]);
   i = sizeof(a)/sizeof(char);

   for(j=0;j<i;j=j+2)
   {
       
       if(a[j] !='1')
          x++;

       if(a[j] !='0')
          y++;
   }
   for(j=1;j<i;j=j+2))
   {
      if(a[j] !='0')
          x++;
       if(a[j] !='1')
          y++;
   }

   if(x>=y)
      printf("%d",y);
   else
      printf("%d",x);
   return 0;
}

Compiler output:
main.c: In function 'main':
main.c:19:22: error: expected statement before ')' token
   19 |    for(j=1;j<i;j=j+2))
      |                      ^
Language: C

#include<stdio.h>

int main()
{
   char a[100000];
   int i=0,j=0,x=0,y=0;
   scanf("%s",&a[0]);
   i = sizeof(a)/sizeof(char);

   for(j=0;j<i;j+2)
   {
       
       if(a[j] !='1')
          x++;

       if(a[j] !='0')
          y++;
   }
   for(j=1;j<i;j+2))
   {
      if(a[j] !='0')
          x++;
       if(a[j] !='1')
          y++;
   }

   if(x>=y)
      printf("%d",y);
   else
      printf("%d",x);
   return 0;
}

Compiler output:
main.c: In function 'main':
main.c:19:20: error: expected statement before ')' token
   19 |    for(j=1;j<i;j+2))
      |                    ^
Language: C

#include<stdio.h>

int main()
{
   char a[100000];
   int i=0,j=0,x=0,y=0;
   scanf("%s",&a[0]);
   i = sizeof(a)/sizeof(char);
   while(j<i)
   {
        if(a[j] !='0' || a[j]!='1')
        {
                scanf("%c",&a[j]);
                j--;
        }
        j++;
   }
   for(j=0;j<i;j+2)
   {
       
       if(a[j] !='1')
          x++;

       if(a[j] !='0')
          y++;
   }
   for(j=1;j<i;j+2))
   {
      if(a[j] !='0')
          x++;
       if(a[j] !='1')
          y++;
   }

   if(x>=y)
      printf("%d",y);
   else
      printf("%d",x);
   return 0;
}

Compiler output:
main.c: In function 'main':
main.c:27:20: error: expected statement before ')' token
   27 |    for(j=1;j<i;j+2))
      |                    ^
Language: C

#include<stdio.h>

int main()
{
   char a[100000];
   int i=0,j=0,x=0,y=0;
   scanf("%s",&a[0]);
   i = sizeof(a)/sizeof(char);
   while(j<i)
   {
        if(a[j] !='0' || a[j]!='1')
        {
                scanf("%c",&a[j]);
                j--;
        }
        j++;
   }
   for(j=0;j<i;j=j+2)
   {
       
       if(a[j] !='1')
          x++;

       if(a[j] !='0')
          y++;
   }
   for(j=1;j<i;j=j+2))
   {
      if(a[j] !='0')
          x++;
       if(a[j] !='1')
          y++;
   }

   if(x>=y)
      printf("%d",y);
   else
      printf("%d",x);
   return 0;
}

Compiler output:
main.c: In function 'main':
main.c:27:22: error: expected statement before ')' token
   27 |    for(j=1;j<i;j=j+2))
      |                      ^
Language: C

#include<stdio.h>

int main()
{
   char a[100000];
   int i=0,j,x=0,y=0;
   scanf("%s",&a[0]);
   while(a[i] !="/0")
   { 
       if(a[i] !='0' || a[i] !='1')
       {
            scanf("%c",&a[i]);
            i--;
       }
       i++;
   }
   for(j=0;j<i;j++)
   {
       if(j%2!=0 && a[j] !='0')
          x++;
       if(J%2==0 && a[j] !='1')
          x++;
   }
   for(j=0;j<i;j++)
   {
       if(j%2!=0 && a[j] !='1')
          y++;
       if(J%2==0 && a[j] !='0')
          y++;
   }
   if(x>=y)
      printf("%d",y);
   else
      printf("%d",x);
   return 0;
}





Compiler output:
main.c: In function 'main':
main.c:8:15: warning: comparison between pointer and integer
    8 |    while(a[i] !="/0")
      |               ^~
main.c:21:11: error: 'J' undeclared (first use in this function)
   21 |        if(J%2==0 && a[j] !='1')
      |           ^
main.c:21:11: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
int main()
{
int S[100000],n;
n=S.length;
int i,k=0;
for(i=0;i<n;i++)
{
    scanf("%d",&S[i]);
}
for(i=0;i<n-1;i++)
{
if(S[i]==S[i+1]&&S[i]==0)
{
S[i+1]=1;
k++;
}
else if(S[i]==S[i+1]&&S[i]==1)
{
S[i+1]=0;
k++;
}
}
printf("%d\n",k);
return 0;
}

Compiler output:
main.c: In function 'main':
main.c:5:4: error: request for member 'length' in something not a structure or union
    5 | n=S.length;
      |    ^
Language: C

#include<stdio.h>
int main()
{
int S[100000];
int N=S.length;
int i,k=0;
for(i=0;i<N;i++)
{
    scanf("%d",&S[i]);
}
for(i=0;i<N-1;i++)
{
if(S[i]==S[i+1]&&S[i]==0)
{
S[i+1]=1;
k++;
}
else if(S[i]==S[i+1]&&S[i]==1)
{
S[i+1]=0;
k++;
}
}
printf("%d\n",k);
return 0;
}

Compiler output:
main.c: In function 'main':
main.c:5:8: error: request for member 'length' in something not a structure or union
    5 | int N=S.length;
      |        ^
Language: C

#include<stdio.h>
#include<string.h>
int main()
{
  char ci[20];
  char *p=ci;
 scanf("%s",ci);
  int i=strlen(ci);
  int j,sum=0;
  for(j=0;j<i;j++)
{
  if(*(p+j)==*(p+j+1))
  {
     sum+=1;
     if(*(p+j)=='0')
       *(p+j+1)='1';
   else
    *(p+j+1)='0';
  }
printf("%d",sum);
}

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

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

int main()
{
int i=0;
char s[i];
scanf("%d",&i);
for(i=0,i<10001,i++)
{
if(i%2==0)
s[i]=1;
else
s[i]=0;
}
if (s[i]=0)
printf('B');
else
printf('W');
if(s[i]!==s[i+1])
{
    printf("%d\n,i")

}
for(i=0,i<10001,i++)
{
if(i%2==0)
s[i]=0;
else
s[i]=1;
}
if (s[i]=0)
printf('B');
else
printf('W');
if(s[i]!==s[i+1])
{
    printf("%d\n,i")

}


Compiler output:
main.c: In function 'main':
main.c:9:20: error: expected ';' before ')' token
    9 | for(i=0,i<10001,i++)
      |                    ^
      |                    ;
main.c:9:20: error: expected expression before ')' token
main.c:17:8: error: passing argument 1 of 'printf' makes pointer from integer without a cast [-Wint-conversion]
   17 | printf('B');
      |        ^~~
      |        |
      |        int
In file included from main.c:1:
/usr/include/stdio.h:363:43: note: expected 'const char * restrict' but argument is of type 'int'
  363 | extern int printf (const char *__restrict __format, ...);
      |                    ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
main.c:19:8: error: passing argument 1 of 'printf' makes pointer from integer without a cast [-Wint-conversion]
   19 | printf('W');
      |        ^~~
      |        |
      |        int
/usr/include/stdio.h:363:43: note: expected 'const char * restrict' but argument is of type 'int'
  363 | extern int printf (const char *__restrict __format, ...);
      |                    ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
main.c:20:10: error: expected expression before '=' token
   20 | if(s[i]!==s[i+1])
      |          ^
main.c:22:21: error: expected ';' before '}' token
   22 |     printf("%d\n,i")
      |                     ^
      |                     ;
   23 | 
   24 | }
      | ~                    
main.c:25:20: error: expected ';' before ')' token
   25 | for(i=0,i<10001,i++)
      |                    ^
      |                    ;
main.c:25:20: error: expected expression before ')' token
main.c:33:8: error: passing argument 1 of 'printf' makes pointer from integer without a cast [-Wint-conversion]
   33 | printf('B');
      |        ^~~
      |        |
      |        int
/usr/include/stdio.h:363:43: note: expected 'const char * restrict' but argument is of type 'int'
  363 | extern int printf (const char *__restrict __format, ...);
      |                    ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
main.c:35:8: error: passing argument 1 of 'printf' makes pointer from integer without a cast [-Wint-conversion]
   35 | printf('W');
      |        ^~~
      |        |
      |        int
/usr/include/stdio.h:363:43: note: expected 'const char * restrict' but argument is of type 'int'
  363 | extern int printf (const char *__restrict __format, ...);
      |                    ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
main.c:36:10: error: expected expression before '=' token
   36 | if(s[i]!==s[i+1])
      |          ^
main.c:38:21: error: expected ';' before '}' token
   38 |     printf("%d\n,i")
      |                     ^
      |                     ;
   39 | 
   40 | }
      | ~                    
main.c:40:1: error: expected declaration or statement at end of input
   40 | }
      | ^
Language: C

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

int main(){
    int x=0,y=0;
    int A,B,C;
    char a="KN",b="KT",c="NT";
    int A,B,C;
    char s[];
    scanf("%d",A);
    scanf("%d",B);
    scanf("%d",C);
    y=A+B;
    for(B=0,B<100000001,B++)
        {printf("%c\n",a);
            for(i=0,y<=B,y++){
                    printf("%c\n",b);
            y=y+1;
    }
    printf("%d\n",y);
    return
    }


Compiler output:
main.c: In function 'main':
main.c:7:12: error: initialization of 'char' from 'char *' makes integer from pointer without a cast [-Wint-conversion]
    7 |     char a="KN",b="KT",c="NT";
      |            ^~~~
main.c:7:19: error: initialization of 'char' from 'char *' makes integer from pointer without a cast [-Wint-conversion]
    7 |     char a="KN",b="KT",c="NT";
      |                   ^~~~
main.c:7:26: error: initialization of 'char' from 'char *' makes integer from pointer without a cast [-Wint-conversion]
    7 |     char a="KN",b="KT",c="NT";
      |                          ^~~~
main.c:8:9: error: redeclaration of 'A' with no linkage
    8 |     int A,B,C;
      |         ^
main.c:6:9: note: previous declaration of 'A' with type 'int'
    6 |     int A,B,C;
      |         ^
main.c:8:11: error: redeclaration of 'B' with no linkage
    8 |     int A,B,C;
      |           ^
main.c:6:11: note: previous declaration of 'B' with type 'int'
    6 |     int A,B,C;
      |           ^
main.c:8:13: error: redeclaration of 'C' with no linkage
    8 |     int A,B,C;
      |             ^
main.c:6:13: note: previous declaration of 'C' with type 'int'
    6 |     int A,B,C;
      |             ^
main.c:9:10: error: array size missing in 's'
    9 |     char s[];
      |          ^
main.c:14:28: error: expected ';' before ')' token
   14 |     for(B=0,B<100000001,B++)
      |                            ^
      |                            ;
main.c:14:28: error: expected expression before ')' token
main.c:16:17: error: 'i' undeclared (first use in this function)
   16 |             for(i=0,y<=B,y++){
      |                 ^
main.c:16:17: note: each undeclared identifier is reported only once for each function it appears in
main.c:16:29: error: expected ';' before ')' token
   16 |             for(i=0,y<=B,y++){
      |                             ^
      |                             ;
main.c:16:29: error: expected expression before ')' token
main.c:22:5: error: expected expression before '}' token
   22 |     }
      |     ^
main.c:22:5: error: expected declaration or statement at end of input
Language: C

#include <stdio.h>
int main(){
    int a,b,c,i,k,j,S;
    k=0;
    scanf("%d",&S[j]);
    for (i=0;i<=j;i++){
        a=S[i];
        b=S[i+1];
        if(a=b){
            if(a=0){
                b=0;
            }
            else{
                b=1;
            }
        k++;
        else(a!=b){
            k--;
        }
        }
    }
    printf("%d",k);
}


Compiler output:
main.c: In function 'main':
main.c:5:18: error: subscripted value is neither array nor pointer nor vector
    5 |     scanf("%d",&S[j]);
      |                  ^
main.c:7:12: error: subscripted value is neither array nor pointer nor vector
    7 |         a=S[i];
      |            ^
main.c:8:12: error: subscripted value is neither array nor pointer nor vector
    8 |         b=S[i+1];
      |            ^
main.c:17:9: error: expected '}' before 'else'
   17 |         else(a!=b){
      |         ^~~~
main.c:17:19: error: expected ';' before '{' token
   17 |         else(a!=b){
      |                   ^
      |                   ;
main.c: At top level:
main.c:22:12: error: expected declaration specifiers or '...' before string constant
   22 |     printf("%d",k);
      |            ^~~~
main.c:22:17: error: unknown type name 'k'
   22 |     printf("%d",k);
      |                 ^
main.c:23:1: error: expected identifier or '(' before '}' token
   23 | }
      | ^
Language: C

#include <stdio.h>
int main(){
    int a,b,c,i,k,j,S;
    scanf("%d",&S[j]);
    for (i=0;i<=j;i++){
        a=S[i];
        b=S[i+1];
        if(a=b){
            if(a=0){
                b=0;
            }
            else{
                b=1;
            }
        k++;
        else(a!=b){
            k--;
        }
        }
    }
    printf("%d",k);
}


Compiler output:
main.c: In function 'main':
main.c:4:18: error: subscripted value is neither array nor pointer nor vector
    4 |     scanf("%d",&S[j]);
      |                  ^
main.c:6:12: error: subscripted value is neither array nor pointer nor vector
    6 |         a=S[i];
      |            ^
main.c:7:12: error: subscripted value is neither array nor pointer nor vector
    7 |         b=S[i+1];
      |            ^
main.c:16:9: error: expected '}' before 'else'
   16 |         else(a!=b){
      |         ^~~~
main.c:16:19: error: expected ';' before '{' token
   16 |         else(a!=b){
      |                   ^
      |                   ;
main.c: At top level:
main.c:21:12: error: expected declaration specifiers or '...' before string constant
   21 |     printf("%d",k);
      |            ^~~~
main.c:21:17: error: unknown type name 'k'
   21 |     printf("%d",k);
      |                 ^
main.c:22:1: error: expected identifier or '(' before '}' token
   22 | }
      | ^
Language: C++

#include<stdio.h>
#define N 100000
int main()
{
    int count1=0,count2=0;
    char s[N];
    char *p=s;
    gets(s);
    for(;*p!='\0';p+=2)
    {
       if(*p=='0')count1++;
    }
    for(p=&s[1];*p!='\0';p+=2)
    {
        if(*p=='1')count1++;
    }
    for(;*p!='\0';p+=2)
    {
       if(*p=='1')count2++;
    }
    for(p=&s[1];*p!='\0';p+=2)
    {
       if(*p=='0')count2++;
    }
    if(count1<count2)
        printf("%d",count1);
    else
        printf("%d",count2);
    return 0;
}


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

#include <stdio.h>
int main(){
    int a,b,c,i,k,S[j];
    =j;
    scanf("%d",&S);
    for (i=0;i<=j;i++){
        a=S[i];
        b=S[i+1];
        if(a=b){
            if(a=0){
                b=0;
            }
            else{
                b=1;
            }
        k++;
        else(a!=b){
            k--;
        }
        }
    }
    printf("%d",k);
}


Compiler output:
main.c: In function 'main':
main.c:3:21: error: 'j' undeclared (first use in this function)
    3 |     int a,b,c,i,k,S[j];
      |                     ^
main.c:3:21: note: each undeclared identifier is reported only once for each function it appears in
main.c:4:5: error: expected expression before '=' token
    4 |     =j;
      |     ^
main.c:17:9: error: expected '}' before 'else'
   17 |         else(a!=b){
      |         ^~~~
main.c:17:19: error: expected ';' before '{' token
   17 |         else(a!=b){
      |                   ^
      |                   ;
main.c: At top level:
main.c:22:12: error: expected declaration specifiers or '...' before string constant
   22 |     printf("%d",k);
      |            ^~~~
main.c:22:17: error: unknown type name 'k'
   22 |     printf("%d",k);
      |                 ^
main.c:23:1: error: expected identifier or '(' before '}' token
   23 | }
      | ^
Language: C

#include<stdio.h>
int main(){
char S[];
int N,i,count=0;
for(i=0;i<N;i++){
scanf("%c ",&S[i]);
if(S[i]!=S[i+1]){
if(S[i]=='0'){
S[i+1]='1';
}
count++;
else{
S[i+1]='0';
count++;
}
}
}
printf("%d",count);
}

Compiler output:
main.c: In function 'main':
main.c:3:6: error: array size missing in 'S'
    3 | char S[];
      |      ^
main.c:12:1: error: expected '}' before 'else'
   12 | else{
      | ^~~~
main.c: At top level:
main.c:18:8: error: expected declaration specifiers or '...' before string constant
   18 | printf("%d",count);
      |        ^~~~
main.c:18:13: error: unknown type name 'count'
   18 | printf("%d",count);
      |             ^~~~~
main.c:19:1: error: expected identifier or '(' before '}' token
   19 | }
      | ^
Language: C

#include<stdio.h>
void main()
{
 char sorce[];
 int i,c;
 c=0;
 printf("S");
 gets(sorce);
 for(i=0;i<=strlen(sorce);i=i+2)
  {
      if(sorce[i]!=sorce[i+2])
      c++;
      sorce[i+2]=sorce[i];
      if(sorce[i+1]==sorce[i])
      c++;
  }
printf("%d",c);
  
}


Compiler output:
main.c: In function 'main':
main.c:4:7: error: array size missing in 'sorce'
    4 |  char sorce[];
      |       ^~~~~
main.c:8:2: error: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration]
    8 |  gets(sorce);
      |  ^~~~
      |  fgets
main.c:9:13: error: implicit declaration of function 'strlen' [-Wimplicit-function-declaration]
    9 |  for(i=0;i<=strlen(sorce);i=i+2)
      |             ^~~~~~
main.c:2:1: note: include '<string.h>' or provide a declaration of 'strlen'
    1 | #include<stdio.h>
  +++ |+#include <string.h>
    2 | void main()
main.c:9:13: warning: incompatible implicit declaration of built-in function 'strlen' [-Wbuiltin-declaration-mismatch]
    9 |  for(i=0;i<=strlen(sorce);i=i+2)
      |             ^~~~~~
main.c:9:13: note: include '<string.h>' or provide a declaration of 'strlen'