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

int main(){
	std::string S;
  	std::cin>>S;
  	int count0=0,count1=0;
  	for(int i=0;i<S.size();++i){
		if(S[i]=='0'){
        	count0++;	
        }else{
        	count1++;
        }
    }
  std::cout<<std::min(count0,count1);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:2:14: error: 'string' is not a member of 'std'
    2 |         std::string S;
      |              ^~~~~~
a.cc:1:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
  +++ |+#include <string>
    1 | int main(){
a.cc:3:14: error: 'cin' is not a member of 'std'
    3 |         std::cin>>S;
      |              ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | int main(){
a.cc:3:19: error: 'S' was not declared in this scope
    3 |         std::cin>>S;
      |                   ^
a.cc:12:8: error: 'cout' is not a member of 'std'
   12 |   std::cout<<std::min(count0,count1);
      |        ^~~~
a.cc:12:8: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:12:19: error: 'min' is not a member of 'std'
   12 |   std::cout<<std::min(count0,count1);
      |                   ^~~
Language: C++

#include <iostream>

int main(){
	std::string S;
  	std::sin>>S;
  	int count0=0,count1=0;
  	for(int i=0;i<S.size();++i){
		if(S[i]=='0'){
        	count0++;	
        }else{
        	count1++;
        }
    }
  std::cout<<std::min(count0,count1);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:14: error: 'sin' is not a member of 'std'; did you mean 'min'?
    5 |         std::sin>>S;
      |              ^~~
      |              min
Language: C++

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

int main(){

	string l;
	cin>>l;
	int a=0;int b=0;
	for(int i= 0;i<l.size();i++){
		if(l[i]=="0"){a++;}
		else{b++;}
	}
	
	cout<<max(a,b)<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:24: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   12 |                 if(l[i]=="0"){a++;}
Language: Java

import java.util.*;

public class Main
{
	public static void main(String[] args)
    {
      	Scanner in = new Scanner(System.in);
      	String s = in.next();
      	int zer = 0, one = 0, len = s.length();
      	for (int i = 0; i < len; i++)
        	if (s.charAt(i) == '0')
            	cnt++;
     	one = len-cnt;
      	System.out.println(2*(int)(Math.min(zer, one)));
      	in.close();
    }
}

Compiler output:
Main.java:12: error: cannot find symbol
            	cnt++;
            	^
  symbol:   variable cnt
  location: class Main
Main.java:13: error: cannot find symbol
     	one = len-cnt;
     	          ^
  symbol:   variable cnt
  location: class Main
2 errors
Language: Java

import java.util.*;

public class Main
{
	public static void main(String[] args)
    {
      	Scanner in = new Scanner(System.in);
      	String s = in.next();
      	int zer = 0, one = 0, len = s.length();
      	for (int i = 0; i < len; i++)
        	if (s.charAt(i) == '0')
            	cnt++;
     	one = len-cnt;
      	System.out.println(2*(int)(Math.min(zer, one)));
      	in.close();
    }

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

#include<iostream>
#include<algorithm>
#include<string>

using namespace std;
int main() {
    string S;
    cin >> S;
    int count=0;
    for (int i = 0; i < S.length(); i++)
    {
        if (S[i] == '1'){
            count++;
        }
    }
    cout << min(count, S.length() - count) * 2 << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:16: error: no matching function for call to 'min(int&, std::__cxx11::basic_string<char>::size_type)'
   16 |     cout << min(count, S.length() - count) * 2 << endl;
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:16:16: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'})
   16 |     cout << min(count, S.length() - count) * 2 << 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,
                 from a.cc:2:
/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:16:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   16 |     cout << min(count, S.length() - count) * 2 << endl;
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include<iostream>
#include<algorithm>
#include<string>

using namespace std;
int main() {
    string S;
    cin >> S;
    int count;
    for (int i = 0; i < S.length(); i++)
    {
        if (S[i] == '1'){
            count++;
        }
    }
    cout << min(count, S.length() - count) * 2 << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:16: error: no matching function for call to 'min(int&, std::__cxx11::basic_string<char>::size_type)'
   16 |     cout << min(count, S.length() - count) * 2 << endl;
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:16:16: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'})
   16 |     cout << min(count, S.length() - count) * 2 << 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,
                 from a.cc:2:
/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:16:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   16 |     cout << min(count, S.length() - count) * 2 << endl;
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include<stdio.h>
int main(){
  char moji[100000];
  int a=0,b=0;
  scanf("%s/n",moji);
  for(i=0;moji[i]='\0';i++){
    if(moji[i]='0')
    {a++;}
    if(moji[i]='1')
    {b++;}
  }
  if(a>b){
    printf("%d",b*2);
  }else{
    printf("%d",a*2);
  }
  return 0;
}

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

#include<stdio.h>
int main(){
  char moji[];
  int a=0,b=0,i;
  scanf("%s/n",moji);
  for(i=0;moji[i]='\0';i++){
    if(moji[i]='0')
    {a++;}
    if(moji[i]='1')
    {b++;}
  }
  if(a>b){
    printf("%d",b*2);
  }else{
    printf("%d",a*2);
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:8: error: storage size of 'moji' isn't known
    3 |   char moji[];
      |        ^~~~
Language: C++

#include<stdio.h>
int main(){
  char moji[];
  int a=0,b=0;
  scanf("%s/n",moji);
  for(i=0;moji[i]='\0';i++){
    if(moji[i]='0')
    {a++;}
    if(moji[i]='1')
    {b++;}
  }
  if(a>b){
    printf("%d",b*2);
  }else{
    printf("%d",a*2);
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:8: error: storage size of 'moji' isn't known
    3 |   char moji[];
      |        ^~~~
a.cc:6:7: error: 'i' was not declared in this scope
    6 |   for(i=0;moji[i]='\0';i++){
      |       ^
Language: C++

f::String->String->Int->Int
f _ [] ans=ans
f [] (x:xs) ans=f (x:[]) xs ans
f (x:xs) (y:ys) ans
      |x=='0' && y=='1'=f xs ys (ans+2)
      |x=='1' && y=='0'=f xs ys (ans+2)
      |otherwise=f (y:x:xs) ys ans

main = do
       xs<-getLine
       putStrLn $ show $ f [] xs 0

Compiler output:
a.cc:1:1: error: 'f' does not name a type
    1 | f::String->String->Int->Int
      | ^
Language: C++

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

int main(){
 std::string a;
 cin >> a;
 size_t size = str.length();
 int i = size;
 int c = 0,d = 0;
 for (int j=0;j<i;++j)
 {
   if(a[j]==0) ++c;
   else ++d;
 }
 int min = min(c,d);
 cout << min*2 << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:16: error: 'str' was not declared in this scope; did you mean 'std'?
   10 |  size_t size = str.length();
      |                ^~~
      |                std
a.cc:18:15: error: 'min' cannot be used as a function
   18 |  int min = min(c,d);
      |            ~~~^~~~~
Language: C++

import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
 
public class Main {
 
    public static void main(String[] args) {
        q_3();
    }
 
    private static void q_1() {
        try (Scanner scan = new Scanner(System.in)) {
            int a = scan.nextInt();
            int b = scan.nextInt();
            int c = scan.nextInt();
 
            System.out.println(b / a < c ? b / a : c);
        }
    }
 
    private static void q_2() {
        try(Scanner scan = new Scanner(System.in)) {
            int a = scan.nextInt();
            int b = scan.nextInt();
            int c = scan.nextInt();
 
            int min = Math.min(a, b);
 
            int cnt = 0;
            for (; min >= 1; min--) {
                if (a % min == 0 && b % min == 0) {
                    cnt ++;
                    if(cnt == c) {
                        break;
                    }
                }
            }
 
            System.out.println(min);
        }
    }
 
    private static void q_3() {
        try(Scanner scan = new Scanner(System.in)) {
 
            String target = scan.next();

            int cnt = 0;
            while(true) {
                    if(target.indexOf("01") == -1 && target.indexOf("10") == -1) {
                            break;
                    }
                    String tmp = target;

                    target = target.replace("01", "");

                    cnt += tmp.length() - target.length();

                    tmp = target;

                    target = target.replace("10", "");

                    cnt += tmp.length() - target.length();
            }

            System.out.println(cnt);

        }
    }
}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.Scanner;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
    2 | import java.util.regex.Matcher;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: 'import' does not name a type
    3 | import java.util.regex.Pattern;
      | ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:5:1: error: expected unqualified-id before 'public'
    5 | public class Main {
      | ^~~~~~
Language: C++

import java.util.Scanner;

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

                String target = sc.next();

                int cnt = 0;
                while(true) {
                        if(target.indexOf("01") == -1 && target.indexOf("10") == -1) {
                                break;
                        }
                        String tmp = target;

                        target = target.replace("01", "");

                        cnt += tmp.length() - target.length();

                        tmp = target;

                        target = target.replace("10", "");

                        cnt += tmp.length() - target.length();
                }

                System.out.println(cnt);
        }
}


Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.Scanner;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: expected unqualified-id before 'public'
    3 | public class Main {
      | ^~~~~~
Language: C++

import java.util.*;

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

                String target = sc.next();

                int cnt = 0;
                while(true) {
                        if(target.indexOf("01") == -1 && target.indexOf("10") == -1) {
                                break;
                        }
                        String tmp = target;

                        target = target.replace("01", "");

                        cnt += tmp.length() - target.length();

                        tmp = target;

                        target = target.replace("10", "");

                        cnt += tmp.length() - target.length();
                }

                System.out.println(cnt);
        }
}


Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.*;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: expected unqualified-id before 'public'
    3 | public class Main {
      | ^~~~~~
Language: C++

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

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

  vector<int> cnt(2, 0);  //長さ2の配列に答えを入れる。0初期化

  for (int i = 0; i < S.size(); i++){
  if (S[i] == '0') cnt[0]++;
  else cnt[1]++;
  }
  int ans = min(cnt[0], cnt[]1) * 2;

  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:29: error: expected primary-expression before ']' token
   18 |   int ans = min(cnt[0], cnt[]1) * 2;
      |                             ^
Language: C++

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

int main() {
    string s;
    cin >> s;
    int c0, c1;
    c0 = count(s.cbegin(), s.cend(), '0');
    c1 = count(s.cbegin(), s.cend(), '1');
    cout << s.length()-abs(c0-c1) << endl;
    return 0;
}

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

#include <iostream>
using namespace std;

int main() {
    string s;
    cin >> s;
    int c0, c1;
    c0 = count(s.cbegin(), s.cend(), '0');
    c1 = count(s.cbegin(), s.cend(), '1');
    cout << s.length()-abs(c0-c1) << endl;
    return 0;
}

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

#include<bits/stdc++.h>
using namespace std;
char s[100005];
stack<int> stk;
int main(){
	gets(s);
	
	int len = strlen(s), res = 0;
	for(int i = 0 ; i < len ; i++){
		if(!stk.empty() && stk.top() + s[i] == '1'){
			stk.pop();
			res++;
		}
		else
			stk.push(s[i] - '0');			
	}
	printf("%d\n", res * 2);
	
	return 0;
}

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

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

int main(int argc, char const *argv[])
{
	int r = 0,b = 0;
	char str[100000];
	scanf("%s",str);
	for (int i = 0; i < strlen(str); ++i)
	{
		if(str[i] == '0')	++r;
		else ++b;
	}
	printf("%d\n", a < b ? 2 * a : 2 * b);
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:17:24: error: 'a' undeclared (first use in this function)
   17 |         printf("%d\n", a < b ? 2 * a : 2 * b);
      |                        ^
main.c:17:24: note: each undeclared identifier is reported only once for each function it appears in
Language: Java

import java.util.*;

public class Main{
  public static void main(String[] args){
  Sccaner sc = new Scanner();
  String s = sc.next();
  
  int cnt0 = 0;
  int cnt1 = 0;
  
  for(int i=0; i<s.length(); i++){
    if( s.charAt(i) == '0')
      ++cnt0;
    else
      ++cnt1;
  }
  System.out.println(Math.min(cnt0, cnt1));
  }
}

Compiler output:
Main.java:5: error: cannot find symbol
  Sccaner sc = new Scanner();
  ^
  symbol:   class Sccaner
  location: class Main
Main.java:5: error: no suitable constructor found for Scanner(no arguments)
  Sccaner sc = new Scanner();
               ^
    constructor Scanner.Scanner(Readable,Pattern) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(Readable) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(InputStream) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(InputStream,String) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(InputStream,Charset) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(File) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(File,String) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(File,Charset) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(File,CharsetDecoder) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(Path) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(Path,String) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(Path,Charset) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(String) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(ReadableByteChannel) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(ReadableByteChannel,String) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(ReadableByteChannel,Charset) is not applicable
      (actual and formal argument lists differ in length)
2 errors
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:9:13: error: invalid types 'int[int]' for array subscript
    9 |         if(a[i]=='0') a++;
      |             ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main
{
   string s;
   cin>>s;
   stack < char > a;
   a.push(s[0]);
   int ans=0;
   for(int i=1;i<s.size();++i)
   {
      if(a.size() && a.top()!=s[i])
      {
         ans++;
         a.pop();
      }
      else
      {
        a.push(s[i]);
      }
   }
   cout<<ans;
}

Compiler output:
a.cc:3:5: error: cannot declare '::main' to be a global variable
    3 | int main
      |     ^~~~
a.cc:5:11: error: expected primary-expression before 's'
    5 |    string s;
      |           ^
a.cc:5:11: error: expected '}' before 's'
a.cc:4:1: note: to match this '{'
    4 | {
      | ^
a.cc:6:4: error: 'cin' does not name a type
    6 |    cin>>s;
      |    ^~~
a.cc:8:4: error: 'a' does not name a type
    8 |    a.push(s[0]);
      |    ^
a.cc:10:4: error: expected unqualified-id before 'for'
   10 |    for(int i=1;i<s.size();++i)
      |    ^~~
a.cc:10:16: error: 'i' does not name a type
   10 |    for(int i=1;i<s.size();++i)
      |                ^
a.cc:10:27: error: expected unqualified-id before '++' token
   10 |    for(int i=1;i<s.size();++i)
      |                           ^~
a.cc:22:4: error: 'cout' does not name a type
   22 |    cout<<ans;
      |    ^~~~
a.cc:23:1: error: expected declaration before '}' token
   23 | }
      | ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define Abs(x)((x) < 0 ? (x) * -1 : (x))

#define rep(x, y) for ((x) = 0; (x) < (y); (x)++)
#define repin(x, y) for ((x) = 0; (x) <= (y); (x)++)
#define nep(x, y) for ((x) = (y) - 1; 0 <= (x); (x)--)
#define nepi(x, y, z) for ((x) = (y) - 1; (z) <= (x); (x)--)
#define repi(x, y, z) for ((x) = (z); (x) < (y); (x)++)
#define repiin(x, y, z) for ((x) = (z); (x) <= (y); (x)++)
#define reps(x, y, z) for ((x) = 0; (x) < (y); (x) += (z))
#define repis(x, y, z, s) for ((x) = (z); (x) < (y); (x) += (s))
#define repiins(x, y, z, s) for ((x) = (z); (x) <= (y); (x) += (s))
#define repit(x) for (__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define nepit(x) for (__typeof((x).rbegin()) it = (x).rbegin(); it != (x).rend(); it++)

#define All(x) (x).begin(),(x).end()

#define Mem0(x) memset(x, 0, sizeof(x))
#define Mem1(x) memset(x, -1, sizeof(x))

#define Unique(v) v.resize(unique(All(v)) - v.begin())

#define peq(p0, p1)(p0.first == p1.first && p0.second == p1.second)

#define End '\n'
#define Out(x) cout<<(x)<<End
#define OutP(p, sep, end) cout<<p.first<<sep<<p.second<<end

template<typename T> inline bool Max(T &x, const T &y) { return x < y ? x = y, 1 : 0; }
template<typename T> inline bool Min(T &x, const T &y) { return x > y ? x = y, 1 : 0; }
template<typename T> using V = vector<T>;
template<typename T> using VV = V<V<T> >;

#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define lb std::lower_bound
#define ub std::upper_bound

#define lbi(v, x) lb(All(v), (x))-v.begin()
#define ubi(v, x) ub(All(v), (x))-v.begin()

static const ll MOD = 1e9 + 7;
static const double PI = 3.141592653589793;

#define LOCAL 0

int main()
{
#if LOCAL
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    freopen("debug.txt", "w", stderr);
#endif

    cin.tie(0);
    ios::sync_with_stdio(false);
	//std::cout.precision(18);

    string s;

	cin >> s;

	stack<char> st;
	long ans = 0;
	
	long i, len = s.size();

	rep(i, len) {
		if (!st.empty()) {
			if (st.top != s[i]) {
				ans += 2;
				st.pop();
			} else {
				st.push(s[i]);
			}
		} else {
			st.push(s[i]);
		}
	}

	Out(ans);
	
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:78:36: error: invalid operands of types '<unresolved overloaded function type>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to binary 'operator!='
   78 |                         if (st.top != s[i]) {
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

int main() {
    string S;
    cin >> S;
    const size_t size = S.size();
    vector<int> ans(2, 0);
    for(int i = 0; i < size; i++) {
        ans[S[i] - '0']++;
    }
    cout << min(ans[0, ans[1]]) << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:16: error: no matching function for call to 'min(__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
   16 |     cout << min(ans[0, ans[1]]) << endl;
      |             ~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   candidate expects 2 arguments, 1 provided
/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, 1 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:4:
/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:   template argument deduction/substitution failed:
a.cc:16:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   16 |     cout << min(ans[0, ans[1]]) << endl;
      |             ~~~^~~~~~~~~~~~~~~~
/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:   candidate expects 2 arguments, 1 provided
Language: Java

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

public class test{


    public static void main(String[] args) {
        FastReader in = new FastReader();

        String s = in.nextLine();
        int cnt[] = new int[2];
        for (int l = 0; l < s.length(); ++l){
            cnt[(int)s.charAt(l) - (int)'0'] ++;
        }
        System.out.println(Math.min(cnt[0], cnt[1])*2);




    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}

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

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

public class test{


    public static void main(String[] args) {
        FastReader in = new FastReader();

        String s = in.nextLine();
        int cnt[] = new int[2];
        for (int l = 0; l < s.length(); ++l){
            cnt[(int)s.charAt(l) - (int)'0'] ++;
        }
        System.out.println(Math.min(cnt[0], cnt[1])*2);




    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.*;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
    2 | import java.io.*;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: expected unqualified-id before 'public'
    4 | public class test{
      | ^~~~~~
Language: Java

import java.util.*;
public class Main{
public static void main(String[]args){
Scanner sc=new Scanner(System.in);
  String po=sc.next();
  int length=po.length();
  String p=po.replace("1","");
  po=po.replace("0","");
  System.out.println(Math.min(p.length),po.length))*2);
}
}


Compiler output:
Main.java:9: error: ';' expected
  System.out.println(Math.min(p.length),po.length))*2);
                                                  ^
1 error
Language: Java

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

public class abc120_c {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String str  = sc.next();
    sc.close();
    int one = 0, zero = 0;
    for (int i = 0; i < str.length(); i++) {
      if (str.charAt(i) == '0') {
        zero++;
      } else {
        one++;
      }
    }
    System.out.println(2 * Math.min(one, zero));
  }
}

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

#include <bits/stdc++.h>
using namespace std;
void solve(string S) {
  int cnt = count(S.begin(), S.end(), '0');
  int cnt = count(S.begin(), S.end(), '0');
  cout << min((int)S.size() - cnt, cnt) * 2 << endl;
}

int main() {
  cout << setprecision(10);
  string S;
  cin >> S;
  solve(S);
  return 0;
}


Compiler output:
a.cc: In function 'void solve(std::string)':
a.cc:5:7: error: redeclaration of 'int cnt'
    5 |   int cnt = count(S.begin(), S.end(), '0');
      |       ^~~
a.cc:4:7: note: 'int cnt' previously declared here
    4 |   int cnt = count(S.begin(), S.end(), '0');
      |       ^~~
Language: C++

#include "bits/stdc++.h"
using namespace std;
char str[100002]={'\0'};
int main()
{
    int len,a=0,b=0;
    int i;
    scanf("%s",str);
    len=strlen(str);
    for(i=0;i<len;i++)
    {
        if(str[i]=='0')
        {
            a++;
        }
        else if(str[i]=='1')
        {
            b++;
        }
    }
    printf("%d\n",min(a,b)*2);
    return 0； 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:12: error: unable to find numeric literal operator 'operator""\U0000ff1b'
   22 |     return 0；
      |            ^~~
a.cc:22:15: error: expected ';' before '}' token
   22 |     return 0；
      |               ^
      |               ;
   23 | }
      | ~
Language: Java

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

public class abc120_c {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String str  = sc.next();
    
    int one = 0, zero = 0;
    for (int i = 0; i < str.length(); i++) {
      if (str.charAt(i) == '0') {
        zero++;
      } else {
        one++;
      }
    }
    System.out.println(2 * Math.min(one, zero));
  }
}

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

#include <bits/stdc++.h>
#define inf 1000000000
#define maxs(x,y) (x = max(x , y))
#define mins(x,y) (x = min(x , y))
using namespace std;
typedef long long int ll;

int main(){
  string s;
  cin  >> s;
  int n,i,ans,a=0,b=0;
  n = s.length()

  for(i=0 ; i<n ; i++){
    if(s[i] == '0'){
      a++;
    }else{
      b++;
    }
  }

  ans = min(a,b)*2;

  cout << ans << endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:17: error: expected ';' before 'for'
   12 |   n = s.length()
      |                 ^
      |                 ;
   13 | 
   14 |   for(i=0 ; i<n ; i++){
      |   ~~~            
a.cc:14:22: error: expected ';' before ')' token
   14 |   for(i=0 ; i<n ; i++){
      |                      ^
      |                      ;
Language: C++

#include <bits/stdc++.h>
#define inf 1000000000
#define maxs(x,y) (x = max(x , y))
#define mins(x,y) (x = min(x , y))
using namespace std;
typedef long long int ll;

int main(){
  string s;
  cin  >> s;
  int n,i,ans,a=0,b=0;
  n = s.length()

  for(i=0 ; i<n ; i++){
    if(s[i] == '0'){
      a++;
    }else{
      b++;
    }
  }

  ans = min(a,b)*2

  cout << ans << endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:17: error: expected ';' before 'for'
   12 |   n = s.length()
      |                 ^
      |                 ;
   13 | 
   14 |   for(i=0 ; i<n ; i++){
      |   ~~~            
a.cc:14:22: error: expected ';' before ')' token
   14 |   for(i=0 ; i<n ; i++){
      |                      ^
      |                      ;
a.cc:22:19: error: expected ';' before 'cout'
   22 |   ans = min(a,b)*2
      |                   ^
      |                   ;
   23 | 
   24 |   cout << ans << endl;
      |   ~~~~
Language: C

#include <stdio.h>
#include <string.h>
int main(){
  
  char s[100000] = "";
  int max;
  int cnt = 0;
  int i = 0;
  
  scanf("%s", s);

  max = strlen(s);

  do{ //1つ目からチェックする
     printf("%c  %c\n", s[i], s[i + 1]);
    
     if( ((s[i] == '0') && (s[i + 1] == '1')) || (s[i] == '1') && (s[i + 1] == '0'))){
      for(int n = i; n < max;){ //文字列並び替え
	s[i] = s[i + 2];
	//	if(s[i + 3] != '\0'){
	  s[i + 1] = s[i + 3];
	  //	}
	n = n + 2;
      }
      i = 0;
      max = max - 2;
      cnt = cnt + 2;
    }else{
      i++;
    }
    
  }while(i <= max);
  
  printf("%d\n",  cnt);
  
}


Compiler output:
main.c: In function 'main':
main.c:17:85: error: expected statement before ')' token
   17 |      if( ((s[i] == '0') && (s[i + 1] == '1')) || (s[i] == '1') && (s[i + 1] == '0'))){
      |                                                                                     ^
main.c:28:6: error: 'else' without a previous 'if'
   28 |     }else{
      |      ^~~~
Language: C++

S =list(input())
L =list(map(int,S))

n = 0
X = 0
while X<1:
	K = len(L)-1
	for i in range(K):
		if L[i]+L[i+1]==1:
			L.pop(i)
			L.pop(i)
			n=n+1
			break
		elif i == K-1:
			X=1

print(n*2)

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

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

int main(){
  char S[1000000];
  int i,z=0,o=0;
  scanf("%s",S)
  for(i=0;i<strlen(S);i++){
    if(S[i]=='0')
      z++;
    else
      o++;
  }
  
  if(z>o){
    printf("%d\n",o*2);
  }
  else
    printf("%d\n",z*2);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:7:16: error: expected ';' before 'for'
    7 |   scanf("%s",S)
      |                ^
      |                ;
    8 |   for(i=0;i<strlen(S);i++){
      |   ~~~
Language: C++

#define size 1000000
int main()
{
  char str[size];
  long long int z,o;
  for(long long int i=0;i<size;i++)str[i]=='\n';
  scanf("%s",str);
  for(long long int i=0;str[i]!='\n';i++)
  {
    if(str[i]=='0')z++;
    if(str[i]=='1')o++;
  }
  if(z<=o) printf("%lld",z*2);
  else printf("%lld",o*2);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: 'scanf' was not declared in this scope
    7 |   scanf("%s",str);
      |   ^~~~~
a.cc:13:12: error: 'printf' was not declared in this scope
   13 |   if(z<=o) printf("%lld",z*2);
      |            ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | #define size 1000000
a.cc:14:8: error: 'printf' was not declared in this scope
   14 |   else printf("%lld",o*2);
      |        ^~~~~~
a.cc:14:8: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
Language: C

#include <stdio.h>

int main(){
  char S[10000];
  
  scanf("%s", &S);
  
  int n = 1;
  char cmp;
  int  count1 = 0;
  int count0 = 0;
  int i=0;
  while(S[i+1] != '\0'){
    if(S[i] == '1')
		count1++;
    else
      count0++;
  }
  int ans;
  if(count1 > = count0)
    ans = count1 - count0;
  else
    ans = count0 - count1;
  
  printf("%d",ans*2);
  
return 0;  
}


Compiler output:
main.c: In function 'main':
main.c:20:15: error: expected expression before '=' token
   20 |   if(count1 > = count0)
      |               ^
Language: C

#include <stdio.h>

int main(){
  char S[10000];
  
  scanf("%s", &S);
  
  int n = 1;
  char cmp;
  int  count1 = 0;
  int count0 = 0;
  int i=0;
  while(S[i+1] != '\0'){
    if(S[i] == '1')
		count1++;
    else
      count0++;
  }
  int ans;
  if(count1 > = count0)
    ans = count1 - count0;
  else
    ans = count0 - count1;
  
  printf("%d",ans*2);
  
return 0;  
}



Compiler output:
main.c: In function 'main':
main.c:20:15: error: expected expression before '=' token
   20 |   if(count1 > = count0)
      |               ^
Language: C

#include <stdio.h>

int main() {
    char s[10100];
    int len = 0, min = 0;
    int i = 0, zero = 0, one = 0;

    scanf_s("%s", s);
    while(s[i]) {
        len++;
        i++;
    }

    for (i = 0; i < len; i++) {
        if (s[i] == '0') zero++;
        else one++;
    }

    if (zero < one) {min = zero;}
    else {min = one;}

    printf("%d", 2*min);

    return 0;
}

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

#include<stdio.h>
int main()
{
  -r9ut08ur139
    490 50ｖ０

Compiler output:
main.c: In function 'main':
main.c:4:4: error: 'r9ut08ur139' undeclared (first use in this function)
    4 |   -r9ut08ur139
      |    ^~~~~~~~~~~
main.c:4:4: note: each undeclared identifier is reported only once for each function it appears in
main.c:4:15: error: expected ';' before numeric constant
    4 |   -r9ut08ur139
      |               ^
      |               ;
    5 |     490 50ｖ０
      |     ~~~        
main.c:5:9: error: invalid suffix "ｖ０" on integer constant
    5 |     490 50ｖ０
      |         ^~~~~~
main.c:5:5: error: expected declaration or statement at end of input
    5 |     490 50ｖ０
      |     ^~~
Language: C++

#define size 1000000
int main()
{
  char str[size];
  long long int z=0,o=0;
  for(long long int i=0;i<size;i++)str[i]=='\n';
  scanf("%s",str);
  for(long long int i=0;str[i]!='\n';i++)
  {
    if(str[i]=='0')z++;
    if(str[i]=='1')o++;
  }
  if(z<=o) printf("%lld",z*2);
  else printf("%lld",o*2);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: 'scanf' was not declared in this scope
    7 |   scanf("%s",str);
      |   ^~~~~
a.cc:13:12: error: 'printf' was not declared in this scope
   13 |   if(z<=o) printf("%lld",z*2);
      |            ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | #define size 1000000
a.cc:14:8: error: 'printf' was not declared in this scope
   14 |   else printf("%lld",o*2);
      |        ^~~~~~
a.cc:14:8: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
Language: C++

#include<cstdio>
#include<cmath>
#include<iostream>
using namespace std;
int vis[200001];
char str[200001];
int main()
{
	
	cin>>str;
	int len=strlen(str);
	int l=0,y=0;
	int sum=0;
	for(int i=0;i<len;i++)
	{
		if(str[i]=='0') l++;
		else y++;
	}
	printf("%d",min(l,y)*2);
}

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

#include <stdio.h>

int main(){
  char S;
  
  scanf("%s", &S);
  
  int n = 1;
  char cmp;
  int  count1 = 0;
  int count0 = 0;
  int i=0;
  while(S[i+1] != '\0'){
    if(S[i] == '1')
		count1++;
    else
      count0++;
  }
  int ans;
  if(count1 > = count0)
    ans = count1 - count0;
  else
    ans = count0 - count1;
  
  printf("%d",ans*2);
  
return 0;  
}



Compiler output:
main.c: In function 'main':
main.c:13:10: error: subscripted value is neither array nor pointer nor vector
   13 |   while(S[i+1] != '\0'){
      |          ^
main.c:14:9: error: subscripted value is neither array nor pointer nor vector
   14 |     if(S[i] == '1')
      |         ^
main.c:20:15: error: expected expression before '=' token
   20 |   if(count1 > = count0)
      |               ^
Language: C++

#include<cstdio>
#include<cmath>
#include<iostream>
using namespace std;
int vis[100001];
char str[100001];
int main()
{
	
	cin>>str;
	int len=strlen(str);
	int l=0,y=0;
	int sum=0;
	for(int i=0;i<len;i++)
	{
		if(str[i]=='0') l++;
		else y++;
	}
	printf("%d",min(l,y)*2);
}

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

#include<cstdio>
#include<cmath>
#include<iostream>
using namespace std;
int vis[10001];
int main()
{
	char str[10001];
	cin>>str;
	int len=strlen(str);
	int l=0,y=0;
	int sum=0;
	for(int i=0;i<len;i++)
	{
		if(str[i]=='0') l++;
		else y++;
	}
	printf("%d",min(l,y)*2);
}

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:10:20: error: expected ';' before '}' token
   10 |     T.at(i)=S.at(i)
      |                    ^
      |                    ;
   11 |   }
      |   ~
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 tmep = 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 != temp)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:36:25: error: 'temp' was not declared in this scope; did you mean 'tmp'?
   36 |               if(ans != temp)goto retry;
      |                         ^~~~
      |                         tmp