submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3
values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s466273393 | p04030 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
string s;
string output(10);
int point;
cin >> s;
point = 0;
for(int i=0;i<s.size();i++){
if(s.at(i)=='B'){
output.at(point) = '';
point = max(point-1,0);
}else{output.at(point) = s.at(i);
point++;
}
}
cou... | a.cc:12:26: error: empty character constant
12 | output.at(point) = '';
| ^~
a.cc: In function 'int main()':
a.cc:6:19: error: no matching function for call to 'std::__cxx11::basic_string<char>::basic_string(int)'
6 | string output(10);
| ^
In file i... |
s839364611 | p04030 | C++ | #include<bits/stdc++.h>
using namespace std;
string a;
int b[15],q;
int main()
{
cin>>a;
for(int i=0;i<a.size();i++)
{
if(a[i]=='0'){q++;b[q]=0;}
if(a[i]=='1'){q++;b[q]=1;}
if(a[i]=='B'&&q>=1)q--;
}
for(int i=1;i<=q;i++)cout<<b[i];
cout<<endl!
return 0;
} | a.cc: In function 'int main()':
a.cc:15:11: error: 'endl\U0000ff01' was not declared in this scope
15 | cout<<endl!
| ^~~~~~
|
s193202143 | p04030 | C | #include<stdio.h>
main()
{
int s[4];
int i;
for(i=1;i<=4;i++)
{
scanf("%c",s[i]);
if(char s[i]==0)
printf("%c",s[i]);
if(char s[i]==1)
printf("%c",s[i]);
if(char s[i]=='65')
{
s[i-1]='\0';
}
}
printf("%c%c%c%c",s[i]);
return 0;
}
| main.c:2:1: error: return type defaults to 'int' [-Wimplicit-int]
2 | main()
| ^~~~
main.c: In function 'main':
main.c:9:12: error: expected expression before 'char'
9 | if(char s[i]==0)
| ^~~~
main.c:11:20: error: expected expression before 'char'
11 | if(char ... |
s899140285 | p04030 | C | #include<stdio.h>
main()
{
char s[4];
int i;
for(i=1;i<=4;i++)
{
scanf("%c",s[i]);
if(char s[i]==0)
printf("%c",s[i]);
if(char s[i]==1)
printf("%c",s[i]);
if(char s[i]==B)
{
s[i-1]='\0';
}
}
printf("%c%c%c%c",s[i]);
return 0;
}
| main.c:2:1: error: return type defaults to 'int' [-Wimplicit-int]
2 | main()
| ^~~~
main.c: In function 'main':
main.c:9:12: error: expected expression before 'char'
9 | if(char s[i]==0)
| ^~~~
main.c:11:20: error: expected expression before 'char'
11 | if(char ... |
s513678360 | p04030 | C | #include<stdio.h>
main()
{
char s[i];
int i;
for(i=1;i<=4;i++)
{
scanf("%c",s[i]);
if(char s[i]==0)
printf("%c",s[i]);
if(char s[i]==1)
printf("%c",s[i]);
if(char s[i]==B)
{
s[i-1]='\0';
}
}
printf("%c%c%c%c",s[i]);
return 0;
}
| main.c:2:1: error: return type defaults to 'int' [-Wimplicit-int]
2 | main()
| ^~~~
main.c: In function 'main':
main.c:4:16: error: 'i' undeclared (first use in this function)
4 | char s[i];
| ^
main.c:4:16: note: each undeclared identifier is reported only once for each funct... |
s987429649 | p04030 | C | #include<stdio.h>
main()
{
char s[i];
int i;
for(i=1;i<=4;i++)
{
scanf("%c",s[i]);
if(char s[i]==0)
printf("%c",s[i]);
if(char s[i]==1)
printf("%c",s[i]);
if(char s[i]==B)
{
s[i-1]='\0';
}
}
printf("%c%c%c%c",s[i]);
return 0;
}
| main.c:2:1: error: return type defaults to 'int' [-Wimplicit-int]
2 | main()
| ^~~~
main.c: In function 'main':
main.c:4:16: error: 'i' undeclared (first use in this function)
4 | char s[i];
| ^
main.c:4:16: note: each undeclared identifier is reported only once for each funct... |
s927244040 | p04030 | C | #include<stdio.h>
int main()
{
char s[i];
int i;
scanf("%c%c%c%c",s[i]);
for(i=0;i<4;i++)
{
if(char s[i]==0)
printf("%c",s[i]);
if(char s[i]==1)
printf("%c",s[i]);
if(char s[i]==B)
{
s[i-1]='\0';
}
}
return 0;
}
| main.c: In function 'main':
main.c:4:16: error: 'i' undeclared (first use in this function)
4 | char s[i];
| ^
main.c:4:16: note: each undeclared identifier is reported only once for each function it appears in
main.c:9:12: error: expected expression before 'char'
9 | if(cha... |
s682585715 | p04030 | C | #include<stdio.h>
int main()
{
char s[i];
scanf("%c%c%c%c",s[i]);
for(i=0;i<4;i++)
{
if(char s[i]==0)
printf("%c",s[i]);
if(char s[i]==1)
printf("%c",s[i]);
if(char s[i]==B)
{
s[i-1]='\0';
}
}
return 0;
}
| main.c: In function 'main':
main.c:4:16: error: 'i' undeclared (first use in this function)
4 | char s[i];
| ^
main.c:4:16: note: each undeclared identifier is reported only once for each function it appears in
main.c:8:12: error: expected expression before 'char'
8 | if(cha... |
s233181157 | p04030 | C++ | #include<iostream>
#include<stack>
#include<string.h>
#include<cstdio>
using namespace std;
int main()
{
char s[12];
int i,j,len,num;
stack<char>str;
getchar();
gets(s);
len=strlen(s);
for(i=0;i<len;i++){
if(str.empty()==false && s[i]==' ') str.pop();
else str.push(s[i]);
... | a.cc: In function 'int main()':
a.cc:13:5: error: 'gets' was not declared in this scope; did you mean 'getw'?
13 | gets(s);
| ^~~~
| getw
|
s702294800 | p04030 | C++ | #include<iostream>
#include<stack>
#include<string.h>
#include<cstdio>
using namespace std;
int main()
{
char s[130];
int i,j,len,num;
stack<char>str;
gets(s);
len=strlen(s);
for(i=0;i<len;i++){
if(str.empty()==false && s[i]==' ') str.pop();
else str.push(s[i]);
}
while(... | a.cc: In function 'int main()':
a.cc:12:5: error: 'gets' was not declared in this scope; did you mean 'getw'?
12 | gets(s);
| ^~~~
| getw
|
s590587259 | p04030 | Java | public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s = sc.nextLine();
char[] c = s.toCharArray();
StringBuilder sb = new StringBuilder();
for (int i=0; i<c.length; i++) {
if (c[i] == '0' | c[i] == '1') {
sb.append(c[i]);
} else if (c[i... | Main.java:4: error: cannot find symbol
Scanner sc = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
Main.java:4: error: cannot find symbol
Scanner sc = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
2 errors
|
s844704517 | p04030 | C++ | #include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdi... | a.cc: In function 'int main()':
a.cc:42:29: error: invalid use of non-static member function 'void std::vector<_Tp, _Alloc>::pop_back() [with _Tp = char; _Alloc = std::allocator<char>]'
42 | key.pop_back;
| ~~~~^~~~~~~~
In file included from /usr/include/c++/14/v... |
s854657183 | p04030 | C++ | #include <iostream>
#include <vector>
using namespace std;
int main(){
string s;
cin >> s;
string ans = "";
for(int i = 0; i < s.size(); i++){
char c = s[i];
if(c == '0') ans.push_back('0');
else if(c == '1') ans.push_back('1');
else if(c == 'B'){
if(s.size >= 1) ans.pop_back();
... | a.cc: In function 'int main()':
a.cc:16:12: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsig... |
s942983644 | p04030 | C++ | #include<bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
#define rep(i, n) for(int i = 0; i < (n); i++)
int int_len(int n) {
int s=0;
while(n!=0) s++, n/=10;
return s;
}
int int_sum(int n) {
int m=0,s=0,a=n;
while(a!=0) s++, a/=10;
for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow... | a.cc: In function 'int main()':
a.cc:84:9: error: 'n' was not declared in this scope
84 | rep(i,n){
| ^
a.cc:4:39: note: in definition of macro 'rep'
4 | #define rep(i, n) for(int i = 0; i < (n); i++)
| ^
|
s988212557 | p04030 | Java | import java.util.*;
class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
String s = sc.next();
int len = s.length();
String fs;
String ls = "";
int lslen = 0;
for(int i;i < len;i++){
fs = s.substring(0,1);
if(fs.equals("0") || fs.equals("1"... | Main.java:12: error: variable i might not have been initialized
for(int i;i < len;i++){
^
1 error
|
s885174998 | p04030 | C++ | #include <bits/stdc++.h>
#include <iostream>
using namespace std;
int main() {
string s;
cin >> s;
vector<string> t(10);
int j=0;
for(int i=0;i<s.size();i++){
if(s.at(i) != 'B'){
t.at(j).at(i) = s.at(i);
}
else if(s.at(i) == 'B' && t.at(j).size() >0){
j++;
for(int k=0;k<i;k++){... | a.cc: In function 'int main()':
a.cc:23:16: error: no match for 'operator<' (operand types are 'int' and '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'})
23 | for(int i=0;i<t.at(j);i++){
| ... |
s280457712 | p04030 | C++ | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int INF=1e9;
int main(){
string s;
cin>>s;
string ans="";
for(char c:s){
if(c!='B')ans+=c;
else if(ans.size()ans.pop_back();
}
cout<<ans<<endl;
}
| a.cc: In function 'int main()':
a.cc:13:27: error: expected ';' before 'ans'
13 | else if(ans.size()ans.pop_back();
| ^~~
| ;
a.cc:13:25: warning: ignoring return value of 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cx... |
s868050872 | p04030 | C++ | #include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); i++)
int int_len(int n) {
int s=0;
while(n!=0) s++, n/=10;
return s;
}
int int_sum(int n) {
int m=0,s=0,a=n;
while(a!=0) s++, a/=10;
for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10;
return m;
}... | a.cc: In function 'int main()':
a.cc:36:9: error: 'class std::vector<char>' has no member named 'pop'
36 | v.pop();
| ^~~
|
s829460946 | p04030 | C++ | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
int main() {
vector<char> ans;
string s;
cin >> s;
for (int i =0; i < s.length(); i++){
if (S[i] == '0' || S[i] ==... | a.cc: In function 'int main()':
a.cc:12:13: error: 'S' was not declared in this scope
12 | if (S[i] == '0' || S[i] == '1'){
| ^
|
s582116478 | p04030 | C | include<stdio.h>
#include <stdlib.h>
#include <ctype.h>
int main() {
char s[4];
for (int i = 0; i < 4; i++) {
scanf_s("%c", &s[i]);
}
if (s[0] = 'B') {
if (s[1] = 'B') {
if (s[2] = 'B') {
if (s[3] = 'B') {
printf("");
}
else {
printf("%c", s[3]);
}
}
else {
... | main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
1 | include<stdio.h>
| ^
In file included from main.c:2:
/usr/include/stdlib.h:98:8: error: unknown type name 'size_t'
98 | extern size_t __ctype_get_mb_cur_max (void) __THROW __wur;
| ^~~~~~
/usr/inclu... |
s630029424 | p04030 | C++ | #include<bits/stdc++.h>
#define REPI(i, n) for(int i = 0; i < n; i++)
#define REPJ(j, n) for(int j = 0; j < n; j++)
using namespace std;
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
#include<bits/stdc++.h>
#define REPI(i, n) for(int i = 0; i < n; i++)
#define REPJ(j, n) for(int j = 0; j < n; j++)
u... | a.cc: In function 'int main()':
a.cc:18:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
18 | int main(){
| ^~
a.cc:18:9: note: remove parentheses to default-initialize a variable
18 | int main(){
| ^~
| --
a.cc:18:9: note: or re... |
s006887723 | p04030 | C++ | s = input()
ans = ''
for i in range(len(s)):
if s[i] == 'B' and ans != '':
ans = ans[:-1]
elif s[i] == 'B' and ans == '':
continue
else:
ans += s[i]
print(ans) | a.cc:2:7: error: empty character constant
2 | ans = ''
| ^~
a.cc:4:31: error: empty character constant
4 | if s[i] == 'B' and ans != '':
| ^~
a.cc:6:33: error: empty character constant
6 | elif s[i] == 'B' and ans == '':
| ... |
s202087211 | p04030 | C++ | #include<bits/stdc++.h>
using namespace std;
string s="";
int main(){
cin>>s;
ans="";
for(int i=0;i<s.zize();i++){
if(s[i]=='0'){ans.append("0");}
if(s[i]=='1'){ans.append("1");}
if((s[i]=='B')&&(ans.empty())){ans.replace(ans.size()-1, 1, "");}
}
cout<<ans<<endl;
} | a.cc: In function 'int main()':
a.cc:6:3: error: 'ans' was not declared in this scope; did you mean 'abs'?
6 | ans="";
| ^~~
| abs
a.cc:7:19: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'zize'; did you mean 'size'?
7 | for(int i=0;i<s.zize();i++){
... |
s370842631 | p04030 | C++ | #include<bits/stdc++.h>
using namespace std;
int a[10],x;
char c;
inline int main()
{
while(cin>>c&&c!='\0')
{
if(c=='0') a[x++]=0;
else if(c=='1') a[x++]=1;
else
{
if(x) x--;
}
}
if(x)
{
for(int i=0;i<x;i++) printf("%d",a[i]);
prin... | a.cc:5:1: error: cannot declare '::main' to be inline
5 | inline int main()
| ^~~~~~
|
s141393662 | p04030 | C++ | #include<iostream>
#include<string>
using namspace std;
int main()
{
string s;
cin >>s;
string temp = "";
int k = 0;
for(int i = 0;i<s.length();i++)
{
if(s[i] == '0' || s[i] == '1')
{
temp = temp+s[i];
k++;
}
if(s[i] == 'B')
{
if(temp.empty())
continue;
... | a.cc:3:7: error: expected nested-name-specifier before 'namspace'
3 | using namspace std;
| ^~~~~~~~
a.cc: In function 'int main()':
a.cc:6:3: error: 'string' was not declared in this scope
6 | string s;
| ^~~~~~
a.cc:6:3: note: suggested alternatives:
In file included from /usr/include/c+... |
s363343900 | p04030 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
string s;
cin >> s;
string ans = "";
for(int i = 0; s.size(); i++){
if(s.at(i)=='0') ans += '0';
if(s.at(i)=='1') ans += '1';
if(s.at(i)=='B' && ans.size()>0) ans.push_buck();
}
cout << ans << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:11:42: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'push_buck'; did you mean 'push_back'?
11 | if(s.at(i)=='B' && ans.size()>0) ans.push_buck();
| ^~~~~~~~~
| ... |
s163687125 | p04030 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
string s;
cin >> s;
string ans = "";
for(int i = 0; s.size(); i++){
if(s.at(i)=='0') ans += '0';
if(s.at(i)=='1') ans += '1';
if(s.at(i)=='B' && ans.size()>0) ans.pop_buck();
}
cout << ans << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:11:42: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'pop_buck'; did you mean 'pop_back'?
11 | if(s.at(i)=='B' && ans.size()>0) ans.pop_buck();
| ^~~~~~~~
| ... |
s642723760 | p04030 | C++ | #include<bits/stdc++.h>
#define repeat(i,a,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
string s;
cin >>s;
int len = s.size();
string ans;
repeat(i,0,len){
if(s[i]=='0') ans += '0';
else if(s[i]=='1') ans += '1';
else if(s[i]=='B' and ans.size()!=0) ans.erase(ans.end()-1,1);
}... | a.cc: In function 'int main()':
a.cc:15:51: error: no matching function for call to 'std::__cxx11::basic_string<char>::erase(__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >, int)'
15 | else if(s[i]=='B' and ans.size()!=0) ans.erase(ans.end()-1,1);
| ... |
s275573907 | p04030 | C++ | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <map>
#include <set>
using namespace std;
string s;
vector<char> d;
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> s;
for (int i = 0; i < s.s... | a.cc: In function 'int main()':
a.cc:29:22: error: request for member 'size' in 's.std::__cxx11::basic_string<char>::operator[](((std::__cxx11::basic_string<char>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
29 | if (s[i].siz... |
s530456592 | p04030 | C++ | #include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;
int main () {
string s;
cin >> s;
string ans = "";
for (int i = 0; i < s.length(); i++){
if (s[i] == '0'){
ans += "0";
}else if (s[i] == '1'){
ans += "1";
}else{
... | a.cc: In function 'int main()':
a.cc:20:14: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsig... |
s083906746 | p04030 | C++ | #include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;
int main () {
string s;
cin >> s;
string ans = "";
for (int i = 0; i < s.length(); i++){
if (s[i] == '0'){
ans += "0";
}else if (s[i] == '1'){
ans += "1";
}else{
... | a.cc: In function 'int main()':
a.cc:20:14: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsig... |
s791271414 | p04030 | C++ | #include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;
string s;
int main () {
cin >> s;
string ans = "";
for (int i = 0; i < s.length(); i++){
if (s[i] == '0'){
ans += "0";
}else if (s[i] == '1'){
ans += "1";
}else{
if... | a.cc: In function 'int main()':
a.cc:20:14: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsig... |
s810857349 | p04030 | C++ | #include<bits/stdc++.h>
using namespace std;
string s;
int main () {
cin >> s;
string ans = "";
for (int i = 0; i < s.length(); i++){
if (s[i] == '0'){
ans += "0";
}else if (s[i] == '1'){
ans += "1";
}else{
if(ans.size != 0){
ans.erase(ans.size()-1, 1)
}
}
}
c... | a.cc: In function 'int main()':
a.cc:15:14: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsig... |
s838556208 | p04030 | C++ | #include<bits/stdc++.h>
using namespace std;
string s, ans = "";
int main () {
cin >> s;
for (int i = 0; i < s.length(); i++){
if (s[i] == '0'){
ans += "0";
}else if (s[i] == '1'){
ans += "1";
}else{
if(ans.size != 0){
ans.erase(ans.size()-1, 1)
}
}
}
cout << an... | a.cc: In function 'int main()':
a.cc:14:14: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsig... |
s990016689 | p04030 | C++ | #include<bits/stdc++.h>
using namespace std;
string s, ans = "";
int main () {
cin >> s;
for (int i = 0; i < s.length(); i++){
if(ans.empty){
if (s[i] == '0'){
ans += "0";
}else if (s[i] == '1'){
ans += "1";
}
}
else{
if (s[i] == '0'){
ans += "0";
... | a.cc: In function 'int main()':
a.cc:9:17: error: cannot convert 'std::__cxx11::basic_string<char>::empty' from type 'bool (std::__cxx11::basic_string<char>::)() const noexcept' to type 'bool'
9 | if(ans.empty){
| ^
a.cc:22:34: error: expected ';' before '}' token
22 | ans.erase... |
s928575446 | p04030 | C++ | #include<bits/stdc++.h>
using namespace std;
string s, ans;
int main () {
cin >> s;
for (int i = 0; i < s.length(), i++){
if (ans.size() > 0){
if (s[i] == '0'){
ans += "0";
}else if(s[i] == '1'){
ans += "1";
}else{
ans.erase(ans.end()-1, ans.end())
}
}else{
... | a.cc: In function 'int main()':
a.cc:8:38: error: expected ';' before ')' token
8 | for (int i = 0; i < s.length(), i++){
| ^
| ;
a.cc:15:42: error: expected ';' before '}' token
15 | ans.erase(ans.end()-1, ans.end())... |
s434311721 | p04030 | C++ | #include<bits/stdc++.h>
using namespace std;
string s;
int main () {
cin >> s;
string ans;
for (int i = 0; i < s.length(); i++){
if(ans.size() > 0){
if(s[i] == '0'){
ans += "0":
}else if (s[i] == '1'){
ans += "1";
}
else{
ans.erase(ans.size(), 1)
}
... | a.cc: In function 'int main()':
a.cc:13:19: error: expected ';' before ':' token
13 | ans += "0":
| ^
| ;
a.cc:18:33: error: expected ';' before '}' token
18 | ans.erase(ans.size(), 1)
| ^
| ... |
s934888005 | p04030 | C++ | #include<bits/stdc++.h>
using namespace std;
string s;
int main () {
cin >> s;
string ans = "";
for (int i = 0; i < s.length(), i++){
if(ans.size() > 0){
if(s[i] == '0'){
ans += "0":
}else if (s[i] == '1'){
ans += "1";
}
else{
ans.erase(ans.size(), 1)
... | a.cc: In function 'int main()':
a.cc:10:38: error: expected ';' before ')' token
10 | for (int i = 0; i < s.length(), i++){
| ^
| ;
a.cc:13:19: error: expected ';' before ':' token
13 | ans += "0":
| ... |
s575200965 | p04030 | C++ | #include<bits/stdc++.h>
using namespace std;
string s;
int main () {
cin >> s;
string ans;
for (int i = 0; i < s.length(), i++){
if(ans.size() > 0){
if(s[i] == '0'){
ans += "0":
}else if (s[i] == '1'){
ans += "1";
}
else{
ans.erase(ans.size(), 1)
}
... | a.cc: In function 'int main()':
a.cc:10:38: error: expected ';' before ')' token
10 | for (int i = 0; i < s.length(), i++){
| ^
| ;
a.cc:13:19: error: expected ';' before ':' token
13 | ans += "0":
| ... |
s607255329 | p04030 | C++ | #include<bits/stdc++.h>
using namespace std;
string s;
int main () {
cin >> s;
string ans;
for (int i = 0; i < s.length(), i++){
if(ans.size() > 0){
if(s[i] == '0'){
ans += '0':
}else if (s[i] == '1'){
ans += '1';
}
else{
ans.erase(ans.size(), 1)
}
... | a.cc: In function 'int main()':
a.cc:10:38: error: expected ';' before ')' token
10 | for (int i = 0; i < s.length(), i++){
| ^
| ;
a.cc:13:19: error: expected ';' before ':' token
13 | ans += '0':
| ... |
s005550756 | p04030 | C++ | #include<bits/stdc++.h>
using namespace std;
string s;
int main () {
cin >> s;
string ans;
for (int i = 0; i < s.length(), i++){
if(ans.size() > 0){
if(s[i] == '0'){
ans += '0':
}else if (s[i] == '1'){
ans += '1';
}
else{
ans.erase(ans.size(), 1)
}
... | a.cc: In function 'int main()':
a.cc:10:38: error: expected ';' before ')' token
10 | for (int i = 0; i < s.length(), i++){
| ^
| ;
a.cc:13:19: error: expected ';' before ':' token
13 | ans += '0':
| ... |
s349650310 | p04030 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
string S;
cin >> S;
stack<char> ans;
for (int i = 0; i < S.length(); i++) {
if (S[i] == '0') {
ans.push('0');
}
else if (S[i] == '1') {
ans.push('1');
}
else {
ans.pop();
}
}
for (int i = 0; i < ans.size();... | a.cc: In function 'int main()':
a.cc:20:16: error: no match for 'operator[]' (operand types are 'std::stack<char>' and 'int')
20 | cout << ans[i];
| ^
|
s863252585 | p04030 | Java | import java.util.Scanner;
import java.util.LinkedList;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
LinkedList<Character> stack = new LinkedList<>();
String s = sc.next();
String res = "";
for (int i = 0; i < s.length(); i++) {
if (s.... | Main.java:18: error: ')' or ',' expected
stack.push(s.charAt(i);
^
1 error
|
s235254155 | p04030 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
int n=s.size();
vector<char> vec(n);
for(int i=0;i<n;i++){
if(s[i]=='0'){
vec.push_back(s[i]);
}
else if(s[i]=='1'){
vec.push_back(s[i]);
}
else {
vec.pop_back();
... | a.cc: In function 'int main()':
a.cc:20:13: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'std::vector<char>')
20 | cout<<vec<<endl;
| ~~~~^~~~~
| | |
| | std::vector<char>
| std::ostream... |
s184070589 | p04030 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
int n=s.size();
vector<char> vec(n);
for(int i=0;i<n;i++){
if(s[i]=='0'){
vec.push_back(s[i]);
}
else if(s[i]=='1'){
vec.push_back(s[i]);
}
else {
vec.pop_back();
... | a.cc: In function 'int main()':
a.cc:19:13: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'std::vector<char>')
19 | cout<<vec<<endl;
| ~~~~^~~~~
| | |
| | std::vector<char>
| std::ostream... |
s946733084 | p04030 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
string s;
cin>>s;
string a;
for(int i=0;i<s.size();i++){
if(s[i]=='0') a.push_back('0');
else if(s[i]=='1') a.push_back('1');
else if((s[i]=='B') && (a.size>=0))a.pop_back();
}
cout<<a<<endl;
}
| a.cc: In function 'int main()':
a.cc:10:31: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsig... |
s507731575 | p04030 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
string s;
cin>>s;
string a;
for(int i=0;i<s.size();i++){
if(s[i]=='0') a.push_back('0');
else if(s[i]=='1') a.push_back('1');
else if(s[i]=='B' && a.size>=0)a.pop_back();
}
cout<<a<<endl;
}
| a.cc: In function 'int main()':
a.cc:10:28: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsig... |
s735637741 | p04030 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
string s;
cin>>s;
string a;
for(int i=0;i<s.size();i++){
if(s[i]=='0') a.push_back('0');
else if(s[i]=='1') a.push_back('1');
else if(s[i]=='B' && s.size>=0)a.pop_back();
}
cout<<a<<endl;
}
| a.cc: In function 'int main()':
a.cc:10:28: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsig... |
s689925164 | p04030 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
string S;
cin >> S;
vector<char> A(S.size());
for (int i = 0 ;i <S.size() ;i++);
string a = " ";
for (int i = 0; i < S.size() ; i++) {
if( A.at(i) = 0){
a += '0';
}
else ... | a.cc: In function 'int main()':
a.cc:24:35: error: expected ';' before '}' token
24 | a.at(a.size()-1) =' '
| ^
| ;
25 | }
| ~
|
s594605786 | p04030 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
string S;
cin >> S;
vector<char> A(S.size());
for (int i = 0 ;i <S.size() ;i++);
string a = " ";
for (int i = 0; i < S.size() ; i++) {
if( A.at(i) == 0){
a += '0';
}
else... | a.cc: In function 'int main()':
a.cc:24:31: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive]
24 | a.at(a.size()) = " "
| ^~~
| |
| ... |
s713181107 | p04030 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
string S;
cin >> S;
vector<char> A(S.size());
for (int i = 0 ;i <S.size() ;i++);
string a = " ";
for (int i = 0; i < S.size() ; i++) {
if( A.at(i) == 0){
a += '0';
}
else... | a.cc: In function 'int main()':
a.cc:24:29: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
24 | a.at(a.size()) == " "
| ~~~~~~~~~~~~~~~^~~~~~
a.cc:24:35: error: expected ';' before '}' token
24 | a.at(a.size()) == " "
| ... |
s888464241 | p04030 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
string S;
cin >> S;
vector<char> A(S.size());
for (int i = 0 ;i <S.size() ;i++);
string a = " ";
for (int i = 0; i < S.size() ; i++) {
if( A.at(i) == 0){
a += '0';
}
else... | a.cc: In function 'int main()':
a.cc:24:16: error: no match for 'operator-=' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'})
24 | a -= a.at(a.size())
| ~~^~~~~~~~~~~~~~~~~
|
s839523536 | p04030 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
string S;
cin >> S;
vector<char> A(S.size());
for (int i = 0 ;i <S.size() ;i++);
string a = " ";
for (int i = 0; i < S.size() ; i++) {
if( A.at(i) == 0){
a += '0';
}
else... | a.cc: In function 'int main()':
a.cc:24:16: error: no match for 'operator-=' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'})
24 | a -= A.at(i)
| ~~^~~~~~~~~~
a.cc: At global... |
s893860802 | p04030 | C++ | #include<bits/stdc++.h>
using namespace std;
int main() {
strint s;
cin >> s;
int len = s.size();
string answer = "";
int counter = 0;
for(int i = 0 ; i < len; ++i){
if(s[i] == 'B'){
if(counter > 0) --counter;
}
else {
++counter;
answer[counter-1] = s[i];
}
}
for(int i... | a.cc: In function 'int main()':
a.cc:5:3: error: 'strint' was not declared in this scope; did you mean 'strcat'?
5 | strint s;
| ^~~~~~
| strcat
a.cc:6:10: error: 's' was not declared in this scope
6 | cin >> s;
| ^
|
s458598582 | p04030 | C++ | int main() {
strint s;
cin >> s;
int len = s.size();
string answer = "";
int counter = 0;
for(int i = 0 ; i < len; ++i){
if(s[i] == 'B'){
if(counter > 0) --counter;
}
else {
++counter;
answer[counter-1] = s[i];
}
}
for(int i = 0 ; i < counter; ++i)
cout << answer[i]... | a.cc: In function 'int main()':
a.cc:2:3: error: 'strint' was not declared in this scope; did you mean 'struct'?
2 | strint s;
| ^~~~~~
| struct
a.cc:3:3: error: 'cin' was not declared in this scope
3 | cin >> s;
| ^~~
a.cc:3:10: error: 's' was not declared in this scope
3 | ci... |
s363096266 | p04030 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
string s;
cin >> s;
vector<char> r;
for(int i=0; i < s.size(); i++){
if(s.at(i)==1){
r.push_back(1);
}
else if(s.at(i)==0){
r.push_back(0);
}
else if(s.at(i)=='B' && r.size()>0){
r.pop_back();
}
}
cout << r ... | a.cc: In function 'int main()':
a.cc:19:8: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'std::vector<char>')
19 | cout << r << endl;
| ~~~~ ^~ ~
| | |
| | std::vector<char>
| std::ostream {aka std::basic_ostream<... |
s168936960 | p04030 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
string s;
cin >> s;
vector<char> r;
for(int i=0; i < s.size(); i++){
if(s.at(i)==1){
r.push_back(1);
}
else if(s.at(i)==0){
r.push_back(0);
}
else if(s.at(i)=='B' && r.size()>0){
r.pop_back();
}
}
cout << r;... | a.cc: In function 'int main()':
a.cc:19:8: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'std::vector<char>')
19 | cout << r;
| ~~~~ ^~ ~
| | |
| | std::vector<char>
| std::ostream {aka std::basic_ostream<char>}
I... |
s856579238 | p04030 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
string s;
cin >> s;
vectorM<char> r;
for(int i=0; i < s.size(); i++){
if(s.at(i)==1){
r.push_back(1);
}
else if(s.at(i)==0){
r.push_back(0);
}
else if(s.at(i)=='B' && r.size()>0){
r.pop_back();
}
}
cout << r... | a.cc: In function 'int main()':
a.cc:7:3: error: 'vectorM' was not declared in this scope
7 | vectorM<char> r;
| ^~~~~~~
a.cc:7:11: error: expected primary-expression before 'char'
7 | vectorM<char> r;
| ^~~~
a.cc:10:7: error: 'r' was not declared in this scope
10 | r.push_b... |
s728183572 | p04030 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
string s;
cin >> s;
vector<int> vec(0);
for(int i=0; i < s.size(); i++){
if(s.at(i)==1){
vec.push_back(1);
}
else if(s.at(i)==0){
vec.push_back(0);
}
else{
vec.pop_back();
}
}
cout << vec << endl;
}
| a.cc: In function 'int main()':
a.cc:19:8: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'std::vector<int>')
19 | cout << vec << endl;
| ~~~~ ^~ ~~~
| | |
| | std::vector<int>
| std::ostream {aka std::basic_ostrea... |
s022264280 | p04030 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
string s;
cin >> s;
vector<string> vec(0);
for(int i=0; i < s.size(); i++){
if(s.at(i)==1){
vec.push_back(1);
}
else if(s.at(i)==0){
vec.push_back(0);
}
else{
vec.pop_back();
}
}
cout << vec << endl;
}
| a.cc: In function 'int main()':
a.cc:10:20: error: no matching function for call to 'std::vector<std::__cxx11::basic_string<char> >::push_back(int)'
10 | vec.push_back(1);
| ~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/14/vector:66,
from /usr/include/c++/14/functional:64... |
s220913964 | p04030 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
string s;
cin >> s;
vector<int> vec(0);
for(int i=0; i < s.size(); i++){
if(s.at(i)==1){
vec.push_back(1);
}
else if(s.at(i)==0){
vec.push_back(0);
}
else{
vec.pop_back();
}
}
cout << vec << endl;
}
| a.cc: In function 'int main()':
a.cc:19:8: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'std::vector<int>')
19 | cout << vec << endl;
| ~~~~ ^~ ~~~
| | |
| | std::vector<int>
| std::ostream {aka std::basic_ostrea... |
s812977008 | p04030 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
string s;
cin >> s;
vector<int> vec(0);
for(int i=0; i < s.size(); i++){
if(s.at(i)==1){
vec.push_back(1);
}
else if(s.at(i)==0){
vec.push_back(0);
}
else if(s.at(i)="B"){
vec.pop_back();
}
}
cout << vec << ... | a.cc: In function 'int main()':
a.cc:15:21: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive]
15 | else if(s.at(i)="B"){
| ^~~
| |
| const ch... |
s818763900 | p04030 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
string s;
cin >> s;
vector<int> vec(0);
for(int i=0; i < s.size(); i++){
if(s.at(i)==1){
vec.push_back(1);
}
else if(s.at(i)==0){
vec.push_back(0);
}
else if(s.at(i)=="B"){
vec.pop_back();
}
}
cout << vec <<... | a.cc: In function 'int main()':
a.cc:15:20: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
15 | else if(s.at(i)=="B"){
| ~~~~~~~^~~~~
a.cc:19:8: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'std::vector<int... |
s072509063 | p04030 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
string s;
cin >> s;
vector<int> vec(0);
for(int i=0; i < s.size(); i++){
if(s.at(i)==1){
vec.push_back(1);
}
else if(s.at(i)==0){
vec.push_back(0);
}
else if(s.at(i)==B){
vec.pop_back();
}
}
cout << vec << e... | a.cc: In function 'int main()':
a.cc:15:22: error: 'B' was not declared in this scope
15 | else if(s.at(i)==B){
| ^
a.cc:19:8: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'std::vector<int>')
19 | cout << vec << endl;
... |
s804002890 | p04030 | C++ | #include <stack>
using namespace std;
int main(){
stack<char> stk;
string s;
cin >> s;
while(auto c: s){
switch(c){
case '0':
case '1':
stk.push(c);
case 'B':
if(!stk.empty()){
stk.pop();
}
}
}
for(auto c: stk){
cout >> c;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:6:9: error: 'string' was not declared in this scope
6 | string s;
| ^~~~~~
a.cc:2:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
1 | #include <stack>
+++ |+#include <string>
2 | using... |
s002618264 | p04030 | C++ | #include <algorithm>
#include <iostream> //入出力
#include <stdio.h>
#include <map>
#include <set>
#include <string>
#include <math.h> //算術演算子
#include <vector>
#include <cstdlib>
#include <queue>
#include <stack>
#include <list>
#include <iomanip> //小数点以下を表示させる(setprecision())
// #include <bits/stdc++.h>
using namespace ... | a.cc: In function 'int main()':
a.cc:57:37: error: invalid use of non-static member function 'void std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::pop_back() [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
57 | ans.pop_back;
| ... |
s422645739 | p04030 | C++ | #include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;
signed main(){
string s;
cin >> s;
string ans;
REP(i,s.size()){
if(s[i] ... | a.cc: In function 'int main()':
a.cc:15:31: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsig... |
s886968416 | p04030 | C++ | #include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define double long double
using namespace std;
signed main(){
string a,b="";
cin>>a;
rep(i,a.size()){
if(a.at(i)=='0')
b+='0';
if(a.at(i)=='1')
... | a.cc: In function 'int main()':
a.cc:18:7: 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>]'
18 | b.pop_back;
| ~~^~~~~~~~
In file included from /u... |
s876604380 | p04030 | C++ | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define fs first
#define sc second
typedef pair<ll, ll> l_l;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
int main(){
string s;
cin>>s;
char ... | a.cc: In function 'int main()':
a.cc:19:10: error: incompatible types in assignment of 'std::__cxx11::basic_string<char>' to 'char [10]'
19 | ans=s.substr(0,i-1);
| ~~~^~~~~~~~~~~~~~~~
a.cc:21:13: error: incompatible types in assignment of '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::val... |
s341884480 | p04030 | C++ | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define fs first
#define sc second
typedef pair<ll, ll> l_l;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
int main(){
string s;
cin>>s;
rep(i... | a.cc: In function 'int main()':
a.cc:17:25: error: invalid operands of types '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} and 'std::nullptr_t' to binary 'operator!='
17 | if(s[i]=='B'&&s[i-1]!=nullptr){
a.cc:18:14: error: cannot convert 'std::nullptr_t' to '__gnu_cxx::__alloc_... |
s476634468 | p04030 | C++ | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define fs first
#define sc second
typedef pair<ll, ll> l_l;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
int main(){
string s;
cin>>s;
rep(i... | a.cc: In function 'int main()':
a.cc:17:25: error: invalid operands of types '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} and 'std::nullptr_t' to binary 'operator!='
17 | if(s[i]=='B'&&s[i-1]!=nullptr){
a.cc:18:13: error: invalid operands of types '__gnu_cxx::__alloc_traits<st... |
s335226585 | p04030 | C++ | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define fs first
#define sc second
typedef pair<ll, ll> l_l;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
int main(){
string s;
cin>>s;
rep(i... | a.cc:17:27: error: empty character constant
17 | if(s[i]=='B'&&s[i-1]!=''){
| ^~
a.cc:18:15: error: empty character constant
18 | s[i-1]=='';
| ^~
|
s557609719 | p04030 | C++ | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define fs first
#define sc second
typedef pair<ll, ll> l_l;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
int main(){
string s;
cin>>s;
rep(i... | a.cc:18:15: error: empty character constant
18 | s[i-1]=='';
| ^~
|
s375565581 | p04030 | C++ | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define fs first
#define sc second
typedef pair<ll, ll> l_l;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
int main(){
string s;
cin>>s;
rep(i... | a.cc:18:15: error: empty character constant
18 | s[i-1]=='';
| ^~
a.cc: In function 'int main()':
a.cc:21:2: error: expected '}' at end of input
21 | }
| ^
a.cc:13:11: note: to match this '{'
13 | int main(){
| ^
|
s490632599 | p04030 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
string s,ss;
int k=0;
cin >> s;
for(int i=0;i<s.length();i++){
if(s[i]=='B')
{ k=k-1;
if(k<0)
=0;}
else
ss[k++]=s[i];
}
cout << ss;
return 0;
}
| a.cc: In function 'int main()':
a.cc:12:7: error: expected primary-expression before '=' token
12 | =0;}
| ^
|
s893481384 | p04030 | Java | import java.util.*;
class Main{
public static void main(String[] args){
String answer = "";
Scanner scan = new Scanner(System.in);
String s = scan.next();
int l = s.length();
String[] moji = new String[];
for(int i = 0;i < l;i++){
moji[i]=s.charAt(i);
}
for(String mo... | Main.java:9: error: array dimension missing
String[] moji = new String[];
^
Main.java:13: error: illegal character: '\u3000'
for(String?moji :moji){
^
Main.java:13: error: not a statement
for(String?moji :moji){
^
Main.java:13: error: not a... |
s861264984 | p04030 | C++ | #include <bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
string a,b;
cin>>a;
for(int i=0;i<a.size();i++)
if(a.at(i)=='0')
b+='0';
if(a.at(i)=='1')
b+='1';
if(a.at(i)=='B'){
if(b.size()>0)
b.pop_back();
}
cout<<b<<endl;
}
| a.cc: In function 'int main()':
a.cc:11:17: error: 'i' was not declared in this scope
11 | if(a.at(i)=='1')
| ^
a.cc:13:17: error: 'i' was not declared in this scope
13 | if(a.at(i)=='B'){
| ^
|
s386791177 | p04030 | C++ | a | a.cc:1:1: error: 'a' does not name a type
1 | a
| ^
|
s204256197 | p04030 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
vector<char> c;
for(int i = 0; i < s.size; i++){
if(s.at(i) == '0'){
c.push_back('0');
}else if(s.at(i) == '1'){
c.push_back('1');
}else{
c.pop_back();
}
}
for(int i : c){
cout << i << endl;... | a.cc: In function 'int main()':
a.cc:8:24: 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 unsign... |
s314178258 | 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[i]=="B"){
if(!ans.empty())ans.pop_back();
}else ans.push_back(s[i]);
}
cout<<ans<<endl;
}
| a.cc: In function 'int main()':
a.cc:8:12: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
8 | if(s[i]=="B"){
|
s146167545 | 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(!ans.empty)ans.pop_back();
else ans.push_back(s[i]);
}
cout<<ans<<endl;
}
| a.cc: In function 'int main()':
a.cc:8:13: error: cannot convert 'std::__cxx11::basic_string<char>::empty' from type 'bool (std::__cxx11::basic_string<char>::)() const noexcept' to type 'bool'
8 | if(!ans.empty)ans.pop_back();
| ^~~~~
a.cc:8:13: error: in argument to unary !
8 | if(!an... |
s324964983 | p04030 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
string s; cin>>s;
stirng ans;
for(int i=0;i<s.size();i++){
if(!ans.empty)ans.pop_back();
else ans.push_back(s[i]);
}
cout<<ans<<endl;
} | a.cc: In function 'int main()':
a.cc:6:3: error: 'stirng' was not declared in this scope
6 | stirng ans;
| ^~~~~~
a.cc:8:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
8 | if(!ans.empty)ans.pop_back();
| ^~~
| abs
a.cc:11:9: error: 'ans' was not dec... |
s431115902 | p04030 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
char s[10];
for(int i=0;i<10;i++)cin>>s[i];
string ans;
for(int i=0;i<10;i++){
if(s[i]=='1'){
ans.push_back("1");
}else if(s[i]=='0'){
ans.push_back("0");
}else{
ans.pop_back();
}
}
cout<<ans<<endl;
} | a.cc: In function 'int main()':
a.cc:10:21: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
10 | ans.push_back("1");
| ^~~
| |
| const char*
In file included from /usr/include/c++/14/string:54,
... |
s473121496 | p04030 | C++ | #include <iostream>
#include <vector>
using namespace std;
int main(){
char s[1];
vector<char>data;
for(int i=0;i<11;i++){
cin>>s[0];
data.emplace_back(s[0]);
}
for(int i=0;i<data.size();i++){
if(data[i]=='B'&&i!=0) data.erase(i-1);
}
for(int i=0;i<data.size();i++){
cout<<data[i];
}
} | a.cc: In function 'int main()':
a.cc:14:38: error: no matching function for call to 'std::vector<char>::erase(int)'
14 | if(data[i]=='B'&&i!=0) data.erase(i-1);
| ~~~~~~~~~~^~~~~
In file included from /usr/include/c++/14/vector:66,
from a.cc:2:
/usr/include/c++/1... |
s988698298 | p04030 | C++ | #include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <fstream>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <string>
#include <cstring>
#include <cctype>
#include <numeric>
#include <cstdio>
#include <math.h>
#include <f... | a.cc: In function 'int main()':
a.cc:91:5: error: 'stack' was not declared in this scope
91 | stack<int> an;
| ^~~~~
a.cc:19:1: note: 'std::stack' is defined in header '<stack>'; this is probably fixable by adding '#include <stack>'
18 | #include <functional>
+++ |+#include <stack>
19 | using n... |
s378867247 | p04030 | C++ | #include<iostream>
#include<vector>
using namespace std;
int main(int argc, char const *argv[])
{
vector<char>c;
string s;
cin>>s;
for(char i:s)
{
if(i=='0'||i=='1')
{
c.push_back(i);
}
else if(i=='B')
{
c.pop_back();
}
... | a.cc: In function 'int main(int, const char**)':
a.cc:22:21: error: 'class std::vector<char>' has no member named 'length'
22 | for(int i=0;i<c.length();i++)
| ^~~~~~
|
s351702994 | p04030 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
string s1,s2;
cin>>s1;
for(int i=0;i<s1.size();i++){
if(s1.at(i)=='0')
if(s2.empty()) s2='0';
else s2+'0'
if(s1.at(i)=='1')
if(s2.empty()) s2='1';
else s2+'1';
else if(s2.size()!=0) s2.erase(s2.size()-1);
}
cout<<s2... | a.cc: In function 'int main()':
a.cc:9:18: error: expected ';' before 'if'
9 | else s2+'0'
| ^
| ;
10 | if(s1.at(i)=='1')
| ~~
a.cc:9:15: warning: ignoring return value of 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::o... |
s930862967 | p04030 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
string s1,s2;
cin>>s1;
for(int i=0;i<s1.size();i++){
if(s1.at(i)=='0') s2.insert(s2.size(),'0');
if(s1.at(i)=='1') s2.insert(s2.size(),'1');
else if(s2.size()!=0) s2.erase(s2.size()-1);
}
cout<<s2<<endl;
} | a.cc: In function 'int main()':
a.cc:7:32: error: no matching function for call to 'std::__cxx11::basic_string<char>::insert(std::__cxx11::basic_string<char>::size_type, char)'
7 | if(s1.at(i)=='0') s2.insert(s2.size(),'0');
| ~~~~~~~~~^~~~~~~~~~~~~~~
In file included from /usr/inclu... |
s073925090 | p04030 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
string s1,s2;
cin>>s1;
for(int i=0;i<s1.size();i++){
if(s1.at(i)=='0') s2+='0';
if(s1.at(i)=='1') s2+='1';
else s2.erase(s2.size-1)
}
cout<<s2<<endl;
} | a.cc: In function 'int main()':
a.cc:9:22: 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 unsign... |
s539351873 | p04030 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
string s1,s2;
cin>>s1;
for(int i=0;i<s1.size();i++){
if(s1.at(i)=='0') s2='0';
if(s1.at(i)=='1') s2='1';
}
cout<<s2<endl;
} | a.cc: In function 'int main()':
a.cc:10:11: error: no match for 'operator<' (operand types are 'std::basic_ostream<char>' and '<unresolved overloaded function type>')
10 | cout<<s2<endl;
| ~~~~~~~~^~~~~
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/... |
s331417884 | p04030 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(void)
{
string s;
cin>>s;
string n="";
for(int i=0;i<s.length;i++){
if(s.at(i)=='b')
n.pop_back();
else
n.push_back(s[i]);
}
cout<<n<<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:9:19: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsi... |
s708190028 | p04030 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
char x;
string a;
while (x != NULL) {
cin >> x;
if (x == 1 || x == 0) {
a.push_back(x);
} else {
a.clear(a.size() - 1);
}
}
cout << a;
}
| a.cc: In function 'int main()':
a.cc:6:15: warning: NULL used in arithmetic [-Wpointer-arith]
6 | while (x != NULL) {
| ^~~~
a.cc:11:14: error: no matching function for call to 'std::__cxx11::basic_string<char>::clear(std::__cxx11::basic_string<char>::size_type)'
11 | a.clear(a.size()... |
s154406140 | p04030 | C | #include <stdio.h>
#include <string.h>
int main(){
char s[11],r[11]={'\0'};
scanf("%s",s);
int n=strlen(s);
for(int i=0;i<n;i++){
int m=strlen(r);
if(s[i]=='B')r[m-1]='\0';
else a[m]=s[i];
}
printf("%s",r);
return 0;
} | main.c: In function 'main':
main.c:10:10: error: 'a' undeclared (first use in this function)
10 | else a[m]=s[i];
| ^
main.c:10:10: note: each undeclared identifier is reported only once for each function it appears in
|
s983189663 | p04030 | C++ | #include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
int main() {
string s;
cin >> s;
int n = s.size();
string ans = "";
rep(i, n) {
if(s[i] ==... | a.cc: In function 'int main()':
a.cc:30:23: error: 'substr' was not declared in this scope
30 | ans = substr(0, m-1);
| ^~~~~~
|
s024796797 | p04030 | C++ | #include <iostream>
#include<algorithm>
#include<string>
#include<vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <numeric>
using namespace std;
int main()
{
string s, ans = { "" };
cin >> s;
for (int i = 0; i < s.length(); i++) {
if (s[i] == '0')ans += "0";
e... | a.cc: In function 'int main()':
a.cc:22:29: error: expected '}' at end of input
22 | cout << ans << endl;
| ^
a.cc:14:1: note: to match this '{'
14 | {
| ^
|
s176612668 | p04030 | C++ | #include<bits/stdc++.h>
using namespace std;
//Optimisations
#pragma GCC target ("avx2")
#pragma GCC optimization ("unroll-loops")
#pragma GCC optimize("O2")
//shortcuts for functions
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl "\n"
#define all(v) v.begin(),v.end()
#... | a.cc: In function 'int main()':
a.cc:107:23: 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 unsi... |
s024128403 | p04030 | C++ | #include<bits/stdc++.h>
using namespace std;
string s;
int cnt=0;
char a[100005];
int main()
{
cin>>s;
for(int i=0;i<s.size();i++)
{
if(s[i]!='B')
{
a[++cnt]=s[i];
}
else
{
cnt--;
if(cnt<0)
{
cnt=0;
}
}
for(int i=1;i<... | a.cc: In function 'int main()':
a.cc:28:2: error: expected '}' at end of input
28 | }
| ^
a.cc:7:1: note: to match this '{'
7 | {
| ^
|
s721836490 | p04030 | C++ | #include<cstring>
#include<cstdio>
using namespace std;
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++;
}
}
s[x] = '\0'
printf("%s", s);
... | a.cc: In function 'int main()':
a.cc:20:14: error: expected ';' before 'printf'
20 | s[x] = '\0'
| ^
| ;
21 | printf("%s", s);
| ~~~~~~
|
s574486427 | 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:20:9: error: expected constructor, destructor, or type conversion before '(' token
20 | printf("%s", s);
| ^
a.cc:22:3: error: expected unqualified-id before 'return'
22 | return 0;
| ^~~~~~
a.cc:23:1: error: expected declaration before '}' token
23 | }
| ^
|
s704086062 | 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:14: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
10 | if(key[i]=="B"){
| ~~~~~~^~~~~
a.cc: At global scope:
a.cc:20:9: error: expected constructor, destructor, or type conversion before '(' token
20 | printf("%s", s);
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.