submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s068934166
p04030
C++
#include<cstring> #include<cstdio> int main(){ char key[100]; char s[100]; int x = 0; scanf("%s", key); for(int i=0; i>strlen(key); i++){ if(key[i] == "B"){ if(x != 0){ x--; } else{ s[x] = key[i]; x++; } } } printf("%s", s); return 0; }
a.cc: In function 'int main()': a.cc:10:15: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 10 | if(key[i] == "B"){ | ~~~~~~~^~~~~~
s566549626
p04030
C++
#include<cstring> #include<cstdio> int main(){ char key[100]; char s[100]; int x = 0; scanf("%s", key); for(int i=0; i>strlen(key); i++){ if(key[i]="B"){ if(x != 0){ x--; } else{ s[x] = key[i]; x++; } } } printf("%s", s); return 0; }
a.cc: In function 'int main()': a.cc:10:15: error: invalid conversion from 'const char*' to 'char' [-fpermissive] 10 | if(key[i]="B"){ | ^~~ | | | const char*
s018546834
p04030
C++
#include<cstdio> int main(){ char key[100]; char s[100]; int x = 0; scanf("%s", key); for(int i=0; i>strlen(key); i++){ if(key[i]="B"){ if(x != 0){ x--; } else{ s[x] = key[i]; x++; } } print("%s", s); return 0; }
a.cc: In function 'int main()': a.cc:8:18: error: 'strlen' was not declared in this scope 8 | for(int i=0; i>strlen(key); i++){ | ^~~~~~ a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 1 | #include<cstdio> +++ |+#include <cstring> 2 | int main(){ a.cc:9:15: error: invalid conversion from 'const char*' to 'char' [-fpermissive] 9 | if(key[i]="B"){ | ^~~ | | | const char* a.cc:18:3: error: 'print' was not declared in this scope; did you mean 'printf'? 18 | print("%s", s); | ^~~~~ | printf a.cc:21:2: error: expected '}' at end of input 21 | } | ^ a.cc:2:11: note: to match this '{' 2 | int main(){ | ^
s068041407
p04030
C++
#include <iostream> #include <string> #include <algorithm> using namespace std; char pop_back(char *str) { const int len = strlen(str); if( len == 0 ) { return '\0'; } else { char c = str[len-1]; str[len-1] = '\0'; return c; } } int main() { string s; cin >> s; string ans = ""; for(int i = 0; i < s.size(); i++) { if(s[i] == '0') { ans.push_back('0'); } else if(s[i] == '1') { ans.push_back('1'); } else { if(ans == "") { continue; } else { pop_back(ans); } } } cout << ans; cout << endl; return 0; }
a.cc: In function 'char pop_back(char*)': a.cc:8:21: error: 'strlen' was not declared in this scope 8 | const int len = strlen(str); | ^~~~~~ a.cc:4:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include <algorithm> +++ |+#include <cstring> 4 | using namespace std; a.cc: In function 'int main()': a.cc:35:26: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'char*' 35 | pop_back(ans); | ^~~ | | | std::string {aka std::__cxx11::basic_string<char>} a.cc:6:21: note: initializing argument 1 of 'char pop_back(char*)' 6 | char pop_back(char *str) | ~~~~~~^~~
s183201979
p04030
C++
#include <iostream> #include <string> #include <algorithm> using namespace std; int main() { string s; cin >> s; string ans = ""; for(int i = 0; i < s.size(); i++) { if(s[i] == '0') { ans.push_back('0'); } else if(s[i] == '1') { ans.push_back('1'); } else { if(ans == "") { continue; } else { ans.erase(ans.end(), 1); } } } cout << ans; cout << endl; return 0; }
a.cc: In function 'int main()': a.cc:23:26: error: no matching function for call to 'std::__cxx11::basic_string<char>::erase(std::__cxx11::basic_string<char>::iterator, int)' 23 | ans.erase(ans.end(), 1); | ~~~~~~~~~^~~~~~~~~~~~~~ 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: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 'std::__cxx11::basic_string<char>::iterator' 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) | ~~~~~~~~~~~~~~~~~^~~~~~
s667939976
p04030
C++
#include<bits/stdc++.h> using namespace std; int main(void) { cahr s[15]; char tmp; int i=0; while(cin>>tmp){ if(tmp=='B'){ if(i>0){ s[i-1]='\0'; i--; } } else{ s[i]=tmp; i++; } } for(inti=0;i<15;i++){ if(s[i]=='0'||s[i]=='1') cout<<s[i]; } cout<<endl; }
a.cc: In function 'int main()': a.cc:6:3: error: 'cahr' was not declared in this scope; did you mean 'char'? 6 | cahr s[15]; | ^~~~ | char a.cc:12:9: error: 's' was not declared in this scope 12 | s[i-1]='\0'; | ^ a.cc:17:7: error: 's' was not declared in this scope 17 | s[i]=tmp; | ^ a.cc:21:7: error: 'inti' was not declared in this scope; did you mean 'int'? 21 | for(inti=0;i<15;i++){ | ^~~~ | int a.cc:22:8: error: 's' was not declared in this scope 22 | if(s[i]=='0'||s[i]=='1') | ^
s021011798
p04030
C++
#include<bits/stdc++.h> using namespace std; int main(void) { char s[10]; char l[10]; cin>>s; for(int i=0;i<strlen(s);i++){ if(s[i]=='0') s.push_back('0'); if(s[i]=='1') s.push_back('1'); if(s[i]==' ') l[i-1]=' '; } cout<<l<<endl; }
a.cc: In function 'int main()': a.cc:12:9: error: request for member 'push_back' in 's', which is of non-class type 'char [10]' 12 | s.push_back('0'); | ^~~~~~~~~ a.cc:14:9: error: request for member 'push_back' in 's', which is of non-class type 'char [10]' 14 | s.push_back('1'); | ^~~~~~~~~
s625692765
p04030
C++
#include<bits/stdc++.h> using namespace std; int main(void) { string s; string l; cin>>s; for(int i=0;i<strlen(s);i++){ if(s[i]=='0') s.push_back('0'); if(s[i]=='1') s.push_back('1'); if(s[i]==' ') l[i-1]=' '; } cout<<l<<endl; }
a.cc: In function 'int main()': a.cc:9:24: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const char*' 9 | for(int i=0;i<strlen(s);i++){ | ^ | | | std::string {aka std::__cxx11::basic_string<char>} In file included from /usr/include/c++/14/cstring:43, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:121, from a.cc:1: /usr/include/string.h:407:35: note: initializing argument 1 of 'size_t strlen(const char*)' 407 | extern size_t strlen (const char *__s) | ~~~~~~~~~~~~^~~
s153832167
p04030
C++
#include<iostream> #include<string> using namespace std; int main(){ char s[15]; char tmp; int i = 0; while(cin >> tmp){ if(tmp=='B'){ if(i>0){ s[i-1] ='\0'; i--; } } else{ s[i] = tmp; i++; } } for(int i=0;i<15;i++){ if(s[i] == '0' || s[i] == '1'){ cout << s[i]; } cout << endl; }
a.cc: In function 'int main()': a.cc:29:2: error: expected '}' at end of input 29 | } | ^ a.cc:8:11: note: to match this '{' 8 | int main(){ | ^
s510121154
p04030
C++
#include<iostream> #include<cstdio> #include<vector> #include<queue> #include<map> #include<unordered_map> #include<stack> #include<string> #include<algorithm> #include<functional> #include<cstring> #include<utility> #include<bits/stdc++.h> #include<math.h> using namespace std; /**** Type Define ****/ typedef long long ll; typedef pair<ll, ll> P; typedef pair<ll, P> Q; /**** Const List ****/ const ll INF = 1LL << 60; const ll mod = 1000000007; const ll dx[4] = {1, 0, -1, 0}; const ll dy[4] = {0, -1, 0, 1}; /**** General Functions ****/ ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); } ll extgcd(ll a, ll b, ll& x, ll& y) { if (b == 0) { x = 1, y = 0; return a; } ll q = a/b, g = extgcd(b, a - q*b, x, y); ll z = x - q * y; x = y; y = z; return g; } ll invmod (ll a, ll m) { // a^-1 mod m ll x, y; extgcd(a, m, x, y); x %= m; if (x < 0) x += m; return x; } ll nCk(ll n, ll k, ll mod) { ll ans = 1; for (ll i = n, j = 1; j <= k; i--, j++) ans = (((ans * i) % mod) * invmod(j, mod)) % mod; return ans; } ll lmin(ll a, ll b) { return a > b ? b : a; }; ll lmax(ll a, ll b) { return a > b ? a : b; }; ll lsum(ll a, ll b) { return a + b; }; /**** Zip ****/ template <typename T> class Zip { vector<T> d; bool flag; public: Zip() { flag = false; } void add(T x) { d.push_back(x); flag = true; } ll getNum(T x) { // T need to have operator < !! if (flag) { sort(d.begin(), d.end()); d.erase(unique(d.begin(), d.end()), d.end()); flag = false; } return lower_bound(d.begin(), d.end(), x) - d.begin(); } ll size() { if (flag) { sort(d.begin(), d.end()); d.erase(unique(d.begin(), d.end()), d.end()); flag = false; } return (ll)d.size(); } }; /**** Union Find ****/ class UnionFind { vector<ll> par, rank; // par > 0: number, par < 0: -par public: void init(ll n) { par.resize(n, 1); rank.resize(n, 0); } ll getSize(ll x) { return par[find(x)]; } ll find(ll x) { if (par[x] > 0) return x; return -(par[x] = -find(-par[x])); } void merge(ll x, ll y) { x = find(x); y = find(y); if (x == y) return; if (rank[x] < rank[y]) { par[y] += par[x]; par[x] = -y; } else { par[x] += par[y]; par[y] = -x; if (rank[x] == rank[y]) rank[x]++; } } bool isSame(ll x, ll y) { return find(x) == find(y); } }; /**** Segment Tree ****/ template <typename T> class SegmentTree { ll n; vector<T> node; function<T(T, T)> fun, fun2; bool customChange; T outValue, initValue; public: void init(ll num, function<T(T, T)> resultFunction, T init, T out, function<T(T, T)> changeFunction = NULL) { // changeFunction: (input, beforevalue) => newvalue fun = resultFunction; fun2 = changeFunction; customChange = changeFunction != NULL; n = 1; while (n < num) n *= 2; node.resize(2 * n - 1, init); outValue = out; initValue = init; } void valueChange(ll num, T value) { num += n-1; if (customChange) node[num] = fun2(value, node[num]); else node[num] = value; while (num > 0) num = (num - 1) / 2, node[num] = fun(node[num * 2 + 1], node[num * 2 + 2]); } T rangeQuery(ll a, ll b, ll l = 0, ll r = -1, ll k = 0) { // [a, b) if (r == -1) r = n; if (a <= l && r <= b) return node[k]; if (b <= l || r <= a) return outValue; ll mid = (l + r) / 2; return fun(rangeQuery(a, b, l, mid, 2*k+1), rangeQuery(a, b, mid, r, 2*k+2)); } }; /**** LIS ****/ ll lis(ll* a, ll n, ll* dp) { fill(dp, dp + n, INF);//INFを代入 for (ll i = 0; i < n; i++) *lower_bound(dp, dp + n, a[i]) = a[i]; return (ll)(lower_bound(dp, dp + n, INF) - dp); } /**** main function ****/ string s; string ans; int main(){ cin>>s; for(int i=0;i<s.size();i++){ if(s[i]=='0'){ ans.push_back('0'); }else if(s[i]=='1'){ ans+=('1'); }else{ if(s.size()!=0)ans.pop_back() } } cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:188:36: error: expected ';' before '}' token 188 | if(s.size()!=0)ans.pop_back() | ^ | ; 189 | } | ~
s177201690
p04030
C++
#include <iostream> #include <string> #include <iomanip> #include <ios> using namespace std; int main(void){ string s; cin >> s; int n = s.length() string ans = ""; for(int i=0;i<n;i++){ if(s[i] == '0') ans += '0'; else if(s[i] == '1') ans += '1'; else{ if(ans.length()) ans = ans.substr(0,ans.length() - 1); } } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:11:3: error: expected ',' or ';' before 'string' 11 | string ans = ""; | ^~~~~~ a.cc:15:7: error: 'ans' was not declared in this scope; did you mean 'abs'? 15 | ans += '0'; | ^~~ | abs a.cc:17:7: error: 'ans' was not declared in this scope; did you mean 'abs'? 17 | ans += '1'; | ^~~ | abs a.cc:19:10: error: 'ans' was not declared in this scope; did you mean 'abs'? 19 | if(ans.length()) | ^~~ | abs a.cc:24:11: error: 'ans' was not declared in this scope; did you mean 'abs'? 24 | cout << ans << endl; | ^~~ | abs
s444228122
p04030
C++
#include <iostream> #include <string> #include <iomanip> #include <ios> using namespace std; int main(void){ string s; cin >> s; int n = s.length() string ans = ""; for(int i=0;i<n;i++){ if(s[i] == '0') s += '0'; else if(s[i] == '1') s += '1'; else{ if(ans.length()) ans = ans.substr(0,ans.length() - 1); } } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:11:3: error: expected ',' or ';' before 'string' 11 | string ans = ""; | ^~~~~~ a.cc:19:10: error: 'ans' was not declared in this scope; did you mean 'abs'? 19 | if(ans.length()) | ^~~ | abs a.cc:24:11: error: 'ans' was not declared in this scope; did you mean 'abs'? 24 | cout << ans << endl; | ^~~ | abs
s033343660
p04030
C++
#include<bits/stdc++.h> using namespace std; int main(void) { string s; cin>>s; string s1; for(int i=0;i<s.size();i++){ if(s[i]=='0') s1[i]='0'; if(s[i]=='1') s[i]='1'; if(s[i+1]=='B'&&(i+1)<s.size()) s[i-1]=''; } cout<<s1<<endl; }
a.cc:15:14: error: empty character constant 15 | s[i-1]=''; | ^~
s365796752
p04030
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.at(i)=='0'||s.at(i)=='1'){ans+=s.at(i);} else{ans-=ans.at(ans.size()-1);} } cout<<ans; }
a.cc: In function 'int main()': a.cc:8:13: 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'}) 8 | else{ans-=ans.at(ans.size()-1);} | ~~~^~~~~~~~~~~~~~~~~~~~~~
s180253439
p04030
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.at(i)=='0'||s.at(i)=='1'){ans+=s.at(i);} else{ans-=s.at(i-1);} } cout<<ans; }
a.cc: In function 'int main()': a.cc:8:13: 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'}) 8 | else{ans-=s.at(i-1);} | ~~~^~~~~~~~~~~
s956961833
p04030
C++
#inlucde <bits/stdc++.h> using namespace std; int main(){ string s; cin >> s; vector<char> data; for(int i=0; i<s.size(); i++){ if(s.at(i) == '0'){ data.push_back(0); }else if(s.at(i) == '1'){ data.push_back(1); }else{ data.pop_back(); } } for(int i=0; i<data.size(); i++){ cout << data.at(i); } cout << endl; }
a.cc:1:2: error: invalid preprocessing directive #inlucde; did you mean #include? 1 | #inlucde <bits/stdc++.h> | ^~~~~~~ | include a.cc: In function 'int main()': a.cc:5:3: error: 'string' was not declared in this scope 5 | string s; | ^~~~~~ a.cc:1:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>' +++ |+#include <string> 1 | #inlucde <bits/stdc++.h> a.cc:6:3: error: 'cin' was not declared in this scope 6 | cin >> s; | ^~~ a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' +++ |+#include <iostream> 1 | #inlucde <bits/stdc++.h> a.cc:6:10: error: 's' was not declared in this scope 6 | cin >> s; | ^ a.cc:7:3: error: 'vector' was not declared in this scope 7 | vector<char> data; | ^~~~~~ a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' +++ |+#include <vector> 1 | #inlucde <bits/stdc++.h> a.cc:7:10: error: expected primary-expression before 'char' 7 | vector<char> data; | ^~~~ a.cc:10:7: error: 'data' was not declared in this scope 10 | data.push_back(0); | ^~~~ a.cc:12:7: error: 'data' was not declared in this scope 12 | data.push_back(1); | ^~~~ a.cc:14:7: error: 'data' was not declared in this scope 14 | data.pop_back(); | ^~~~ a.cc:17:18: error: 'data' was not declared in this scope 17 | for(int i=0; i<data.size(); i++){ | ^~~~ a.cc:18:5: error: 'cout' was not declared in this scope 18 | cout << data.at(i); | ^~~~ a.cc:18:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:20:3: error: 'cout' was not declared in this scope 20 | cout << endl; | ^~~~ a.cc:20:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:20:11: error: 'endl' was not declared in this scope 20 | cout << endl; | ^~~~ a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' +++ |+#include <ostream> 1 | #inlucde <bits/stdc++.h>
s509802706
p04030
C++
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; string ans; for (int i = 0; i < s.size(); i++) { if (s.at(i) == '0') ans.push_back('0'); else if (s.at(i) == '1') ans.push_back('1'); else ans.pop_back; } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:17:11: 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>]' 17 | 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:2174:7: note: declared here 2174 | pop_back() noexcept | ^~~~~~~~
s002336516
p04030
C++
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; string ans = ""; for(int i = 0; i < s.length(): i ++) { switch (s[i]) { case '0': ans += '0'; break; case '1': ans += '1'; break; case 'B': if(ans.length()!=0) { ans.erase(ans.length()-1,1); } break; } } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:7:20: warning: range-based 'for' loops with initializer only available with '-std=c++20' or '-std=gnu++20' [-Wc++20-extensions] 7 | for(int i = 0; i < s.length(): i ++) { | ^ a.cc:7:34: error: expected ';' before ':' token 7 | for(int i = 0; i < s.length(): i ++) { | ^ | ; a.cc:24:1: error: expected primary-expression before '}' token 24 | } | ^ a.cc:23:25: error: expected ')' before '}' token 23 | cout << ans << endl; | ^ | ) 24 | } | ~ a.cc:7:8: note: to match this '(' 7 | for(int i = 0; i < s.length(): i ++) { | ^ a.cc:24:1: error: expected primary-expression before '}' token 24 | } | ^
s137758844
p04030
C++
#include <bits/stdc++.h> using namespace std; int main(){ string s; cin >> s; int size = 0; vector<int> t(s.size(),2) for(int i = 0; i < s.size(); i++){ if(s[i] == '0'){ t[i] = 0; size++; } else if(s[i] == '1'){ t[i] = 1; size++; } else { if(size >= 1){ t[size-1] = 2; size--; } } } for(int i = 0; i < size;i++){ cout << t[i]; } }
a.cc: In function 'int main()': a.cc:9:3: error: expected ',' or ';' before 'for' 9 | for(int i = 0; i < s.size(); i++){ | ^~~ a.cc:9:18: error: 'i' was not declared in this scope 9 | for(int i = 0; i < s.size(); i++){ | ^
s773164416
p04030
C++
#include <bits/stdc++.h> #define cinf(n,x) for(int i=0;i<(n);i++) cin >> x[i]; typedef long long int ll; using namespace std; int main(){ string s; cin >> s; string ans; for(int i=0;i<s.size();i++){ if(s[i]=='B'&&ans.size()>0)ans.pop_back(); else if(s[i]!='B')ans.push_back(s[i]) } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:11:46: error: expected ';' before '}' token 11 | else if(s[i]!='B')ans.push_back(s[i]) | ^ | ; 12 | } | ~
s246612273
p04030
C++
#include <bits/stdc++.h> #define cinf(n,x) for(int i=0;i<(n);i++) cin >> x[i]; typedef long long int ll; using namespace std; int main(){ string s; cin >> s; string ans; for(int i=0;i<s.size();i++){ if(s[i]=='B'&&t.size()>0)t.pop_back(); else if(s[i]!='B')t.push_back(s[i]) } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:10:23: error: 't' was not declared in this scope 10 | if(s[i]=='B'&&t.size()>0)t.pop_back(); | ^
s682239730
p04030
C++
#include <iostream> #include <algorithm> #include <string> #include <math.h> #include <stdio.h> #include <set> #include <vector> using namespace std; int main(){ string s; cin>>s; vector<char> v; for(auto i: s){ if(i=='0'){ v.pb('0'); } else if(i=='1'){ v.pb('1'); } else{ if(v.size()>0){ v.pop_back(); } } } for(auto i:v){ cout<<i; } cout<<endl; return 0; }
a.cc: In function 'int main()': a.cc:16:15: error: 'class std::vector<char>' has no member named 'pb' 16 | v.pb('0'); | ^~ a.cc:19:15: error: 'class std::vector<char>' has no member named 'pb' 19 | v.pb('1'); | ^~
s305392133
p04030
C++
#include <bits/stdc++.h> using namespace std; int main() { string str; cin>>str; char ch[11]; int count=0; for(int i=0;i<str.length();i++){ if(str[i]=='0') { count++; ch[count]=str[i], } if(str[i]=='1'){ count++; ch[count]=str[i], } if(str[i]=='B') { if(count==0)continue; else count--; } } for(int i=1;i<=count;i++){ printf("%c",count[i]); } }
a.cc: In function 'int main()': a.cc:14:17: error: expected primary-expression before '}' token 14 | } | ^ a.cc:18:17: error: expected primary-expression before '}' token 18 | } | ^ a.cc:26:34: error: invalid types 'int[int]' for array subscript 26 | printf("%c",count[i]); | ^
s564573740
p04030
C++
#include <bits/stdc++.h> using namespace std; int main() { string str; cin>>str; char ch[11]; int count=0; for(int i=0;i<str.length();i++){ if(str[i]=='0') { count++; ch[count]=str[i], } if(str[i]=='1'){ count++; ch[count]=str[i], } if(str[i]=='B') { if(count==0)continue; else count--; } } for(int i=1;i<=count;i++){ printf("%c",count[i]); } }
a.cc: In function 'int main()': a.cc:14:17: error: expected primary-expression before '}' token 14 | } | ^ a.cc:18:17: error: expected primary-expression before '}' token 18 | } | ^ a.cc:26:34: error: invalid types 'int[int]' for array subscript 26 | printf("%c",count[i]); | ^
s251814521
p04030
C++
#include <bits/stdc++.h> using namespace std; int main() { char str[11]; gets(str); for(int i=0;i<strlen(str);i++){ if(str[i]=='B')str[i]='x',str[i-1]='x'; } for(int i=0;i<strlen(str);i++){ if(str[i]=='x') continue; else cout<<str[i]; } cout<<endl; }
a.cc: In function 'int main()': a.cc:7:9: error: 'gets' was not declared in this scope; did you mean 'getw'? 7 | gets(str); | ^~~~ | getw
s842601913
p04030
C++
#include <bits/stdc++.h> #include <numeric> #include<iostream> #include<vector> #include<algorithm> using namespace std; int main(){ string s; cin >> s; s+=0; for(int i=0;i<s.size();i++){ if(s[i]!='B'&&s[i+1]!='B') cout << s[i]; } cout << endl; }
a.cc: In function 'int main()': a.cc:11:6: error: ambiguous overload for 'operator+=' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'int') 11 | s+=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) | ^~~~~~~~
s330069071
p04030
C++
#include <bits/stdc++.h> using namespace std; int main() { string S; cin >> S; string X; for (int i = 0; i < S.size(); i++) { if(S[i] == 0) { X += "0"; } else if (S[i] == 1) { X += "1"; } else if (S[i] == "B") { if (X != "") { X.erase(X.size() - 1); } } } cout << X << endl; return 0; }
a.cc: In function 'int main()': a.cc:16:19: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 16 | else if (S[i] == "B") {
s770326930
p04030
C++
#include <bits/stdc++.h> using namespace std; int main() { string S; cin >> S; string X; for (int i = 0; i < S.size(); i++) { if(S[i] == 0) { X += "0"; } else if (S[i] == 1) { X += "1"; } else if (S[i] == B) { if (X != "") { X.erase(X.size() - 1); } } } cout << X << endl; return 0; }
a.cc: In function 'int main()': a.cc:16:22: error: 'B' was not declared in this scope 16 | else if (S[i] == B) { | ^
s422733939
p04030
C++
#include <bits/stdc++.h> using namespace std; int main() { string S; cin >> S; string X; for (int i = 0; i < S.size(); i++) { if(S[i] == 0) { X += 0; } else if (S[i] == 1) { X += 1; } else if (S[i] == B) { if (X != "") { X.erase(X.size() - 1); } } } cout << X << endl; return 0; }
a.cc: In function 'int main()': a.cc:11:9: error: ambiguous overload for 'operator+=' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'int') 11 | X += 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:22: error: 'B' was not declared in this scope 16 | else if (S[i] == B) { | ^
s399709868
p04030
C++
#include <bits/stdc++.h> using namespace std; int main() { string S; cin S; string X; for (int i = 0; i < S.size(); i++) { if(S[i] == 0) { X += 0; } else if (S[i] == 1) { X += 1; } else if (S[i] == B) { if (X != "") { X.erase(X.size() - 1); } } } cout << X << endl; return 0; }
a.cc: In function 'int main()': a.cc:6:6: error: expected ';' before 'S' 6 | cin S; | ^~ | ; a.cc:11:9: error: ambiguous overload for 'operator+=' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'int') 11 | X += 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:22: error: 'B' was not declared in this scope 16 | else if (S[i] == B) { | ^
s696644492
p04030
C++
#include <bits/stdc++.h> using namespace std; int main(){ string s; cin >> s; int pos = 0; vector<char> o(s.size()); for(auto& c : S){ if(c=='B'){ pos = max(0, pos-1); }else{ o[pos] = c; pos++; } } for(int ii=0; ii<pos; ii++){ cout << o[ii]; } cout << endl; return 0; }
a.cc: In function 'int main()': a.cc:9:17: error: 'S' was not declared in this scope 9 | for(auto& c : S){ | ^
s142689266
p04030
C++
#include <bits/stdc++.h> using namespace std; int main(){ string s; cin >> s; int pos = 0; string o(s.size()); for(auto& c : S){ if(c=='B'){ pos = max(0, pos-1); }else{ o[pos] = c; pos++; } } for(int ii=0; ii<pos; ii++){ cout << o[ii]; } cout << endl; return 0; }
a.cc: In function 'int main()': a.cc:8:20: error: no matching function for call to 'std::__cxx11::basic_string<char>::basic_string(std::__cxx11::basic_string<char>::size_type)' 8 | string o(s.size()); | ^ 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:800:9: note: candidate: 'template<class _Tp, class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _Tp&, const _Alloc&) [with <template-parameter-2-2> = _Tp; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 800 | basic_string(const _Tp& __t, const _Alloc& __a = _Alloc()) | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:800:9: note: template argument deduction/substitution failed: In file included from /usr/include/c++/14/bits/stl_pair.h:60, from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/type_traits: In substitution of 'template<bool _Cond, class _Tp> using std::enable_if_t = typename std::enable_if::type [with bool _Cond = false; _Tp = void]': /usr/include/c++/14/bits/basic_string.h:149:8: required by substitution of 'template<class _CharT, class _Traits, class _Alloc> template<class _Tp, class _Res> using std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv = std::enable_if_t<((bool)std::__and_<std::is_convertible<const _Tp&, std::basic_string_view<_CharT, _Traits> >, std::__not_<std::is_convertible<const _Tp*, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>*> >, std::__not_<std::is_convertible<const _Tp&, const _CharT*> > >::value), _Res> [with _Tp = long unsigned int; _Res = void; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 149 | using _If_sv = enable_if_t< | ^~~~~~ /usr/include/c++/14/bits/basic_string.h:797:30: required from here 797 | template<typename _Tp, typename = _If_sv<_Tp, void>> | ^~~~~~~~ /usr/include/c++/14/type_traits:2711:11: error: no type named 'type' in 'struct std::enable_if<false, void>' 2711 | using enable_if_t = typename enable_if<_Cond, _Tp>::type; | ^~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:788:9: note: candidate: 'template<class _Tp, class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _Tp&, size_type, size_type, const _Alloc&) [with <template-parameter-2-2> = _Tp; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 788 | basic_string(const _Tp& __t, size_type __pos, size_type __n, | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:788:9: note: candidate expects 3 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:765:9: note: candidate: 'template<class _InputIterator, class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(_InputIterator, _InputIterator, const _Alloc&) [with <template-parameter-2-2> = _InputIterator; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 765 | basic_string(_InputIterator __beg, _InputIterator __end, | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:765:9: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:669:7: note: candidate: 'template<class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(size_type, _CharT, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 669 | basic_string(size_type __n, _CharT __c, const _Alloc& __a = _Alloc()) | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:669:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:646:7: note: candidate: 'template<class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 646 | basic_string(const _CharT* __s, const _Alloc& __a = _Alloc()) | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:646:7: note: template argument deduction/substitution failed: a.cc:8:18: note: cannot convert 's.std::__cxx11::basic_string<char>::size()' (type 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'}) to type 'const char*' 8 | string o(s.size()); | ~~~~~~^~ /usr/include/c++/14/bits/basic_string.h:721:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 721 | basic_string(basic_string&& __str, const _Alloc& __a) | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:721:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:716:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 716 | basic_string(const basic_string& __str, const _Alloc& __a) | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:716:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:711:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(std::initializer_list<_Tp>, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 711 | basic_string(initializer_list<_CharT> __l, const _Alloc& __a = _Alloc()) | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:711:45: note: no known conversion for argument 1 from 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} to 'std::initializer_list<char>' 711 | basic_string(initializer_list<_CharT> __l, const _Alloc& __a = _Alloc()) | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/basic_string.h:682:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 682 | basic_string(basic_string&& __str) noexcept | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:682:35: note: no known conversion for argument 1 from 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} to 'std::__cxx11::basic_string<char>&&' 682 | basic_string(basic_string&& __str) noexcept | ~~~~~~~~~~~~~~~^~~~~ /usr/include/c++/14/bits/basic_string.h:624:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, size_type, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' 624 | basic_string(const _CharT* __s, size_type __n, | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:624:7: note: candidate expects 3 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:604:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, size_type, size_type, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' 604 | basic_string(const basic_string& __str, size_type __pos, | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:604:7: note: candidate expects 4 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:586:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, size_type, size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' 586 | basic_string(const basic_string& __str, size_type __pos, | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:586:7: note: candidate expects 3 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:569:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, size_type, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' 569 | basic_string(const basic_string& __str, size_type __pos, | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:569:7: note: candidate expects 3 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:552:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 552 | basic_string(const basic_string& __str) | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:552:40: note: no known conversion for argument 1 from 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} to 'const std::__cxx11::basic_string<char>&' 552 | basic_string(const basic_string& __str) | ~~~~~~~~~~~~~~~~~~~~^~~~~ /usr/include/c++/14/bits/basic_string.h:540:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 540 | basic_string(const _Alloc& __a) _GLIBCXX_NOEXCEPT | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basi
s231278713
p04030
C++
#include <bits/stdc++.h> using namespace std; int main(){ int i, c; string s, result = ""; cin >> s; for(i= n.size()-1; i>=0; i--){ if(s[i] == 'B'){ c++; }else if(c > 0){ c--; }else{ result = s[i] + result; } } cout << result; return 0; }
a.cc: In function 'int main()': a.cc:8:12: error: 'n' was not declared in this scope 8 | for(i= n.size()-1; i>=0; i--){ | ^
s143765038
p04030
C++
#include <bits/stdc++.h> using namespace std; int main(){ int i, c; string s, result = ""; cin >> s; for(i= n.size()-1, i>=0; i--){ if(s[i] == 'B'){ c++; }else if(c > 0){ c--; }else{ result = s[i] + result; } } cout << result; return 0; }
a.cc: In function 'int main()': a.cc:8:12: error: 'n' was not declared in this scope 8 | for(i= n.size()-1, i>=0; i--){ | ^ a.cc:8:33: error: expected ';' before ')' token 8 | for(i= n.size()-1, i>=0; i--){ | ^ | ;
s633117022
p04030
C++
#include<stdio.h> #include<stdlib.h> #include<iostream> #include<string> #include<algorithm> #include<vector> #include<limits> #include<numeric> #include<type_traits> #include<math.h> using namespace std; typedef long long ll; #define rep(i, n) for(int i = 0; i < (int)(n); i++) #define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++) #define in(x) cin >> x #define out(str) cout << str << endl template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; } template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; } string S,s; int main(){ cin>>s; for(int i=s.length()-1;i>=0;i--){ if(s[i]!='B')S+=s[i]; else i++; } for(int i=S.length()-1;i>=0;i--){ printf(S[i]); } out(""); }
a.cc: In function 'int main()': a.cc:31:15: error: invalid conversion from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const char*' [-fpermissive] 31 | printf(S[i]); | ~~~~~~^~~~~~ | | | __gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char} In file included from a.cc:1: /usr/include/stdio.h:363:43: note: initializing argument 1 of 'int printf(const char*, ...)' 363 | extern int printf (const char *__restrict __format, ...); | ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
s436641680
p04030
C++
#include<stdio.h> #include<stdlib.h> #include<iostream> #include<string> #include<algorithm> #include<vector> #include<limits> #include<numeric> #include<type_traits> #include<math.h> using namespace std; typedef long long ll; #define rep(i, n) for(int i = 0; i < (int)(n); i++) #define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++) #define in(x) cin >> x #define out(str) cout << str << endl template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; } template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; } string S,s; int main(){ cin>>s; for(int i=s.length()-1;i>=0;i--){ if(s[i]!='B')S+=s[i]; else i++; } for(int i=S.length()-1;i>=0;i--){ print(S[i]); } out(""); }
a.cc: In function 'int main()': a.cc:31:9: error: 'print' was not declared in this scope; did you mean 'rint'? 31 | print(S[i]); | ^~~~~ | rint
s158660309
p04030
C++
#include <iostream> #include <algorithm> using namespace std; int main(){ string s, ans; cin >> s; for (int i = 0; i < s.size(); i++){ if(s(i) == 0){ string += '0'; } else if (s(i) == 1){ string += '1'; } else string--; } cout >> ans >> endl; }
a.cc: In function 'int main()': a.cc:10:9: error: no match for call to '(std::string {aka std::__cxx11::basic_string<char>}) (int&)' 10 | if(s(i) == 0){ | ~^~~ a.cc:11:14: error: expected unqualified-id before '+=' token 11 | string += '0'; | ^~ a.cc:12:17: error: no match for call to '(std::string {aka std::__cxx11::basic_string<char>}) (int&)' 12 | } else if (s(i) == 1){ | ~^~~ a.cc:13:14: error: expected unqualified-id before '+=' token 13 | string += '1'; | ^~ a.cc:14:18: error: expected unqualified-id before '--' token 14 | } else string--; | ^~ a.cc:16:8: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'std::string' {aka 'std::__cxx11::basic_string<char>'}) 16 | cout >> ans >> endl; | ~~~~ ^~ ~~~ | | | | | std::string {aka std::__cxx11::basic_string<char>} | std::ostream {aka std::basic_ostream<char>} In file included from /usr/include/c++/14/string:55, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/basic_string.tcc:835:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 835 | operator>>(basic_istream<_CharT, _Traits>& __in, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.tcc:835:5: note: template argument deduction/substitution failed: a.cc:16:11: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 16 | cout >> ans >> endl; | ^~~ In file included from /usr/include/c++/14/bits/memory_resource.h:38, from /usr/include/c++/14/string:68: /usr/include/c++/14/cstddef:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)' 131 | operator>>(byte __b, _IntegerType __shift) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:131:5: note: template argument deduction/substitution failed: a.cc:16:3: note: cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte' 16 | cout >> ans >> endl; | ^~~~ In file included from /usr/include/c++/14/istream:1109, from /usr/include/c++/14/iostream:42: /usr/include/c++/14/bits/istream.tcc:978:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT&)' 978 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c) | ^~~~~~~~ /usr/include/c++/14/bits/istream.tcc:978:5: note: template argument deduction/substitution failed: a.cc:16:11: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 16 | cout >> ans >> endl; | ^~~ /usr/include/c++/14/istream:849:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char&)' 849 | operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:849:5: note: template argument deduction/substitution failed: a.cc:16:11: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 16 | cout >> ans >> endl; | ^~~ /usr/include/c++/14/istream:854:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char&)' 854 | operator>>(basic_istream<char, _Traits>& __in, signed char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:854:5: note: template argument deduction/substitution failed: a.cc:16:11: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 16 | cout >> ans >> endl; | ^~~ /usr/include/c++/14/istream:896:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT*)' 896 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s) | ^~~~~~~~ /usr/include/c++/14/istream:896:5: note: template argument deduction/substitution failed: a.cc:16:11: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 16 | cout >> ans >> endl; | ^~~ /usr/include/c++/14/istream:939:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char*)' 939 | operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s) | ^~~~~~~~ /usr/include/c++/14/istream:939:5: note: template argument deduction/substitution failed: a.cc:16:11: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 16 | cout >> ans >> endl; | ^~~ /usr/include/c++/14/istream:945:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char*)' 945 | operator>>(basic_istream<char, _Traits>& __in, signed char* __s) | ^~~~~~~~ /usr/include/c++/14/istream:945:5: note: template argument deduction/substitution failed: a.cc:16:11: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 16 | cout >> ans >> endl; | ^~~ /usr/include/c++/14/istream:1099:5: note: candidate: 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&)' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~ /usr/include/c++/14/istream:1099:5: note: template argument deduction/substitution failed: /usr/include/c++/14/istream: In substitution of 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::basic_ostream<char>&; _Tp = std::__cxx11::basic_string<char>&]': a.cc:16:11: required from here 16 | cout >> ans >> endl; | ^~~ /usr/include/c++/14/istream:1099:5: error: no type named 'type' in 'struct std::enable_if<false, void>' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~
s897831389
p04030
C++
#include<bits/stdc++.h> using namespace std; int main(){ string s,ans; cin>>s; int i=0; for(i=0;i<s.size();i++){ if(s[i]=="0"){ ans[i]="0" }else if(s[i]=="1"){ ans[i]="1" }else if(s[i]=="B"){ if(ans.size()!=0){ ans[i-1] = " "; i = i-1; } } } cout<<ans; return 0; }
a.cc: In function 'int main()': a.cc:9:12: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 9 | if(s[i]=="0"){ a.cc:10:14: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive] 10 | ans[i]="0" | ^~~ | | | const char* a.cc:10:17: error: expected ';' before '}' token 10 | ans[i]="0" | ^ | ; 11 | }else if(s[i]=="1"){ | ~ a.cc:11:18: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 11 | }else if(s[i]=="1"){ a.cc:12:14: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive] 12 | ans[i]="1" | ^~~ | | | const char* a.cc:12:17: error: expected ';' before '}' token 12 | ans[i]="1" | ^ | ; 13 | }else if(s[i]=="B"){ | ~ a.cc:13:18: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 13 | }else if(s[i]=="B"){ a.cc:15:20: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive] 15 | ans[i-1] = " "; | ^~~ | | | const char*
s294359151
p04030
C++
#include <bits/stdc++.h> using namespace std; int main() { string s, t(0); cin >> s; int i; for(i = 0; i < s.size(); i++){ if(s.at(i) == '0'){ t += '0'; } else if(s.at(i) == '1'){ t += '1'; } else if(s.at(i-1) == '0'){ t -= '0'; } else if(s.at(i-1) == '1'){ t -= '1'; } } cout << t << endl; }
a.cc: In function 'int main()': a.cc:17:9: error: no match for 'operator-=' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'char') 17 | t -= '0'; | ~~^~~~~~ a.cc:20:9: error: no match for 'operator-=' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'char') 20 | t -= '1'; | ~~^~~~~~
s924549204
p04030
C++
#include <iostream> #include <vector> #include <algorithm> #include <iomanip> #include <cmath> using namespace std; typedef long long unsigned int ll; int main() { string s; string t; int a,b,c,d,i,j,k; cin >> s; for(i=0;i<s.length();i++){ if(s[i]=='1') t.back()='1'; if(s[i]=='0') t.back()='0'; if(s[i]=='0'&&s.length()>=1) erase(t.back()); } cout << t <<endl; return 0; }
a.cc: In function 'int main()': a.cc:19:34: error: 'erase' was not declared in this scope 19 | if(s[i]=='0'&&s.length()>=1) erase(t.back()); | ^~~~~
s422743193
p04030
C++
#include <iostream> #include <vector> #include <algorithm> #include <iomanip> #include <cmath> using namespace std; typedef long long unsigned int ll; int main() { string s; string t; int a,b,c,d,i,j,k; cin >> s; for(i=0;i<s.length();i++){ if(s[i]=='1') t.back()=='1'; if(s[i]=='0') t.back()=='0'; if(s[i]=='0'&&s.length()>=1) erase(t.back()); } cout << t <<endl; return 0; }
a.cc: In function 'int main()': a.cc:19:34: error: 'erase' was not declared in this scope 19 | if(s[i]=='0'&&s.length()>=1) erase(t.back()); | ^~~~~
s493651298
p04030
C++
#include <iostream> #include <string> //#include <algorithm> using namespace std; int main() { //vars; string str; //input; cin >> str; //process; for (int i = 0; i < str.size; i++) { if (str[0] == 'B') { str.erase(str.begin()); i--; } if (str[i] == 'B'&&i > 0) { str.erase(str.begin() + i - 1, str.begin() + i); i -= 2; } } //output; cout << str; }
a.cc: In function 'int main()': a.cc:14:33: 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 | for (int i = 0; i < str.size; i++) { | ~~~~^~~~ | ()
s703216128
p04030
C
#include <stdio.h> #include <string.h> int main() { char s[11], out[11]={'\0'}; scanf("%s", s); n = strlen(s); for(int i=0; i<n; i++){ int m = strlen(out); if(s[i] == 'B') out[m-1]='\0'; else out[m]=s[i]; } printf("%s", out); return 0; }
main.c: In function 'main': main.c:8:3: error: 'n' undeclared (first use in this function) 8 | n = strlen(s); | ^ main.c:8:3: note: each undeclared identifier is reported only once for each function it appears in
s891668926
p04030
C++
#include<iostream> #include<algorithm> #include<string> #include<vector> #include<queue> #include<map> #include<math.h> #define rep(i,a,n) for(int (i)=(a);(i)<(n);(i)++) #define rrep(i,a,n) for(int (i)=(a);(i)>=(n);(i)--) #define INF 10000000 typedef long long ll; using namespace std; double euclid_distance(double a,double b){ return sqrt(a*a+b*b); } int gcd(long long int a,long long int b){ long long int r; if(a < b){ int tmp; tmp = a; a = b; b = tmp; } while(r != 0){ r = a % b; a = b; b = r; } return r; } void Integer_factorization(long long int b,long long int n){ long long int a = 2; long long int count = 0; long long int ans = 1; long long int ndash = n; if(b == 1) cout << n << endl; else{ while(ndash >= a*a){ if(n % a == 0){ count++; n/=a; if(count % b == 0){ ans *= a; } }else{a++;count = 0;} } cout<< ans << endl; } } void ys(){ cout << "Yes" << endl; } void yb(){ cout << "YES" << endl; } void ns(){ cout << "No" << endl; } void nb(){ cout << "NO" << endl; } //A 40s //B 20min //C //D string ans; void solve(void){ string s; cin >> s; string ans; ep(i,0,s.size()){ if(i != 0 && s[i] == 'B'){ if(ans.size()!=0) ans.erase(ans.size()-1); }else if(s[i] == '0' || s[i] == '1')ans+=s[i]; } if(ans[ans.size()-1] == 'B')ans.erase(ans.size()-1); cout << ans; } int main(){ cin.tie(0); ios::sync_with_stdio(false); solve(); }
a.cc: In function 'void solve()': a.cc:85:8: error: 'i' was not declared in this scope 85 | ep(i,0,s.size()){ | ^ a.cc:85:5: error: 'ep' was not declared in this scope; did you mean 'exp'? 85 | ep(i,0,s.size()){ | ^~ | exp
s662264978
p04030
C++
#include <bits/stdc++.h> using namespace std; int main () { string s; cin >> s; deque<char> data; for(int i = 0; i < s.size(); i--) { if(s.at(i) == 'B' && !data.empty())data.pop_back(); else if(s.at(i) == '1' || s.at(i) == '2')data.push_back(s.at(i)); } while(!data.empty()) { cout << data.front(); data.pop_front; } return 0; }
a.cc: In function 'int main()': a.cc:13:10: error: invalid use of non-static member function 'void std::deque<_Tp, _Alloc>::pop_front() [with _Tp = char; _Alloc = std::allocator<char>]' 13 | data.pop_front; | ~~~~~^~~~~~~~~ In file included from /usr/include/c++/14/deque:66, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:139, from a.cc:1: /usr/include/c++/14/bits/stl_deque.h:1574:7: note: declared here 1574 | pop_front() _GLIBCXX_NOEXCEPT | ^~~~~~~~~
s673232132
p04030
C
#include<stdio.h> int main(){ char S[11]; scanf("%s",S); int i; for(i=1;i<=9;i++){ if(S[i] == 'B'){ S[i] = ¥0; S[i-1] = ¥0; }; }; printf(S); }
main.c: In function 'main': main.c:9:14: error: stray '\302' in program 9 | S[i] = <U+00A5>0; | ^~~~~~~~ main.c:10:16: error: stray '\302' in program 10 | S[i-1] = <U+00A5>0; | ^~~~~~~~
s138868397
p04030
C++
#include<cstdio> #include<string> char s[101],s2[101]; int s1,a; int main() { scanf("%s",s); s1=strlen(s); for(int i=0; i<s1; i++) { switch(s[i]) { case'0':s2[a]='0'; a++; break; case'1':s2[a]='1'; a++; break; case'B':if(a!=0) a--; break; } } for(int i=0; i<a; i++) { printf("%c",s2[i]); } printf("\n"); }
a.cc: In function 'int main()': a.cc:8:12: error: 'strlen' was not declared in this scope 8 | s1=strlen(s); | ^~~~~~ a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include<string> +++ |+#include <cstring> 3 | char s[101],s2[101];
s259593719
p04030
C++
#include<cstdio> #include<string> char s[101],s2[101]; int s1,a; int main() { gets(s); s1=strlen(s); for(int i=0; i<s1; i++) { switch(s[i]) { case'0':s2[a]='0'; a++; break; case'1':s2[a]='1'; a++; break; case'B':if(a!=0) a--; break; } } for(int i=0; i<a; i++) { printf("%c",s2[i]); } printf("\n"); }
a.cc: In function 'int main()': a.cc:7:5: error: 'gets' was not declared in this scope; did you mean 'getw'? 7 | gets(s); | ^~~~ | getw a.cc:8:12: error: 'strlen' was not declared in this scope 8 | s1=strlen(s); | ^~~~~~ a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include<string> +++ |+#include <cstring> 3 | char s[101],s2[101];
s915953964
p04030
C++
/*#include<cstdio> #include<string.h> char str[101],answer[101]; int lens,i,lena=0; int main() { gets(str); lens=strlen(str), for(i=0;i<lens;i++) switch(str[i]) { case '0':answer[lena]='0';lena++;break; case '1':answer[lena]='1';lena++;break; case 'B':if(lena!=0) lena--;break; } for(i=0;i<lena;i++)printf("%c",answer[i]); printf("\n"); }*/
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x17): undefined reference to `main' collect2: error: ld returned 1 exit status
s065692847
p04030
C++
sefwrwrwwrwr
a.cc:1:1: error: 'sefwrwrwwrwr' does not name a type 1 | sefwrwrwwrwr | ^~~~~~~~~~~~
s724324188
p04030
C++
#include<iostream> #include<string> using namespace std; int main(){ int i, len; string n, result; cin >> n; len = n.length(); for(i=0; i < 10; i++){ cout << n[i] << endl; if((n[i] == '0') or (n[i] == '1') or (n[i] == 'B')){ if((n[i] == '0') or (n[i] == '1')){ result += n[i]; } else { if(result.length() == 0){ continue; }else(result = result.substr(0, result.size()-1)); } }else(continue;) } cout << result << endl; }
a.cc: In function 'int main()': a.cc:20:15: error: expected primary-expression before 'continue' 20 | }else(continue;) | ^~~~~~~~ a.cc:20:15: error: expected ')' before 'continue' 20 | }else(continue;) | ~^~~~~~~~ | ) a.cc:20:24: error: expected primary-expression before ')' token 20 | }else(continue;) | ^
s277480835
p04030
C++
#include<iostream> #include<string> using namespace std; int main(){ string s; int i=0; while(cin>>s){ if(s[i]=='0')s.push('0'); else if(s[i]=='1')s.push('1'); else s.pop_back(); } cout<<s<<endl; return 0; }
a.cc: In function 'int main()': a.cc:10:24: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'push' 10 | if(s[i]=='0')s.push('0'); | ^~~~ a.cc:11:29: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'push' 11 | else if(s[i]=='1')s.push('1'); | ^~~~
s169011223
p04030
C++
#include<iostream> #include<bits/stdc++.h> using namespace std; int main(){ string s, ans; int N = s.size(); ans = ""; for(int i = 0, i < N; i++){ if( s.at(i) != 'B'){ ans = ans + s.at(i); } else if(ans.size() > 1 && s.at(i) == 'B'){ int a = ans.size(); string X = ""; for(int j=0; j<a-1; j++){ X = X + ans.at(j); } ans = X; } else{ ans = ""; } } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:10:19: error: expected ';' before '<' token 10 | for(int i = 0, i < N; i++){ | ^~ | ; a.cc:10:20: error: expected primary-expression before '<' token 10 | for(int i = 0, i < N; i++){ | ^
s446895495
p04030
C++
#include<iostream> #include <bits/stdc++.h> using namespace std; int main() { string ttt; cin >> ttt; string ans = "99999999999"; int a = 0; for(int i = 0; i < ttt.size(); i++) { switch(ttt.at(i)) { case '0': ans.at(a) = '0'; a++; break; case '1'; ans.at(a) = '1'; a++; break; case 'B'; ans.at(a) = '9'; if(a > 0) a--; break; } } int i = 0; while(ans.at(i) != 'B') { cout << ans.at(i); i++; } cout << endl; return 0; }
a.cc: In function 'int main()': a.cc:17:15: error: expected ':' before ';' token 17 | case '1'; | ^ | : a.cc:21:15: error: expected ':' before ';' token 21 | case 'B'; | ^ | :
s008953502
p04030
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; #define Abs(x)((x) < 0 ? (x) * -1 : (x)) #define rep(x, y) for ((x) = 0; (x) < (y); (x)++) #define repin(x, y) for ((x) = 0; (x) <= (y); (x)++) #define nep(x, y) for ((x) = (y) - 1; 0 <= (x); (x)--) #define nepi(x, y, z) for ((x) = (y) - 1; (z) <= (x); (x)--) #define repi(x, y, z) for ((x) = (z); (x) < (y); (x)++) #define repiin(x, y, z) for ((x) = (z); (x) <= (y); (x)++) #define reps(x, y, z) for ((x) = 0; (x) < (y); (x) += (z)) #define repis(x, y, z, s) for ((x) = (z); (x) < (y); (x) += (s)) #define repiins(x, y, z, s) for ((x) = (z); (x) <= (y); (x) += (s)) #define repit(x) for (__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++) #define nepit(x) for (__typeof((x).rbegin()) it = (x).rbegin(); it != (x).rend(); it++) #define All(x) (x).begin(),(x).end() #define Mem0(x) memset(x, 0, sizeof(x)) #define Mem1(x) memset(x, -1, sizeof(x)) #define Unique(v) v.resize(unique(All(v)) - v.begin()) #define peq(p0, p1)(p0.first == p1.first && p0.second == p1.second) #define End '\n' #define Out(x) cout<<(x)<<End #define OutP(p, sep, end) cout<<p.first<<sep<<p.second<<end template<typename T> inline bool Max(T &x, const T &y) { return x < y ? x = y, 1 : 0; } template<typename T> inline bool Min(T &x, const T &y) { return x > y ? x = y, 1 : 0; } template<typename T> using V = vector<T>; template<typename T> using VV = V<V<T> >; #define pb push_back #define mp make_pair #define X first #define Y second #define lb std::lower_bound #define ub std::upper_bound #define lbi(v, x) lb(All(v), (x))-v.begin() #define ubi(v, x) ub(All(v), (x))-v.begin() static const ll MOD = 1e9 + 7; static const double PI = 3.141592653589793; #define LOCAL 0 int main() { #if LOCAL freopen("in.txt", "r", stdin); freopen("out.txt", "w", stdout); freopen("debug.txt", "w", stderr); #endif cin.tie(0); ios::sync_with_stdio(false); //std::cout.precision(18); string s; cin >> s; stack<char> st; string ans = ""; int i, len = s.size(); rep(i, len) { if (s[i] == '0') s.push('0'); else if (s[i] == '1') s.push('1'); else s.pop(); } while (!s.empty()) { ans += s.top(); s.pop(); } std::reverse(All(ans)); Out(ans); return 0; }
a.cc: In function 'int main()': a.cc:77:36: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'push' 77 | if (s[i] == '0') s.push('0'); | ^~~~ a.cc:78:41: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'push' 78 | else if (s[i] == '1') s.push('1'); | ^~~~ a.cc:79:24: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'pop' 79 | else s.pop(); | ^~~ a.cc:83:26: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'top' 83 | ans += s.top(); | ^~~ a.cc:85:19: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'pop' 85 | s.pop(); | ^~~
s511398368
p04030
C++
#include<stdio.h> int main(){ char s[100],k = 'B'; scanf("%s",&s); for(int i = 1;i < strlen(s);i++){ if(s[i] == k){ int j = i - 1; while(s[j] == k && j > 0){ j--; } s[j] = k; } } for(int i = 0;i < strlen(s);i++){ if(s[i] != k){ printf("%c",s[i]); } } return 0; }
a.cc: In function 'int main()': a.cc:6:21: error: 'strlen' was not declared in this scope 6 | for(int i = 1;i < strlen(s);i++){ | ^~~~~~ a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 1 | #include<stdio.h> +++ |+#include <cstring> 2 | a.cc:15:21: error: 'strlen' was not declared in this scope 15 | for(int i = 0;i < strlen(s);i++){ | ^~~~~~ a.cc:15:21: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
s621002351
p04030
C++
#include "bits/stdc++.h" using namespace std; #define Would #define you const long long INF = 99999999999999999; const long long MOD = 1e9 + 7; const double pi = 3.1415926535897932384626; const int SIZE = 1 << 17; int main() { string h; cin >> h; vector<char>ans; for (int i = 0; i < h.length(); ++i) { if (h[i] == '0') { ans.push_back("0"); } else if (h[i] == '1') { ans.push_back("1"); } else if (v.size() != 0) { ans.pop_back(); } } for (int i = 0; i < v.size(); ++i) { cout << v[i]; } cout << endl; }
a.cc: In function 'int main()': a.cc:15:49: error: no matching function for call to 'push_back(const char [2])' 15 | if (h[i] == '0') { ans.push_back("0"); } | ~~~~~~~~~~~~~^~~~~ 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 = char; _Alloc = std::allocator<char>; value_type = char]' (near match) 1283 | push_back(const value_type& __x) | ^~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:1283:7: note: conversion of argument 1 would be ill-formed: a.cc:15:50: error: invalid conversion from 'const char*' to 'std::vector<char>::value_type' {aka 'char'} [-fpermissive] 15 | if (h[i] == '0') { ans.push_back("0"); } | ^~~ | | | const char* /usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = char; _Alloc = std::allocator<char>; value_type = char]' (near match) 1300 | push_back(value_type&& __x) | ^~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:1300:7: note: conversion of argument 1 would be ill-formed: a.cc:15:50: error: invalid conversion from 'const char*' to 'std::vector<char>::value_type' {aka 'char'} [-fpermissive] 15 | if (h[i] == '0') { ans.push_back("0"); } | ^~~ | | | const char* a.cc:16:54: error: no matching function for call to 'push_back(const char [2])' 16 | else if (h[i] == '1') { ans.push_back("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 = char; _Alloc = std::allocator<char>; value_type = char]' (near match) 1283 | push_back(const value_type& __x) | ^~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:1283:7: note: conversion of argument 1 would be ill-formed: a.cc:16:55: error: invalid conversion from 'const char*' to 'std::vector<char>::value_type' {aka 'char'} [-fpermissive] 16 | else if (h[i] == '1') { ans.push_back("1"); } | ^~~ | | | const char* /usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = char; _Alloc = std::allocator<char>; value_type = char]' (near match) 1300 | push_back(value_type&& __x) | ^~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:1300:7: note: conversion of argument 1 would be ill-formed: a.cc:16:55: error: invalid conversion from 'const char*' to 'std::vector<char>::value_type' {aka 'char'} [-fpermissive] 16 | else if (h[i] == '1') { ans.push_back("1"); } | ^~~ | | | const char* a.cc:17:26: error: 'v' was not declared in this scope 17 | else if (v.size() != 0) { ans.pop_back(); } | ^ a.cc:19:29: error: 'v' was not declared in this scope 19 | for (int i = 0; i < v.size(); ++i) { cout << v[i]; } | ^
s319458730
p04030
C++
using namespace std; int main(void){ string str; cin >> str; string ans=""; for(int i=0; i<str.size(); i++){ if(str[i]=='0') ans+='0'; if(str[i]=='1') ans+='1'; if(str[i]=='B'){ if(!str.empty()) ans.pop_back(); } } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:4:5: error: 'string' was not declared in this scope 4 | string str; | ^~~~~~ a.cc:1:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>' +++ |+#include <string> 1 | using namespace std; a.cc:5:5: error: 'cin' was not declared in this scope 5 | cin >> str; | ^~~ a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' +++ |+#include <iostream> 1 | using namespace std; a.cc:5:12: error: 'str' was not declared in this scope; did you mean 'std'? 5 | cin >> str; | ^~~ | std a.cc:7:11: error: expected ';' before 'ans' 7 | string ans=""; | ^~~~ | ; a.cc:10:25: error: 'ans' was not declared in this scope 10 | if(str[i]=='0') ans+='0'; | ^~~ a.cc:11:25: error: 'ans' was not declared in this scope 11 | if(str[i]=='1') ans+='1'; | ^~~ a.cc:13:30: error: 'ans' was not declared in this scope 13 | if(!str.empty()) ans.pop_back(); | ^~~ a.cc:17:5: error: 'cout' was not declared in this scope 17 | cout << ans << endl; | ^~~~ a.cc:17:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:17:13: error: 'ans' was not declared in this scope 17 | cout << ans << endl; | ^~~ a.cc:17:20: error: 'endl' was not declared in this scope 17 | cout << ans << endl; | ^~~~ a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' +++ |+#include <ostream> 1 | using namespace std;
s382355822
p04030
C
#include<stdio.h> int main(){ int len = 0, i = 0; char s[11], t[11]; scanf("%s", s); while(s[len]){ if(s[len] == '0'){ t[i++] = 0; } else if(s[len] == '1'){ t[i++] = 1; } else if(s[len] == 'B'){ if(i != 0){ t[--i] = '\0'; } } len++; } for (j = i; j >= 0; j--){ printf("%c", t[i]); } printf("\n"); return 0; }
main.c: In function 'main': main.c:21:8: error: 'j' undeclared (first use in this function) 21 | for (j = i; j >= 0; j--){ | ^ main.c:21:8: note: each undeclared identifier is reported only once for each function it appears in
s752331080
p04030
C++
#include <iostream> using namespace std; int main() { char s[11]; cin >> s; char ans[11]; int flag=0; int i = strlen(s); for (int j=0; j<i; j++){ if(s[j]=='0'){ ans[flag]='0'; flag++; }else if(s[j]=='1'){ ans[flag]='1'; flag++; }else if(flag!=0){ flag--; ans[flag]='\0'; } } cout << ans << '\n'; return 0; }
a.cc: In function 'int main()': a.cc:10:13: error: 'strlen' was not declared in this scope 10 | int i = strlen(s); | ^~~~~~ a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 1 | #include <iostream> +++ |+#include <cstring> 2 | using namespace std;
s207005004
p04030
C
#include<stdio.h> int main(void){ int i=0,j=0; char s[11]; char t[11]; scanf("%s",&s); while(s[i]!='\0'){ if(s[i]!='B'){ t[j]=s[i]; j++; }else{ if(j<1){ j=j-j; }else{ j=j-1; } } t[j]='\0'; printf("%s\n",t); return 0; }
main.c: In function 'main': main.c:21:3: error: expected declaration or statement at end of input 21 | } | ^
s959158133
p04030
C++
#include<stdio.h> #include<cstdio> #include<cstring> #include<cmath> #include<queue> #include<algorithm> #include<iostream> using namespace std; int main() { char ch[10000]; cin>>ch; int len = strlen(ch); int l = 100; int r = 101; int ans[1000]; for(int i= 0;i<len;i++) { if(ch[i]=='0') { ans[l] = 0; l--; } else if(ch[i] == '1') { ans[r] = 1; r++; } else if(ch[i]=='B') { if(r==l+1) continue; r--; } } for(int i = l +1;i<r;i++) cout<<ans[i]; return 0;
a.cc: In function 'int main()': a.cc:39:14: error: expected '}' at end of input 39 | return 0; | ^ a.cc:10:1: note: to match this '{' 10 | { | ^
s886369461
p04030
C++
#include <cstdio> #include <iostream> #include <cstring> using namespace std; int main() { char a[100]; gets(a); int n = strlen(a); char b[100]; int j = 0; for(int i = 0; i < n; i++) { if(a[i] == '0') b[j++] = '0'; if(a[i] == '1') b[j++] = '1'; if(a[i] == 'B') { if(j == 0) continue; else j--; } } if(j == 0) printf("\n"); else { for(int i = 0; i <= j; i++) printf("%c", b[i]); printf("\n"); } return 0; }
a.cc: In function 'int main()': a.cc:7:5: error: 'gets' was not declared in this scope; did you mean 'getw'? 7 | gets(a); | ^~~~ | getw
s496708347
p04030
C
#include <cstdio> #include <cstring> int main(){ char s[105]; char ch[105]; int cnt=0; scanf("%s",s); for(int i=0;i<strlen(s);i++){ if(s[i]=='B'&&i>0){ s[i-1]='B'; } } for(int i=0;i<=strlen(s);i++){ if(s[i]=='B')cnt++; else ch[i-cnt]=s[i]; } printf("%s\n",ch); }
main.c:1:10: fatal error: cstdio: No such file or directory 1 | #include <cstdio> | ^~~~~~~~ compilation terminated.
s558798210
p04030
C
#include <cstdio> #include <cstring> int main(){ char s[15]; for(int i=0;i<15;i++){ scanf("%c",&s[i]); if(s[i]=='B'&&i>0){i-=2;continue;} if(s[i]=='\n')break; } for(int i=0;i<strlen(s);i++){ printf("%c",s[i]); } return 0; }
main.c:1:10: fatal error: cstdio: No such file or directory 1 | #include <cstdio> | ^~~~~~~~ compilation terminated.
s084854434
p04030
C++
#include<stdio.h> #include<string.h> #define N 11 char str[N]; char end[N]; int main() { int i,len; gets(str); len = strlen(str); for(i=0 ; i<len ; i++) { if(str[i]=='0') end[i]='0'; if(str[i]=='B') end[i]='\b'; if(str[i]=='1') end[i]='1'; } printf("%s\n",end); return 0; }
a.cc: In function 'int main()': a.cc:9:9: error: 'gets' was not declared in this scope; did you mean 'getw'? 9 | gets(str); | ^~~~ | getw
s417867778
p04030
C++
#include<stdio.h> #include<string.h> #define N 99 char str[N]; char end[N]; int main() { int i,len; gets(str); len = strlen(str); for(i=0 ; i<len ; i++) { if(str[i]=='0') end[i]='0'; if(str[i]=='B') end[i]='\b'; if(str[i]=='1') end[i]='1'; } printf("%s\n",end); return 0; }
a.cc: In function 'int main()': a.cc:9:9: error: 'gets' was not declared in this scope; did you mean 'getw'? 9 | gets(str); | ^~~~ | getw
s624339267
p04030
C
#include <stdio.h> #include <string.h> int main() { char s[11] = { 0 }; char t[11] = { 0 }; int p = 0; scanf("%s", s); for (int i = 0; i < strlen(s); i++) { if (s[i] == 'B') { if (p != 0) { p--; } } else { t[p++] = s[i]; } } t[p] = '\0'; printf("%s\n", t); return 0;
main.c: In function 'main': main.c:22:5: error: expected declaration or statement at end of input 22 | return 0; | ^~~~~~
s148039734
p04030
C++
#include<bits/stdc++.h> int main() { char str[101],ans[101]; gets(str); int i,lena=0; for(i=0;i<strlen(str);i++) switch(str[i]) { case '0': ans[lena]='0'; lena++; break; case '1': ans[lena]='1'; lena++; break; case 'B': if(lena!=0) lena--; break; } for(i=0;i<lena;i++) printf("%c",ans[i]); printf("\n"); return 0; }
a.cc: In function 'int main()': a.cc:5:5: error: 'gets' was not declared in this scope; did you mean 'getw'? 5 | gets(str); | ^~~~ | getw
s714258773
p04030
C++
#include <iostream> #include <vector> using namespace std; int main(){ int j=0; string s; vector<char> str2; cin >> s; for(int i=0;i<s;i++){ if(s.at(i)=='0'){ str2.at(j)='0'; j++; } else if(s.at(i)=='1'){ str2.at(j)='1'; j++; } else if(s.at(i)=='B'){ if(i==0)continue; else j--; } } for(int i=0;i<j;i++)cout << str2.at(j); return 0; }
a.cc: In function 'int main()': a.cc:10:18: error: no match for 'operator<' (operand types are 'int' and 'std::string' {aka 'std::__cxx11::basic_string<char>'}) 10 | for(int i=0;i<s;i++){ | ~^~ | | | | | std::string {aka std::__cxx11::basic_string<char>} | int In file included from /usr/include/c++/14/string:48, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 448 | operator<(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed: a.cc:10:19: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int' 10 | for(int i=0;i<s;i++){ | ^ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 493 | operator<(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed: a.cc:10:19: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int' 10 | for(int i=0;i<s;i++){ | ^ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1694 | operator<(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed: a.cc:10:19: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int' 10 | for(int i=0;i<s;i++){ | ^ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1760 | operator<(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: template argument deduction/substitution failed: a.cc:10:19: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int' 10 | for(int i=0;i<s;i++){ | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/string:51: /usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed: a.cc:10:19: note: mismatched types 'const std::pair<_T1, _T2>' and 'int' 10 | for(int i=0;i<s;i++){ | ^ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54: /usr/include/c++/14/string_view:673:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 673 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:673:5: note: template argument deduction/substitution failed: a.cc:10:19: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int' 10 | for(int i=0;i<s;i++){ | ^ /usr/include/c++/14/string_view:680:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 680 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:680:5: note: template argument deduction/substitution failed: a.cc:10:19: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int' 10 | for(int i=0;i<s;i++){ | ^ /usr/include/c++/14/string_view:688:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 688 | operator< (__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:688:5: note: template argument deduction/substitution failed: a.cc:10:19: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 10 | for(int i=0;i<s;i++){ | ^ /usr/include/c++/14/bits/basic_string.h:3874:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3874 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3874:5: note: template argument deduction/substitution failed: a.cc:10:19: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 10 | for(int i=0;i<s;i++){ | ^ /usr/include/c++/14/bits/basic_string.h:3888:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3888 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3888:5: note: template argument deduction/substitution failed: a.cc:10:19: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 10 | for(int i=0;i<s;i++){ | ^ /usr/include/c++/14/bits/basic_string.h:3901:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3901 | operator<(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3901:5: note: template argument deduction/substitution failed: a.cc:10:19: note: mismatched types 'const _CharT*' and 'int' 10 | for(int i=0;i<s;i++){ | ^ In file included from /usr/include/c++/14/bits/memory_resource.h:47, from /usr/include/c++/14/string:68: /usr/include/c++/14/tuple:2600:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator<(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)' 2600 | operator<(const tuple<_TElements...>& __t, | ^~~~~~~~ /usr/include/c++/14/tuple:2600:5: note: template argument deduction/substitution failed: a.cc:10:19: note: mismatched types 'const std::tuple<_UTypes ...>' and 'int' 10 | for(int i=0;i<s;i++){ | ^ In file included from /usr/include/c++/14/vector:66, from a.cc:2: /usr/include/c++/14/bits/stl_vector.h:2089:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator<(const vector<_Tp, _Alloc>&, const vector<_Tp, _Alloc>&)' 2089 | operator<(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:2089:5: note: template argument deduction/substitution failed: a.cc:10:19: note: mismatched types 'const std::vector<_Tp, _Alloc>' and 'int' 10 | for(int i=0;i<s;i++){ | ^ In file included from /usr/include/c++/14/bits/ios_base.h:46: /usr/include/c++/14/system_error:324:3: note: candidate: 'bool std::operator<(const error_code&, const error_code&)' 324 | operator<(const error_code& __lhs, const error_code& __rhs) noexcept | ^~~~~~~~ /usr/include/c++/14/system_error:324:31: note: no known conversion for argument 1 from 'int' to 'const std::error_code&' 324 | operator<(const error_code& __lhs, const error_code& __rhs) noexcept | ~~~~~~~~~~~~~~~~~~^~~~~ /usr/include/c++/14/system_error:507:3: note: candidate: 'bool std::operator<(const error_condition&, const error_condition&)' 507 | operator<(const error_condition& __lhs, | ^~~~~~~~ /usr/include/c++/14/system_error:507:36: note: no known conversion for argument 1 from 'int' to 'const std::error_condition&' 507 | operator<(const error_condition& __lhs, | ~~~~~~~~~~~~~~~~~~~~~~~^~~~~
s680651565
p04030
C++
#include <bits/stdc++.h> char str[101],answer[101]; int main() { gets(str); int lens=strlen(str),i,lena=0; for(i=0;i<lens;i++) switch(str[i]) { case '0':answer[lena]='0';lena++;break; case '1':answer[lena]='1';lena++;break; case 'B':if(lena!=0) lena--;break; for(i=0;i<lena;i++) printf("%c",answer[i]); printf("\n"); }
a.cc: In function 'int main()': a.cc:6:5: error: 'gets' was not declared in this scope; did you mean 'getw'? 6 | gets(str); | ^~~~ | getw a.cc:17:2: error: expected '}' at end of input 17 | } | ^ a.cc:4:1: note: to match this '{' 4 | { | ^
s186352921
p04030
Java
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Stack; public class AtCoderAbc043A { public static void main(String[] args)throws Exception { BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); String word = input.readLine(); Stack<Character> characters = new Stack<>(); for (int i = 0; i < word.length(); i++) { if (word.charAt(i) == 'B' && !characters.isEmpty()){ characters.pop(); }else if (word.charAt(i) == '1' || word.charAt(i) == '0'){ characters.push(word.charAt(i)); } } StringBuilder out = new StringBuilder(); for (int i = 0; i < characters.size(); i++) { out.append(characters.get(i)); } System.out.println(out); } }
Main.java:5: error: class AtCoderAbc043A is public, should be declared in a file named AtCoderAbc043A.java public class AtCoderAbc043A { ^ 1 error
s264510540
p04030
C
#include<cstdio> #include<cstring> char stop,ans[12],c[12]; int len,str; int main() {int s; scanf("%s",c); len=strlen(c); for(int i=1;i<=len;i++) { stop=c[i]; if(stop=='B') {if(str>0) { str--; ans[str]='\0'; }} else{ans[str]=stop; str++; } } printf("%s",ans); }
main.c:1:9: fatal error: cstdio: No such file or directory 1 | #include<cstdio> | ^~~~~~~~ compilation terminated.
s941825609
p04030
C++
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; if (s.at(0) != 'B') { cout << s.at(0); } for (int i = 1; i < n - 1; i ++) { if (s.at(i + 1) != 'B' || s.at(i) != 'B') { cout << s.at(i); } } if (s.at(s.size() - 1) != 'B') { cout << s.at(s.size() - 1); } cout << endl; }
a.cc: In function 'int main()': a.cc:11:23: error: 'n' was not declared in this scope 11 | for (int i = 1; i < n - 1; i ++) { | ^
s135133963
p04030
C++
#include <iostream> #include<cstring> using namespace std; int main() { char str[101], answer[101]; gets(str); int lens = strlen(str), i, lena = 0; for (i = 0; i < lens; i++) switch (str[i]) { case '0':answer[lena] = '0'; lena++; break; case '1':answer[lena] = '1'; lena++; break; case 'B':if (lena != 0) lena--; break; } for (i = 0; i < lena; i++) printf("%c", answer[i]); printf("\n"); }
a.cc: In function 'int main()': a.cc:7:9: error: 'gets' was not declared in this scope; did you mean 'getw'? 7 | gets(str); | ^~~~ | getw
s019252564
p04030
C++
#include <iostream> using namespace std; int main() { char str[101], answer[101]; gets(str); int lens = strlen(str), i, lena = 0; for (i = 0; i < lens; i++) switch (str[i]) { case '0':answer[lena] = '0'; lena++; break; case '1':answer[lena] = '1'; lena++; break; case 'B':if (lena != 0) lena--; break; } for (i = 0; i < lena; i++) printf("%c", answer[i]); printf("\n"); }
a.cc: In function 'int main()': a.cc:6:9: error: 'gets' was not declared in this scope; did you mean 'getw'? 6 | gets(str); | ^~~~ | getw a.cc:7:20: error: 'strlen' was not declared in this scope 7 | int lens = strlen(str), i, lena = 0; | ^~~~~~ a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 1 | #include <iostream> +++ |+#include <cstring> 2 | using namespace std; a.cc:8:14: error: 'i' was not declared in this scope 8 | for (i = 0; i < lens; i++) | ^ a.cc:11:33: error: 'lena' was not declared in this scope; did you mean 'lens'? 11 | case '0':answer[lena] = '0'; lena++; break; | ^~~~ | lens a.cc:15:14: error: 'i' was not declared in this scope 15 | for (i = 0; i < lena; i++) | ^ a.cc:15:25: error: 'lena' was not declared in this scope; did you mean 'lens'? 15 | for (i = 0; i < lena; i++) | ^~~~ | lens
s286941273
p04030
C++
#include<bits/c++std.h> using namespace std; #define rep(i,n) for(int i=0;i<(n);i++) map<string, int> mp; int main() { string s; cin >> s; vector<char> ans; for (int i = 0; i < s.size();i++) { if (s[i] == '0') { ans.push_back('0'); } if (s[i] == '1') { ans.push_back('1'); } if (ans.size() >= 1 && s[i] == 'B') { ans.pop_back(); } for (int i = 0; i < ans.size();i++) { cout << ans[i]; } } cout << endl; }
a.cc:1:9: fatal error: bits/c++std.h: No such file or directory 1 | #include<bits/c++std.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s219224315
p04030
C++
#include <iostream> #include <string> #include <vector> #include <algorithm> #include <cmath> #include <cstdlib> #include <thread> #include <chrono> #include <queue> using namespace std; int main(void){ string s; queue<char> q; cin >> s; for(int i=0;i<s.length();i++){ if(s.at(i)=='0'){ q.push('0'); }else if(s.at(i)=='1'){ q.push('1'); }else{ if(!(i==0)){ q.push(' '); } } } for(int i=q.size();i>=0;i--){ cout << q[i]; q.pop(); } cout << endl; return 0; }
a.cc: In function 'int main()': a.cc:29:26: error: no match for 'operator[]' (operand types are 'std::queue<char>' and 'int') 29 | cout << q[i]; | ^
s279057601
p04030
C++
#include <iostream> #include <string> #include <vector> #include <algorithm> #include <cmath> #include <cstdlib> #include <thread> #include <chrono> #include <queue> using namespace std; int main(void){ string s; queue<char> q; cin >> s; for(int i=0;i<s.length();i++){ if(s.at(i)=='0'){ q.push('0'); }else if(s.at(i)=='1'){ q.push('1'); }else{ if(!(i==0)){ q.push(' '); } } } for(int i=q.size();i>=0;i--){ cout << q[i]; q.pop; } cout << endl; return 0; }
a.cc: In function 'int main()': a.cc:29:26: error: no match for 'operator[]' (operand types are 'std::queue<char>' and 'int') 29 | cout << q[i]; | ^ a.cc:30:19: error: invalid use of non-static member function 'void std::queue<_Tp, _Sequence>::pop() [with _Tp = char; _Sequence = std::deque<char, std::allocator<char> >]' 30 | q.pop; | ~~^~~ In file included from /usr/include/c++/14/queue:66, from a.cc:9: /usr/include/c++/14/bits/stl_queue.h:316:7: note: declared here 316 | pop() | ^~~
s697273022
p04030
C++
#include <iostream> #include <string> #include <vector> #include <algorithm> #include <cmath> #include <cstdlib> #include <thread> #include <chrono> #include <queue> using namespace std; int main(void){ string s; queue<char> q; cin >> s; for(int i=0;i<s.length();i++){ if(s.at(i)=='0'){ q.push('0'); }else if(s.at(i)=='1'){ q.push('1'); }else{ if(!(i==0)){ q.push(' '); } } } for(int i=0;i<q.size();i++){ cout << q; cout << endl; } return 0; }
a.cc: In function 'int main()': a.cc:29:22: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'std::queue<char>') 29 | cout << q; | ~~~~ ^~ ~ | | | | | std::queue<char> | std::ostream {aka std::basic_ostream<char>} In file included from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from 'std::queue<char>' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'} 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]' 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from 'std::queue<char>' to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ^~~~~~~~ /usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from 'std::queue<char>' to 'std::ios_base& (*)(std::ios_base&)' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 174 | operator<<(long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from 'std::queue<char>' to 'long int' 174 | operator<<(long __n) | ~~~~~^~~ /usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 178 | operator<<(unsigned long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from 'std::queue<char>' to 'long unsigned int' 178 | operator<<(unsigned long __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 182 | operator<<(bool __n) | ^~~~~~~~ /usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from 'std::queue<char>' to 'bool' 182 | operator<<(bool __n) | ~~~~~^~~ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]' 96 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from 'std::queue<char>' to 'short int' 97 | operator<<(short __n) | ~~~~~~^~~ /usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 189 | operator<<(unsigned short __n) | ^~~~~~~~ /usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from 'std::queue<char>' to 'short unsigned int' 189 | operator<<(unsigned short __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]' 110 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from 'std::queue<char>' to 'int' 111 | operator<<(int __n) | ~~~~^~~ /usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 200 | operator<<(unsigned int __n) | ^~~~~~~~ /usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from 'std::queue<char>' to 'unsigned int' 200 | operator<<(unsigned int __n) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 211 | operator<<(long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from 'std::queue<char>' to 'long long int' 211 | operator<<(long long __n) | ~~~~~~~~~~^~~ /usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 215 | operator<<(unsigned long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from 'std::queue<char>' to 'long long unsigned int' 215 | operator<<(unsigned long long __n) | ~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 231 | operator<<(double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from 'std::queue<char>' to 'double' 231 | operator<<(double __f) | ~~~~~~~^~~ /usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 235 | operator<<(float __f) | ^~~~~~~~ /usr/include/c++/14/ostream:235:24: note: no known conversion for argument 1 from 'std::queue<char>' to 'float' 235 | operator<<(float __f) | ~~~~~~^~~ /usr/include/c++/14/ostream:243:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 243 | operator<<(long double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:243:30: note: no known conversion for argument 1 from 'std::queue<char>' to 'long double' 243 | operator<<(long double __f) | ~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:301:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 301 | operator<<(const void* __p) | ^~~~~~~~ /usr/include/c++/14/ostream:301:30: note: no known conversion for argument 1 from 'std::queue<char>' to 'const void*' 301 | operator<<(const void* __p) | ~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:306:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::nullptr_t) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; std::nullptr_t = std::nullptr_t]' 306 | operator<<(nullptr_t) | ^~~~~~~~ /usr/include/c++/14/ostream:306:18: note: no known conversion for argument 1 from 'std::queue<char>' to 'std::nullptr_t' 306 | operator<<(nullptr_t) | ^~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:124:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(__streambuf_type*) [with _CharT
s264147343
p04030
C++
#include <iostream> #include <string> #include <vector> #include <algorithm> #include <cmath> #include <cstdlib> #include <thread> #include <chrono> #include <queue> using namespace std; int main(void){ string s; queue<char> q; cin >> s; for(int i=0;i<s.length();i++){ if(s.at(i)=='0'){ q.push('0'); }else if(s.at(i)=='1'){ q.push('1'); }else{ if(!(i==0)){ q.push(' '); } } } for(int i=0;i<q.length();i++){ cout << q; cout << endl; } return 0; }
a.cc: In function 'int main()': a.cc:28:25: error: 'class std::queue<char>' has no member named 'length' 28 | for(int i=0;i<q.length();i++){ | ^~~~~~ a.cc:29:22: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'std::queue<char>') 29 | cout << q; | ~~~~ ^~ ~ | | | | | std::queue<char> | std::ostream {aka std::basic_ostream<char>} In file included from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from 'std::queue<char>' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'} 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]' 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from 'std::queue<char>' to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ^~~~~~~~ /usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from 'std::queue<char>' to 'std::ios_base& (*)(std::ios_base&)' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 174 | operator<<(long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from 'std::queue<char>' to 'long int' 174 | operator<<(long __n) | ~~~~~^~~ /usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 178 | operator<<(unsigned long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from 'std::queue<char>' to 'long unsigned int' 178 | operator<<(unsigned long __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 182 | operator<<(bool __n) | ^~~~~~~~ /usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from 'std::queue<char>' to 'bool' 182 | operator<<(bool __n) | ~~~~~^~~ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]' 96 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from 'std::queue<char>' to 'short int' 97 | operator<<(short __n) | ~~~~~~^~~ /usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 189 | operator<<(unsigned short __n) | ^~~~~~~~ /usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from 'std::queue<char>' to 'short unsigned int' 189 | operator<<(unsigned short __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]' 110 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from 'std::queue<char>' to 'int' 111 | operator<<(int __n) | ~~~~^~~ /usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 200 | operator<<(unsigned int __n) | ^~~~~~~~ /usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from 'std::queue<char>' to 'unsigned int' 200 | operator<<(unsigned int __n) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 211 | operator<<(long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from 'std::queue<char>' to 'long long int' 211 | operator<<(long long __n) | ~~~~~~~~~~^~~ /usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 215 | operator<<(unsigned long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from 'std::queue<char>' to 'long long unsigned int' 215 | operator<<(unsigned long long __n) | ~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 231 | operator<<(double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from 'std::queue<char>' to 'double' 231 | operator<<(double __f) | ~~~~~~~^~~ /usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 235 | operator<<(float __f) | ^~~~~~~~ /usr/include/c++/14/ostream:235:24: note: no known conversion for argument 1 from 'std::queue<char>' to 'float' 235 | operator<<(float __f) | ~~~~~~^~~ /usr/include/c++/14/ostream:243:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 243 | operator<<(long double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:243:30: note: no known conversion for argument 1 from 'std::queue<char>' to 'long double' 243 | operator<<(long double __f) | ~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:301:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 301 | operator<<(const void* __p) | ^~~~~~~~ /usr/include/c++/14/ostream:301:30: note: no known conversion for argument 1 from 'std::queue<char>' to 'const void*' 301 | operator<<(const void* __p) | ~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:306:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::nullptr_t) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; std::nullptr_t = std::nullptr_t]' 306 | operator<<(nullptr_t) | ^~~~~~~~ /usr/include/c++/14/ostream:306:18: note: no known conversion for argument 1 from 'std::queue<char>' to 'std::nullptr_t' 306 | operator<<(nullptr_t) | ^~~~~~~~~ /usr/include/c++/14
s208265697
p04030
C++
#include <iostream> #include <string> #include <algorithm> using namespace std; int main() { string s, t; cin >> s; for (int i = 0; i < s.size(); i++) { if (s[i] == 0) t += "0"; if (s[i] == 1) t += "1"; if (s[i] == "B") t.pop_back(); } cout << t; return 0; }
a.cc: In function 'int main()': a.cc:13:14: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 13 | if (s[i] == "B") t.pop_back();
s612583384
p04030
C++
#include <iostream> #include <string> #include <algorithm> using namespace std; int main() { string s, t; cin >> s; for (int i = 0; i < s.sixe(); i++) { if (s[i] == 0) t += "0"; if (s[i] == 1) t += "1"; if (s[i] == "B") t.pop_back(); } cout << t; return 0; }
a.cc: In function 'int main()': a.cc:10:25: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'sixe'; did you mean 'size'? 10 | for (int i = 0; i < s.sixe(); i++) { | ^~~~ | size a.cc:13:14: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 13 | if (s[i] == "B") t.pop_back();
s389873540
p04030
C++
#include <iostream> #include <string> #include <algorithm> int main() { string s, t; cin >> s; for (int i = 0; i < s.sixe(); i++) { if (s[i] == 0) t += "0"; if (s[i] == 1) t += "1"; if (s[i] == "B") t.pop_back(); } cout << t; return 0; }
a.cc: In function 'int main()': a.cc:6:3: error: 'string' was not declared in this scope 6 | string s, t; | ^~~~~~ 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:10: error: 's' was not declared in this scope 7 | cin >> s; | ^ a.cc:10:20: error: 't' was not declared in this scope 10 | if (s[i] == 0) t += "0"; | ^ a.cc:11:20: error: 't' was not declared in this scope 11 | if (s[i] == 1) t += "1"; | ^ a.cc:12:22: error: 't' was not declared in this scope 12 | if (s[i] == "B") t.pop_back(); | ^ a.cc:14:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 14 | cout << t; | ^~~~ | std::cout /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~ a.cc:14:11: error: 't' was not declared in this scope; did you mean 'tm'? 14 | cout << t; | ^ | tm
s700899988
p04030
C++
#include <iostream> #include <string> using namespace std; int main() { string str, ans; cin >> str; for (auto s : str) { if (s != 'B') ans += s; else if (!ans.empty()) { auto it = ans.end(); ans.erace(--it); } } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:13:11: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'erace'; did you mean 'erase'? 13 | ans.erace(--it); | ^~~~~ | erase
s437471045
p04030
C++
#include<iostream> #include<algorithm> #include<math.h> #include<queue> #include<string> #include<vector> #include<tuple> #include<stack> #include<iomanip> #include<map> using namespace std; int main() { string s; int i,n; cin >> s; n = strlen (s); i = 0; while (s[i] == 'B') { s[i] = 2; i++; } int j; for (j = i; j < n; j++) { if (s[j] == 'B') { s[j] = 2; s[j - 1] = 2; } } for (j = 0; j < n; j++) { if (s[j] != '2')cout << s[j]; } cout << endl; return 0; }
a.cc: In function 'int main()': a.cc:17:13: error: 'strlen' was not declared in this scope 17 | n = strlen (s); | ^~~~~~ a.cc:11:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 10 | #include<map> +++ |+#include <cstring> 11 | using namespace std;
s870723817
p04030
C++
#include<iostream> #include<algorithm> #include<math.h> #include<queue> #include<string> #include<vector> #include<tuple> #include<stack> #include<iomanip> #include<map> using namespace std; int main() { string s; int i,n; cin >> s; n = strlen (s); i = 0; while (s[i] == 'B') { s[i] == 2; i++; } int j; for (j = i; j < n; j++) { if (s[j] == 'B') { s[j] = 2; s[j - 1] = 2; } } for (j = 0; j < n; j++) { if (s[j] != '2')cout << s[j]; } cout << endl; return 0; }
a.cc: In function 'int main()': a.cc:17:13: error: 'strlen' was not declared in this scope 17 | n = strlen (s); | ^~~~~~ a.cc:11:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 10 | #include<map> +++ |+#include <cstring> 11 | using namespace std;
s745835697
p04030
C++
#include<iostream> #include<algorithm> #include<math.h> #include<queue> #include<string> #include<vector> #include<tuple> #include<stack> #include<iomanip> #include<map> using namespace std; int main() { string s; int i,n; cin >> s; n = strlen(s); i = 0; while (s[i] == 'B') { s[i] == 2; i++; } int j; for (j = i; j < n; j++) { if (s[j] == 'B') { s[j] = 2; s[j - 1] = 2; } } for (j = 0; j < n; j++) { if (s[j] != '2')cout << s[j]; } cout << endl; return 0; }
a.cc: In function 'int main()': a.cc:17:13: error: 'strlen' was not declared in this scope 17 | n = strlen(s); | ^~~~~~ a.cc:11:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 10 | #include<map> +++ |+#include <cstring> 11 | using namespace std;
s011115720
p04030
C++
#include <iostream> using namespace std; int main(int argc, char const *argv[]) { cin.tie(0); ios::sync_with_stdio(false); string s; cin >> s; string ans; for (int i = 0; i < s.length(); ++i) { if (s[i] == 'B') { ans.pop_back(); } else { if (ans.length > 0) { ans.push_back(s[i]); } } } cout << ans << "\n"; return 0; }
a.cc: In function 'int main(int, const char**)': a.cc:14:15: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?) 14 | if (ans.length > 0) { | ~~~~^~~~~~ | ()
s940872302
p04030
C++
#include<bits/stdc++.h> using namespace std; int main() { string s; cin >> s; string ans; for (char c : s) { if (c == 1) { ans+='1' } else if (c == 0) { ans+='0' } else { if (s.begin() == s.end()) { continue; } else { ans.erase(ans.end() - 1); } } } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:9:33: error: expected ';' before '}' token 9 | ans+='1' | ^ | ; 10 | } | ~ a.cc:12:33: error: expected ';' before '}' token 12 | ans+='0' | ^ | ; 13 | } | ~
s289163188
p04030
C++
#include<bits/stdc++.h> using namespace std; int main() { string s; cin >> s; string ans; for (char c : s) { if (c == 1) { ans+='1' } else if (c == 0) { ans+='0' } else { if (s.begin() == s.end()) { continue; } else { s.erase(s.end() - 1); } } } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:9:33: error: expected ';' before '}' token 9 | ans+='1' | ^ | ; 10 | } | ~ a.cc:12:33: error: expected ';' before '}' token 12 | ans+='0' | ^ | ; 13 | } | ~
s390589181
p04030
C++
#include <bits/stdc++.h> using namespace std; int main(){ string s; cin >>s; int n=-1; string t=" "; for(int i =0; i< s.size(); i++) { if(s[i] == "B" && n>=0) { t[n--] = ""; } else { t[++n] = s[i]; } } cout << t << endl; }
a.cc: In function 'int main()': a.cc:10:25: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 10 | if(s[i] == "B" && n>=0) { a.cc:11:34: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive] 11 | t[n--] = ""; | ^~ | | | const char*
s136997075
p04030
C++
#include <iostream> #include <string.h> using namespace std; int main() { char s[100],s1[100]; cin>>s; for(int i=0; i<strlen(s); i++){ s1[i]='2'; if(s1[i]=='B'&&i==0){ continue; } else{ if(s[i]=='0'){ s1[i]='0'; } else if(s[i]=='1'){ s1[i]='1'; } else{ s1[i-1]='2'; } } for(int i=0; i<strlen(s); i++){ if(s1[i]!='2'){ cout<<s1[i]; } } return 0; }
a.cc: In function 'int main()': a.cc:31:2: error: expected '}' at end of input 31 | } | ^ a.cc:6:1: note: to match this '{' 6 | { | ^
s748739331
p04030
C++
#include <iostream> #include <string.h> using namespace std; int main() { char s[100],s1[100]; cin>>s; for(int i=0; i<strlen(s); i++){ s1[i]='2'; if(s1[i]=='B'){ continue; } else{ if(s[i]=='0'){ s1[i]='0'; } else if(s[i]=='1'){ s1[i]='1'; } else{ s1[i-1]='2'; } } for(int i=0; i<strlen(s); i++){ if(s1[i]!='2'){ cout<<s1[i]; } } return 0; }
a.cc: In function 'int main()': a.cc:31:2: error: expected '}' at end of input 31 | } | ^ a.cc:6:1: note: to match this '{' 6 | { | ^
s341481287
p04030
C++
#include <cstdio> #include <stack> #include <cstring> using namespace std; stack<int> s; int main() { int n, lim; char str[15]; gets(str+1); n = strlen(str); for(int i=1; i<n; i++) { if(str[i] == '0' || str[i] == '1') s.push(str[i]); else s.pop(); } lim = s.size(); for(int i=1; i<=lim; i++) { str[i] = s.top(); s.pop(); } for(int i=1; i<=lim; i++) printf("%c", str[i]); printf("\n"); return 0; }
a.cc: In function 'int main()': a.cc:14:5: error: 'gets' was not declared in this scope; did you mean 'getw'? 14 | gets(str+1); | ^~~~ | getw
s077741088
p04030
C++
#include "bits/stdc++.h" using namespace std; int main() { string s, a=''; cin >> s; for(int i=0;i<s.size();i++) { if(s.at(i) == '0') a += '0'; if(s.at(i) == '1') a += '1'; if(s.at(i) == 'B') a.pop_back(); } cout << a << endl; }
a.cc:5:21: error: empty character constant 5 | string s, a=''; | ^~ a.cc: In function 'int main()': a.cc:5:21: error: conversion from 'char' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
s601839587
p04030
C++
include <iostream> #include <cstring> #include <algorithm> #include <vector> using namespace std; int main(void){ char com[10]; cin>>com; int N; N=strlen(com); vector<int> str; for(int i=0;i<N;i++){ if(com[i]==1) {str.push_back(1);} else if(com[i]==0) {str.push_back(0);} else if(com[i]=='B') {str.pop_back();} } for(int i=0;i<str.size();i++){ cout<<str[i]; } return 0; }
a.cc:1:1: error: 'include' does not name a type 1 | include <iostream> | ^~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:62, from /usr/include/c++/14/algorithm:60, from a.cc:3: /usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity 164 | __is_null_pointer(std::nullptr_t) | ^ /usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)' 159 | __is_null_pointer(_Type) | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std' 164 | __is_null_pointer(std::nullptr_t) | ^~~~~~~~~ In file included from /usr/include/c++/14/bits/stl_pair.h:60, from /usr/include/c++/14/bits/stl_algobase.h:64: /usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std' 666 | struct is_null_pointer<std::nullptr_t> | ^~~~~~~~~ /usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid 666 | struct is_null_pointer<std::nullptr_t> | ^ /usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid 670 | struct is_null_pointer<const std::nullptr_t> | ^ /usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid 674 | struct is_null_pointer<volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid 678 | struct is_null_pointer<const volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^~~~~~ In file included from /usr/include/string.h:33, from /usr/include/c++/14/cstring:43, from a.cc:2: /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^ /usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1438 | : public integral_constant<std::size_t, 0> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid 1438 | : public integral_constant<std::size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared 1440 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope 1441 | struct rank<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid 1441 | struct rank<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:2086:26: error: 'std::size_t' has not been declared 2086 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:2087:30: error: '_Size' was not declared in this scope 2087 | struct remove_extent<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:2087:36: error: template argument 1 is invalid 2087 | struct remove_extent<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:2099:26: error: 'std::size_t' has not been declared 2099 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:2100:35: error: '_Size' was not declared in this scope 2100 | struct remove_all_extents<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:2100:41: error: template argument 1 is invalid 2100 | struct remove_all_extents<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:2171:12: error: 'std::size_t' has not been declared 2171 | template<std::size_t _Len> | ^~~ /usr/include/c++/14/type_traits:2176:30: error: '_Len' was not declared in this scope 2176 | unsigned char __data[_Len]; | ^~~~ /usr/include/c++/14/type_traits:2194:12: error: 'std::size_t' has not been declared 2194 | template<std::size_t _Len, std::size_t _Align = | ^~~ /usr/include/c++/14/type_traits:2194:30: error: 'std::size_t' has not been declared 2194 | template<std::size_t _Len, std::size_t _Align = | ^~~ /usr/include/c++/14/type_traits:2195:55: error: '_Len' was not declared in this scope 2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)> | ^~~~ /usr/include/c++/14/type_traits:2195:59: error: template argument 1 is invalid 2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)> | ^ /usr/include/c++/14/type_traits:2202:30: error: '_Len' was not declared in this scope 2202 | unsigned char __data[_Len]; | ^~~~ /usr/include/c++/14/type_traits:2203:44: error: '_Align' was not declared in this scope 2203 | struct __attribute__((__aligned__((_Align)))) { } __align; | ^~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:65: /usr/include/c++/14/bits/stl_iterator_base_types.h:125:67: error: 'ptrdiff_t' does not name a type 125 | template<typename _Category, typename _Tp, typename _Distance = ptrdiff_t, | ^~~~~~~~~ /usr/include/c++/14/bits/stl_iterator_base_types.h:1:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' +++ |+#include <cstddef> 1 | // Types used in iterator implementation -*- C++ -*- /usr/include/c++/14/bits/stl_iterator_base_types.h:214:15: error: 'ptrdiff_t' does not name a type 214 | typedef ptrdiff_t difference_type; | ^~~~~~~~~ /usr/include/c++/14/bits/stl_iterator_base_types.h:214:15: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/bits/stl_iterator_base_types.h:225:15: error: 'ptrdiff_t' does not name a type 225 | typedef ptrdiff_t difference_type; | ^~~~~~~~~ /usr/include/c++/14/bits/stl_iterator_base_types.h:225:15: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' In file included from /usr/include/c++/14/bits/stl_algobase.h:66: /usr/include/c++/14/bits/stl_iterator_base_funcs.h:112:5: error: 'ptrdiff_t' does not name a type 112 | ptrdiff_t | ^~~~~~~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:66:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' 65 | #include <debug/assertions.h> +++ |+#include <cstddef> 66 | #include <bits/stl_iterator_base_types.h> /usr/include/c++/14/bits/stl_iterator_base_funcs.h:118:5: error: 'ptrdiff_t' does not name a type 118 | ptrdiff_t | ^~~~~~~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:118:5: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' In file included from /usr/include/c++/14/bits/stl_iterator.h:67, from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/ptr_traits.h:156:47: error: 'ptrdiff_t' was not declared in this scope
s427357883
p04030
Java
import java.util.*; public class Keyboard { public static void main(String[] args) { // TODO 自动生成的方法存根 Scanner sc=new Scanner(System.in); String b=sc.nextLine(); String K ; int j=0; StringBuilder builder=new StringBuilder(""); for(int i=0;i<b.length();i++) { K=b.substring(i,i+1); if(K.equals("B")&&builder.length()>0) {//如果是B空格键就删除前面的元素,如果不是添加进集合中 builder.delete(j-1,j); j--; }if(K.equals("1")) { builder.append(K); j++; }if(K.equals("0")){ builder.append(K); j++; } } System.out.println(builder.toString()); } }
Main.java:2: error: class Keyboard is public, should be declared in a file named Keyboard.java public class Keyboard { ^ 1 error
s312283883
p04030
Java
import java.util.*; public class Keyboard { public static void main(String[] args) { // TODO 自动生成的方法存根 Scanner sc=new Scanner(System.in); String b=sc.nextLine(); String K ; int j=0; StringBuilder builder=new StringBuilder(""); for(int i=0;i<b.length();i++) { K=b.substring(i,i+1); if(K.equals("B")&&builder.length()>0) {//如果是B空格键就删除前面的元素,如果不是添加进集合中 builder.delete(j-1,j); j--; }if(K.equals("1")) { builder.append(K); j++; }if(K.equals("0")){ builder.append(K); j++; } } System.out.println(builder.toString()); } }
Main.java:2: error: class Keyboard is public, should be declared in a file named Keyboard.java public class Keyboard { ^ 1 error
s267286759
p04030
C++
#include<iostream> #include<cstring> #include<cstdio> using namespace std; char s[105],ans[105]; int main() { gets(s); int len=strlen(s),tot=0; for(int i=0;i<len;i++) { if(s[i]=='0') ans[++tot]='0'; if(s[i]=='B'&&tot>0) tot--; if(s[i]=='1') ans[++tot]='1'; } for(int i=1;i<=tot;i++) { cout<<ans[i]; } return 0; }
a.cc: In function 'int main()': a.cc:8:9: error: 'gets' was not declared in this scope; did you mean 'getw'? 8 | gets(s); | ^~~~ | getw