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

#include<stdio.h>
int main()
{
	char s[i];
	scanf("%c%c%c%c",s[i]);
	for(i=0;i<4;i++)
	{
	if(char s[i]==0)
		printf("%c",s[i]);
		if(char s[i]==1)
		printf("%c",s[i]);
		if(char s[i]==B)
		{
			s[i-1]='\0';
			}
	}
	return 0;
}


Compiler output:
main.c: In function 'main':
main.c:4:16: error: 'i' undeclared (first use in this function)
    4 |         char s[i];
      |                ^
main.c:4:16: note: each undeclared identifier is reported only once for each function it appears in
main.c:8:12: error: expected expression before 'char'
    8 |         if(char s[i]==0)
      |            ^~~~
main.c:10:20: error: expected expression before 'char'
   10 |                 if(char s[i]==1)
      |                    ^~~~
main.c:12:20: error: expected expression before 'char'
   12 |                 if(char s[i]==B)
      |                    ^~~~
Language: C++

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

int main()
{
    char s[12];
    int i,j,len,num;
    stack<char>str;
    getchar();
    gets(s);
    len=strlen(s);
    for(i=0;i<len;i++){
        if(str.empty()==false && s[i]==' ') str.pop();
        else str.push(s[i]);
    }
    while(str.empty()==false){
        cout<<str.top();
        str.pop();
    }
    cout<<endl;
}


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

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

int main()
{
    char s[130];
    int i,j,len,num;
    stack<char>str;
    gets(s);
    len=strlen(s);
    for(i=0;i<len;i++){
        if(str.empty()==false && s[i]==' ') str.pop();
        else str.push(s[i]);
    }
    while(str.empty()==false){
        cout<<str.top();
        str.pop();
    }
    cout<<endl;
}


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

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String s = sc.nextLine();
		
		char[] c = s.toCharArray();
		
		StringBuilder sb = new StringBuilder();
		for (int i=0; i<c.length; i++) {
			if (c[i] == '0' | c[i] == '1') {
				sb.append(c[i]);
			} else if (c[i] == 'B') {
				sb.delete(sb.length(), sb.length());
			}
		}
		
		System.out.println(sb.toString());
	}

}

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

#include <iostream>      // cout, endl, cin
#include <string>        // string, to_string, stoi
#include <vector>        // vector
#include <algorithm>     // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility>       // pair, make_pair
#include <tuple>         // tuple, make_tuple
#include <cstdint>       // int64_t, int*_t
#include <cstdio>        // printf
#include <map>           // map
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <deque>         // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset>        // bitset
#include <cmath>
#include <limits>
typedef long long ll;
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define mod 1000000007
#define fst first
#define pb push_back

//ユークリッドの互除法
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x;}


int main() {
	string s;
	cin >> s;
	vector<char> key;
	for (int i = 0; i < s.length(); i++) {
		if (s[i] == '0') {
			key[i] == s[i];
		}
		else if (s[i] == '1') {
			key[i] == s[i];
		}
		else if (s[i] == 'B' && !key.empty()) {
			key.pop_back;
		}
	}
	string ans(key.begin(), key.end());
	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:42:29: error: invalid use of non-static member function 'void std::vector<_Tp, _Alloc>::pop_back() [with _Tp = char; _Alloc = std::allocator<char>]'
   42 |                         key.pop_back;
      |                         ~~~~^~~~~~~~
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_vector.h:1324:7: note: declared here
 1324 |       pop_back() _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int main(){
  string s;
  cin >> s;
  
  string ans = "";
  for(int i = 0; i < s.size(); i++){
    char c = s[i];
    if(c == '0') ans.push_back('0');
    else if(c == '1') ans.push_back('1');
    else if(c == 'B'){
      if(s.size >= 1) ans.pop_back();
      else;
    }else;
  }
  cout << ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:12: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
   16 |       if(s.size >= 1) ans.pop_back();
      |          ~~^~~~
      |                ()
Language: C++

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

int int_len(int n) {
  int s=0;
  while(n!=0) s++, n/=10;
  return s;
}

int int_sum(int n) {
  int m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10;
  return m;
}






int gcd(int a,int b)
{
 
  int r, tmp;
 
  
 
  /* 自然数 a > b を確認・入替 */
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
 
  /* ユークリッドの互除法 */
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
 
 
 
  return b;
}







int fac(int n){
  int m=1;
  while(n>=1) m*=n,n--;
  return m;
}

int vec_sum(vector<int> v){
  int n=0;
  for(int i=0;i<v.size();i++) n+=v[i];
  return n;
}
///////////////////////////
int main() {
  string s;
  cin>>s;
  vector<char> v;
  rep(i,s.size()){
    if(i=='0'){
      v.push_back(0);
    }
    if(i=='1'){
      v.push_back(1);
    }
     if(i=='B'){
       if(v.size()>=1) v.pop_back();
    }
  }
  rep(i,n){
    cout<<v[i];
  }
  cout<<endl;
  
}
///////////////////////////

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

import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    int len = s.length();
    String fs;
    String ls = "";
    int lslen = 0;

    for(int i;i < len;i++){
      fs = s.substring(0,1);
      if(fs.equals("0") || fs.equals("1")){
        ls = ls + fs;
      }else if(fs.equals("B")){
        if(!(ls.equals(""))){
          lslen = ls.length();
          lslen -= 1;
          ls = ls.substring(0,lslen);
        }
      }
    }
    System.out.println(ls);
  }
}

Compiler output:
Main.java:12: error: variable i might not have been initialized
    for(int i;i < len;i++){
              ^
1 error
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int INF=1e9;

int main(){
    string s;
    cin>>s;
    string ans="";
    for(char c:s){
        if(c!='B')ans+=c;
        else if(ans.size()ans.pop_back();
    }
    cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:27: error: expected ';' before 'ans'
   13 |         else if(ans.size()ans.pop_back();
      |                           ^~~
      |                           ;
a.cc:13:25: warning: ignoring return value of 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]', declared with attribute 'nodiscard' [-Wunused-result]
   13 |         else if(ans.size()ans.pop_back();
      |                 ~~~~~~~~^~
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:1076:7: note: declared here
 1076 |       size() const _GLIBCXX_NOEXCEPT
      |       ^~~~
a.cc:14:5: error: expected primary-expression before '}' token
   14 |     }
      |     ^
a.cc:13:42: error: expected ')' before '}' token
   13 |         else if(ans.size()ans.pop_back();
      |                ~                         ^
      |                                          )
   14 |     }
      |     ~                                     
a.cc:14:5: error: expected primary-expression before '}' token
   14 |     }
      |     ^
Language: C++

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

int int_len(int n) {
  int s=0;
  while(n!=0) s++, n/=10;
  return s;
}

int int_sum(int n) {
  int m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10;
  return m;
}

long long int fac(long long int n){
  long long int m=1;
  while(n>=1) m*=n,m%=1000000007,n--;
  return m;
}

int vec_sum(vector<int> v){
  int n=0;
  for(int i=0;i<v.size();i++) n+=v[i];
  return n;
}
///////////////////////////
int main() {
  string s;
  cin>>s;
  vector<char> v;
  for(char i:s){
    if(i=='B'){
      v.pop();
    }else{
      v.push_back(i);
    }
  }
  rep(i,v.size()) cout<<v[i];
  cout<<endl;
}
///////////////////////////




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

#include <bits/stdc++.h>
using namespace std;
#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++)
typedef long long ll;

int main() {
    vector<char> ans;
    string s;
    cin >> s;
    for (int i  =0; i < s.length(); i++){
        if (S[i] == '0' || S[i] == '1'){
            ans.push_back(s[i]);
        }
        else {
            ans.pop_back();
        }
    }
    for (int i = 0; i < ans.size(); i++){
        cout << ans[i] << endl;
    }
}


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

#include<bits/stdc++.h>

#define REPI(i, n) for(int i = 0; i < n; i++)
#define REPJ(j, n) for(int j = 0; j < n; j++)

using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
#include<bits/stdc++.h>

#define REPI(i, n) for(int i = 0; i < n; i++)
#define REPJ(j, n) for(int j = 0; j < n; j++)

using namespace std;

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

    string s;
    char c;
    while(cin >> c){
        if(c !='B') s += c;
        else if(s !="") s.pop_back();
   } 
}
   string s; cin >> s;
    REPI(i, s.length()){
        if(s[i + 1] != 'B' && s[i] != 'B') cout << s[i];
   } 
}


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

s = input()
ans = ''
for i in range(len(s)):
    if s[i] == 'B' and ans != '':
        ans = ans[:-1]
    elif s[i] == 'B' and ans == '':
        continue
    else:
        ans += s[i]
print(ans)

Compiler output:
a.cc:2:7: error: empty character constant
    2 | ans = ''
      |       ^~
a.cc:4:31: error: empty character constant
    4 |     if s[i] == 'B' and ans != '':
      |                               ^~
a.cc:6:33: error: empty character constant
    6 |     elif s[i] == 'B' and ans == '':
      |                                 ^~
a.cc:1:1: error: 's' does not name a type
    1 | s = input()
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
string s="";
int main(){
  cin>>s;
  ans="";
  for(int i=0;i<s.zize();i++){
    if(s[i]=='0'){ans.append("0");}
    if(s[i]=='1'){ans.append("1");}
    if((s[i]=='B')&&(ans.empty())){ans.replace(ans.size()-1, 1, "");}
  }
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:3: error: 'ans' was not declared in this scope; did you mean 'abs'?
    6 |   ans="";
      |   ^~~
      |   abs
a.cc:7:19: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'zize'; did you mean 'size'?
    7 |   for(int i=0;i<s.zize();i++){
      |                   ^~~~
      |                   size
Language: C++

#include<bits/stdc++.h>
using namespace std;
int a[10],x;
char c;
inline int main()
{
    while(cin>>c&&c!='\0')
    {
        if(c=='0') a[x++]=0;
        else if(c=='1') a[x++]=1;
        else
        {
            if(x) x--;
        }
    }
    if(x)
    {
        for(int i=0;i<x;i++) printf("%d",a[i]);
        printf("\n"); 
    }
    return (0-0);
}

Compiler output:
a.cc:5:1: error: cannot declare '::main' to be inline
    5 | inline int main()
      | ^~~~~~
Language: C++

#include<iostream>
#include<string>
using namspace std;
int main()
{
  string s;
  cin >>s;
  string temp = "";
  int k = 0;
  for(int i = 0;i<s.length();i++)
  {
    if(s[i] == '0' || s[i] == '1')
    {
      temp = temp+s[i];
      k++;
    }
    if(s[i] == 'B')
    {
      if(temp.empty())
        continue;
      
      temp = temp.substr(0,k-1);
      k--;
    }
  }
  cout<<temp;
  return 0;
}

Compiler output:
a.cc:3:7: error: expected nested-name-specifier before 'namspace'
    3 | using namspace std;
      |       ^~~~~~~~
a.cc: In function 'int main()':
a.cc:6:3: error: 'string' was not declared in this scope
    6 |   string s;
      |   ^~~~~~
a.cc:6: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:7:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    7 |   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:7:9: error: 's' was not declared in this scope
    7 |   cin >>s;
      |         ^
a.cc:8:9: error: expected ';' before 'temp'
    8 |   string temp = "";
      |         ^~~~~
      |         ;
a.cc:14:7: error: 'temp' was not declared in this scope; did you mean 'tm'?
   14 |       temp = temp+s[i];
      |       ^~~~
      |       tm
a.cc:19:10: error: 'temp' was not declared in this scope; did you mean 'tm'?
   19 |       if(temp.empty())
      |          ^~~~
      |          tm
a.cc:22:7: error: 'temp' was not declared in this scope; did you mean 'tm'?
   22 |       temp = temp.substr(0,k-1);
      |       ^~~~
      |       tm
a.cc:26:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   26 |   cout<<temp;
      |   ^~~~
      |   std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:26:9: error: 'temp' was not declared in this scope; did you mean 'tm'?
   26 |   cout<<temp;
      |         ^~~~
      |         tm
Language: C++

#include<bits/stdc++.h>
using namespace std;
 
int main(){
  string s;
  cin >> s;
  string ans = "";
  for(int i = 0; s.size(); i++){
    if(s.at(i)=='0') ans += '0';
    if(s.at(i)=='1') ans += '1';
    if(s.at(i)=='B' && ans.size()>0) ans.push_buck();
  }
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:42: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'push_buck'; did you mean 'push_back'?
   11 |     if(s.at(i)=='B' && ans.size()>0) ans.push_buck();
      |                                          ^~~~~~~~~
      |                                          push_back
Language: C++

#include<bits/stdc++.h>
using namespace std;
 
int main(){
  string s;
  cin >> s;
  string ans = "";
  for(int i = 0; s.size(); i++){
    if(s.at(i)=='0') ans += '0';
    if(s.at(i)=='1') ans += '1';
    if(s.at(i)=='B' && ans.size()>0) ans.pop_buck();
  }
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:42: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'pop_buck'; did you mean 'pop_back'?
   11 |     if(s.at(i)=='B' && ans.size()>0) ans.pop_buck();
      |                                          ^~~~~~~~
      |                                          pop_back
Language: C++

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

int main(){
  string s;
  cin >>s;
  
  int len = s.size();
  string ans;
  
  repeat(i,0,len){
    if(s[i]=='0') ans += '0';
    else if(s[i]=='1') ans += '1';
    else if(s[i]=='B' and ans.size()!=0) ans.erase(ans.end()-1,1);
  }
     
  cout <<ans<< endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:51: error: no matching function for call to 'std::__cxx11::basic_string<char>::erase(__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >, int)'
   15 |     else if(s[i]=='B' and ans.size()!=0) ans.erase(ans.end()-1,1);
      |                                          ~~~~~~~~~^~~~~~~~~~~~~~~
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:2114:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::erase(size_type, size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
 2114 |       erase(size_type __pos = 0, size_type __n = npos)
      |       ^~~~~
/usr/include/c++/14/bits/basic_string.h:2114:23: note:   no known conversion for argument 1 from '__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >' to 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'}
 2114 |       erase(size_type __pos = 0, size_type __n = npos)
      |             ~~~~~~~~~~^~~~~~~~~
/usr/include/c++/14/bits/basic_string.h:2134:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::iterator std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::erase(__const_iterator) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; iterator = std::__cxx11::basic_string<char>::iterator; __const_iterator = std::__cxx11::basic_string<char>::const_iterator]'
 2134 |       erase(__const_iterator __position)
      |       ^~~~~
/usr/include/c++/14/bits/basic_string.h:2134:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/basic_string.h:2154:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::iterator std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::erase(__const_iterator, __const_iterator) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; iterator = std::__cxx11::basic_string<char>::iterator; __const_iterator = std::__cxx11::basic_string<char>::const_iterator]'
 2154 |       erase(__const_iterator __first, __const_iterator __last)
      |       ^~~~~
/usr/include/c++/14/bits/basic_string.h:2154:56: note:   no known conversion for argument 2 from 'int' to 'std::__cxx11::basic_string<char>::__const_iterator' {aka 'std::__cxx11::basic_string<char>::const_iterator'}
 2154 |       erase(__const_iterator __first, __const_iterator __last)
      |                                       ~~~~~~~~~~~~~~~~~^~~~~~
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <map>
#include <set>

using namespace std;

string s;
vector<char> d;

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> s;
    for (int i = 0; i < s.size(); i++)
    {
        if (s[i] != 'B')
        {
            d.push_back(s[i]);
        }
        else
        {
            if (s[i].size())
            {
                d.pop_back();
            }
        }
    }
    for (int i = 0; i < d.size(); i++)
        cout << d[i];
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:22: error: request for member 'size' in 's.std::__cxx11::basic_string<char>::operator[](((std::__cxx11::basic_string<char>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
   29 |             if (s[i].size())
      |                      ^~~~
Language: C++

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

int main () {
  string s;

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


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

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

int main () {
  string s;

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


Compiler output:
a.cc: In function 'int main()':
a.cc:20:14: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
   20 |       if(ans.size != 0){
      |          ~~~~^~~~
      |                  ()
a.cc:21:35: error: expected ';' before '}' token
   21 |         ans.erase(ans.size()-1, 1)
      |                                   ^
      |                                   ;
   22 |       }
      |       ~
Language: C++

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

string s;

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


Compiler output:
a.cc: In function 'int main()':
a.cc:20:14: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
   20 |       if(ans.size != 0){
      |          ~~~~^~~~
      |                  ()
a.cc:21:35: error: expected ';' before '}' token
   21 |         ans.erase(ans.size()-1, 1)
      |                                   ^
      |                                   ;
   22 |       }
      |       ~
Language: C++

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

string s;

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


Compiler output:
a.cc: In function 'int main()':
a.cc:15:14: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
   15 |       if(ans.size != 0){
      |          ~~~~^~~~
      |                  ()
a.cc:16:35: error: expected ';' before '}' token
   16 |         ans.erase(ans.size()-1, 1)
      |                                   ^
      |                                   ;
   17 |       }
      |       ~
Language: C++

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

string s, ans = "";

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

Compiler output:
a.cc: In function 'int main()':
a.cc:14:14: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
   14 |       if(ans.size != 0){
      |          ~~~~^~~~
      |                  ()
a.cc:15:35: error: expected ';' before '}' token
   15 |         ans.erase(ans.size()-1, 1)
      |                                   ^
      |                                   ;
   16 |       }
      |       ~
Language: C++

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

string s, ans = "";

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

Compiler output:
a.cc: In function 'int main()':
a.cc:9:17: error: cannot convert 'std::__cxx11::basic_string<char>::empty' from type 'bool (std::__cxx11::basic_string<char>::)() const noexcept' to type 'bool'
    9 |     if(ans.empty){
      |                 ^
a.cc:22:34: error: expected ';' before '}' token
   22 |         ans.erase(ans.size()-1,1)
      |                                  ^
      |                                  ;
   23 |       }
      |       ~
Language: C++

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

string s, ans;

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

Compiler output:
a.cc: In function 'int main()':
a.cc:8:38: error: expected ';' before ')' token
    8 |   for (int i = 0; i < s.length(), i++){
      |                                      ^
      |                                      ;
a.cc:15:42: error: expected ';' before '}' token
   15 |         ans.erase(ans.end()-1, ans.end())
      |                                          ^
      |                                          ;
   16 |       }
      |       ~
Language: C++

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

string s;

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

Compiler output:
a.cc: In function 'int main()':
a.cc:13:19: error: expected ';' before ':' token
   13 |         ans += "0":
      |                   ^
      |                   ;
a.cc:18:33: error: expected ';' before '}' token
   18 |         ans.erase(ans.size(), 1)
      |                                 ^
      |                                 ;
   19 |       }
      |       ~
Language: C++

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

string s;

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

Compiler output:
a.cc: In function 'int main()':
a.cc:10:38: error: expected ';' before ')' token
   10 |   for (int i = 0; i < s.length(), i++){
      |                                      ^
      |                                      ;
a.cc:13:19: error: expected ';' before ':' token
   13 |         ans += "0":
      |                   ^
      |                   ;
a.cc:18:33: error: expected ';' before '}' token
   18 |         ans.erase(ans.size(), 1)
      |                                 ^
      |                                 ;
   19 |       }
      |       ~
Language: C++

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

string s;

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

Compiler output:
a.cc: In function 'int main()':
a.cc:10:38: error: expected ';' before ')' token
   10 |   for (int i = 0; i < s.length(), i++){
      |                                      ^
      |                                      ;
a.cc:13:19: error: expected ';' before ':' token
   13 |         ans += "0":
      |                   ^
      |                   ;
a.cc:18:33: error: expected ';' before '}' token
   18 |         ans.erase(ans.size(), 1)
      |                                 ^
      |                                 ;
   19 |       }
      |       ~
Language: C++

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

string s;

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

Compiler output:
a.cc: In function 'int main()':
a.cc:10:38: error: expected ';' before ')' token
   10 |   for (int i = 0; i < s.length(), i++){
      |                                      ^
      |                                      ;
a.cc:13:19: error: expected ';' before ':' token
   13 |         ans += '0':
      |                   ^
      |                   ;
a.cc:18:33: error: expected ';' before '}' token
   18 |         ans.erase(ans.size(), 1)
      |                                 ^
      |                                 ;
   19 |       }
      |       ~
Language: C++

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

string s;

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

Compiler output:
a.cc: In function 'int main()':
a.cc:10:38: error: expected ';' before ')' token
   10 |   for (int i = 0; i < s.length(), i++){
      |                                      ^
      |                                      ;
a.cc:13:19: error: expected ';' before ':' token
   13 |         ans += '0':
      |                   ^
      |                   ;
a.cc:18:33: error: expected ';' before '}' token
   18 |         ans.erase(ans.size(), 1)
      |                                 ^
      |                                 ;
   19 |       }
      |       ~
Language: C++

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

int main() {
  string S;
  cin >> S;
  stack<char> ans;
  for (int i = 0; i < S.length(); i++) {
    if (S[i] == '0') {
      ans.push('0');
    }
    else if (S[i] == '1') {
      ans.push('1');
    }
    else {
      ans.pop();
    }
  }
  for (int i = 0; i < ans.size(); i++) {
    cout << ans[i];
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:16: error: no match for 'operator[]' (operand types are 'std::stack<char>' and 'int')
   20 |     cout << ans[i];
      |                ^
Language: Java

import java.util.Scanner;
import java.util.LinkedList;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
  	LinkedList<Character> stack = new LinkedList<>();
    String s = sc.next();
    String res = "";
    
    for (int i = 0; i < s.length(); i++) {
    	if (s.charAt(i) == 'B') {
          if (!stack.isEmpty()) {
          	stack.pop();
          }
        } else {
        	stack.push(s.charAt(i);
        }
    }
                       
    while (!stack.isEmpty()) {
      res = stack.pop() + res;
    }
                       
    System.out.println(res);
  }
}

Compiler output:
Main.java:18: error: ')' or ',' expected
        	stack.push(s.charAt(i);
        	                      ^
1 error
Language: C++

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


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

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


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

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

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

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

int main() {
  string  S;
  cin >> S;
  
  vector<char> A(S.size());
  
    for (int i = 0 ;i <S.size()  ;i++);
  
  string a = " ";
   
      for (int i = 0; i < S.size() ; i++) {
        
        if( A.at(i) = 0){
             a += '0';
        }
          
        else if ( A.at(i) = 1){
             a += '1';
         }
        else if (A.at(i) = 'B'){
             a.at(a.size()-1) =' '
        }
      }
          cout << a << endl;
}
            
          
          
        


Compiler output:
a.cc: In function 'int main()':
a.cc:24:35: error: expected ';' before '}' token
   24 |              a.at(a.size()-1) =' '
      |                                   ^
      |                                   ;
   25 |         }
      |         ~
Language: C++

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

int main() {
  string  S;
  cin >> S;
  
  vector<char> A(S.size());
  
    for (int i = 0 ;i <S.size()  ;i++);
  
  string a = " ";
   
      for (int i = 0; i < S.size() ; i++) {
        
        if( A.at(i) == 0){
             a += '0';
        }
          
        else if ( A.at(i) == 1){
             a += '1';
         }
        else if (A.at(i) == 'B'){
             a.at(a.size()) = " "
        }
      }
          cout << a << endl;
}
            
          
          
        


Compiler output:
a.cc: In function 'int main()':
a.cc:24:31: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive]
   24 |              a.at(a.size()) = " "
      |                               ^~~
      |                               |
      |                               const char*
a.cc:24:34: error: expected ';' before '}' token
   24 |              a.at(a.size()) = " "
      |                                  ^
      |                                  ;
   25 |         }
      |         ~
Language: C++

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

int main() {
  string  S;
  cin >> S;
  
  vector<char> A(S.size());
  
    for (int i = 0 ;i <S.size()  ;i++);
  
  string a = " ";
   
      for (int i = 0; i < S.size() ; i++) {
        
        if( A.at(i) == 0){
             a += '0';
        }
          
        else if ( A.at(i) == 1){
             a += '1';
         }
        else if (A.at(i) == 'B'){
             a.at(a.size()) == " "
        }
      }
          cout << a << endl;
}
            
          
          
        


Compiler output:
a.cc: In function 'int main()':
a.cc:24:29: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   24 |              a.at(a.size()) == " "
      |              ~~~~~~~~~~~~~~~^~~~~~
a.cc:24:35: error: expected ';' before '}' token
   24 |              a.at(a.size()) == " "
      |                                   ^
      |                                   ;
   25 |         }
      |         ~
Language: C++

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

int main() {
  string  S;
  cin >> S;
  
  vector<char> A(S.size());
  
    for (int i = 0 ;i <S.size()  ;i++);
  
  string a = " ";
   
      for (int i = 0; i < S.size() ; i++) {
        
        if( A.at(i) == 0){
             a += '0';
        }
          
        else if ( A.at(i) == 1){
             a += '1';
         }
        else if (A.at(i) == 'B'){
             a -= a.at(a.size())
        }
      }
}
            
          
          
        


Compiler output:
a.cc: In function 'int main()':
a.cc:24:16: 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'})
   24 |              a -= a.at(a.size())
      |              ~~^~~~~~~~~~~~~~~~~
Language: C++

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

int main() {
  string  S;
  cin >> S;
  
  vector<char> A(S.size());
  
    for (int i = 0 ;i <S.size()  ;i++);
  
  string a = " ";
   
      for (int i = 0; i < S.size() ; i++) {
        
        if( A.at(i) == 0){
             a += '0';
        }
          
        else if ( A.at(i) == 1){
             a += '1';
         }
        else if (A.at(i) == 'B'){
             a -= A.at(i)
        }
      }
}
            
          
          
        }
        }


Compiler output:
a.cc: In function 'int main()':
a.cc:24:16: 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'})
   24 |              a -= A.at(i)
      |              ~~^~~~~~~~~~
a.cc: At global scope:
a.cc:31:9: error: expected declaration before '}' token
   31 |         }
      |         ^
a.cc:32:9: error: expected declaration before '}' token
   32 |         }
      |         ^
Language: C++

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

int main() {
  strint s;
  cin >> s;
  int len = s.size();
  string answer = "";
  int counter = 0;
  for(int i = 0 ; i < len; ++i){
    if(s[i] == 'B'){
     if(counter > 0) --counter;
    } 
    else {
      ++counter;
      answer[counter-1] = s[i];
    }
  }
  for(int i = 0 ; i < counter; ++i)
    cout << answer[i];
  cout << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:3: error: 'strint' was not declared in this scope; did you mean 'strcat'?
    5 |   strint s;
      |   ^~~~~~
      |   strcat
a.cc:6:10: error: 's' was not declared in this scope
    6 |   cin >> s;
      |          ^
Language: C++

int main() {
  strint s;
  cin >> s;
  int len = s.size();
  string answer = "";
  int counter = 0;
  for(int i = 0 ; i < len; ++i){
    if(s[i] == 'B'){
     if(counter > 0) --counter;
    } 
    else {
      ++counter;
      answer[counter-1] = s[i];
    }
  }
  for(int i = 0 ; i < counter; ++i)
    cout << answer[i];
  cout << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:2:3: error: 'strint' was not declared in this scope; did you mean 'struct'?
    2 |   strint s;
      |   ^~~~~~
      |   struct
a.cc:3:3: error: 'cin' was not declared in this scope
    3 |   cin >> s;
      |   ^~~
a.cc:3:10: error: 's' was not declared in this scope
    3 |   cin >> s;
      |          ^
a.cc:5:3: error: 'string' was not declared in this scope
    5 |   string answer = "";
      |   ^~~~~~
a.cc:13:7: error: 'answer' was not declared in this scope
   13 |       answer[counter-1] = s[i];
      |       ^~~~~~
a.cc:17:5: error: 'cout' was not declared in this scope
   17 |     cout << answer[i];
      |     ^~~~
a.cc:17:13: error: 'answer' was not declared in this scope
   17 |     cout << answer[i];
      |             ^~~~~~
a.cc:18:3: error: 'cout' was not declared in this scope
   18 |   cout << endl;
      |   ^~~~
a.cc:18:11: error: 'endl' was not declared in this scope
   18 |   cout << endl;
      |           ^~~~
Language: C++

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

int main(){
  string s;
  cin >> s;
  vectorM<char> r;
  for(int i=0; i < s.size(); i++){
    if(s.at(i)==1){
      r.push_back(1);
    }
    else if(s.at(i)==0){
      r.push_back(0);
    }
    else if(s.at(i)=='B' && r.size()>0){
      r.pop_back();
    }
  }
  cout << r;
}
    

Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: 'vectorM' was not declared in this scope
    7 |   vectorM<char> r;
      |   ^~~~~~~
a.cc:7:11: error: expected primary-expression before 'char'
    7 |   vectorM<char> r;
      |           ^~~~
a.cc:10:7: error: 'r' was not declared in this scope
   10 |       r.push_back(1);
      |       ^
a.cc:13:7: error: 'r' was not declared in this scope
   13 |       r.push_back(0);
      |       ^
a.cc:15:29: error: 'r' was not declared in this scope
   15 |     else if(s.at(i)=='B' && r.size()>0){
      |                             ^
a.cc:19:11: error: 'r' was not declared in this scope
   19 |   cout << r;
      |           ^
Language: C++

#include <algorithm>
#include <iostream> //入出力
#include <stdio.h>
#include <map>
#include <set>
#include <string>
#include <math.h> //算術演算子
#include <vector>
#include <cstdlib>
#include <queue>
#include <stack>
#include <list>
#include <iomanip> //小数点以下を表示させる(setprecision())
// #include <bits/stdc++.h>
using namespace std;
typedef long long ll; //64bit型

#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(a) (a).begin(), (a).end()
#define debug(x) cerr << x << " " \
                      << "(L:" << __LINE__ << ")" << '\n'
#define PRINT(V)                                   \
        {                                          \
                for (int i = 0; i < V.size(); i++) \
                {                                  \
                        cout << V[i] << " ";       \
                }                                  \
                cout << endl;                      \
        }

int gcd(int a, int b)
{
        return b ? gcd(b, a % b) : a;
}

int main() //input->compute->output
{
        string N;
        cin >> N;

        string ans = "";

        rep(i, N.size())
        {
                if (N[i] == '0')
                {
                        ans += '0';
                }
                else if (N[i] == '1')
                {
                        ans += '1';
                }
                else
                {
                        if (ans.size()>0)
                        {
                                ans.pop_back;
                        } 
                }
        }
        cout << ans << endl;
        return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:57:37: error: invalid use of non-static member function 'void std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::pop_back() [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
   57 |                                 ans.pop_back;
      |                                 ~~~~^~~~~~~~
In file included from /usr/include/c++/14/string:54,
                 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:2:
/usr/include/c++/14/bits/basic_string.h:2174:7: note: declared here
 2174 |       pop_back() noexcept
      |       ^~~~~~~~