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

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

int main(){
  string S,ans;
  cin >> S;
  for (int i=0; i<S.size(); i++){
    if (S[i] == 0){
      ans += 0;
    }
    else if(S[i] == 1){
      ans += 1;
    }
    else if(
      ans.erase(i);
      ans.erase(i-1);
    }
    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:11: error: ambiguous overload for 'operator+=' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'int')
    9 |       ans += 0;
      |       ~~~~^~~~
In file included from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:1377:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator+=(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
 1377 |       operator+=(const basic_string& __str)
      |       ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:1387:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator+=(const _CharT*) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
 1387 |       operator+=(const _CharT* __s)
      |       ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:1397:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator+=(_CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
 1397 |       operator+=(_CharT __c)
      |       ^~~~~~~~
a.cc:16:21: error: expected ')' before ';' token
   16 |       ans.erase(i-1);
      |                     ^
      |                     )
a.cc:14:12: note: to match this '('
   14 |     else if(
      |            ^
a.cc:16:16: error: could not convert 'ans.std::__cxx11::basic_string<char>::erase(((std::__cxx11::basic_string<char>::size_type)(i - 1)), ((std::__cxx11::basic_string<char>::size_type)std::__cxx11::basic_string<char>::npos))' from 'std::__cxx11::basic_string<char>' to 'bool'
   16 |       ans.erase(i-1);
      |       ~~~~~~~~~^~~~~
      |                |
      |                std::__cxx11::basic_string<char>
Language: Java

import java.io.BufferedReader;
import java.io.IOException;
import java.io.FileWriter;
import java.io.PrintWriter;
import java.nio.charset.StandardCharsets;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.File;
import java.util.*;

public class B {

    public static StringBuilder output = new StringBuilder();

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.next().trim();
        Solver solver = new Solver();
        solver.solve(s);
        System.out.println(output.reverse());
    }

}

class Solver {
    public void solve(String s) {
        String ans = "";
        int count = 0;
        for (int i = s.length() - 1; i >= 0; i--) {
            if (s.charAt(i) == 'B') {
                count++;
            } else {
                if (count > 0) {
                    count--;
                    continue;
                } else {
                    ans = ans.concat(Character.toString(s.charAt(i)));
                }
            }
        }
        B.output.append(ans);
    }
}

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

/* ex9_1
    fmuacshai */

# include<stdio.h>
#include<stdlib.h>
# define SIZE 20
//stackの定義
typedef struct{
    int size;
    int count;
    char string[SIZE];
    char *top;
} stack;
//データの追加
void push(stack *stk,char character){
    if(stk->count>=stk->size){
        printf("Error");
    }else{
        stk->top--;
        *(stk->top)=character;
        stk->count++;
    }
}
//データの取り出し
void pop(stack *stk){
    if(stk->count>=0){
        stk->top++;
        stk->count--;
    }
}
//データの初期化
void initialize(stack *stk){
    stk->size=SIZE;
    stk->count=0;
    stk->top=&(stk->string[SIZE]);
}
//データの出力
void output(stack *stk){
    int i;
    stk->top+=stk->count;
    for(i=0;i<=stk->count;i++){
        printf("%c",*(stk->top));
        stk->top--;
    }
    printf("\n");
}

int main(void){
    int i;
    //stack stkの定義
    stack stk;
    //入力で利用するinputを定義
    char input[SIZE];
    //データを初期化
    initialize(&stk);
    //追加と消去をする
    for(i=0;input[i]!=`\0`;i++){
        if(input=='0'||input=='1'){
            push(&stk, input);
        }else{
            pop(&stk);
        }
    }
    //出力
    output(&stk);
    return 0;
}








Compiler output:
main.c: In function 'main':
main.c:57:23: error: stray '`' in program
   57 |     for(i=0;input[i]!=`\0`;i++){
      |                       ^
main.c:57:24: error: stray '\' in program
   57 |     for(i=0;input[i]!=`\0`;i++){
      |                        ^
main.c:57:26: error: stray '`' in program
   57 |     for(i=0;input[i]!=`\0`;i++){
      |                          ^
main.c:58:17: warning: comparison between pointer and integer
   58 |         if(input=='0'||input=='1'){
      |                 ^~
main.c:58:29: warning: comparison between pointer and integer
   58 |         if(input=='0'||input=='1'){
      |                             ^~
main.c:59:24: error: passing argument 2 of 'push' makes integer from pointer without a cast [-Wint-conversion]
   59 |             push(&stk, input);
      |                        ^~~~~
      |                        |
      |                        char *
main.c:15:27: note: expected 'char' but argument is of type 'char *'
   15 | void push(stack *stk,char character){
      |                      ~~~~~^~~~~~~~~
Language: C

/* ex 9_1
   hangan2020 */

#include <stdio.h>
#include <stdlib.h>
#define SIZE 11

typedef struct stack{
   int size;
   int count;
   char data[SIZE];
   char *top;
} stack;

void initialize_stack(stack *stk){
   stk->count = 0;
   stk->size = SIZE;
   stk->top = &(stk->data[SIZE]);
}

void push(stack *stk, char elem){
   if(stk->count >= stk->size){
      fprintf(stderr, "Error: Stack overflow\n");
      exit(1);
   }
   else{
      stk->top--;
      *(stk->top) = elem;
      stk->count++;
   }
}

void pop(stack *stk){
   //char latest;
   /*if(stk->count <= 0){
      fprintf(stderr, "Error: Stack underflow\n");
      exit(1);
   }*/
   else{
      //latest = *(stk->top);
      stk->top++;
      stk->count--;
   }
}

void print_stk(stack *stk){
   char *p;
   p = stk->top;
   for(int i = 0; i < stk->count; i++){
      printf("%c", *p);
      p++;
   }
   printf("\n");
}

int main(void){
   stack stk;
   char string[SIZE];
   int i = 0;

   initialize_stack(&stk);
   scanf("%s", &string);
   
   while(string[i] != '\0'){
      if(string[i] == 'B'){
         if(stk.count != 0){
            pop(&stk);
         }
      }else{
         push(&stk, string[i]);
      }
      i++;
   }

   print_stk(&stk);

   return 0;

}

Compiler output:
main.c: In function 'pop':
main.c:39:4: error: 'else' without a previous 'if'
   39 |    else{
      |    ^~~~
Language: C

/* ex 9_1
   riverstone */

#include <stdio.h>
#include <stdlib.h>
//スタックに格納するデータの数
#define SIZE 20

//プロトタイプ宣言
typedef struct stack stack;
void initialize_stack(stack *stk);
void push(stack *stk, char elem);
char pop(stack *stk);
void print_stuck(stack *stk);
 
//スタックの定義
typedef struct stack{
    int size;
    int count;
    char data[SIZE];
    char *top;
} stack;

int main(void){
    int i=0;
    char string[SIZE];
    stack stk;
 
    //スタックを初期化
    initialize_stack(&stk);
 
    //入力を受け取る
    scanf("%s", string);

    //stringの中身を一文字ずつ見ていく
    for(i=0;i<strlen(string);i++){
        //0か1ならスタックにプッシュする
        if(string[i]=='0' || string[i]=='1'){
            push(&stk,string[i]);
        }

        //Bならスタックから一文字popする
        else if(string[i]=='B' && stk.count>0){
            pop(&stk);
        }
    } 
    
    //stackの中身を出力
    print_stack(&stk);
    printf("\n");
    return 0;
}

//スタックの初期化
void initialize_stack(stack *stk){
    stk->count = 0;
    stk->size = SIZE;
    stk->top = &(stk->data[SIZE]);
}

//データの追加
void push(stack *stk, char elem){
    if(stk->count >= stk->size){
        fprintf(stderr, "Error: stack overflow. (x=%c)\n", elem);
        exit(1);
    }
    else{
        stk->top--;
        *(stk->top) = elem;
        stk->count++;
    }
}

//データの取り出し
char pop(stack *stk){
    char latest;
    if(stk->count <= 0){
        fprintf(stdout, "Error: stack underflow.\n");
        exit(1);
    }
    else{
        latest = *(stk->top);
        stk->top++;
        stk->count--;
        return latest;
    }
}
 
//出力
void print_stuck(stack *stk){
    int i;
    for (i=0;i < stk->count;i++){
        printf("%c",stk->data[SIZE-i-1]);
    }
    printf("\n");
}

Compiler output:
main.c: In function 'main':
main.c:36:15: error: implicit declaration of function 'strlen' [-Wimplicit-function-declaration]
   36 |     for(i=0;i<strlen(string);i++){
      |               ^~~~~~
main.c:6:1: note: include '<string.h>' or provide a declaration of 'strlen'
    5 | #include <stdlib.h>
  +++ |+#include <string.h>
    6 | //スタックに格納するデータの数
main.c:36:15: warning: incompatible implicit declaration of built-in function 'strlen' [-Wbuiltin-declaration-mismatch]
   36 |     for(i=0;i<strlen(string);i++){
      |               ^~~~~~
main.c:36:15: note: include '<string.h>' or provide a declaration of 'strlen'
main.c:49:5: error: implicit declaration of function 'print_stack'; did you mean 'print_stuck'? [-Wimplicit-function-declaration]
   49 |     print_stack(&stk);
      |     ^~~~~~~~~~~
      |     print_stuck
Language: C++

/* ex 9_1
series2 */
#include <stdio.h>
#include <stdlib.h>
#define SIZE 10
//条件　文字列を格納するスタックを定義、push,pop
typedef struct stack {
    int size;
    int count;        //現在格納されている文字数
    char data[SIZE];  //データ内容そのもの
    char *top;  //外部からのアクセス部はdata配列の一番後ろの番地のアドレスをさす
} stack;

void init_stack(stack *stk) {
    stk->count = 0;
    stk->size = SIZE;
    stk->top = &(stk->data[SIZE]);
}
void push(stack *stk, char data) {
    if (stk->count <
        stk->size) {  //用意したstackの要領未満の時、入力文字をトップアドレスに追加する
        stk->top--;
        *(stk->top) = data;
        stk->count++;
    }
}
char pop(stack *stk) {
    char latest;
    if (stk->count > 0) {  //文字が残っている時
        latest = *(stk->top);
        stk->top++;
        stk->count--;
        return latest;
    } else {
        latest = '\0';  //文字が残っていない時null文字を返す
    }
    return latest;
}

void printout(
    stack
        stk) {  // stackなので、再帰的に呼び出すことで正しい順にする。(直接呼び出すのは、stackとしての設計に反する)
    char out = pop(&stk);
    if (out) {  // outがnull文字でない時
        printout(stk);
        printf("%c", out);
    }
}

int main(void) {
    stack stk;
    init_stack(&stk);　//stackの初期化
    char inp = ' '; 
    while (inp != '\n') {
        scanf("%c", &inp);
        if (inp == 'B') { //BackSpaceの時削除
            pop(&stk);
        } else if (inp != '\n') { //最終文字でない時追加する
            push(&stk, inp);
        }
    }
    printout(stk);
    printf("\n");

    return 0;
}

Compiler output:
a.cc:52:22: error: extended character 　 is not valid in an identifier
   52 |     init_stack(&stk);　//stackの初期化
      |                      ^
a.cc: In function 'int main()':
a.cc:52:22: error: '\U00003000' was not declared in this scope
   52 |     init_stack(&stk);　//stackの初期化
      |                      ^~
a.cc:54:12: error: 'inp' was not declared in this scope; did you mean 'int'?
   54 |     while (inp != '\n') {
      |            ^~~
      |            int
Language: C

/* ex9_1
   YSK722 */

#include <stdio.h>
#include <stdlib.h>
//スタックに格納するデータの最大数
#define SIZE 11

//スタックの定義
typedef struct stack{
    int size;
    int count;
    char data[SIZE];
    char *top;
} stack;

//スタックの初期化
void initialize_stack(stack *stk){
    stk->count = 0;
    stk->size = SIZE;
    stk->top = &(stk->data[SIZE]);
}

//データの追加
void push(stack *stk, char elem){
    if (stk->count >= stk->size){
        printf("Error: stack overflow. (x=%c)\n", elem);
        exit(1);
    }
    else{
        stk->top--;
        *(stk->top) = elem;
        stk->count++;
    }
}

//データの取り出し
char pop(stack *stk){
    char latest;
    if (stk->count <= 0){
        printf("Error: stack underflow.\n");
        exit(1);
    }
    else{
        latest = *(stk->top);
        stk->top++;
        stk->count--;
        return latest;
    }
}

int main(void){
    stack stk;
    char text[SIZE], *ptr;
    int i = 0;
    scanf("%s", text);
    //スタックを初期化
    initialize_stack(&stk);
    //スタックにデータを追加
    for (i = 0; text[i] != '\0'; i++){
        if (text[i] == 'B'){
            pop(&stk);
        }
        else{
            push(&stk, text[i]);
        }
    }
    ptr = stk->top;
    ptr += stk->count - 1;
    for (i = 0; i < stk->count; i++){
        printf("%c", *ptr--);
    }
    printf("\n");
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:68:14: error: invalid type argument of '->' (have 'stack')
   68 |     ptr = stk->top;
      |              ^~
main.c:69:15: error: invalid type argument of '->' (have 'stack')
   69 |     ptr += stk->count - 1;
      |               ^~
main.c:70:24: error: invalid type argument of '->' (have 'stack')
   70 |     for (i = 0; i < stk->count; i++){
      |                        ^~
Language: C++

#include<iostream>
using namespace std;
int main()
{
  string s1,s2;
  cin>>s1;
  for(int i=0;i<n;i++)
  {
    if(s1[i]=='0'||s[i]=='1')
      s2.push_back(s[i]);
    if(s[i]=='B'){
      s2.pop_back();
    i=i-1;}
  }
  cout<<s2[s2.length()-1];
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:17: error: 'n' was not declared in this scope
    7 |   for(int i=0;i<n;i++)
      |                 ^
a.cc:9:20: error: 's' was not declared in this scope
    9 |     if(s1[i]=='0'||s[i]=='1')
      |                    ^
a.cc:11:8: error: 's' was not declared in this scope
   11 |     if(s[i]=='B'){
      |        ^
Language: Java

import java.util.*;
 
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String ans = "";
      
		for(int i=0; i<S.length(); i++){
			String str = String.valueOf(S.charAt(i));
			if(str.equals("0")){
				ans += "0";
            }else if(str.equals("1")){
				ans += "1";
            }else {
				if(!(ans.isEmpty())){
					ans = ans.subStrings(0, ans.length()-1);
                }
            }
        }
					
		
		System.out.println(ans);
    }
}


Compiler output:
Main.java:17: error: cannot find symbol
					ans = ans.subStrings(0, ans.length()-1);
					         ^
  symbol:   method subStrings(int,int)
  location: variable ans of type String
1 error
Language: C++

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

int main() {
  vector<char> a;
  string s;
  cin >> s;
  for ( char c:s ) {
    if ( c=='B'&&asize() ) a.pop_back();
    else a.push_back(c);
  }
  for ( char c:a ) {
    cout << c;
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:18: error: 'asize' was not declared in this scope; did you mean 'dysize'?
    9 |     if ( c=='B'&&asize() ) a.pop_back();
      |                  ^~~~~
      |                  dysize
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s;
  cin >> s;
  string e = "";
 
  for(int i = 0; i < s.size(); i++) {
    if(s[i] == '0') {
      e.emplace_back('0');
    }
    else if(s[i] == '1') {
      e.emplace_back('1');
    }
    else if (s[i] == 'B' && e.size() > 0) {
      e.pop_back();
    }
  }
  cout << e << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:9: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'emplace_back'
   11 |       e.emplace_back('0');
      |         ^~~~~~~~~~~~
a.cc:14:9: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'emplace_back'
   14 |       e.emplace_back('1');
      |         ^~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s;
  cin >> s;
  string e = "";
 
  for(int i = 0; i < s.size(); i++) {
    if(s[i] == '0') {
      e.push_back('0');
    }
    else if(s[i] == '1') {
      e.emplace_back('1');
    }
    else if (s[i] == 'B' && ans.size() > 0) {
      e.pop_back();
    }
  }
  cout << e << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:9: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'emplace_back'
   14 |       e.emplace_back('1');
      |         ^~~~~~~~~~~~
a.cc:16:29: error: 'ans' was not declared in this scope; did you mean 'abs'?
   16 |     else if (s[i] == 'B' && ans.size() > 0) {
      |                             ^~~
      |                             abs
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main() {
    string s;
    cin >> s;
    vector<char> v;
    for (char c : s) {
        switch (c) {
            case '0':
                v.push_back('0');
                break;
            case '1':
                v.push_back('1');
                break;
            case 'B':
                if (v.size() != 0) v.pop_back();
                break;
        }
    }

    string ans;
    for (char c : v) ans += c;


Compiler output:
a.cc: In function 'int main()':
a.cc:24:31: error: expected '}' at end of input
   24 |     for (char c : v) ans += c;
      |                               ^
a.cc:5:12: note: to match this '{'
    5 | int main() {
      |            ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
 
  char s[1000000];
  char v[1000000];
  long long i=0;
   long long l=0;
 cin>>s;
 l=s.size();
  for(i=0;i<l;i++)
  {
    if(s[i]=='0')
    {
      v.push('0');
      l++;
    }
    else if(s[i]=='1')
    {
      v.push('1');
      l++;
    }
    else if(s[i]=='B')
    {
      v.pop();
      l--;
    }
  }
 
    cout<<v;
 
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:6: error: request for member 'size' in 's', which is of non-class type 'char [1000000]'
   11 |  l=s.size();
      |      ^~~~
a.cc:16:9: error: request for member 'push' in 'v', which is of non-class type 'char [1000000]'
   16 |       v.push('0');
      |         ^~~~
a.cc:21:9: error: request for member 'push' in 'v', which is of non-class type 'char [1000000]'
   21 |       v.push('1');
      |         ^~~~
a.cc:26:9: error: request for member 'pop' in 'v', which is of non-class type 'char [1000000]'
   26 |       v.pop();
      |         ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
 
  char s[1000000];
  char v[1000000];
  long long i=0;
   long long l=0;
 cin>>s;
 l=s.size();
  for(i=0;i<l;i++)
  {
    if(s[i]=='0')
    {
      v.push_back('0');
      l++;
    }
    else if(s[i]=='1')
    {
      v.push_back('1');
      l++;
    }
    else if(s[i]=='B')
    {
      
      v.pop_back();
      l--;
     
    }
  }
 
    cout<<v;
 
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:6: error: request for member 'size' in 's', which is of non-class type 'char [1000000]'
   11 |  l=s.size();
      |      ^~~~
a.cc:16:9: error: request for member 'push_back' in 'v', which is of non-class type 'char [1000000]'
   16 |       v.push_back('0');
      |         ^~~~~~~~~
a.cc:21:9: error: request for member 'push_back' in 'v', which is of non-class type 'char [1000000]'
   21 |       v.push_back('1');
      |         ^~~~~~~~~
a.cc:27:9: error: request for member 'pop_back' in 'v', which is of non-class type 'char [1000000]'
   27 |       v.pop_back();
      |         ^~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
 
  string s;
   int i=0;
   int l=0;
  while(cin>>s[i])
  {
    l++;
    i++;
  }
 
 
  for(i=0;i<l;i++)
  {
    if(s[i]=="0")
    {
      s.push_back('0');
      l++;
    }
    else if(s[i]=="1")
    {
      s.push_back('1');
      l++;
    }
    else if(s[i]=="B")
    {
      s.pop_back();
      l--;
    }
  }
 
    cout<<s;
 
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:12: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   18 |     if(s[i]=="0")
a.cc:23:17: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   23 |     else if(s[i]=="1")
a.cc:28:17: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   28 |     else if(s[i]=="B")
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
 
  vector<string> s;
   int i=0;
   int l=0;
  while(cin>>s[i])
  {
    l++;
    i++;
  }
 
 
  for(i=0;i<l;i++)
  {
    if(s[i]=="0")
    {
      s.push_back(0);
      l++;
    }
    else if(s[i]=="1")
    {
      s.push_back(1);
      l++;
    }
    else if(s[i]=="B")
    {
      s.pop_back();
      l--;
    }
  }
  for(i=0;i<l;i++)
  {
    cout<<s[i];
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:18: error: no matching function for call to 'std::vector<std::__cxx11::basic_string<char> >::push_back(int)'
   25 |       s.push_back(1);
      |       ~~~~~~~~~~~^~~
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:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >; value_type = std::__cxx11::basic_string<char>]'
 1283 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:35: note:   no known conversion for argument 1 from 'int' to 'const std::vector<std::__cxx11::basic_string<char> >::value_type&' {aka 'const std::__cxx11::basic_string<char>&'}
 1283 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >; value_type = std::__cxx11::basic_string<char>]'
 1300 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:30: note:   no known conversion for argument 1 from 'int' to 'std::vector<std::__cxx11::basic_string<char> >::value_type&&' {aka 'std::__cxx11::basic_string<char>&&'}
 1300 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
  vector<int> s;
   int i=0;
  while(cin>>s[i])
  {
    l++;
    i++;
  }
 
  int l=s.size();
  for(i=0;i<l;i++)
  {
    if(s[i]==0)
    {
      s.push_back(0);
    }
    else if(s[i]==1)
    {
      s.push_back(1);
    }
    else if(s[i]=='B')
    {
      s.pop_back();
    }
  }
  for(i=0;i<v.size();i++)
  {
    cout<<s[i];
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:5: error: 'l' was not declared in this scope
    9 |     l++;
      |     ^
a.cc:29:13: error: 'v' was not declared in this scope
   29 |   for(i=0;i<v.size();i++)
      |             ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
  vector<int> s;
   int i;
  for(i=0;i!='\0';i++)
  {
    cin>>s[i];
  }
 
  int l=s.size();
  for(i=0;i<l;i++)
  {
    if(s[i]==0)
    {
      s.push_back(0);
    }
    else if(s[i]==1)
    {
      s.push_back(1);
    }
    else if(s[i]=='B')
    {
      s.pop_back();
    }
  }
  for(i=0;i<v.size();i++)
  {
    cout<<s[i];
  }
  return 0;
}

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

#include<bits/stdc++.h>
using namespace std;
int main()
{
  vector<int> s;
  for(i=0;i!='\0';i++)
  {
    cin>>s[i];
  }
  int i;
  int l=s.size();
  for(i=0;i<l;i++)
  {
    if(s[i]==0)
    {
      s.push_back(0);
    }
    else if(s[i]==1)
    {
      s.push_back(1);
    }
    else if(s[i]=='B')
    {
      s.pop_back();
    }
  }
  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;i!='\0';i++)
      |       ^
Language: C++

    #include <bits/stdc++.h> 
    #define REP(i, n) for(i = 0; i < n ; i++){}
    #define REPN(i, n) for(i = n-1; i > -1 ; i--}{}
    #define MOD 1000000007
    using namespace std;    
    typedef unsigned int ll;
    typedef long long ull;
    
    int main() {
        #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin) ;
        freopen("output.txt", "w", stdout) ;
        #endif
        ios_base::sync_with_stdio(false);
        cin.tie(NULL) ; cout.tie(NULL) ;
        string str;
        cin >> str;
        int n = str.size();
        int i = n;
        int count  = 0;
        for(i = n-1;i>-1;i--){
            if((str[i]=='B')&(i!=0)){
                if(str[i-1]!='B'){for(int j = 1; j <= count; j++)str[i-j]!='B';i-=j;}
                else count++;
            }
        }
        i = 0;
        for(i;i<n;i++){
            if(str[i]!='B')cout << str[i];
        }
        cout << endl;
    }

Compiler output:
a.cc: In function 'int main()':
a.cc:23:83: error: 'j' was not declared in this scope
   23 |                 if(str[i-1]!='B'){for(int j = 1; j <= count; j++)str[i-j]!='B';i-=j;}
      |                                                                                   ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
     #include<bits/stdc++.h>
    using namespace std;
    #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    #define ll long long
    #define ld long double
    #define pb push_back
    #define w(t)  int t;cin>>t;while(t--)
    int solve()
    {
 string s;
    cin >> s;
    ll N = s.size();
    string ans = "";
    for(int i=0;i<N;i++)
    {
        if (s.at(i) == '0')
        {
            ans += '0';
        }
        else if (s.at(i) == '1')
        {
            ans += '1';
        }
        else if (ans.size() != 0)
        {
            ans.pop_back();
        }
    }

    cout << ans << endl;
    }


    int main()
    {
        IOS;
    {solve();}

       return 0;
     }

 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:14: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   12 |     int solve()
      |              ^~
a.cc:12:14: note: remove parentheses to default-initialize a variable
   12 |     int solve()
      |              ^~
      |              --
a.cc:12:14: note: or replace parentheses with braces to value-initialize a variable
a.cc:13:5: error: a function-definition is not allowed here before '{' token
   13 |     {
      |     ^
a.cc:38:13: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   38 |     int main()
      |             ^~
a.cc:38:13: note: remove parentheses to default-initialize a variable
   38 |     int main()
      |             ^~
      |             --
a.cc:38:13: note: or replace parentheses with braces to value-initialize a variable
a.cc:39:5: error: a function-definition is not allowed here before '{' token
   39 |     {
      |     ^
Language: C++

#include<iostream>
using namespace std;

int main(){
    string s,result="";
    cin >> s;
    for(int i=0; i<s.length(); i++){
        char c = s[i];
        switch(c){
            case '0':
                result += c;
                break;
            case '1':
                result += c;
                break;
            case 'B':
                if(result.length()>0){
                    result = result.substr(0, result.length()-1);
                }
                break;
        }
    }
    cout << result << '\n'
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:27: error: expected ';' before '}' token
   23 |     cout << result << '\n'
      |                           ^
      |                           ;
   24 | }
      | ~
Language: C++

#include<iostream>
using namespace std;

int main(){
    string s,result="";
    cin >> s;
    for(int i=0; i<s.length(); i++){
        char c = s[i];
        switch(c){
            case '0':
                result += c;
                break;
            case '1':
                result += c;
                break;
            case 'B':
                if(result.length()>0){
                    result = result.substr(0, result.length()-1);
                }
                break;
        }
    }
    cout << result << '\n'
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:27: error: expected ';' before '}' token
   23 |     cout << result << '\n'
      |                           ^
      |                           ;
   24 | }
      | ~
Language: C++

#include<iostream>
using namespace std;

int main(){
    string s,result="";
    cin >> s;
    for(int i=0; i<s.length(); i++){
        char c = s[i];
        switch(c){
            case '0':
            case '1':
                result += c;
                break;
            case 'B':
                if(result.length()>0){
                    result = result.substr(0, result.length()-1);
                }
                break;
        }
    }
    cout << result << '\n'
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:27: error: expected ';' before '}' token
   21 |     cout << result << '\n'
      |                           ^
      |                           ;
   22 | }
      | ~
Language: C++

#include<iostream>
using namepace std;
int main(){
  string s, result =" ";
  cin >> s;
  for(int i = 0; i < s.length(); i++){
    char c = s[i];
    switch(c){
      case'0':
        result += '0';
        break;
      case'1':
        result += '1';
        break;
      case'B':
      if(result.length() > 0){
        result = result.substr(0, result.length() - 1);
      }
      
    }
  }
  cout << result << '\n';
}

Compiler output:
a.cc:2:7: error: expected nested-name-specifier before 'namepace'
    2 | using namepace std;
      |       ^~~~~~~~
a.cc: In function 'int main()':
a.cc:4:3: error: 'string' was not declared in this scope
    4 |   string s, result =" ";
      |   ^~~~~~
a.cc:4:3: 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:5:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    5 |   cin >> s;
      |   ^~~
      |   std::cin
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:5:10: error: 's' was not declared in this scope
    5 |   cin >> s;
      |          ^
a.cc:10:9: error: 'result' was not declared in this scope
   10 |         result += '0';
      |         ^~~~~~
a.cc:22:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   22 |   cout << result << '\n';
      |   ^~~~
      |   std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:22:11: error: 'result' was not declared in this scope
   22 |   cout << result << '\n';
      |           ^~~~~~
Language: C++

#include <iostream>
using namespace std;

int main () {
  string A;
  string str;
  cin >> str;
  for (int i = 0; i < str.length(); i ++){
    if (str[i] == '0'){
      A[i] = '0';
    } else if (str[i] == '1'){
      A[i] = '1';
    } else if (str[i] == 'B'){
      A[i - 1] = "";
    }
   cout << A; 
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:18: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive]
   14 |       A[i - 1] = "";
      |                  ^~
      |                  |
      |                  const char*
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll mod=1000000007;
const int MAX_N = 1000;         // n の最大値
 
// nCk を取得
double nCk(int n, int k) {
double res=1.0;
for(int i=0; i<n; i++){
res*=0.5;}
for(int i=0; i<k; i++){
res*=(double)(n-i);
res/=(double)(k-i);
}
return res;}
 
int main() {
string s;
cin>>s;
ll n=s.size();
string ans;
char q;
for(ll i=0; i<n; i++){
if(s.at(i)=='0'){
ans+='0';}
else if(s.at(i)=='1'){
ans+='1';}
else if(ans.size()==0){
continue;}
else{
q=ans.at(ans.size()-1);
ans-=q;}}
cout<<ans<<endl;}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:4: error: no match for 'operator-=' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'char')
   34 | ans-=q;}}
      | ~~~^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll mod=1000000007;
const int MAX_N = 1000;         // n の最大値
 
// nCk を取得
double nCk(int n, int k) {
double res=1.0;
for(int i=0; i<n; i++){
res*=0.5;}
for(int i=0; i<k; i++){
res*=(double)(n-i);
res/=(double)(k-i);
}
return res;}
 
int main() {
string s;
cin>>s;
ll n=s.size();
string ans;
string q;
for(ll i=0; i<n; i++){
if(s.at(i)=='0'){
ans+='0';}
else if(s.at(i)=='1'){
ans+='1';}
else if(ans.size()==0){
continue;}
else{
q=ans.at(ans.size()-1);
ans-=q;}}
cout<<ans<<endl;}
cout<<ca<<endl;}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:4: error: no match for 'operator-=' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
   34 | ans-=q;}}
      | ~~~^~~
a.cc: At global scope:
a.cc:36:1: error: 'cout' does not name a type
   36 | cout<<ca<<endl;}
      | ^~~~
a.cc:36:16: error: expected declaration before '}' token
   36 | cout<<ca<<endl;}
      |                ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll mod=1000000007;
const int MAX_N = 1000;         // n の最大値
 
// nCk を取得
double nCk(int n, int k) {
double res=1.0;
for(int i=0; i<n; i++){
res*=0.5;}
for(int i=0; i<k; i++){
res*=(double)(n-i);
res/=(double)(k-i);
}
return res;}
 
int main() {
string s;
cin>>s;
ll n=s.size();
string ans;
for(ll i=0; i<n; i++){
if(s.at(i)=='0'){
ans+='0';}
else if(s.at(i)=='1'){
ans+='1';}
else if(ans.size()==0){
continue;}
else{
ans-=ans.at(ans.size()-1);}}
cout<<ans<<endl;}
cout<<ca<<endl;}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:4: error: no match for 'operator-=' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'})
   32 | ans-=ans.at(ans.size()-1);}}
      | ~~~^~~~~~~~~~~~~~~~~~~~~~
a.cc: At global scope:
a.cc:34:1: error: 'cout' does not name a type
   34 | cout<<ca<<endl;}
      | ^~~~
a.cc:34:16: error: expected declaration before '}' token
   34 | cout<<ca<<endl;}
      |                ^
Language: Java

import java.util.Scanner;

public class UnhappyHacking {
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scn = new Scanner(System.in);
		String s = scn.nextLine();
		if (s.isEmpty()) {
			System.out.println("");
		} else {
			String ans = "";
			boolean check = true;
			for (int i = 0; i < s.length(); i++) {
				char ch1 = s.charAt(i);
				if (i > 0 && ch1 == 'B') {
					if (!ans.isEmpty())
						ans = ans.substring(0, ans.length() - 1);
					if (ans.isEmpty()) {
						ans = "";
					}
				} else {
					if (ch1 != 'B')
						ans += ch1;
				}
			}
			if (check) {
				System.out.println(ans);
			}
		}
	}
}

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

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;
const long long INF=1e9+5;
const string alp="abcdefghijklmnopqrstuvwxyg"; //26
const string ALP="ABCDEFGHIJKLMNOPQRSTUVWXYG";
typedef long long ll;

int main() {
  string s;
  cin>>s;
  vector<char> vec;
  for(int i=0;i<s.size();i++){
    if(s[i]=='0'){
      vec.push_back('0');
    }
    else if(s[i]=='1'){
      vec.push_back('1');
    }
    else{
      if(!vec.empty()){
        vec.pop();
      }
    }
  }
  string ans;
  for(int i=0;i<vec.size();i++){
    ans+=vec.at(i);
  }
  cout<<ans<<endl;
      
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:13: error: 'class std::vector<char>' has no member named 'pop'
   23 |         vec.pop();
      |             ^~~
Language: C++

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

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

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

#include <bits/stdc++.h>
#include <math.h>
#define rep(i,n) for (int i=0;i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;

int main() {
    stack<char> s;
    string S,ans="";
    cin >> S;
    rep(i,S.size()){
        if(S[i]=='B'&&ans.size()!=0){
            ans.back() = "";
        } else {
            ans += S[i];
        }
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:26: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive]
   14 |             ans.back() = "";
      |                          ^~
      |                          |
      |                          const char*
Language: Java

import java.util.Scanner;
public class Solution
{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		String str = sc.nextLine();
		String ans = "";

		for (int i=0;i<str.length();i++)
		{
			char c = str.charAt(i);
			if (c=='0')
				ans = ans+'0';
			else if (c=='1')
				ans = ans+'1';
			else if (c=='B')
			{
				if (str.length()==0)
					continue;
				else
					str = str.substring(0,str.length());
			}
		}

		System.out.print(res);
	}
}

Compiler output:
Main.java:2: error: class Solution is public, should be declared in a file named Solution.java
public class Solution
       ^
Main.java:26: error: cannot find symbol
		System.out.print(res);
		                 ^
  symbol:   variable res
  location: class Solution
2 errors
Language: C++

#include <stdio.h>
#include <cstring>
char s[11];
char result[11];
int main()
{
	scanf("%s",s);

	for (int i=0;i<strlen(s);i++)
	{
		char c = s[i];

		if (c=='1')
			result[i] = '1';
		else if (c=='0')
			result[i] = '0';
		else
			i=max(0,i--);
	}

	printf("%s",result);

}

int max(int x, int y)
{
	if (x>=y)
		return x
	else 
		return y;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:27: error: 'max' was not declared in this scope
   18 |                         i=max(0,i--);
      |                           ^~~
a.cc: In function 'int max(int, int)':
a.cc:28:25: error: expected ';' before 'else'
   28 |                 return x
      |                         ^
      |                         ;
   29 |         else
      |         ~~~~
Language: C++

#include <stdio.h>
#include <cstring>
char s[11];
char result[11];
int main()
{
	scanf("%s",s);

	for (int i=0;i<strlen(s);i++)
	{
		char c = s[i];

		if (c=='1')
			result[i] = '1';
		else if (c=='0')
			result[i] = '0';
		else
			i=max(0,i--);
	}

	printf("%s",result);


Compiler output:
a.cc: In function 'int main()':
a.cc:18:27: error: 'max' was not declared in this scope
   18 |                         i=max(0,i--);
      |                           ^~~
a.cc:21:29: error: expected '}' at end of input
   21 |         printf("%s",result);
      |                             ^
a.cc:6:1: note: to match this '{'
    6 | {
      | ^
Language: C++


using namespace std;

int main()
{
	string input;
	vector<int> output(0);
	cin >> input;


	for (int i = 0; i < input.size(); i++) {
		switch (input.at(i)) {
		case '0':	output.push_back(0);	break;
		case '1':	output.push_back(1);	break;
		case 'B':	if (output.empty());
            		else output.pop_back();	break;
		}
	}
	for (int i : output)
		cout << i;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:9: error: 'string' was not declared in this scope
    6 |         string input;
      |         ^~~~~~
a.cc:1:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
  +++ |+#include <string>
    1 | 
a.cc:7:9: error: 'vector' was not declared in this scope
    7 |         vector<int> output(0);
      |         ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
  +++ |+#include <vector>
    1 | 
a.cc:7:16: error: expected primary-expression before 'int'
    7 |         vector<int> output(0);
      |                ^~~
a.cc:8:9: error: 'cin' was not declared in this scope
    8 |         cin >> input;
      |         ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | 
a.cc:8:16: error: 'input' was not declared in this scope; did you mean 'int'?
    8 |         cin >> input;
      |                ^~~~~
      |                int
a.cc:13:33: error: 'output' was not declared in this scope
   13 |                 case '0':       output.push_back(0);    break;
      |                                 ^~~~~~
a.cc:19:22: error: 'output' was not declared in this scope
   19 |         for (int i : output)
      |                      ^~~~~~
a.cc:20:17: error: 'cout' was not declared in this scope
   20 |                 cout << i;
      |                 ^~~~
a.cc:20:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++


using namespace std;

int main()
{
	string input;
	vector<int> output(0);
	cin >> input;


	for (int i = 0; i < input.size(); i++) {
		switch (input.at(i)) {
		case '0':	output.push_back(0);	break;
		case '1':	output.push_back(1);	break;
		case 'B':	output.pop_back();	break;
		}
	}
	for (int i : output)
		cout << i;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:9: error: 'string' was not declared in this scope
    6 |         string input;
      |         ^~~~~~
a.cc:1:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
  +++ |+#include <string>
    1 | 
a.cc:7:9: error: 'vector' was not declared in this scope
    7 |         vector<int> output(0);
      |         ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
  +++ |+#include <vector>
    1 | 
a.cc:7:16: error: expected primary-expression before 'int'
    7 |         vector<int> output(0);
      |                ^~~
a.cc:8:9: error: 'cin' was not declared in this scope
    8 |         cin >> input;
      |         ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | 
a.cc:8:16: error: 'input' was not declared in this scope; did you mean 'int'?
    8 |         cin >> input;
      |                ^~~~~
      |                int
a.cc:13:33: error: 'output' was not declared in this scope
   13 |                 case '0':       output.push_back(0);    break;
      |                                 ^~~~~~
a.cc:18:22: error: 'output' was not declared in this scope
   18 |         for (int i : output)
      |                      ^~~~~~
a.cc:19:17: error: 'cout' was not declared in this scope
   19 |                 cout << i;
      |                 ^~~~
a.cc:19:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

void solve() {
	string s;
	cin >> s;
	
	for(char c: s) {
		if(c == 'B') {
			ans = ans.substr(0, ans.length()-1);
		} else { 
			ans += c;
		}
	}
	cout << ans << endl;
 		
}
		
			
		

int32_t main() {
	IOS;
	solve();
	return 0;
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:14:25: error: 'ans' was not declared in this scope; did you mean 'abs'?
   14 |                         ans = ans.substr(0, ans.length()-1);
      |                         ^~~
      |                         abs
a.cc:16:25: error: 'ans' was not declared in this scope; did you mean 'abs'?
   16 |                         ans += c;
      |                         ^~~
      |                         abs
a.cc:19:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   19 |         cout << ans << endl;
      |                 ^~~
      |                 abs
Language: C++

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

int main() {
  string s,S;
  cin >> s ;
  
  for(int i=0;i<s.size();i++){
    if(s.at(i) == '0'){
      S = S + '0';
    }
    
    else if(s,at(i) == '1'){
      S = S + '1';
    }
    
    else{
      S.erase(S.size()--);
    }
  }
  
  cout << S << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:15: error: 'at' was not declared in this scope
   13 |     else if(s,at(i) == '1'){
      |               ^~
a.cc:18:21: error: lvalue required as decrement operand
   18 |       S.erase(S.size()--);
      |               ~~~~~~^~
Language: C++

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

int main() {
  string s,S;
  cin >> s ;
  
  for(int i=0;i<s.size();i++){
    if(s.at(i) == '0'){
      S = S + '0';
    }
    
    else if(s,at(i) == '1'){
      S = S + '1';
    }
    
    else{
      S.erase(S.size()--) = '';
    }
  }
  
  cout << S << endl;
}


Compiler output:
a.cc:18:29: error: empty character constant
   18 |       S.erase(S.size()--) = '';
      |                             ^~
a.cc: In function 'int main()':
a.cc:13:15: error: 'at' was not declared in this scope
   13 |     else if(s,at(i) == '1'){
      |               ^~
a.cc:18:21: error: lvalue required as decrement operand
   18 |       S.erase(S.size()--) = '';
      |               ~~~~~~^~