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

            #include <iostream>
            using namespace std;
             
            int f(string S){
              static int ans = 0;
              /*static int two = 0;
              static string tmp = S;
         
              yarinaosi:*/
         retry:
              int tmp = ans;
              if(S.length() < 2)return ans;
              
              int tmp = 0;
              for(int i = 0;i < S.length()-tmp;i++){
                if(i != S.length()-1 && S[i] == '0' && S[i + 1] == '1'){
                  //two = 0;
                  ans +=2 ;
                  S.erase(S.begin()+i);
                  S.erase(S.begin()+i+1);
                  tmp += 2;
                  i-=2;
                }
                if(i != S.length()-1 && S[i] == '1' && S[i + 1] == '0'){
                  //two = 0;
                  ans +=2 ;
                  S.erase(S.begin()+i);
                  S.erase(S.begin()+i+1);
                  tmp += 2;
                  i-=2;
                }
              }
              /*two++;
              if(S == tmp)return ans; else goto yarinaosi;
            */
              if(ans != tmp)goto retry;
              return ans;
            }
             
             
            int main(){
              string S;
              cin>>S;    
              cout<<f(S); 
              return 0;
            }

Compiler output:
a.cc: In function 'int f(std::string)':
a.cc:14:19: error: redeclaration of 'int tmp'
   14 |               int tmp = 0;
      |                   ^~~
a.cc:11:19: note: 'int tmp' previously declared here
   11 |               int tmp = ans;
      |                   ^~~
Language: C

#include <stdio.h>

int main(){
  
  char n[];
  int c0=0;
  int c1=0;
  int less;
  int i=0;
 
  scanf("%s",n);
  
  while(n[i]!=null){
  
    if(n[i]=='1'){
      c1++;
    }
    else if(n[i]=='0'){
      c0++;
    }
  i++
  }
  
  less= (c0>=c1) ? c1 : c0;
  
  printf("%d",2*less);
  
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:5:8: error: array size missing in 'n'
    5 |   char n[];
      |        ^
main.c:13:15: error: 'null' undeclared (first use in this function)
   13 |   while(n[i]!=null){
      |               ^~~~
main.c:13:15: note: each undeclared identifier is reported only once for each function it appears in
main.c:21:6: error: expected ';' before '}' token
   21 |   i++
      |      ^
      |      ;
   22 |   }
      |   ~
Language: C++

#include <iostream>
#include <string>
#include <cmath>
using namespace std;
int main(void){
    string s;
    cin>>s;
    int c0=0,c1-0;
    for(int i=0;i<s.size();i++){
        if(s[i]=='0')c0++;
        else c1++;
    }
    if(c1==0||c0==0){
        cout<<0<<endl;
    }
    else if(c1==c0){
        cout<<c1*2<<endl;
    }else cout<<abs(c1-c0)*2<<endl;
    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:16: error: expected initializer before '-' token
    8 |     int c0=0,c1-0;
      |                ^
a.cc:11:14: error: 'c1' was not declared in this scope; did you mean 'c0'?
   11 |         else c1++;
      |              ^~
      |              c0
a.cc:13:8: error: 'c1' was not declared in this scope; did you mean 'c0'?
   13 |     if(c1==0||c0==0){
      |        ^~
      |        c0
Language: Java

import java.util.ArrayList;
import java.util.Scanner;

public class Main2 {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);

		String s = sc.nextLine();
		int n = s.length();
		ArrayList<Integer> list = new ArrayList<Integer>();
		for (int i = 0; i < s.length(); i++) {
			list.add(Integer.parseInt(s.substring(i,i+1)));
		}


		int count = 0;
		int i = 0;
		while(i < n - 2 ) {
			if (list.size() < 2) {
				break;
			}
			//System.out.println(i + "番目：" + list.get(i));
			//System.out.println(i+1 + "番目：" +list.get(i+1));
			if (list.get(i) != list.get(i + 1))  {
				//System.out.println("aaaaa");
				list.remove(i);
				list.remove(i);
				count = count + 2;
				i = 0;
			} else {
				i++;
			}
		}
		System.out.println(count);


	}

}


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

#include <iostream>
#include <string>
#include <cmaths>
using namespace std;
int main(void){
    string s;
    cin>>s;
    int c0=0,c1-0;
    for(int i=0;i<s.size();i++){
        if(s[i]=='0')c0++;
        else c1++;
    }
    if(c1==0||c0==0){
        cout<<0<<endl;
    }
    else if(c1==c0){
        cout<<c1*2<<endl;
    }else cout<<abs(c1-c0)*2<<endl;
    
}


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

import java.util.ArrayList;
import java.util.Scanner;

public class Main3 {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);

		String s = sc.nextLine();
		int n = s.length();
		ArrayList<Integer> list = new ArrayList<Integer>();
		for (int i = 0; i < s.length(); i++) {
			list.add(Integer.parseInt(s.substring(i,i+1)));
		}


		int count = 0;
		int i = 0;
		while(i < n - 2 ) {
			if (list.size() < 3) {
				break;
			}
			//System.out.println(i + "番目：" + list.get(i));
			//System.out.println(i+1 + "番目：" +list.get(i+1));
			if (list.get(i) != list.get(i + 1))  {
				//System.out.println("aaaaa");
				list.remove(i);
				list.remove(i);
				count = count + 2;
				i = 0;
			} else {
				i++;
			}
		}
		System.out.println(count);


	}

}


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

#include <iostream>
using namespace std;

int f(string S){
  static int ans = 0;
  /*static int two = 0;
  static string tmp = S;
  
  yarinaosi:*/
  
  if(S.length() < 2)return ans;
  
  int tmp = 0;
  for(int i = 0;i < S.length()-tmp;i++){
    if(i != S.length()-1 && S[i] == '0' && S[i + 1] == '1'){
      two = 0;
      ans +=2 ;
      S.erase(S.begin()+i);
      S.erase(S.begin()+i+1);
      tmp += 2;
      i-=2;
    }
    if(i != S.length()-1 && S[i] == '1' && S[i + 1] == '0'){
      two = 0;
      ans +=2 ;
      S.erase(S.begin()+i);
      S.erase(S.begin()+i+1);
      tmp += 2;
      i-=2;
    }
  }
  /*two++;
  if(S == tmp)return ans; else goto yarinaosi;
*/
  return ans;
}


int main(){
  string S;
  cin>>S;    
  cout<<f(S); 
  return 0;
}

Compiler output:
a.cc: In function 'int f(std::string)':
a.cc:16:7: error: 'two' was not declared in this scope
   16 |       two = 0;
      |       ^~~
a.cc:24:7: error: 'two' was not declared in this scope
   24 |       two = 0;
      |       ^~~
Language: C++

#include <iostream>
#include <string>
 
int main() {
	string N;
	cin >> N;
	int ans = 0;
	for (int i = 0; i < N.size();) {
		if (N[i] == '0') {
			if (N[i + 1] == '1') {
				ans += 2;
				N.erase(N.begin() + i);
				N.erase(N.begin() + i);
				i = 0;
				continue;
			}
		}
		if (N[i] == '1') {
			if (N[i + 1] == '0') {
				ans += 2;
				N.erase(N.begin() + i);
				N.erase(N.begin() + i);
				i = 0;
				continue;
			}
		}
		i++;
	}
	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:9: error: 'string' was not declared in this scope
    5 |         string N;
      |         ^~~~~~
a.cc:5:9: note: suggested alternatives:
In file included from /usr/include/c++/14/iosfwd:41,
                 from /usr/include/c++/14/ios:40,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stringfwd.h:77:33: note:   'std::string'
   77 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
In file included from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44:
/usr/include/c++/14/string:76:11: note:   'std::pmr::string'
   76 |     using string    = basic_string<char>;
      |           ^~~~~~
a.cc:6:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    6 |         cin >> N;
      |         ^~~
      |         std::cin
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:6:16: error: 'N' was not declared in this scope
    6 |         cin >> N;
      |                ^
a.cc:29:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   29 |         cout << ans << endl;
      |         ^~~~
      |         std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:29:24: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   29 |         cout << ans << endl;
      |                        ^~~~
      |                        std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: Java

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String word = sc.next();
        String[] words = word.split("");
        int num0 = 0;
        int num1 = 0;

        for (int n = 0; n < words.length; n++) {
            if (words[n].equals("0")) {
                num0 = num0 + 1;
            }
            else {
                num1 = num1 + 1;
            }
        }
         if (num1 > num0) {
            System.out.println(num0 * 2);
        } else if (num0 > num1) {
            System.out.println(num1 * 2);
        } else {
            System.out.println(num1 + num0);
        }
    }
}

Compiler output:
Main.java:3: error: cannot find symbol
        Scanner sc = new Scanner(System.in);
        ^
  symbol:   class Scanner
  location: class Main
Main.java:3: error: cannot find symbol
        Scanner sc = new Scanner(System.in);
                         ^
  symbol:   class Scanner
  location: class Main
2 errors
Language: C++

#include <bits/stdc++.h>
using namespace std;
char a[100001]; 
int k[100001];
int len,l;
int dfs()
{
	int j,i;
	for(i=0;i<len-1;i++)
	{
		if(a[i]!=a[i+1])
		{
			for(j=i+2;j<len;j++)
			{
				a[j-2]=a[j];
			}
			len-=2;
			return 1;
		}
	}
	return 0;
}
int main()
{
	int i,ret=1;
	gets(a);
	l=len=strlen(a);
	while(ret)
	{
		ret=dfs();
	}
	printf("%d",l-len);
	return 0;
}

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

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

int main() {
    cin.tie(0);
   	ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());

    string S;
    cin >> S;

    bool has01 = true;
    long cnt = 0;
    while(has01) {
        has01 = false;
        for (long i = 0; i < S.length()-1; i++) {
            if (S.length > 1 && S[i] != S[i+1]) {
                S.erase(S.begin() + i + 1);
                S.erase(S.begin() + i);
                cnt += 2;
                has01 = true;
                break;
            }

        }
    }
    cout << cnt << endl;

}


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

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

int main(){
  int a=0,b=0,len;
  string S;
  cin>>S;
  
  len = S.size();

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

if(S.at(i)=='0')
a++;
else //(S.at(i)=='1')
b++;
}

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

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

int main()
{
  string str;
  cin >> str;
  int i = 0;
  int ans = 0;
  while(1){
    if(str.size() == 0 || str.size() == i+1) break;
    if( str[i] != str[i+1]) {
      str.erase(i, 2);
      ans += 2;
      i -= (i==0? 1:2);
    }
    i++;
  }
  cout << ans << endl;
  return 0;
}


Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

S=str(input())
l=list(S) # ['1', '2', '3']
ilength=len(l)
bS=[1 for i in range(len(S))]
recon=True
while(recon):
  recon=False
  indeces=[]
  jump=False
  for i in range(len(l)-1):
    if(int(l[i])+int(l[i+1])==1 and not(jump)):
      indeces.append(i)
      indeces.append(i+1)
      i+=1
      recon=True
      jump=True
    else:
      jump=False
  sl=[]
  for i in range(len(l)):
    if(not(i in indeces)): sl.append(l[i])
  l=sl[:]
flength=len(l)
print(ilength-flength)

Compiler output:
a.cc:2:11: error: stray '#' in program
    2 | l=list(S) # ['1', '2', '3']
      |           ^
a.cc:1:1: error: 'S' does not name a type
    1 | S=str(input())
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S,T;
  cin >> S;
  int j,count;
  count=0;
  T=S;
  while (j!=0){
    j=0;
    for (int i=0; i<S.size(); ){
      if (S.at(i)==S.at(i+1)){
      i=i+2;
      }
    else{
      T.push_back(S.at(i));
      count=count+1;
    }
      
  }
  


}

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

#include <iostream>
#include <vector>
#include <numeric>//accumulate(v.begin(), v.end(), 0);
#include <algorithm>//sort(v.begin(),v.end());
#include <string>//
#include <cmath>
#include <iomanip> //setprecision(2)
using namespace std;
#define ll long long
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

int main() {
  string s;
  cin >> s;
  stack<char> res;
  for (auto e : s) {
    if (!res.empty() && e != res.top()) {
      res.pop();
    } else {
      res.push(e);
    }
  }
  cout << s.size() - res.size() << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:3: error: 'stack' was not declared in this scope
   15 |   stack<char> res;
      |   ^~~~~
a.cc:8:1: note: 'std::stack' is defined in header '<stack>'; this is probably fixable by adding '#include <stack>'
    7 | #include <iomanip> //setprecision(2)
  +++ |+#include <stack>
    8 | using namespace std;
a.cc:15:9: error: expected primary-expression before 'char'
   15 |   stack<char> res;
      |         ^~~~
a.cc:17:10: error: 'res' was not declared in this scope; did you mean 'rep'?
   17 |     if (!res.empty() && e != res.top()) {
      |          ^~~
      |          rep
a.cc:23:22: error: 'res' was not declared in this scope; did you mean 'rep'?
   23 |   cout << s.size() - res.size() << endl;
      |                      ^~~
      |                      rep
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S,T;
  cin >> S;
  int j,count;
  count=0;
  T=S;
  while (j!=0){
    j=0;
    for (int i=0; i<S.size(); ){
      if (S.at(i)==S.at(i+1)){
      i=i+2;
      }
    else{
      T.push_back=S.at(i);
      count=count+1;
    }
      
  }
  


}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:9: error: invalid use of member function 'void std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::push_back(_CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' (did you forget the '()' ?)
   17 |       T.push_back=S.at(i);
      |       ~~^~~~~~~~~
a.cc:25:2: error: expected '}' at end of input
   25 | }
      |  ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: Java

import java.util.*;
public class SetCalc
{
    public static void main(String args[])
    {
        Scanner sc=new Scanner(System.in);
        String s=sc.next();
        int count=0;
        int len=s.length();
        while(s.indexOf("01")>=0) {
            s = s.replaceAll("01", "");
            count +=len-s.length();
            len=s.length();
        }
        while(s.indexOf("10")>=0) {
            s = s.replaceAll("10", "");
            count +=len-s.length();
            len=s.length();
        }
        System.out.println(count);
    }
}

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

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
    //cout.precision(11);
    string S;
    cin >> S;
    vector<char> s(S.size());
    for(int i = 0; i < S.size(); i++){
        s[i] = S[i];
    }

    ll ans = 0;
    int flag = 1;
    while(flag){ 
        flag = 0;
        for(int i = 0; i < s.size()-1; i++){
            if(s[i] != s[i+1]){
                ans += 2;
                flag = 1;
                s.erase(i, 2);
                break;
            }
        }
        
    }

    cout << ans << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:24: error: no matching function for call to 'std::vector<char>::erase(int&, int)'
   26 |                 s.erase(i, 2);
      |                 ~~~~~~~^~~~~~
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1536:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(const_iterator) [with _Tp = char; _Alloc = std::allocator<char>; iterator = std::vector<char>::iterator; const_iterator = std::vector<char>::const_iterator]'
 1536 |       erase(const_iterator __position)
      |       ^~~~~
/usr/include/c++/14/bits/stl_vector.h:1536:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_vector.h:1564:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(const_iterator, const_iterator) [with _Tp = char; _Alloc = std::allocator<char>; iterator = std::vector<char>::iterator; const_iterator = std::vector<char>::const_iterator]'
 1564 |       erase(const_iterator __first, const_iterator __last)
      |       ^~~~~
/usr/include/c++/14/bits/stl_vector.h:1564:28: note:   no known conversion for argument 1 from 'int' to 'std::vector<char>::const_iterator'
 1564 |       erase(const_iterator __first, const_iterator __last)
      |             ~~~~~~~~~~~~~~~^~~~~~~
Language: C

#include <iostream>
#include <stack>

using namespace std;

int main(void){
	char s[100000];
	stack<int> box;
	cin >> s;
	int banhei=0;
	int i=0,res=0;
	while(s[i] != '\0'){
		if(banhei >= 1 && box.top() != s[i]-'0'){
			box.pop();
			res += 2;
			banhei--;
		}else{
			if(s[i] == '1'){
				box.push(1);
			}else{
				box.push(0);
			}
			banhei++;
		}
		i++;
	}
	cout << res << endl;
	return 0;
}

Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C

#include <cstdio>
#include <cstring>
#include <stack>

using namespace std;

int main(void){
	char s[100000];
	stack<int> box;
	scanf("%s",s);
	int banhei=0;
	int i=0,res=0;
	while(s[i] != '\0'){
		if(banhei >= 1 && box.top() != s[i]-'0'){
			box.pop();
			res += 2;
			banhei--;
		}else{
			if(s[i] == '1'){
				box.push(1);
			}else{
				box.push(0);
			}
			banhei++;
		}
		i++;
	}
	printf("%d\n",res);
	return 0;
}

Compiler output:
main.c:1:10: fatal error: cstdio: No such file or directory
    1 | #include <cstdio>
      |          ^~~~~~~~
compilation terminated.
Language: C++

#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstring>
#define ll long long
using namespace std;
int main()
{
   char s[100001];
   gets(s);
   int l=strlen(s);
   int ans=0;
   for(int i=0;i<l;i++)
   {
       if((s[i]=='0'&&s[i+1]=='1')||(s[i]=='1'&&s[i+1]=='0'))
        {
              ans++;
              s[i+1]=s[i-1];
        }
   }
   cout<<2*ans;

}


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

#include<iostream>
#include<string>
#include<algorythm>
using namespace std;
int main(){
  string s;
  int a,b;
  cin >> s;
  a=count(s.cbegin(),s.cend(),'1');
  b=count(s.cbegin(),s.cend(),'0');
 if(a<=b) cout << a << endl;
  else cout << b << endl;
}

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

#include <stdio.h>
#include <math.h>
int main(void){
    // Your code here!
    char S[100000];
    
    scanf("%s",S);
    
    int l=strlen(S);
    int il=l;
    
    while(1){
        int chan=0;
        
        for(int i=0;i<l-1;i++){
            if(S[i]!=S[i+1]){
                for(int j=i;j<l-1;j++){
                    S[j]=S[j+2];
                }
                chan++;
                l-=2;
                //printf("p%s\n",S);
            }
        }
        
        if(chan==0)break;
    }
    
    
    printf("%d\n",il-l);
    
}

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

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<string.h>
using namespace std;
typedef long long ll;
const int mod=1e9+7;
int cmp(int a,int b)
{
    return a>b;
}
int main()
{
    char a[10010];
    gets(a);
    ll num1=0,num2=0;
    for(int i=0;a[i]!='\0';i++)
    {
        if(a[i]=='1')
            num1++;
        if(a[i]=='0')
            num2++;
    }
    ll mi=min(num1,num2);
    printf("%lld\n",mi*2);
    return 0;
}


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

#include <iostream>
#include <string>

using namespace std;

int main(int argc, char **argv) {
    int count = 0;
    string s;

    cin >> s;

    int i = 0;
    while (true) {
        if (i > s.size() - 1 || s.empty()) {
            break;
        }

        if (s[i] == '0' && s[i + 1] == '1' || s[i] == '1' && s[i + 1] == '0') {
            s.erase(s.begin() + i + 1);
            s.erase(s.begin() + i);
            count += 2;
            i = 0;
        }
        else {
            i++;
        }
    }

    cout << count << endl;

    return 0;
}#include <iostream>
#include <string>

using namespace std;

int main(int argc, char **argv) {
    int count = 0;
    string s;

    cin >> s;

    int i = 0;
    while (true) {
        if (i > s.size() - 1 || s.empty()) {
            break;
        }

        if (s[i] == '0' && s[i + 1] == '1' || s[i] == '1' && s[i + 1] == '0') {
            s.erase(s.begin() + i + 1);
            s.erase(s.begin() + i);
            count += 2;
            i = 0;
        }
        else {
            i++;
        }
    }

    cout << count << endl;

    return 0;
}

Compiler output:
a.cc:32:2: error: stray '#' in program
   32 | }#include <iostream>
      |  ^
a.cc:32:3: error: 'include' does not name a type
   32 | }#include <iostream>
      |   ^~~~~~~
a.cc:37:5: error: redefinition of 'int main(int, char**)'
   37 | int main(int argc, char **argv) {
      |     ^~~~
a.cc:6:5: note: 'int main(int, char**)' previously defined here
    6 | int main(int argc, char **argv) {
      |     ^~~~
Language: C++

#include<iostream>
#include<string>
using namespace std;
int main(){
  String s;
  int a,b;
  cin >> s;
  a=count(s.cbegin(),s.cend(),'1');
  b=count(s.cbegin(),s.cend(),'0');
 if(a<=b) cout << a << endl;
  else cout << b << endl;
}

      
    

Compiler output:
a.cc: In function 'int main()':
a.cc:5:3: error: 'String' was not declared in this scope
    5 |   String s;
      |   ^~~~~~
a.cc:7:10: error: 's' was not declared in this scope
    7 |   cin >> s;
      |          ^
a.cc:8:5: error: 'count' was not declared in this scope
    8 |   a=count(s.cbegin(),s.cend(),'1');
      |     ^~~~~
Language: C++

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

int main() {
	string S;
	cin>>S;
	int N = S.size();
	int cnt = 0;
	rep(i,N){
		if(S[i] ==  '0')cnt++;
		else cnt--;
	}
	int ans = N-abs(cnt0);
	cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:25: error: 'cnt0' was not declared in this scope; did you mean 'cnt'?
   14 |         int ans = N-abs(cnt0);
      |                         ^~~~
      |                         cnt
Language: C++

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

int main(){
  int ans;
  int A=0;
  int B=0;
  string s;
  cin >> s;
  for(int i=0; i<s.size(); ++i){
    if(s.at[i]=='0') A+=1;
    if(s.at[i]=='1') B+=1;
  }
  ans=min(A,B)*2;
  cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:12: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   14 |     if(s.at[i]=='0') A+=1;
      |            ^
a.cc:15:12: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   15 |     if(s.at[i]=='1') B+=1;
      |            ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

int solve(std::vector<char>& ss) {
  if (ss.size() <= 1) {
    return 0;
  }
  int ret = 0;
  int firstRemoved = 0;
  int lastRemoved = ss.size();
  do {
    int const begin = std::max(0, firstRemoved - 1);
    int const end = std::min(int(ss.size()), lastRemoved + 1);
    firstRemoved = -1;
    lastRemoved = 10000000;
    for (int i = begin; i + 1 < std::min(int(ss.size()), end);) {
      if (ss[i] != ss[i + 1]) {
        ss.erase(ss.begin() + i, ss.begin() + i + 2);
        if (firstRemoved < 0) {
          firstRemoved = i;
        }
        lastRemoved = i;
        ret += 2;
      } else {
        ++i;
      }
    }
  } while (firstRemoved >= 0 && ss.size() > 1);
  return ret;
}

int main() {
  std::cin.tie(nullptr);
  std::ios::sync_with_stdio(false);
  std::string s;
  std::cin >> s;
  std::vector<char> ss;
  for (auto ch : s) {
    ss.push_back(static_cast<std::__1::vector<char, class std::__1::allocator<char> >::value_type>(ch == '1'));
  }
  std::cout << solve(ss) << std::endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:40:35: error: '__1' in namespace 'std' does not name a type
   40 |     ss.push_back(static_cast<std::__1::vector<char, class std::__1::allocator<char> >::value_type>(ch == '1'));
      |                                   ^~~
a.cc:40:38: error: expected '>' before '::' token
   40 |     ss.push_back(static_cast<std::__1::vector<char, class std::__1::allocator<char> >::value_type>(ch == '1'));
      |                                      ^~
a.cc:40:38: error: expected '(' before '::' token
   40 |     ss.push_back(static_cast<std::__1::vector<char, class std::__1::allocator<char> >::value_type>(ch == '1'));
      |                                      ^~
      |                                      (
a.cc:40:64: error: '__1' in namespace 'std' does not name a type
   40 |     ss.push_back(static_cast<std::__1::vector<char, class std::__1::allocator<char> >::value_type>(ch == '1'));
      |                                                                ^~~
a.cc:40:85: error: template argument 2 is invalid
   40 |     ss.push_back(static_cast<std::__1::vector<char, class std::__1::allocator<char> >::value_type>(ch == '1'));
      |                                                                                     ^
Language: C++

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

int main(){
  int ans;
  int A=0;
  int B=0;
  string s;
  cin >> s;
  for(int i=0; i<s.size(); ++i){
    if(s.at[i]=='0') A+=1;
    if(s.at[i]=='1') B+=1;
  }
  ans=min(A,B)*2;
  cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:12: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   12 |     if(s.at[i]=='0') A+=1;
      |            ^
a.cc:13:12: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   13 |     if(s.at[i]=='1') B+=1;
      |            ^
Language: C++

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

int main(){
  int ans;
  int A=0;
  int B=0;
  string s;
  cin >> s;
  for(int i=0; i<s.size(); ++i){
    if(s.at[i]==0) A+=1;
    if(s.at[i]==1) B+=1;
  }
  ans=min(A,B)*2;
  cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:12: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   12 |     if(s.at[i]==0) A+=1;
      |            ^
a.cc:13:12: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   13 |     if(s.at[i]==1) B+=1;
      |            ^
Language: C++

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

int main(){
  int ans;
  int A=0;
  int B=0;
  vector<int> s(100000);
  for(int i=1; i<=100000; ++i){
    cin >> s.at[i];
    s.at[i]=s.at[i]-'0';
  }
  for(int i=1; i<=100000; ++i){
    if(s.at[i]==0) A+=1;
    if(s.at[i]==1) B+=1;
  }
  ans=min(A,B)*2;
  cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:16: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   11 |     cin >> s.at[i];
      |                ^
a.cc:12:9: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   12 |     s.at[i]=s.at[i]-'0';
      |         ^
a.cc:12:17: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   12 |     s.at[i]=s.at[i]-'0';
      |                 ^
a.cc:15:12: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   15 |     if(s.at[i]==0) A+=1;
      |            ^
a.cc:16:12: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   16 |     if(s.at[i]==1) B+=1;
      |            ^
Language: Java

import java.util.*;

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

		LinkedList<Character> list = new LinkedList<Character>();
		for(char cc:c){
			list.add(cc);
		}

		int cnt=0;
		boolean end=false;

		while(!end){
			for (int i=0; i<(list.size()-1); i++) {
				if(list.get(i) != list.get(i+1)){
					list.remove(i);
					list.remove(i);
					cnt += 2;
					break;
				}
				if(i == list.size()-2) end = true;
			}
		}
		System.out.println(cnt);
		return;
	}
}

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

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

int main(){
  int ans;
  int A=0;
  int B=0;
  vector<int> s;
  for(int i=1; i<=s.size(); ++i){
    cin >> s.at[i];
    s.at[i]=s.at[i]-'0';
  }
  for(int i=1; i<=s.size(); ++i){
    if(s.at[i]==0) A+=1;
    if(s.at[i]==1) B+=1;
  }
  ans=min(A,B)*2;
  cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:16: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   11 |     cin >> s.at[i];
      |                ^
a.cc:12:9: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   12 |     s.at[i]=s.at[i]-'0';
      |         ^
a.cc:12:17: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   12 |     s.at[i]=s.at[i]-'0';
      |                 ^
a.cc:15:12: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   15 |     if(s.at[i]==0) A+=1;
      |            ^
a.cc:16:12: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   16 |     if(s.at[i]==1) B+=1;
      |            ^
Language: C++

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


int main(){
    string = S;
    stack<int> st;
    cin >> S;
    
    for(int i=0;i<S.length();i++){
        if(st.empty()){
            st.push(S[i]);
            continue;
        }else if(st.top() != S[i] - '0'){
            st.pop();
        }else{
            st.push(S[i] - '0');
        }
    }
    cout << S.length() - st.size() << endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:12: error: expected unqualified-id before '=' token
    9 |     string = S;
      |            ^
a.cc:11:12: error: 'S' was not declared in this scope
   11 |     cin >> S;
      |            ^
Language: C++


int solve() {
    string s;
    cin >> s;
    ll a, b;

    for(string::iterator it = s.begin(); it != s.end(); ++it) {
        if (*it == '1') {
            ++a;
        } else {
            ++b;
        }
    }
    int m = min(a, b) * 2;
    return m;
}

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

    cout << solve();
    return 0;
}

Compiler output:
a.cc: In function 'int solve()':
a.cc:3:5: error: 'string' was not declared in this scope
    3 |     string s;
      |     ^~~~~~
a.cc:4:5: error: 'cin' was not declared in this scope
    4 |     cin >> s;
      |     ^~~
a.cc:4:12: error: 's' was not declared in this scope
    4 |     cin >> s;
      |            ^
a.cc:5:5: error: 'll' was not declared in this scope
    5 |     ll a, b;
      |     ^~
a.cc:7:9: error: 'string' is not a class, namespace, or enumeration
    7 |     for(string::iterator it = s.begin(); it != s.end(); ++it) {
      |         ^~~~~~
a.cc:7:42: error: 'it' was not declared in this scope; did you mean 'int'?
    7 |     for(string::iterator it = s.begin(); it != s.end(); ++it) {
      |                                          ^~
      |                                          int
a.cc:9:15: error: 'a' was not declared in this scope
    9 |             ++a;
      |               ^
a.cc:11:15: error: 'b' was not declared in this scope
   11 |             ++b;
      |               ^
a.cc:14:17: error: 'a' was not declared in this scope
   14 |     int m = min(a, b) * 2;
      |                 ^
a.cc:14:20: error: 'b' was not declared in this scope
   14 |     int m = min(a, b) * 2;
      |                    ^
a.cc:14:13: error: 'min' was not declared in this scope
   14 |     int m = min(a, b) * 2;
      |             ^~~
a.cc: In function 'int main()':
a.cc:19:5: error: 'cin' was not declared in this scope
   19 |     cin.tie(0);
      |     ^~~
a.cc:20:5: error: 'ios' has not been declared
   20 |     ios::sync_with_stdio(false);
      |     ^~~
a.cc:22:5: error: 'cout' was not declared in this scope
   22 |     cout << solve();
      |     ^~~~
Language: C++

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

int main(){
  int ans;
  int A=0;
  int B=0;
  vector<char> s;
  for(int i=1; i<=s.size(); ++i){
    cin >> s.at[i];
  }
  for(int i=1; i<=s.size(); ++i){
    if(s.at[i]==0) A+=1;
    if(s.at[i]==1) B+=1;
  }
  ans=min(A,B)*2;
  cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:16: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   11 |     cin >> s.at[i];
      |                ^
a.cc:14:12: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   14 |     if(s.at[i]==0) A+=1;
      |            ^
a.cc:15:12: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   15 |     if(s.at[i]==1) B+=1;
      |            ^
Language: C++

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

int main(){
  int ans;
  int A=0;
  int B=0;
  vector<char> s;
  for(int i=1; i<=s.size(); ++i){
    cin >> s.at[i];
    s.at[i]=s.at[i]-'0';
  }
  for(int i=1; i<=s.size(); ++i){
    if(s.at[i]==0) A+=1;
    if(s.at[i]==1) B+=1;
  }
  ans=min(A,B)*2;
  cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:16: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   11 |     cin >> s.at[i];
      |                ^
a.cc:12:9: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   12 |     s.at[i]=s.at[i]-'0';
      |         ^
a.cc:12:17: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   12 |     s.at[i]=s.at[i]-'0';
      |                 ^
a.cc:15:12: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   15 |     if(s.at[i]==0) A+=1;
      |            ^
a.cc:16:12: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   16 |     if(s.at[i]==1) B+=1;
      |            ^
Language: Java

import java.util.Scanner;
import java.util.Stack;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String S = sc.nextLine();
		int num = 0;
		Stack<Character> stack = new Stack<Character>();
		for(int i = S.length() - 1; i >=0; i--) {
			if(stack.isEmpty()) {
				stack.push(S.charAt(i));
			}else {
				char a = stack.peek();
				if(a != S.charAt(i)) {
					stack.pop();
					num += 2;
				}else {
					stack.push(S.charAt(i));
				}
			}
		}
		System.out.println(num);
    }

Compiler output:
Main.java:26: error: reached end of file while parsing
    }
     ^
1 error
Language: C++

#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
#define rep(i,s,t) for(register int i=s;i<=t;++i)
const int N=2e5+11;
int a[N],b[N],sz[N],fa[N];
int ans;
char s[N],c;
int st[N];
int cnt;
int main(){
	gets(s+1);
	int n=strlen(s+1);
	rep(i,1,n){
		if(s[i]=='1'){
			if(cnt){
				if(c=='0')
					--cnt,++ans;
				else 
					++cnt;
			}
			else
				++cnt,c=s[i];
		}
		else{
			if(cnt){
				if(c=='1')
					--cnt,++ans;
				else 
					++cnt;
			}
			else
				++cnt,c=s[i];
		}
	}
	printf("%d\n",ans+ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
   13 |         gets(s+1);
      |         ^~~~
      |         getw
a.cc:15:13: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   15 |         rep(i,1,n){
      |             ^
a.cc:5:37: note: in definition of macro 'rep'
    5 | #define rep(i,s,t) for(register int i=s;i<=t;++i)
      |                                     ^
Language: C++

#include<cstdio>
#include<cstring>
using namespace std;
#define rep(i,s,t) for(register int i=s;i<=t;++i)
const int N=2e5+11;
int a[N],b[N],sz[N],fa[N];
int ans;
char s[N],c;
int st[N];
int cnt;
int main(){
	gets(s+1);
	int n=strlen(s+1);
	rep(i,1,n){
		if(s[i]=='1'){
			if(cnt){
				if(c=='0')
					--cnt,++ans;
				else 
					++cnt;
			}
			else
				++cnt,c=s[i];
		}
		else{
			if(cnt){
				if(c=='1')
					--cnt,++ans;
				else 
					++cnt;
			}
			else
				++cnt,c=s[i];
		}
	}
	printf("%d\n",ans+ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
   12 |         gets(s+1);
      |         ^~~~
      |         getw
a.cc:14:13: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   14 |         rep(i,1,n){
      |             ^
a.cc:4:37: note: in definition of macro 'rep'
    4 | #define rep(i,s,t) for(register int i=s;i<=t;++i)
      |                                     ^
Language: C++

#include<cstdio>
#include<cstring>
#define rep(i,s,t) for(register int i=s;i<=t;++i)
const int N=2e5+11;
int a[N],b[N],sz[N],fa[N];
int ans;
char s[N],c;
int st[N];
int cnt;
int main(){
	gets(s+1);
	int n=strlen(s+1);
	rep(i,1,n){
		if(s[i]=='1'){
			if(cnt){
				if(c=='0')
					--cnt,++ans;
				else 
					++cnt;
			}
			else
				++cnt,c=s[i];
		}
		else{
			if(cnt){
				if(c=='1')
					--cnt,++ans;
				else 
					++cnt;
			}
			else
				++cnt,c=s[i];
		}
	}
	printf("%d\n",ans+ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
   11 |         gets(s+1);
      |         ^~~~
      |         getw
a.cc:13:13: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   13 |         rep(i,1,n){
      |             ^
a.cc:3:37: note: in definition of macro 'rep'
    3 | #define rep(i,s,t) for(register int i=s;i<=t;++i)
      |                                     ^
Language: C++

#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int main()
{
	char str[100005];
	gets(str);
	int a0=0,a1=0,len=strlen(str);
	for(int i=0;i<len;i++){
		if(str[i]=='0') a0++;
		else if(str[i]=='1') a1++;
	}
	int min=a0;
	if(min>a1) min=a1;
	printf("%d\n",min*2);
	return 0;
} 

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

public class Main {
    public static void main(String... args) {
        // 入力
        Scanner sc = new Scanner(System.in);
        String s = sc.next();

        int n = 0;

        while(true) {
            int size = s.length();
            s = s.replaceAll("01", "");
            if (s.length() < size) {
                n += size - s.length();
                continue;
            } else {
                s = s.replaceAll("10", "");
                if (s.length() < size) {
                    n += size- s.length();
                    continue;
                } else {
                    break;
                }
            }
        }
        System.out.println(n);
    }
}

Compiler output:
Main.java:4: error: cannot find symbol
        Scanner sc = new Scanner(System.in);
        ^
  symbol:   class Scanner
  location: class Main
Main.java:4: error: cannot find symbol
        Scanner sc = new Scanner(System.in);
                         ^
  symbol:   class Scanner
  location: class Main
2 errors
Language: Java

import java.util.Scanner;
class Main{
  public static void main(String args[]){
    Scanner scan=new Scanner(System.in);
    String str=scan.next();
    int count=0;
    int dount=0;
    for(int i=0;i<str.length;i++){
      if(str[i].equals("0")){
        count++;
      }else{
        dount++;
      }
    }
    count=Math.min(count,dount);
    System.out.println(2*count);
  }
}


Compiler output:
Main.java:8: error: cannot find symbol
    for(int i=0;i<str.length;i++){
                     ^
  symbol:   variable length
  location: variable str of type String
Main.java:9: error: array required, but String found
      if(str[i].equals("0")){
            ^
2 errors
Language: C++

#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;
#define fr(i,n) for(int i=0;i<n;i++)
#define ifr(i,n) for(int i=n-1;i>=0;i--)

//const int INF = INT_MAX / 2;



int main() {
	string S;
	cin >> S;
	int counter = 0;
	for (int i = 0; i < S.length(); i++) {
		if (S[i] == '1') counter++;
	}
	int s = S.length();
	cout << abs(s - counter) << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:9: error: 'string' was not declared in this scope
   13 |         string S;
      |         ^~~~~~
a.cc:3:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
    2 | #include <vector>
  +++ |+#include <string>
    3 | using namespace std;
a.cc:14:9: error: 'cin' was not declared in this scope
   14 |         cin >> S;
      |         ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include <vector>
  +++ |+#include <iostream>
    3 | using namespace std;
a.cc:14:16: error: 'S' was not declared in this scope
   14 |         cin >> S;
      |                ^
a.cc:20:9: error: 'cout' was not declared in this scope
   20 |         cout << abs(s - counter) << endl;
      |         ^~~~
a.cc:20:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:20:37: error: 'endl' was not declared in this scope
   20 |         cout << abs(s - counter) << endl;
      |                                     ^~~~
a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    2 | #include <vector>
  +++ |+#include <ostream>
    3 | using namespace std;
Language: C++

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

using namespace std ;

const int N=1e5+100;

char s[N];
char t[N];
int top ;
int n ;
int res;

int main ()
{
	int i ;
	gets(s+1),n=strlen(s+1);
	for ( i=1 ; i<=n ; i++ ) 
		if ( top>0 && t[top]!=s[i] ) top--,res+=2;
		else t[++top]=s[i];
	printf("%d\n",res);
	return 0 ;
}

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

#include<bits/stdc++.h>         //可以处理负权边
using namespace std;
const int INF =  0x3f3f3f;
#define rep(i,n) for( i = 0; i < n; i++)
#define rep2(i,n) for(i = n-1; i >= 0; i--)
#define rep3(i,n,m) for(i = m; i < n; i++)
#define CloseIo   ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define PB(x) push_back(x)
#define MP(x,y) make_pair(x,y)
typedef long long ll;
const int N = 100000+50;
typedef pair<int, int> P;
typedef vector<P> vctp;
int arry[N] = {0};
int main(){
    char a[N];
    gets(a);
    int n = strlen(a);
    int sum = 0;
    stack<char> st;
    st.push(a[0]);
    for(int i = 1; i < n;i++){
      if(st.empty()){
        st.push(a[i]);
      }else if(a[i] == st.top()){
        st.push(a[i]);
      }else{
          st.pop();
          sum++;
          // cout<<sum<<endl;
      }
    }
    cout<<sum*2<<endl;
}


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

// c
const solve = (inputs) => {
  const input = inputs.split("\n");
  const arr = input[0].split('');
  const c1 = arr.reduce((a,b) => a + (b == '0' ? 1 : 0),0);
  const c2 = arr.reduce((a,b) => a + (b == '1' ? 1 : 0),0);
  console.log('%d',Math.min(c1,c2) * 2);
}

solve(require("fs").readFileSync("/dev/stdin", "utf8"));


Compiler output:
a.cc:4:30: error: empty character constant
    4 |   const arr = input[0].split('');
      |                              ^~
a.cc:7:15: warning: multi-character character constant [-Wmultichar]
    7 |   console.log('%d',Math.min(c1,c2) * 2);
      |               ^~~~
a.cc:2:7: error: 'solve' does not name a type
    2 | const solve = (inputs) => {
      |       ^~~~~
a.cc:10:6: error: expected constructor, destructor, or type conversion before '(' token
   10 | solve(require("fs").readFileSync("/dev/stdin", "utf8"));
      |      ^
Language: Java

import java.util.Scanner;

public class Unification {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String S = sc.nextLine();
		int z = 0;
		int x = 0;
		for(int i = 0; i< S.length();i++) {
			if(S.charAt(i)=='0') z++;
			else if(S.charAt(i)=='1') x++;
		}
		System.out.println(Math.min(z, x)*2);

	}

}


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