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

#include<iostream>
#include<string>
#include<math.h>
#include<vector>
using namespace std;
using ll= long long;
int main() {
	string S;
	cin >> S;
	int count=0;
	int k = 0;
	while (S[k]) {
		count++;
		k++;
	}
	
	int henka=0;
	int kai=0;
	int tmp = count;
	for (int j = 0; j < tmp; j++) {
		henka = 0;
		for (int i = 0; i < count - 1; i++) {
			if (S[i] != S[i + 1]&&S[i]!=2&&S[i+1]!=2) {
				
				for (int l = 0; i + 2 + l < count; l++) {
					S[i + l] = S[i + 2 + l];
					
				}
				S[count-1]=2;
				S[count-2]=2
				count -= 2;

				kai += 2;
				i++;
				henka = 1;
			}
		
		}



		if (henka == 0) {
			break;
		}
	}
		cout << kai;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:45: error: expected ';' before 'count'
   30 |                                 S[count-2]=2
      |                                             ^
      |                                             ;
   31 |                                 count -= 2;
      |                                 ~~~~~
Language: C++

#include<iostream>
using namespace std;

int main()
{
    string S;
    cin >> S;
    int i = count(S.begin(), S.end(), '0');
    int j = S.size() - i;
    cout << 2 * min(i, j) << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:13: error: 'count' was not declared in this scope
    8 |     int i = count(S.begin(), S.end(), '0');
      |             ^~~~~
Language: C++

#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
  cin >> s;
  int n = (int)s.length();
  int i;
  int chk[2] = {0,0};
  for(i=0;i<n;i++){
    if(s[i] == '0')chk[0]++;
    else chk[1]++;
  }
  cout << (max(chk[0],chk[1])-min(chk[0],chk[1])) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:10: error: 's' was not declared in this scope
    6 |   cin >> s;
      |          ^
Language: Java


import java.util.Scanner;

public class C_Unification {

	static class node{
		int val=-1;
		node prev;
		node next;
	}
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scn=new Scanner(System.in);
		String str=scn.next();
		int []arr=new int[str.length()];
		for(int i=0;i<str.length();i++) {
			arr[i]=str.charAt(i)-'0';
		}
		node start=new node();
		node ptr=new node();
		ptr=start;
		for(int i=str.length()-1;i>=0;i--) {
			if(start.val==-1) {
				node n1=new node();
				n1.val=arr[i];
				n1.prev=null;
				n1.next=null;
				start=n1;
				ptr=start;
			}else if(arr[i]==1) {
				//System.out.println(i);
				if(ptr.val==1) {
					//System.out.println("jj");
					node n1=new node();
					n1.val=arr[i];
					n1.prev=ptr;
					n1.next=null;
					ptr.next=n1;
					ptr=n1;
					
				}else {
					if(start!=null&&ptr!=start) {
						//System.out.println("mmmm");
						ptr=ptr.prev;
						ptr.next=null;
					}else if(ptr==start) {
						start=new node();
						ptr=start;
					}
				}
			}else {
				
				if(ptr.val==0){
					node n1=new node();
					n1.val=arr[i];
					n1.prev=ptr;
					n1.next=null;
					ptr.next=n1;
					ptr=n1;
				}else {
					if(start!=null&&ptr!=start) {
						//System.out.println("mmmm");
						ptr=ptr.prev;
						ptr.next=null;
					}else if(ptr==start) {
						start=new node();
						ptr=start;
					}
				}
					
				
			}
//			node n=start;
//			while(n!=null) {
//				System.out.print(n.val+" ");
//				n=n.next;
//			}
//			System.out.println("klklklklll"+i);
		}
		int cnt=0;
		while(start!=null) {
			if(start.val!=-1)
				cnt++;
			start=start.next;
			
		}
		System.out.println(str.length()-cnt);
	}

}


Compiler output:
Main.java:4: error: class C_Unification is public, should be declared in a file named C_Unification.java
public class C_Unification {
       ^
1 error
Language: C++

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

int main(){
  string s; cin>>s;
  int c0=0,c1=0;
  for(int i=0;<s.size();i++){
    if(s[i]=='0') c0++;
    else c1++;
  }
  if(c0<c1) cout<<c0*2;
  else cout<<c1*2;
  cout<<endl;
}

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

#include <bits/stdc++.h>
#include <algorithm>

using namespace std;


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

  

  




Compiler output:
a.cc: In function 'int main()':
a.cc:28:14: error: expected primary-expression before ',' token
   28 | cout << "0" <, endl;
      |              ^
Language: C++

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

int main(){
  int c1=0,c2=0;
  string s;
  cin >> s;
  r(i,n){
    if(s.at(i)=='0')c1++;
    else c2++;
  }
  cout << min(c1,c2)*2<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:7: error: 'n' was not declared in this scope
   10 |   r(i,n){
      |       ^
a.cc:2:33: note: in definition of macro 'r'
    2 | #define r(i,n) for(int i = 0; i<n; i++)
      |                                 ^
Language: C++

#include<algorithm>//sort(all(変数),greater<型名>())　で降順に
#include<cmath>//切り上げceil(値)
#include<deque>
#include<iomanip>//setprecision(数字)
#include<iostream>
#include<list>
#include<map>
#include<numeric> //xとyの最大公約数は__gcd(x,y),xとyの最小公倍数は(x*y)/__gcd
#include<queue>//priority_queue<型名> 変数：優先度付きキュー　最大値の探索が早い
#include<set>
#include<stack>
#include<string>
#include<vector>
#include<bits/stdc++.h>
#include<cstdio>
#include<cstdlib>
#include<tuple>
#include<utility>
#define rep0(i,n)  for(ll i=0; i<n; i++)
#define rrep0(i,n) for(ll i=n-1; 0<=i; i--)
#define rep1(i,n)  for(ll i=1; i<=n; i++)
#define rrep1(i,n) for(ll i=n; 1<=i; i--)
#define vll vector<ll>
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
using ll = long long;
using namespace std;

int main(){
  string s;  cin >> s;
  deque<char> dq;
  ll ans = 0;
  rep0(i,s.size()){
    if(dq.empty()){
      dq.puch_front(s[i]);
    }else{
      if(dq.front() != s[i]){
        ans += 2;
        dq.pop_front();
      }else{
      	dq.puch_front(s[i]);
      }
    }
  } 
}
      


Compiler output:
a.cc: In function 'int main()':
a.cc:36:10: error: 'class std::deque<char>' has no member named 'puch_front'; did you mean 'push_front'?
   36 |       dq.puch_front(s[i]);
      |          ^~~~~~~~~~
      |          push_front
a.cc:42:12: error: 'class std::deque<char>' has no member named 'puch_front'; did you mean 'push_front'?
   42 |         dq.puch_front(s[i]);
      |            ^~~~~~~~~~
      |            push_front
Language: C++

#include<algorithm>//sort(all(変数),greater<型名>())　で降順に
#include<cmath>//切り上げceil(値)
#include<deque>
#include<iomanip>//setprecision(数字)
#include<iostream>
#include<list>
#include<map>
#include<numeric> //xとyの最大公約数は__gcd(x,y),xとyの最小公倍数は(x*y)/__gcd
#include<queue>//priority_queue<型名> 変数：優先度付きキュー　最大値の探索が早い
#include<set>
#include<stack>
#include<string>
#include<vector>
#include<bits/stdc++.h>
#include<cstdio>
#include<cstdlib>
#include<tuple>
#include<utility>
#define rep0(i,n)  for(ll i=0; i<n; i++)
#define rrep0(i,n) for(ll i=n-1; 0<=i; i--)
#define rep1(i,n)  for(ll i=1; i<=n; i++)
#define rrep1(i,n) for(ll i=n; 1<=i; i--)
#define vll vector<ll>
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
using ll = long long;
using namespace std;

int main(){
  string s;  cin >> s;
  deque<char> dq;
  ll ans = 0;
  rep0(i,s.size()){
    if(dq.empty()){
      dq.puch_front(s[i]);
    }else{
      if(dq.front() != s[i]){
        ans += 2;
        st.pop_front();
      }else{
      	dq.puch_front(s[i]);
      }
    }
  } 
}
      


Compiler output:
a.cc: In function 'int main()':
a.cc:36:10: error: 'class std::deque<char>' has no member named 'puch_front'; did you mean 'push_front'?
   36 |       dq.puch_front(s[i]);
      |          ^~~~~~~~~~
      |          push_front
a.cc:40:9: error: 'st' was not declared in this scope; did you mean 's'?
   40 |         st.pop_front();
      |         ^~
      |         s
a.cc:42:12: error: 'class std::deque<char>' has no member named 'puch_front'; did you mean 'push_front'?
   42 |         dq.puch_front(s[i]);
      |            ^~~~~~~~~~
      |            push_front
Language: C++

#include<algorithm>//sort(all(変数),greater<型名>())　で降順に
#include<cmath>//切り上げceil(値)
#include<deque>
#include<iomanip>//setprecision(数字)
#include<iostream>
#include<list>
#include<map>
#include<numeric> //xとyの最大公約数は__gcd(x,y),xとyの最小公倍数は(x*y)/__gcd
#include<queue>//priority_queue<型名> 変数：優先度付きキュー　最大値の探索が早い
#include<set>
#include<stack>
#include<string>
#include<vector>
#include<bits/stdc++.h>
#include<cstdio>
#include<cstdlib>
#include<tuple>
#include<utility>
#define rep0(i,n)  for(ll i=0; i<n; i++)
#define rrep0(i,n) for(ll i=n-1; 0<=i; i--)
#define rep1(i,n)  for(ll i=1; i<=n; i++)
#define rrep1(i,n) for(ll i=n; 1<=i; i--)
#define vll vector<ll>
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
using ll = long long;
using namespace std;

int main(){
  string s;  cin >> s;
  stack<char> st;
  ll ans = 0;
  rep0(i,s.size()){
    if(st.empty()){
      st.puch_back(s[i]);
    }else{
      if(st.back() != s[i]){
        ans += 2;
        st.pop_back();
      }else{
      	st.puch_back(s[i]);
      }
    }
  } 
}
      


Compiler output:
a.cc: In function 'int main()':
a.cc:36:10: error: 'class std::stack<char>' has no member named 'puch_back'
   36 |       st.puch_back(s[i]);
      |          ^~~~~~~~~
a.cc:38:13: error: 'class std::stack<char>' has no member named 'back'
   38 |       if(st.back() != s[i]){
      |             ^~~~
a.cc:40:12: error: 'class std::stack<char>' has no member named 'pop_back'
   40 |         st.pop_back();
      |            ^~~~~~~~
a.cc:42:12: error: 'class std::stack<char>' has no member named 'puch_back'
   42 |         st.puch_back(s[i]);
      |            ^~~~~~~~~
Language: C++

#include<algorithm>//sort(all(変数),greater<型名>())　で降順に
#include<cmath>//切り上げceil(値)
#include<deque>
#include<iomanip>//setprecision(数字)
#include<iostream>
#include<list>
#include<map>
#include<numeric> //xとyの最大公約数は__gcd(x,y),xとyの最小公倍数は(x*y)/__gcd
#include<queue>//priority_queue<型名> 変数：優先度付きキュー　最大値の探索が早い
#include<set>
#include<stack>
#include<string>
#include<vector>
#include<bits/stdc++.h>
#include<cstdio>
#include<cstdlib>
#include<tuple>
#include<utility>
#define rep0(i,n)  for(ll i=0; i<n; i++)
#define rrep0(i,n) for(ll i=n-1; 0<=i; i--)
#define rep1(i,n)  for(ll i=1; i<=n; i++)
#define rrep1(i,n) for(ll i=n; 1<=i; i--)
#define vll vector<ll>
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
using ll = long long;
using namespace std;

int main(){
  string s;  cin >> s;
  stack<char> st;
  ll ans = 0;
  rep0(i,s.size()){
    if(st.empty()){
      st.puch(s[i]);
    }else{
      if(st.top() != s[i]){
        ans += 2;
        st.pop();
      }else{
      	st.puch(s[i]);
      }
    }
  } 
}
      


Compiler output:
a.cc: In function 'int main()':
a.cc:36:10: error: 'class std::stack<char>' has no member named 'puch'; did you mean 'push'?
   36 |       st.puch(s[i]);
      |          ^~~~
      |          push
a.cc:42:12: error: 'class std::stack<char>' has no member named 'puch'; did you mean 'push'?
   42 |         st.puch(s[i]);
      |            ^~~~
      |            push
Language: C++

#include<algorithm>//sort(all(変数),greater<型名>())　で降順に
#include<cmath>//切り上げceil(値)
#include<deque>
#include<iomanip>//setprecision(数字)
#include<iostream>
#include<list>
#include<map>
#include<numeric> //xとyの最大公約数は__gcd(x,y),xとyの最小公倍数は(x*y)/__gcd
#include<queue>//priority_queue<型名> 変数：優先度付きキュー　最大値の探索が早い
#include<set>
#include<stack>
#include<string>
#include<vector>
#include<bits/stdc++.h>
#include<cstdio>
#include<cstdlib>
#include<tuple>
#include<utility>
#define rep0(i,n)  for(ll i=0; i<n; i++)
#define rrep0(i,n) for(ll i=n-1; 0<=i; i--)
#define rep1(i,n)  for(ll i=1; i<=n; i++)
#define rrep1(i,n) for(ll i=n; 1<=i; i--)
#define vll vector<ll>
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
using ll = long long;
using namespace std;

int main(){
  string s;  cin >> s;
  stack<int> st;
  ll ans = 0;
  rep0(i,s.size()){
    if(st.empty()){
      st.puch(atoi(s[i].c_str()));
    }else{
      if(st.tpo() != atoi(s[i].c_str())){
        ans += 2;
        st.pop();
      }else{
      	st.puch(atoi(s[i].c_str()));
      }
    }
  } 
}
      

Compiler output:
a.cc: In function 'int main()':
a.cc:36:10: error: 'class std::stack<int>' has no member named 'puch'; did you mean 'push'?
   36 |       st.puch(atoi(s[i].c_str()));
      |          ^~~~
      |          push
a.cc:36:25: error: request for member 'c_str' in 's.std::__cxx11::basic_string<char>::operator[](((std::__cxx11::basic_string<char>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
   36 |       st.puch(atoi(s[i].c_str()));
      |                         ^~~~~
a.cc:38:13: error: 'class std::stack<int>' has no member named 'tpo'; did you mean 'top'?
   38 |       if(st.tpo() != atoi(s[i].c_str())){
      |             ^~~
      |             top
a.cc:38:32: error: request for member 'c_str' in 's.std::__cxx11::basic_string<char>::operator[](((std::__cxx11::basic_string<char>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
   38 |       if(st.tpo() != atoi(s[i].c_str())){
      |                                ^~~~~
a.cc:42:12: error: 'class std::stack<int>' has no member named 'puch'; did you mean 'push'?
   42 |         st.puch(atoi(s[i].c_str()));
      |            ^~~~
      |            push
a.cc:42:27: error: request for member 'c_str' in 's.std::__cxx11::basic_string<char>::operator[](((std::__cxx11::basic_string<char>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
   42 |         st.puch(atoi(s[i].c_str()));
      |                           ^~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n;i>0;i--)
#define rep1(i,s,n) for(int i=s;i<n;i++)
typedef long long ll;

int main(){
   string s;
   cin >> s;
   int c0=0,c1=0;
   rep(i,s.size()){
       if(a[i]=='0') c0++;
       else if(a[i]=='1') c1++;
   }
   cout << 2*min(c0,c1);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:11: error: 'a' was not declared in this scope
   13 |        if(a[i]=='0') c0++;
      |           ^
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repl(i,n) for(int64_t i=0;i<(int64_t)(n);i++)
#define MAX_N 10000000
#define ll int64_t
#define all(v) (v).begin(),(v).end()
#define P pair<int,int>
using namespace std;


int main() {
  string s; cin>>s;
  int red=0,blue=0;
  rep(i,n) {
    if(s[i]=='0') red++;
    else if(s[i]=='1') blue++;
  }
  cout<<min(red,blue)<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:9: error: 'n' was not declared in this scope
   14 |   rep(i,n) {
      |         ^
a.cc:2:38: note: in definition of macro 'rep'
    2 | #define rep(i,n) for(int i=0;i<(int)(n);i++)
      |                                      ^
Language: C++

#include<iostream>
#include<string>

using namespace std;

int main(){
    string s;
    int a, b =0;
    cin >> s;
    a = count(s.cbegin(),s.cend(),"1");
    b = count(s.cbegin(),s.cend(),"0");
    if(a>b) cout << b << endl;
    else cout << a << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:9: error: 'count' was not declared in this scope
   10 |     a = count(s.cbegin(),s.cend(),"1");
      |         ^~~~~
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef  long long ll;
int main(void){
    string S;
    cin >> S;
    ll cnt[2]={};
    rep(i,S.length()){
        cnt[S[i]%2]++;
    }
    cout << min(cnt[1],cnt[0])*2 << endl;



Compiler output:
a.cc: In function 'int main()':
a.cc:12:42: error: expected '}' at end of input
   12 |     cout << min(cnt[1],cnt[0])*2 << endl;
      |                                          ^
a.cc:5:15: note: to match this '{'
    5 | int main(void){
      |               ^
Language: C

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define FOR(n) for(int i=0;i<n;i++)
#define FORJ(n) for(int j=0;j<n;j++)
#define PRN(n) printf("%d\n",n)
#define PRF(n) printf("%lf\n",n)
#define PRL(n) printf("%lld\n",n)
#define PRS(s) printf("%s\n",s)
#define PRC(c) printf("%c",c)
#define mod 1000000007
typedef long long int ll;
int u(const void *a, const void *b){
    return *(ll*)a-*(ll*)b;
}
int d(const void *a, const void *b){
    return *(ll*)b-*(ll*)a;
}
int min(int a,int b){
  if(a>b)return b;
  return a;
}
int max(int a,int b){
  if(a>b)return a;
  return b;
}
ll gcd(ll a,ll b){
  if(!b)return a;
  return gcd(b,a%b);
}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
int kt(ll a){
  int sum=0;
  while(a){
    a/=10;
    sum++;
  }
  return sum;
}
int ks(ll a){
  int sum=0;
  while(a){
    sum+=a%10;
    a/=10;
  }
  return sum;
}
int dp[10001];
int main(void){
  char s[100001];
  scanf("%s",s);
  int a[2]={0,}0;
  FOR(strlen(s))a[s[i]-'0']++;
  PRN(min(a[0],a[1])*2);
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:53:16: error: expected ',' or ';' before numeric constant
   53 |   int a[2]={0,}0;
      |                ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  cin >> S;
  int count=0;
  for (int i=0;i<S.size();i++){
    if (S[i]=='1'){
      count++;
    }
  }
  int ans=2*min(count,S.size()-count);
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:16: error: no matching function for call to 'min(int&, std::__cxx11::basic_string<char>::size_type)'
   13 |   int ans=2*min(count,S.size()-count);
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:13:16: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'})
   13 |   int ans=2*min(count,S.size()-count);
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:13:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   13 |   int ans=2*min(count,S.size()-count);
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~
Language: C++

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

int main(){
    string S;
    cin >> S;
    int zero,one;
    zero = 0;
    one = 0;
    for(int i = 0; i< S.length();i++){
        if(S[i] == "0") zero += 1;
        else one += 1;
    }
    cout << min(one,zero) << endl;
}

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

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

int main() {
  string S;
  cin >> S;
  int red = 0;
  int blue = 0;
  for (int i = 0; i < S.length()a; i++) {
    if (S[i] == '0') red += 1;
    else blue += 1;
  }
  cout << min(red, blue) * 2 << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:33: error: expected ';' before 'a'
   10 |   for (int i = 0; i < S.length()a; i++) {
      |                                 ^
      |                                 ;
a.cc:10:33: error: 'a' was not declared in this scope
a.cc:10:34: error: expected ')' before ';' token
   10 |   for (int i = 0; i < S.length()a; i++) {
      |       ~                          ^
      |                                  )
a.cc:10:36: error: 'i' was not declared in this scope
   10 |   for (int i = 0; i < S.length()a; i++) {
      |                                    ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main() {
	string s; int a=0,b=0;cin>>s;for(int i=0 ;i<s.length();i++) a+=s[i]=='1';cout<<min(a,s.length()-a)*2;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:91: error: no matching function for call to 'min(int&, std::__cxx11::basic_string<char>::size_type)'
    4 |         string s; int a=0,b=0;cin>>s;for(int i=0 ;i<s.length();i++) a+=s[i]=='1';cout<<min(a,s.length()-a)*2;
      |                                                                                        ~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:4:91: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'})
    4 |         string s; int a=0,b=0;cin>>s;for(int i=0 ;i<s.length();i++) a+=s[i]=='1';cout<<min(a,s.length()-a)*2;
      |                                                                                        ~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:4:91: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
    4 |         string s; int a=0,b=0;cin>>s;for(int i=0 ;i<s.length();i++) a+=s[i]=='1';cout<<min(a,s.length()-a)*2;
      |                                                                                        ~~~^~~~~~~~~~~~~~~~
Language: Java

import java.util.Scanner;

class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力
		String ss = sc.next();
		
		int ans = 0;
		MyStack<Character> stack = new MyStack<Character>();
		
		for(int i = 0;i < ss.length();i++){
			if(stack.isEmpty()){
				stack.push(ss.charAt(i));
			}else{
				if(stack.peak() != ss.charAt(i)){			//01 or 10 なら削除
					ans += 2;
					stack.pop();
				}else{								//追加
					stack.push(ss.charAt(i));
				}
				
			}
		}
		System.out.println(ans);
		
	}
	
	
}



Compiler output:
Main.java:10: error: cannot find symbol
		MyStack<Character> stack = new MyStack<Character>();
		^
  symbol:   class MyStack
  location: class Main
Main.java:10: error: cannot find symbol
		MyStack<Character> stack = new MyStack<Character>();
		                               ^
  symbol:   class MyStack
  location: class Main
2 errors
Language: Java

import java.util.Scanner;

class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力
		String ss = sc.next();
		
		int ans = 0;
		Stack stack = new Stack();
		
		for(int i = 0;i < ss.length();i++){
			if(stack.isEmpty()){
				stack.push(ss.charAt(i));
			}else{
				if(stack.peak() != ss.charAt(i)){			//01 or 10 なら削除
					ans += 2;
					stack.pop();
				}else{								//追加
					stack.push(ss.charAt(i));
				}
				
			}
		}
		System.out.println(ans);
		
	}
	
	
}



Compiler output:
Main.java:10: error: cannot find symbol
		Stack stack = new Stack();
		^
  symbol:   class Stack
  location: class Main
Main.java:10: error: cannot find symbol
		Stack stack = new Stack();
		                  ^
  symbol:   class Stack
  location: class Main
2 errors
Language: C++

#include <iostream>
#include <string>
#include <cstring>

using namespace std;

int main()
{
  string s;
  cin >> s;
  int red=0, blue=0;
  red = count(s.begin(), s.end(), '0');
  blue = count(s.begin(), s.end(), '1');
 
  cout << min(red,blue)*2 << endl;

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:9: error: 'count' was not declared in this scope
   12 |   red = count(s.begin(), s.end(), '0');
      |         ^~~~~
Language: Java

import java.util.*;
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner scn = new Scanner(System.in);
    char[] S = scn.nextLine().toCharArray();
    LinkedList<Character> Slist = new LinkedList<>();
    for (Character ch : S) {
      Slist.add(ch);
    }

    int count = 0;
    for (int i = 0; i < Slist.size() - 1; i++) {
      String chunk = Slist.get(i).toString() + Slist.get(i + 1).toString();

      if (chunk.equals("10") || chunk.equals("01")) {
        count += 2;
        Slist.remove(i);
        Slist.remove(i);
        // System.out.println(Slist);
        i -= 2;

        if (i < -1) {
          i = -1;
        }
      }

    }

    System.out.println(count);
  }

}

public class Main {
  public static void main(String[] args) {
    Scanner scn = new Scanner(System.in);
    char[] S = scn.nextLine().toCharArray();

    HashMap<Character, Integer> map = new HashMap<>();
    map.put('0', 0);
    map.put('1', 0);
    for (char ch : S) {
      map.put(ch, map.get(ch) + 1);
    }

    int ans = 2 * Math.min(map.get('0'), map.get('1'));
    System.out.println(ans);

  }

}


Compiler output:
Main.java:36: error: duplicate class: Main
public class Main {
       ^
1 error
Language: C++

S = input()

#  print(S.count('0'))
#  print(S.count('1'))

print(2*min(S.count('0'), S.count('1')))


Compiler output:
a.cc:3:4: error: invalid preprocessing directive #print
    3 | #  print(S.count('0'))
      |    ^~~~~
a.cc:4:4: error: invalid preprocessing directive #print
    4 | #  print(S.count('1'))
      |    ^~~~~
a.cc:1:1: error: 'S' does not name a type
    1 | S = input()
      | ^
Language: C++

#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define double long double
using namespace std;
signed main(){
  string a;
  cin>>a;
  int b,c;
  rep(i,a.size()){
    if(a.at(i)=='0')
      c++;
  else
    b++;
    }
  cout<<min(a,b)*2;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:18:12: error: no matching function for call to 'min(std::string&, long long int&)'
   18 |   cout<<min(a,b)*2;
      |         ~~~^~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:18:12: note:   deduced conflicting types for parameter 'const _Tp' ('std::__cxx11::basic_string<char>' and 'long long int')
   18 |   cout<<min(a,b)*2;
      |         ~~~^~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:18:12: note:   'std::__cxx11::basic_string<char>' is not derived from 'std::initializer_list<_Tp>'
   18 |   cout<<min(a,b)*2;
      |         ~~~^~~~~
Language: C++

#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define double long double
using namespace std;
signed main(){
  string a;
  cin>>a;
  int b,c;
  rep(i,a.size()){
    if(a.at(i)=='0')
      a++;
  else
    b++;
    }
  cout<<min(a,b)*2;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:14:8: error: no 'operator++(int)' declared for postfix '++' [-fpermissive]
   14 |       a++;
      |       ~^~
a.cc:18:12: error: no matching function for call to 'min(std::string&, long long int&)'
   18 |   cout<<min(a,b)*2;
      |         ~~~^~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:18:12: note:   deduced conflicting types for parameter 'const _Tp' ('std::__cxx11::basic_string<char>' and 'long long int')
   18 |   cout<<min(a,b)*2;
      |         ~~~^~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:18:12: note:   'std::__cxx11::basic_string<char>' is not derived from 'std::initializer_list<_Tp>'
   18 |   cout<<min(a,b)*2;
      |         ~~~^~~~~
Language: C++

#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define double long double
using namespace std;
signed main(){
  string a;
  int b=a.size();
  cin>>a;
  rep(i,a.size()-1){
    if(a.at(i)==a.at(i+1)){
      replace(i,2,"");
      i--;
      }
    }
  cout<<b-a.size();
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:14: error: no matching function for call to 'replace(long long int&, int, const char [1])'
   14 |       replace(i,2,"");
      |       ~~~~~~~^~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:4280:5: note: candidate: 'template<class _FIter, class _Tp> void std::replace(_FIter, _FIter, const _Tp&, const _Tp&)'
 4280 |     replace(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4280:5: note:   candidate expects 4 arguments, 3 provided
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:174:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::replace(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&, const _Tp&)'
  174 | replace(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __old_value,
      | ^~~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:174:1: note:   candidate expects 5 arguments, 3 provided
Language: C

#include<stdio.h>
#include<string.h>
int main(void){
  int one=0,zero=0;
  char S[100003]={'\0'};
  scanf("%s",S);
  for(int i=0;i<string(S);i++){
    if(S[i]=='0'){
      zero++;
    }else{
      one++;
    }
  }
  if(zero>one){
    printf("%d\n",one*2);
  }else{
    printf("%d\n",zero*2);
  }
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:7:17: error: implicit declaration of function 'string'; did you mean 'stdin'? [-Wimplicit-function-declaration]
    7 |   for(int i=0;i<string(S);i++){
      |                 ^~~~~~
      |                 stdin
Language: C++

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

char s[100001];

int main()
{
	cin >> s;
	int c0 = 0, c1 = 0;
	int len = strlen(s);
	for (int i = 0; i < len; i++) {
		if (s[i] == '0')
			c0++;
		else if (s[i] == '1')
			c1++;
	}
	cout << min(c0, c1) *2<< endl;

}

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

#include <iostream>
#include <string>
using namespace std;
int main(){
	string s;
	cin>>s;
	int k=s.size();
	int x=0,y=0;
	if(k===1){
		cout<<"0";
		return 0;
	} 
	for(int i=0;i<k;i++){
		if(s[i]=='0')x++;
		else y++;
	}
	if(x>y)cout<<x*2;
	else cout<<y*2;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:15: error: expected primary-expression before '=' token
    9 |         if(k===1){
      |               ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(void){
  stirng S;
  cin >> S;
  int numz = 0;
  int numo = 0;
  for(int i=0; i<S.size(); i++){
    if(S[i] == '0') numz++;
    else numo++;
  }
  int ans = 2*min(numz, numo);
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:4:3: error: 'stirng' was not declared in this scope
    4 |   stirng S;
      |   ^~~~~~
a.cc:5:10: error: 'S' was not declared in this scope
    5 |   cin >> S;
      |          ^
Language: C++

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


Compiler output:
a.cc: In function 'int main()':
a.cc:8:8: error: no matching function for call to 'min(int&, std::__cxx11::basic_string<char>::size_type)'
    8 |   r=min(r,s.size()-r);
      |     ~~~^~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:8:8: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'})
    8 |   r=min(r,s.size()-r);
      |     ~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:8:8: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
    8 |   r=min(r,s.size()-r);
      |     ~~~^~~~~~~~~~~~~~
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:8:14: error: no matching function for call to 'min(int&, std::__cxx11::basic_string<char>::size_type)'
    8 |   cout<<2*min(r,s.size()-r)<<endl;
      |           ~~~^~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:8:14: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'})
    8 |   cout<<2*min(r,s.size()-r)<<endl;
      |           ~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:8:14: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
    8 |   cout<<2*min(r,s.size()-r)<<endl;
      |           ~~~^~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main()
{
  string s;
  cin >> s;
  int cnt1=0;
  int cnt0=0;
  for(int i=0;i<s.size();i++) {
    if(s[i] == 1) cnt1++;
    else cnt0++;
    }
  }
  cout << s.size()-abs(cnt0-cnt1) << endl;
}


Compiler output:
a.cc:14:3: error: 'cout' does not name a type
   14 |   cout << s.size()-abs(cnt0-cnt1) << endl;
      |   ^~~~
a.cc:15:1: error: expected declaration before '}' token
   15 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define all(x)    (x).begin(),(x).end()
typedef long long ll;
const int MOD = (int)1e9 + 7;

int main(){
  string s;
  cin >>s;
  int ans = 0;
  vector<char> ans;
  char buf = c[0];
  rep(i;s.size()){
    if (i == 0) continue;
    if (buf == c[i]) continue;
    else{
      ans.push_back[c[i]];
      buf = c[i];
    }
  }
  cout << ans.size() / 2 << endl;
}



Compiler output:
a.cc:14:17: error: macro "rep" requires 2 arguments, but only 1 given
   14 |   rep(i;s.size()){
      |                 ^
a.cc:3:9: note: macro "rep" defined here
    3 | #define rep(i, n) for(int i=0;i<(int)(n);i++)
      |         ^~~
a.cc: In function 'int main()':
a.cc:12:16: error: conflicting declaration 'std::vector<char> ans'
   12 |   vector<char> ans;
      |                ^~~
a.cc:11:7: note: previous declaration as 'int ans'
   11 |   int ans = 0;
      |       ^~~
a.cc:13:14: error: 'c' was not declared in this scope
   13 |   char buf = c[0];
      |              ^
a.cc:14:3: error: 'rep' was not declared in this scope
   14 |   rep(i;s.size()){
      |   ^~~
a.cc:22:15: error: request for member 'size' in 'ans', which is of non-class type 'int'
   22 |   cout << ans.size() / 2 << endl;
      |               ^~~~
Language: Java

import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Unification {

    public static void main(String[] args) {

        FastScanner fc = new FastScanner();
        String S = fc.next();

        String S2 = new String();

        //Sの'01'と'10'を消去する
        S2 = remove10Or01(S);

        System.out.println(S.length() - S2.length());
    }

    //文字列中の01,10が無くなるまで繰り返す
    public static String remove10Or01 (String S) {

        if (!(S.contains("01") || S.contains("10"))) {

            return S;
        }

        return remove10Or01(S.replace("10", "").replace("01", ""));
    }
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}

Compiler output:
Main.java:5: error: class Unification is public, should be declared in a file named Unification.java
public class Unification {
       ^
1 error
Language: C++

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

int main(){
  char N[100100];cin>>N;
  string S=N;
  int z=0,o=0,cnt=0;
  for(int i=0;i<S.length();i++){
    if(S[i]=='0'){
      z++;
    }else{
      o++;
    }
    cnt++;
  }
  cout<<S.length()-abs(z-o)<<endl;
}

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

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

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

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


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

    int red;
    int blue;
    for (int i = 0; i < S.size; ++i)
    {
        if(S[i] == 0){
            ++red;
        }else{
            ++blue;
        }
    }

    int ans = min(red, blue) * 2;

    cout << ans << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:27: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
   15 |     for (int i = 0; i < S.size; ++i)
      |                         ~~^~~~
      |                               ()
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main() {
	string st;
	cin >> st;
	int num_0 = 0;
	int num_1 = 0;
	for (int i = 0; i < st.size; ++i) {
		if (st[i] == '0') num_0++;
		if (st[i] == '1') num_1++;
	}
	cout << min(num_0, num_1)*2 << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:32: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
   10 |         for (int i = 0; i < st.size; ++i) {
      |                             ~~~^~~~
      |                                    ()