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++;
}
}
cout << output << endl;
return 0;
}
|
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 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 = 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:6:17: note: cannot convert '10' (type 'int') to type 'const char*'
6 | string output(10);
| ^~
/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 '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 '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 '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/basic_string.h:540:34: note: no known conversion for argument 1 from 'int' to 'const std::allocator<char>&'
540 | basic_string(const _Alloc& __a) _GLIBCXX_NOEXCEPT
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/basic
|
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 s[i]==1)
| ^~~~
main.c:13:20: error: expected expression before 'char'
13 | if(char s[i]=='65')
| ^~~~
main.c:13:31: warning: multi-character character constant [-Wmultichar]
13 | if(char s[i]=='65')
| ^~~~
|
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 s[i]==1)
| ^~~~
main.c:13:20: error: expected expression before 'char'
13 | if(char s[i]==B)
| ^~~~
|
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 function it appears in
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 s[i]==1)
| ^~~~
main.c:13:20: error: expected expression before 'char'
13 | if(char s[i]==B)
| ^~~~
|
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 function it appears in
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 s[i]==1)
| ^~~~
main.c:13:20: error: expected expression before 'char'
13 | if(char s[i]==B)
| ^~~~
|
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(char s[i]==0)
| ^~~~
main.c:11:20: error: expected expression before 'char'
11 | if(char s[i]==1)
| ^~~~
main.c:13:20: error: expected expression before 'char'
13 | if(char s[i]==B)
| ^~~~
|
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(char s[i]==0)
| ^~~~
main.c:10:20: error: expected expression before 'char'
10 | if(char s[i]==1)
| ^~~~
main.c:12:20: error: expected expression before 'char'
12 | if(char s[i]==B)
| ^~~~
|
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]);
}
while(str.empty()==false){
cout<<str.top();
str.pop();
}
cout<<endl;
}
|
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(str.empty()==false){
cout<<str.top();
str.pop();
}
cout<<endl;
}
|
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] == 'B') {
sb.delete(sb.length(), sb.length());
}
}
System.out.println(sb.toString());
}
}
|
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 <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cmath>
#include <limits>
typedef long long ll;
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define mod 1000000007
#define fst first
#define pb push_back
//ユークリッドの互除法
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x;}
int main() {
string s;
cin >> s;
vector<char> key;
for (int i = 0; i < s.length(); i++) {
if (s[i] == '0') {
key[i] == s[i];
}
else if (s[i] == '1') {
key[i] == s[i];
}
else if (s[i] == 'B' && !key.empty()) {
key.pop_back;
}
}
string ans(key.begin(), key.end());
cout << ans << endl;
}
|
a.cc: In function 'int main()':
a.cc:42:29: error: invalid use of non-static member function 'void std::vector<_Tp, _Alloc>::pop_back() [with _Tp = char; _Alloc = std::allocator<char>]'
42 | key.pop_back;
| ~~~~^~~~~~~~
In file included from /usr/include/c++/14/vector:66,
from a.cc:3:
/usr/include/c++/14/bits/stl_vector.h:1324:7: note: declared here
1324 | pop_back() _GLIBCXX_NOEXCEPT
| ^~~~~~~~
|
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();
else;
}else;
}
cout << ans;
}
|
a.cc: In function 'int main()':
a.cc:16:12: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
16 | if(s.size >= 1) ans.pop_back();
| ~~^~~~
| ()
|
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(10,i+1)))*10;
return m;
}
int gcd(int a,int b)
{
int r, tmp;
/* 自然数 a > b を確認・入替 */
if(a<b){
tmp = a;
a = b;
b = tmp;
}
/* ユークリッドの互除法 */
r = a % b;
while(r!=0){
a = b;
b = r;
r = a % b;
}
return b;
}
int fac(int n){
int m=1;
while(n>=1) m*=n,n--;
return m;
}
int vec_sum(vector<int> v){
int n=0;
for(int i=0;i<v.size();i++) n+=v[i];
return n;
}
///////////////////////////
int main() {
string s;
cin>>s;
vector<char> v;
rep(i,s.size()){
if(i=='0'){
v.push_back(0);
}
if(i=='1'){
v.push_back(1);
}
if(i=='B'){
if(v.size()>=1) v.pop_back();
}
}
rep(i,n){
cout<<v[i];
}
cout<<endl;
}
///////////////////////////
|
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")){
ls = ls + fs;
}else if(fs.equals("B")){
if(!(ls.equals(""))){
lslen = ls.length();
lslen -= 1;
ls = ls.substring(0,lslen);
}
}
}
System.out.println(ls);
}
}
|
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++){
t.at(j).at(k) = t.at(j-1).at(k);
}
}
}
for(int i=0;i<t.at(j);i++){
cout << t.at(j).at(i);
}
cout << endl;
return 0;
}
|
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++){
| ~^~~~~~~~
| | |
| int __gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type {aka std::__cxx11::basic_string<char>}
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181,
from a.cc:1:
/usr/include/c++/14/bits/regex.h:1143:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
1143 | operator<(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1143:5: note: template argument deduction/substitution failed:
a.cc:23:23: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
23 | for(int i=0;i<t.at(j);i++){
| ^
/usr/include/c++/14/bits/regex.h:1224:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)'
1224 | operator<(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1224:5: note: template argument deduction/substitution failed:
a.cc:23:23: note: mismatched types 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' and 'int'
23 | for(int i=0;i<t.at(j);i++){
| ^
/usr/include/c++/14/bits/regex.h:1317:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
1317 | operator<(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1317:5: note: template argument deduction/substitution failed:
a.cc:23:23: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
23 | for(int i=0;i<t.at(j);i++){
| ^
/usr/include/c++/14/bits/regex.h:1391:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
1391 | operator<(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1391:5: note: template argument deduction/substitution failed:
a.cc:23:23: note: '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
23 | for(int i=0;i<t.at(j);i++){
| ^
/usr/include/c++/14/bits/regex.h:1485:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
1485 | operator<(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1485:5: note: template argument deduction/substitution failed:
a.cc:23:23: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
23 | for(int i=0;i<t.at(j);i++){
| ^
/usr/include/c++/14/bits/regex.h:1560:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
1560 | operator<(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1560:5: note: template argument deduction/substitution failed:
a.cc:23:23: note: '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
23 | for(int i=0;i<t.at(j);i++){
| ^
/usr/include/c++/14/bits/regex.h:1660:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
1660 | operator<(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1660:5: note: template argument deduction/substitution failed:
a.cc:23:23: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
23 | for(int i=0;i<t.at(j);i++){
| ^
In file included 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/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:23:23: note: mismatched types 'const std::pair<_T1, _T2>' and 'int'
23 | for(int i=0;i<t.at(j);i++){
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/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:23:23: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int'
23 | for(int i=0;i<t.at(j);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:23:23: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int'
23 | for(int i=0;i<t.at(j);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:23:23: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int'
23 | for(int i=0;i<t.at(j);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:23:23: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int'
23 | for(int i=0;i<t.at(j);i++){
| ^
In file included from /usr/include/c++/14/bits/basic_string.h:47,
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:
/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:23:23: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
23 | for(int i=0;i<t.at(j);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:23:23: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
23 | for(int i=0;i<t.at(j);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:23:23: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
23 | for(int i=0;i<t.at(j);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:38
|
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::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]', declared with attribute 'nodiscard' [-Wunused-result]
13 | else if(ans.size()ans.pop_back();
| ~~~~~~~~^~
In file included from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:1076:7: note: declared here
1076 | size() const _GLIBCXX_NOEXCEPT
| ^~~~
a.cc:14:5: error: expected primary-expression before '}' token
14 | }
| ^
a.cc:13:42: error: expected ')' before '}' token
13 | else if(ans.size()ans.pop_back();
| ~ ^
| )
14 | }
| ~
a.cc:14:5: error: expected primary-expression before '}' token
14 | }
| ^
|
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;
}
long long int fac(long long int n){
long long int m=1;
while(n>=1) m*=n,m%=1000000007,n--;
return m;
}
int vec_sum(vector<int> v){
int n=0;
for(int i=0;i<v.size();i++) n+=v[i];
return n;
}
///////////////////////////
int main() {
string s;
cin>>s;
vector<char> v;
for(char i:s){
if(i=='B'){
v.pop();
}else{
v.push_back(i);
}
}
rep(i,v.size()) cout<<v[i];
cout<<endl;
}
///////////////////////////
|
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] == '1'){
ans.push_back(s[i]);
}
else {
ans.pop_back();
}
}
for (int i = 0; i < ans.size(); i++){
cout << ans[i] << endl;
}
}
|
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 {
if (s[3] = 'B') {
printf("");
}
else {
printf("%c", s[3]);
}
}
}
else {
if (s[2] = 'B') {
if (s[3] = 'B') {
printf("");
}
else {
printf("%c", s[3]);
}
}
else {
if (s[3] = 'B') {
printf("");
}
else {
printf("%c", s[1]);
}
}
}
}
else {
if (s[1] = 'B') {
if (s[2] = 'B') {
if (s[3] = 'B') {
printf("");
}
else {
printf("%c", s[3]);
}
}
else {
if (s[3] = 'B') {
printf("");
}
else {
printf("%c%c", s[2],s[3]);
}
}
}
else {
if (s[2] = 'B') {
if (s[3] = 'B') {
printf("");
}
else {
printf("%c%c",s[0] ,s[3]);
}
}
else {
if (s[3] = 'B') {
printf("%c%c",s[0],s[1]);
}
else {
printf("%c%c%c%c",s[0], s[1],s[2],s[3]);
}
}
}
}
}
|
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/include/stdlib.h:57:1: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
56 | #include <bits/floatn.h>
+++ |+#include <stddef.h>
57 |
/usr/include/stdlib.h:531:25: error: unknown type name 'size_t'
531 | size_t __statelen) __THROW __nonnull ((2));
| ^~~~~~
/usr/include/stdlib.h:531:25: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:561:25: error: unknown type name 'size_t'
561 | size_t __statelen,
| ^~~~~~
/usr/include/stdlib.h:561:25: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:661:42: error: unknown type name 'size_t'
661 | extern void arc4random_buf (void *__buf, size_t __size)
| ^~~~~~
/usr/include/stdlib.h:661:42: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:672:22: error: unknown type name 'size_t'
672 | extern void *malloc (size_t __size) __THROW __attribute_malloc__
| ^~~~~~
/usr/include/stdlib.h:672:22: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:675:22: error: unknown type name 'size_t'
675 | extern void *calloc (size_t __nmemb, size_t __size)
| ^~~~~~
/usr/include/stdlib.h:675:22: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:675:38: error: unknown type name 'size_t'
675 | extern void *calloc (size_t __nmemb, size_t __size)
| ^~~~~~
/usr/include/stdlib.h:675:38: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:683:36: error: unknown type name 'size_t'
683 | extern void *realloc (void *__ptr, size_t __size)
| ^~~~~~
/usr/include/stdlib.h:683:36: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:695:41: error: unknown type name 'size_t'
695 | extern void *reallocarray (void *__ptr, size_t __nmemb, size_t __size)
| ^~~~~~
/usr/include/stdlib.h:695:41: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:695:57: error: unknown type name 'size_t'
695 | extern void *reallocarray (void *__ptr, size_t __nmemb, size_t __size)
| ^~~~~~
/usr/include/stdlib.h:695:57: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:701:41: error: unknown type name 'size_t'
701 | extern void *reallocarray (void *__ptr, size_t __nmemb, size_t __size)
| ^~~~~~
/usr/include/stdlib.h:701:41: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:701:57: error: unknown type name 'size_t'
701 | extern void *reallocarray (void *__ptr, size_t __nmemb, size_t __size)
| ^~~~~~
/usr/include/stdlib.h:701:57: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
In file included from /usr/include/stdlib.h:706:
/usr/include/alloca.h:32:22: error: unknown type name 'size_t'
32 | extern void *alloca (size_t __size) __THROW;
| ^~~~~~
/usr/include/alloca.h:25:1: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
24 | #include <stddef.h>
+++ |+#include <stddef.h>
25 |
/usr/include/stdlib.h:712:22: error: unknown type name 'size_t'
712 | extern void *valloc (size_t __size) __THROW __attribute_malloc__
| ^~~~~~
/usr/include/stdlib.h:712:22: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:718:45: error: unknown type name 'size_t'
718 | extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size)
| ^~~~~~
/usr/include/stdlib.h:718:45: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:718:65: error: unknown type name 'size_t'
718 | extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size)
| ^~~~~~
/usr/include/stdlib.h:718:65: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:724:29: error: unknown type name 'size_t'
724 | extern void *aligned_alloc (size_t __alignment, size_t __size)
| ^~~~~~
/usr/include/stdlib.h:724:29: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:724:49: error: unknown type name 'size_t'
724 | extern void *aligned_alloc (size_t __alignment, size_t __size)
| ^~~~~~
/usr/include/stdlib.h:724:49: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:961:23: error: unknown type name 'size_t'
961 | size_t __nmemb, size_t __size, __compar_fn_t __compar)
| ^~~~~~
/usr/include/stdlib.h:961:23: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:961:39: error: unknown type name 'size_t'
961 | size_t __nmemb, size_t __size, __compar_fn_t __compar)
| ^~~~~~
/usr/include/stdlib.h:961:39: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:970:34: error: unknown type name 'size_t'
970 | extern void qsort (void *__base, size_t __nmemb, size_t __size,
| ^~~~~~
/usr/include/stdlib.h:970:34: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:970:50: error: unknown type name 'size_t'
970 | extern void qsort (void *__base, size_t __nmemb, size_t __size,
| ^~~~~~
/usr/include/stdlib.h:970:50: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:1044:20: error: unknown type name 'size_t'
1044 | size_t __len) __THROW __nonnull ((3, 4, 5));
| ^~~~~~
/usr/include/stdlib.h:1044:20: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:1047:20: error: unknown type name 'size_t'
1047 | size_t __len) __THROW __nonnull ((3, 4, 5));
| ^~~~~~
/usr/include/stdlib.h:1047:20: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:1051:45: error: unknown type name 'size_t'
1051 | char *__restrict __buf, size_t __len)
| ^~~~~~
/usr/include/stdlib.h:1051:45: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:1055:45: error: unknown type name 'size_t'
1055 | char *__restrict __buf, size_t __len)
| ^~~~~~
/usr/include/stdlib.h:1055:45: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:1062:36: error: unknown type name 'size_t'
1062 | extern int mblen (const char *__s, size_t __n) __THROW;
| ^~~~~~
/usr/include/stdlib.h:1062:36: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:1066:48: error: unknown type name 'size_t'
1066 | const char *__restrict __s, size_t __n) __THROW;
| ^~~~~~
/usr/include/stdlib.h:1066:48: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:1073:8: error: unknown type name 'size_t'
1073 | extern size_t mbstowcs (wchar_t *__restrict __pwcs,
| ^~~~~~
/usr/include/stdlib.h:1073:8: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:1074:53: error: unknown type name 'size_t'
1074 | const char *__restrict __s, size_t __n) __THROW
| ^~~~~~
/usr/include/stdlib.h:1074:53: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:1077:8: error: unknown type name 'size_t'
1077 | extern size_t wcstombs (char *__restrict __s,
| ^~~~~~
/usr/include/stdlib.h:1077:8: note: 'size_t' is defined in header '<stddef.h>'; this is probably
|
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++)
using namespace std;
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
string s;
char c;
while(cin >> c){
if(c !='B') s += c;
else if(s !="") s.pop_back();
}
}
string s; cin >> s;
REPI(i, s.length()){
if(s[i + 1] != 'B' && s[i] != 'B') cout << s[i];
}
}
|
a.cc: In function 'int main()':
a.cc:18:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
18 | int main(){
| ^~
a.cc:18:9: note: remove parentheses to default-initialize a variable
18 | int main(){
| ^~
| --
a.cc:18:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:18:11: error: a function-definition is not allowed here before '{' token
18 | int main(){
| ^
|
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 == '':
| ^~
a.cc:1:1: error: 's' does not name a type
1 | s = input()
| ^
|
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++){
| ^~~~
| size
|
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]);
printf("\n");
}
return (0-0);
}
|
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;
temp = temp.substr(0,k-1);
k--;
}
}
cout<<temp;
return 0;
}
|
a.cc:3:7: error: expected nested-name-specifier before 'namspace'
3 | using namspace std;
| ^~~~~~~~
a.cc: In function 'int main()':
a.cc:6:3: error: 'string' was not declared in this scope
6 | string s;
| ^~~~~~
a.cc:6:3: note: suggested alternatives:
In file included from /usr/include/c++/14/iosfwd:41,
from /usr/include/c++/14/ios:40,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stringfwd.h:77:33: note: 'std::string'
77 | typedef basic_string<char> string;
| ^~~~~~
In file included from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44:
/usr/include/c++/14/string:76:11: note: 'std::pmr::string'
76 | using string = basic_string<char>;
| ^~~~~~
a.cc:7:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
7 | cin >>s;
| ^~~
| std::cin
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
a.cc:7:9: error: 's' was not declared in this scope
7 | cin >>s;
| ^
a.cc:8:9: error: expected ';' before 'temp'
8 | string temp = "";
| ^~~~~
| ;
a.cc:14:7: error: 'temp' was not declared in this scope; did you mean 'tm'?
14 | temp = temp+s[i];
| ^~~~
| tm
a.cc:19:10: error: 'temp' was not declared in this scope; did you mean 'tm'?
19 | if(temp.empty())
| ^~~~
| tm
a.cc:22:7: error: 'temp' was not declared in this scope; did you mean 'tm'?
22 | temp = temp.substr(0,k-1);
| ^~~~
| tm
a.cc:26:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
26 | cout<<temp;
| ^~~~
| std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
a.cc:26:9: error: 'temp' was not declared in this scope; did you mean 'tm'?
26 | cout<<temp;
| ^~~~
| tm
|
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();
| ^~~~~~~~~
| push_back
|
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();
| ^~~~~~~~
| pop_back
|
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);
}
cout <<ans<< endl;
}
|
a.cc: In function 'int main()':
a.cc:15:51: error: no matching function for call to 'std::__cxx11::basic_string<char>::erase(__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >, int)'
15 | else if(s[i]=='B' and ans.size()!=0) ans.erase(ans.end()-1,1);
| ~~~~~~~~~^~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:2114:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::erase(size_type, size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
2114 | erase(size_type __pos = 0, size_type __n = npos)
| ^~~~~
/usr/include/c++/14/bits/basic_string.h:2114:23: note: no known conversion for argument 1 from '__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >' to 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'}
2114 | erase(size_type __pos = 0, size_type __n = npos)
| ~~~~~~~~~~^~~~~~~~~
/usr/include/c++/14/bits/basic_string.h:2134:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::iterator std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::erase(__const_iterator) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; iterator = std::__cxx11::basic_string<char>::iterator; __const_iterator = std::__cxx11::basic_string<char>::const_iterator]'
2134 | erase(__const_iterator __position)
| ^~~~~
/usr/include/c++/14/bits/basic_string.h:2134:7: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/basic_string.h:2154:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::iterator std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::erase(__const_iterator, __const_iterator) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; iterator = std::__cxx11::basic_string<char>::iterator; __const_iterator = std::__cxx11::basic_string<char>::const_iterator]'
2154 | erase(__const_iterator __first, __const_iterator __last)
| ^~~~~
/usr/include/c++/14/bits/basic_string.h:2154:56: note: no known conversion for argument 2 from 'int' to 'std::__cxx11::basic_string<char>::__const_iterator' {aka 'std::__cxx11::basic_string<char>::const_iterator'}
2154 | erase(__const_iterator __first, __const_iterator __last)
| ~~~~~~~~~~~~~~~~~^~~~~~
|
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.size(); i++)
{
if (s[i] != 'B')
{
d.push_back(s[i]);
}
else
{
if (s[i].size())
{
d.pop_back();
}
}
}
for (int i = 0; i < d.size(); i++)
cout << d[i];
}
|
a.cc: In function 'int main()':
a.cc:29:22: error: request for member 'size' in 's.std::__cxx11::basic_string<char>::operator[](((std::__cxx11::basic_string<char>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
29 | if (s[i].size())
| ^~~~
|
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{
if(ans.size != 0){
ans.erase(ans.size()-1, 1);
}
}
}
cout << ans << endl;
}
|
a.cc: In function 'int main()':
a.cc:20:14: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
20 | if(ans.size != 0){
| ~~~~^~~~
| ()
|
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{
if(ans.size != 0){
ans.erase(ans.size()-1, 1)
}
}
}
cout << ans << endl;
}
|
a.cc: In function 'int main()':
a.cc:20:14: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
20 | if(ans.size != 0){
| ~~~~^~~~
| ()
a.cc:21:35: error: expected ';' before '}' token
21 | ans.erase(ans.size()-1, 1)
| ^
| ;
22 | }
| ~
|
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(ans.size != 0){
ans.erase(ans.size()-1, 1)
}
}
}
cout << ans << endl;
}
|
a.cc: In function 'int main()':
a.cc:20:14: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
20 | if(ans.size != 0){
| ~~~~^~~~
| ()
a.cc:21:35: error: expected ';' before '}' token
21 | ans.erase(ans.size()-1, 1)
| ^
| ;
22 | }
| ~
|
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)
}
}
}
cout << ans << endl;
}
|
a.cc: In function 'int main()':
a.cc:15:14: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
15 | if(ans.size != 0){
| ~~~~^~~~
| ()
a.cc:16:35: error: expected ';' before '}' token
16 | ans.erase(ans.size()-1, 1)
| ^
| ;
17 | }
| ~
|
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 << ans << endl;
}
|
a.cc: In function 'int main()':
a.cc:14:14: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
14 | if(ans.size != 0){
| ~~~~^~~~
| ()
a.cc:15:35: error: expected ';' before '}' token
15 | ans.erase(ans.size()-1, 1)
| ^
| ;
16 | }
| ~
|
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";
}else if(s[i] == '1'){
ans += "1";
}else{
ans.erase(ans.size()-1,1)
}
}
}
cout << ans << endl;
}
|
a.cc: In function 'int main()':
a.cc:9:17: error: cannot convert 'std::__cxx11::basic_string<char>::empty' from type 'bool (std::__cxx11::basic_string<char>::)() const noexcept' to type 'bool'
9 | if(ans.empty){
| ^
a.cc:22:34: error: expected ';' before '}' token
22 | ans.erase(ans.size()-1,1)
| ^
| ;
23 | }
| ~
|
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{
if (s[i] == '0'){
ans += "0";
}else if(s[i] == '1'){
ans += "1";
}
}
}
cout << ans << endl;
}
|
a.cc: In function 'int main()':
a.cc:8:38: error: expected ';' before ')' token
8 | for (int i = 0; i < s.length(), i++){
| ^
| ;
a.cc:15:42: error: expected ';' before '}' token
15 | ans.erase(ans.end()-1, ans.end())
| ^
| ;
16 | }
| ~
|
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)
}
}
else{
if(s[i] == '0'){
ans += "0";
}else if (s[i] == '1'){
ans += "1";
}
}
}
cout << ans << endl;
}
|
a.cc: In function 'int main()':
a.cc:13:19: error: expected ';' before ':' token
13 | ans += "0":
| ^
| ;
a.cc:18:33: error: expected ';' before '}' token
18 | ans.erase(ans.size(), 1)
| ^
| ;
19 | }
| ~
|
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)
}
}
else{
if(s[i] == '0'){
ans += "0";
}else if (s[i] == '1'){
ans += "1";
}
}
}
cout << ans << endl;
}
|
a.cc: In function 'int main()':
a.cc:10:38: error: expected ';' before ')' token
10 | for (int i = 0; i < s.length(), i++){
| ^
| ;
a.cc:13:19: error: expected ';' before ':' token
13 | ans += "0":
| ^
| ;
a.cc:18:33: error: expected ';' before '}' token
18 | ans.erase(ans.size(), 1)
| ^
| ;
19 | }
| ~
|
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)
}
}
else{
if(s[i] == '0'){
ans += "0";
}else if (s[i] == '1'){
ans += "1";
}
}
}
cout << ans << endl;
}
|
a.cc: In function 'int main()':
a.cc:10:38: error: expected ';' before ')' token
10 | for (int i = 0; i < s.length(), i++){
| ^
| ;
a.cc:13:19: error: expected ';' before ':' token
13 | ans += "0":
| ^
| ;
a.cc:18:33: error: expected ';' before '}' token
18 | ans.erase(ans.size(), 1)
| ^
| ;
19 | }
| ~
|
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)
}
}
else{
if(s[i] == '0'){
ans += '0';
}else if (s[i] == '1'){
ans += '1';
}
}
}
cout << ans << endl;
}
|
a.cc: In function 'int main()':
a.cc:10:38: error: expected ';' before ')' token
10 | for (int i = 0; i < s.length(), i++){
| ^
| ;
a.cc:13:19: error: expected ';' before ':' token
13 | ans += '0':
| ^
| ;
a.cc:18:33: error: expected ';' before '}' token
18 | ans.erase(ans.size(), 1)
| ^
| ;
19 | }
| ~
|
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)
}
}
else{
if(s[i] == '0'){
ans += '0';
}else if (s[i] == '1'){
ans += '1';
}
}
cout << ans << endl;
}
}
|
a.cc: In function 'int main()':
a.cc:10:38: error: expected ';' before ')' token
10 | for (int i = 0; i < s.length(), i++){
| ^
| ;
a.cc:13:19: error: expected ';' before ':' token
13 | ans += '0':
| ^
| ;
a.cc:18:33: error: expected ';' before '}' token
18 | ans.erase(ans.size(), 1)
| ^
| ;
19 | }
| ~
|
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(); i++) {
cout << ans[i];
}
}
|
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.charAt(i) == 'B') {
if (!stack.isEmpty()) {
stack.pop();
}
} else {
stack.push(s.charAt(i);
}
}
while (!stack.isEmpty()) {
res = stack.pop() + res;
}
System.out.println(res);
}
}
|
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();
}
}
cout<<vec<<endl;
}
|
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 {aka std::basic_ostream<char>}
In file included from /usr/include/c++/14/istream:41,
from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127,
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::vector<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::vector<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::vector<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::vector<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::vector<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::vector<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::vector<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::vector<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::vector<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::vector<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::vector<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::vector<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::vector<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::vector<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::vector<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::vector<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::vector<char>' to 'std::nullptr_t'
306 | operator<<(nul
|
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();
}
cout<<vec<<endl;
}
|
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 {aka std::basic_ostream<char>}
In file included from /usr/include/c++/14/istream:41,
from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127,
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::vector<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::vector<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::vector<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::vector<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::vector<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::vector<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::vector<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::vector<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::vector<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::vector<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::vector<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::vector<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::vector<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::vector<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::vector<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::vector<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::vector<char>' to 'std::nullptr_t'
306 | operator<<(nul
|
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 unsigned int]' (did you forget the '()' ?)
10 | else if((s[i]=='B') && (a.size>=0))a.pop_back();
| ~~^~~~
| ()
|
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 unsigned int]' (did you forget the '()' ?)
10 | else if(s[i]=='B' && a.size>=0)a.pop_back();
| ~~^~~~
| ()
|
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 unsigned int]' (did you forget the '()' ?)
10 | else if(s[i]=='B' && s.size>=0)a.pop_back();
| ~~^~~~
| ()
|
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 if ( A.at(i) = 1){
a += '1';
}
else if (A.at(i) = 'B'){
a.at(a.size()-1) =' '
}
}
cout << a << endl;
}
|
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 if ( A.at(i) == 1){
a += '1';
}
else if (A.at(i) == 'B'){
a.at(a.size()) = " "
}
}
cout << a << endl;
}
|
a.cc: In function 'int main()':
a.cc:24:31: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive]
24 | a.at(a.size()) = " "
| ^~~
| |
| const char*
a.cc:24:34: error: expected ';' before '}' token
24 | a.at(a.size()) = " "
| ^
| ;
25 | }
| ~
|
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 if ( A.at(i) == 1){
a += '1';
}
else if (A.at(i) == 'B'){
a.at(a.size()) == " "
}
}
cout << a << endl;
}
|
a.cc: In function 'int main()':
a.cc:24:29: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
24 | a.at(a.size()) == " "
| ~~~~~~~~~~~~~~~^~~~~~
a.cc:24:35: error: expected ';' before '}' token
24 | a.at(a.size()) == " "
| ^
| ;
25 | }
| ~
|
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 if ( A.at(i) == 1){
a += '1';
}
else if (A.at(i) == 'B'){
a -= a.at(a.size())
}
}
}
|
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 if ( A.at(i) == 1){
a += '1';
}
else if (A.at(i) == 'B'){
a -= A.at(i)
}
}
}
}
}
|
a.cc: In function 'int main()':
a.cc:24:16: error: no match for 'operator-=' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'})
24 | a -= A.at(i)
| ~~^~~~~~~~~~
a.cc: At global scope:
a.cc:31:9: error: expected declaration before '}' token
31 | }
| ^
a.cc:32:9: error: expected declaration before '}' token
32 | }
| ^
|
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 = 0 ; i < counter; ++i)
cout << answer[i];
cout << endl;
}
|
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];
cout << endl;
}
|
a.cc: In function 'int main()':
a.cc:2:3: error: 'strint' was not declared in this scope; did you mean 'struct'?
2 | strint s;
| ^~~~~~
| struct
a.cc:3:3: error: 'cin' was not declared in this scope
3 | cin >> s;
| ^~~
a.cc:3:10: error: 's' was not declared in this scope
3 | cin >> s;
| ^
a.cc:5:3: error: 'string' was not declared in this scope
5 | string answer = "";
| ^~~~~~
a.cc:13:7: error: 'answer' was not declared in this scope
13 | answer[counter-1] = s[i];
| ^~~~~~
a.cc:17:5: error: 'cout' was not declared in this scope
17 | cout << answer[i];
| ^~~~
a.cc:17:13: error: 'answer' was not declared in this scope
17 | cout << answer[i];
| ^~~~~~
a.cc:18:3: error: 'cout' was not declared in this scope
18 | cout << endl;
| ^~~~
a.cc:18:11: error: 'endl' was not declared in this scope
18 | cout << endl;
| ^~~~
|
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 << 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<char>')
19 | cout << r << endl;
| ~~~~ ^~ ~
| | |
| | std::vector<char>
| std::ostream {aka std::basic_ostream<char>}
In file included from /usr/include/c++/14/istream:41,
from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127,
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::vector<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::vector<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::vector<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::vector<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::vector<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::vector<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::vector<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::vector<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::vector<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::vector<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::vector<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::vector<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::vector<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::vector<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::vector<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::vector<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::vector<char>' to 'std::nullptr_t'
306 | operator<<(nullptr_t)
|
|
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>}
In file included from /usr/include/c++/14/istream:41,
from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127,
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::vector<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::vector<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::vector<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::vector<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::vector<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::vector<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::vector<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::vector<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::vector<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::vector<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::vector<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::vector<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::vector<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::vector<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::vector<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::vector<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::vector<char>' to 'std::nullptr_t'
306 | operator<<(nullptr_t)
|
|
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_back(1);
| ^
a.cc:13:7: error: 'r' was not declared in this scope
13 | r.push_back(0);
| ^
a.cc:15:29: error: 'r' was not declared in this scope
15 | else if(s.at(i)=='B' && r.size()>0){
| ^
a.cc:19:11: error: 'r' was not declared in this scope
19 | cout << r;
| ^
|
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_ostream<char>}
In file included from /usr/include/c++/14/istream:41,
from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127,
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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' to 'std::nullptr_t'
306 | operator<<(nullptr_t)
| ^~~~~~~
|
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,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >; value_type = std::__cxx11::basic_string<char>]'
1283 | push_back(const value_type& __x)
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:35: note: no known conversion for argument 1 from 'int' to 'const std::vector<std::__cxx11::basic_string<char> >::value_type&' {aka 'const std::__cxx11::basic_string<char>&'}
1283 | push_back(const value_type& __x)
| ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >; value_type = std::__cxx11::basic_string<char>]'
1300 | push_back(value_type&& __x)
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:30: note: no known conversion for argument 1 from 'int' to 'std::vector<std::__cxx11::basic_string<char> >::value_type&&' {aka 'std::__cxx11::basic_string<char>&&'}
1300 | push_back(value_type&& __x)
| ~~~~~~~~~~~~~^~~
a.cc:19:8: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'std::vector<std::__cxx11::basic_string<char> >')
19 | cout << vec << endl;
| ~~~~ ^~ ~~~
| | |
| | std::vector<std::__cxx11::basic_string<char> >
| std::ostream {aka std::basic_ostream<char>}
In file included from /usr/include/c++/14/istream:41,
from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/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::vector<std::__cxx11::basic_string<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::vector<std::__cxx11::basic_string<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::vector<std::__cxx11::basic_string<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::vector<std::__cxx11::basic_string<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::vector<std::__cxx11::basic_string<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::vector<std::__cxx11::basic_string<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::vector<std::__cxx11::basic_string<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::vector<std::__cxx11::basic_string<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::vector<std::__cxx11::basic_string<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::vector<std::__cxx11::basic_string<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::vector<std::__cxx11::basic_string<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::vector<std::__cxx11::basic_string<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::vector<std::__cxx11::basic_string<char> >' to 'double'
231 | operator<<(double __f)
| ~~~~~~~^~~
/usr/include/
|
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_ostream<char>}
In file included from /usr/include/c++/14/istream:41,
from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127,
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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' to 'std::nullptr_t'
306 | operator<<(nullptr_t)
| ^~~~~~~
|
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 << endl;
}
|
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 char*
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_ostream<char>}
In file included from /usr/include/c++/14/istream:41,
from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127,
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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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
|
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 << endl;
}
|
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>')
19 | cout << vec << endl;
| ~~~~ ^~ ~~~
| | |
| | std::vector<int>
| std::ostream {aka std::basic_ostream<char>}
In file included from /usr/include/c++/14/istream:41,
from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127,
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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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
|
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 << endl;
}
|
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;
| ~~~~ ^~ ~~~
| | |
| | std::vector<int>
| std::ostream {aka std::basic_ostream<char>}
In file included from /usr/include/c++/14/istream:41,
from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127,
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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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::vector<int>' 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 argum
|
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 namespace std;
a.cc:7:9: error: 'cin' was not declared in this scope
7 | cin >> s;
| ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
1 | #include <stack>
+++ |+#include <iostream>
2 | using namespace std;
a.cc:7:16: error: 's' was not declared in this scope
7 | cin >> s;
| ^
a.cc:8:21: error: found ':' in nested-name-specifier, expected '::'
8 | while(auto c: s){
| ^
| ::
a.cc:8:20: error: 'c' has not been declared
8 | while(auto c: s){
| ^
a.cc:8:24: error: qualified-id in declaration before ')' token
8 | while(auto c: s){
| ^
a.cc:9:24: error: 'c' was not declared in this scope
9 | switch(c){
| ^
a.cc:19:21: error: no matching function for call to 'begin(std::stack<char>&)'
19 | for(auto c: stk){
| ^~~
In file included from /usr/include/c++/14/bits/stl_deque.h:63,
from /usr/include/c++/14/deque:66,
from /usr/include/c++/14/stack:62,
from a.cc:1:
/usr/include/c++/14/initializer_list:88:5: note: candidate: 'template<class _Tp> constexpr const _Tp* std::begin(initializer_list<_Tp>)'
88 | begin(initializer_list<_Tp> __ils) noexcept
| ^~~~~
/usr/include/c++/14/initializer_list:88:5: note: template argument deduction/substitution failed:
a.cc:19:21: note: 'std::stack<char>' is not derived from 'std::initializer_list<_Tp>'
19 | for(auto c: stk){
| ^~~
In file included from /usr/include/c++/14/deque:68:
/usr/include/c++/14/bits/range_access.h:52:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.begin()) std::begin(_Container&)'
52 | begin(_Container& __cont) -> decltype(__cont.begin())
| ^~~~~
/usr/include/c++/14/bits/range_access.h:52:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/range_access.h: In substitution of 'template<class _Container> constexpr decltype (__cont.begin()) std::begin(_Container&) [with _Container = std::stack<char>]':
a.cc:19:14: required from here
19 | for(auto c: stk){
| ^~~
/usr/include/c++/14/bits/range_access.h:52:50: error: 'class std::stack<char>' has no member named 'begin'
52 | begin(_Container& __cont) -> decltype(__cont.begin())
| ~~~~~~~^~~~~
/usr/include/c++/14/bits/range_access.h:63:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.begin()) std::begin(const _Container&)'
63 | begin(const _Container& __cont) -> decltype(__cont.begin())
| ^~~~~
/usr/include/c++/14/bits/range_access.h:63:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/range_access.h: In substitution of 'template<class _Container> constexpr decltype (__cont.begin()) std::begin(const _Container&) [with _Container = std::stack<char>]':
a.cc:19:14: required from here
19 | for(auto c: stk){
| ^~~
/usr/include/c++/14/bits/range_access.h:63:56: error: 'const class std::stack<char>' has no member named 'begin'
63 | begin(const _Container& __cont) -> decltype(__cont.begin())
| ~~~~~~~^~~~~
/usr/include/c++/14/bits/range_access.h:95:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::begin(_Tp (&)[_Nm])'
95 | begin(_Tp (&__arr)[_Nm]) noexcept
| ^~~~~
/usr/include/c++/14/bits/range_access.h:95:5: note: template argument deduction/substitution failed:
a.cc:19:21: note: mismatched types '_Tp [_Nm]' and 'std::stack<char>'
19 | for(auto c: stk){
| ^~~
/usr/include/c++/14/bits/range_access.h:113:31: note: candidate: 'template<class _Tp> _Tp* std::begin(valarray<_Tp>&)'
113 | template<typename _Tp> _Tp* begin(valarray<_Tp>&) noexcept;
| ^~~~~
/usr/include/c++/14/bits/range_access.h:113:31: note: template argument deduction/substitution failed:
a.cc:19:21: note: 'std::stack<char>' is not derived from 'std::valarray<_Tp>'
19 | for(auto c: stk){
| ^~~
/usr/include/c++/14/bits/range_access.h:114:37: note: candidate: 'template<class _Tp> const _Tp* std::begin(const valarray<_Tp>&)'
114 | template<typename _Tp> const _Tp* begin(const valarray<_Tp>&) noexcept;
| ^~~~~
/usr/include/c++/14/bits/range_access.h:114:37: note: template argument deduction/substitution failed:
a.cc:19:21: note: 'std::stack<char>' is not derived from 'const std::valarray<_Tp>'
19 | for(auto c: stk){
| ^~~
a.cc:19:21: error: no matching function for call to 'end(std::stack<char>&)'
/usr/include/c++/14/initializer_list:99:5: note: candidate: 'template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)'
99 | end(initializer_list<_Tp> __ils) noexcept
| ^~~
/usr/include/c++/14/initializer_list:99:5: note: template argument deduction/substitution failed:
a.cc:19:21: note: 'std::stack<char>' is not derived from 'std::initializer_list<_Tp>'
19 | for(auto c: stk){
| ^~~
/usr/include/c++/14/bits/range_access.h:74:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)'
74 | end(_Container& __cont) -> decltype(__cont.end())
| ^~~
/usr/include/c++/14/bits/range_access.h:74:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/range_access.h: In substitution of 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&) [with _Container = std::stack<char>]':
a.cc:19:14: required from here
19 | for(auto c: stk){
| ^~~
/usr/include/c++/14/bits/range_access.h:74:48: error: 'class std::stack<char>' has no member named 'end'
74 | end(_Container& __cont) -> decltype(__cont.end())
| ~~~~~~~^~~
/usr/include/c++/14/bits/range_access.h:85:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)'
85 | end(const _Container& __cont) -> decltype(__cont.end())
| ^~~
/usr/include/c++/14/bits/range_access.h:85:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/range_access.h: In substitution of 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&) [with _Container = std::stack<char>]':
a.cc:19:14: required from here
19 | for(auto c: stk){
| ^~~
/usr/include/c++/14/bits/range_access.h:85:54: error: 'const class std::stack<char>' has no member named 'end'
85 | end(const _Container& __cont) -> decltype(__cont.end())
| ~~~~~~~^~~
/usr/include/c++/14/bits/range_access.h:106:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])'
106 | end(_Tp (&__arr)[_Nm]) noexcept
| ^~~
/usr/include/c++/14/bits/range_access.h:106:5: note: template argument deduction/substitution failed:
a.cc:19:21: note: mismatched types '_Tp [_Nm]' and 'std::stack<char>'
19 | for(auto c: stk){
| ^~~
/usr/include/c++/14/bits/range_access.h:115:31: note: candidate: 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)'
115 | template<typename _Tp> _Tp* end(valarray<_Tp>&) noexcept;
| ^~~
/usr/include/c++/14/bits/range_access.h:115:31: note: template argument deduction/substitution failed:
a.cc:19:21: note: 'std::stack<char>' is not derived from 'std::valarray<_Tp>'
19 | for(auto c: stk){
| ^~~
/usr/include/c++/14/bits/range_access.h:116:37: note: candidate: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)'
116 | template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept;
| ^~~
/usr/include/c++/14/bits/range_access.h:116:37: note: template argument deduction/substitution failed:
a.cc:19:21: note: 'std::stack<char>' is not derived from 'const std::valarray<_Tp>'
19 | for(auto c: stk){
| ^~~
a.cc:20:17: error: 'cout' was not declared in this scope
20 | cout >> c;
| ^~~~
a.cc:20:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
|
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 std;
typedef long long ll; //64bit型
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(a) (a).begin(), (a).end()
#define debug(x) cerr << x << " " \
<< "(L:" << __LINE__ << ")" << '\n'
#define PRINT(V) \
{ \
for (int i = 0; i < V.size(); i++) \
{ \
cout << V[i] << " "; \
} \
cout << endl; \
}
int gcd(int a, int b)
{
return b ? gcd(b, a % b) : a;
}
int main() //input->compute->output
{
string N;
cin >> N;
string ans = "";
rep(i, N.size())
{
if (N[i] == '0')
{
ans += '0';
}
else if (N[i] == '1')
{
ans += '1';
}
else
{
if (ans.size()>0)
{
ans.pop_back;
}
}
}
cout << ans << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:57:37: error: invalid use of non-static member function 'void std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::pop_back() [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
57 | ans.pop_back;
| ~~~~^~~~~~~~
In file included from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:2:
/usr/include/c++/14/bits/basic_string.h:2174:7: note: declared here
2174 | pop_back() noexcept
| ^~~~~~~~
|
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] == 'B' && ans.size > 0) ans.pop_back();
else{
ans += s[i];
}
}
cout << ans << endl;
}
|
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 unsigned int]' (did you forget the '()' ?)
15 | if(s[i] == 'B' && ans.size > 0) ans.pop_back();
| ~~~~^~~~
| ()
|
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')
b+='1';
else{
if(b!="")
b.pop_back;
}
}
cout<<b;
}
|
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 /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
| ^~~~~~~~
|
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 ans[10];
rep(i,s.size()){
if(s[i]=='B'){
ans=s.substr(0,i-1);
}
else ans+=s[i];
}
cout<<ans<<endl;
}
|
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>::value_type' {aka 'char'} to 'char [10]'
21 | else ans+=s[i];
|
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,s.size()){
if(s[i]=='B'&&s[i-1]!=nullptr){
s[i-1]=nullptr;
}
}
rep(i,s.size())cout<<s[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_traits<std::allocator<char>, char>::value_type' {aka 'char'} in assignment
18 | s[i-1]=nullptr;
| ^~~~~~~
|
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,s.size()){
if(s[i]=='B'&&s[i-1]!=nullptr){
s[i-1]==nullptr;
}
}
rep(i,s.size())cout<<s[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<std::allocator<char>, char>::value_type' {aka 'char'} and 'std::nullptr_t' to binary 'operator=='
18 | s[i-1]==nullptr;
|
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,s.size()){
if(s[i]=='B'&&s[i-1]!=''){
s[i-1]=='';
}
}
rep(i,s.size())cout<<s[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,s.size()){
if(s[i]=='B'&&(s[i-1]=='0'||s[i-1]=='1'||s[i-1]=='B')){
s[i-1]=='';
}
}
rep(i,s.size())cout<<s[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,s.size()){
if(s[i]=='B'&&(s[i-1]=='0'||s[i-1]=='1'||s[i-1]=='B')){
s[i-1]=='';
}
rep(i,s.size())cout<<s[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 moji :moji){
boolean is0 = moji.equals("0");
boolean is1 = moji.equals("1");
boolean isB = moji.equals("B");
boolean isAns0 = answer.length()==0;
if(is0){
answer += "0";
}else if(is1){
answer += "1";
}else if(isB && !isAns0){
answer = answer.substring(answer.length()-1);
}
}
System.out.println(answer);
}
|
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 statement
for(String?moji :moji){
^
Main.java:13: error: ';' expected
for(String?moji :moji){
^
Main.java:28: error: reached end of file while parsing
}
^
6 errors
|
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 unsigned int]' (did you forget the '()' ?)
8 | for(int i = 0; i < s.size; i++){
| ~~^~~~
| ()
|
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(!ans.empty)ans.pop_back();
| ~~~~^~~~~
|
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 declared in this scope; did you mean 'abs'?
11 | cout<<ans<<endl;
| ^~~
| abs
|
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,
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:1572:24: note: initializing argument 1 of 'void std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::push_back(_CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
1572 | push_back(_CharT __c)
| ~~~~~~~^~~
a.cc:12:21: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
12 | ans.push_back("0");
| ^~~
| |
| const char*
/usr/include/c++/14/bits/basic_string.h:1572:24: note: initializing argument 1 of 'void std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::push_back(_CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
1572 | push_back(_CharT __c)
| ~~~~~~~^~~
|
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++/14/bits/stl_vector.h:1536:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(const_iterator) [with _Tp = char; _Alloc = std::allocator<char>; iterator = std::vector<char>::iterator; const_iterator = std::vector<char>::const_iterator]'
1536 | erase(const_iterator __position)
| ^~~~~
/usr/include/c++/14/bits/stl_vector.h:1536:28: note: no known conversion for argument 1 from 'int' to 'std::vector<char>::const_iterator'
1536 | erase(const_iterator __position)
| ~~~~~~~~~~~~~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1564:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(const_iterator, const_iterator) [with _Tp = char; _Alloc = std::allocator<char>; iterator = std::vector<char>::iterator; const_iterator = std::vector<char>::const_iterator]'
1564 | erase(const_iterator __first, const_iterator __last)
| ^~~~~
/usr/include/c++/14/bits/stl_vector.h:1564:7: note: candidate expects 2 arguments, 1 provided
|
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 <functional>
using namespace std;
struct initon
{
initon()
{
cin.tie(0);
ios::sync_with_stdio(false);
};
};
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvi = vector<vi>;
using vs = vector<string>;
using vl = vector<ll>;
using vvl = vector<vl>;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using vp = vector<P>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for (i64 i = m; i < n; i++)
#define SORT(x) sort(x.begin(), x.end())
#define RS(x) rsort(x.begin(),x,end()))
#define REVE(x) reverse(x.begin(), x.end())
#define all(x) (x).begin(), (x).end()
#define fst first
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pob pop_back
#define sw swap
#define UP(x) transform(x.begin(), x.end(), x.begin(), ::toupper);
#define LOW(x) transform(x.begin(), x.end(), x.begin(), ::tolower);
#define na(a, n) rep(i, n) cin >> a[i];
template <class T>
inline bool chmax(T &a, T b)
{
if (a < b)
{
a = b;
return 1;
}
return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
if (a > b)
{
a = b;
return 1;
}
return 0;
}
vb d(10);
int ans(int x)
{
while (x)
{
if (d[x % 10])
return 0;
x /= 10;
}
return 1;
}
//ここからメイン
int main()
{
int a,b,c,n,d;
string A,B,C,D,N;
stack<int> an;
cin >> A;
for(const auto& i:B){
if(i=='B'){
if(A.size())A.pob();
}else if(i=='0'){
A.pb(0);
}else if(i=='1'){
A.pb(1);
}
}
}
|
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 namespace std;
a.cc:91:11: error: expected primary-expression before 'int'
91 | stack<int> an;
| ^~~
|
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();
}
}
for(int i=0;i<c.length();i++)
{
cout<<c[i];
}
return 0;
}
|
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<<endl;
}
|
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::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, _CharT) [with _CharT = char; _Traits = char_traits<char>; _Alloc = allocator<char>]', declared with attribute 'nodiscard' [-Wunused-result]
9 | else s2+'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:3670:5: note: declared here
3670 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs)
| ^~~~~~~~
a.cc:12:15: warning: ignoring return value of 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, _CharT) [with _CharT = char; _Traits = char_traits<char>; _Alloc = allocator<char>]', declared with attribute 'nodiscard' [-Wunused-result]
12 | else s2+'1';
| ^~~
/usr/include/c++/14/bits/basic_string.h:3670:5: note: declared here
3670 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs)
| ^~~~~~~~
a.cc:13:5: error: 'else' without a previous 'if'
13 | else if(s2.size()!=0) s2.erase(s2.size()-1);
| ^~~~
|
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/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:2007:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(size_type, const _CharT*) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (near match)
2007 | insert(size_type __pos, const _CharT* __s)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:2007:7: note: conversion of argument 2 would be ill-formed:
a.cc:7:43: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
7 | if(s1.at(i)=='0') s2.insert(s2.size(),'0');
| ^~~
| |
| char
/usr/include/c++/14/bits/basic_string.h:1876:9: note: candidate: 'template<class _InputIterator, class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::iterator std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(const_iterator, _InputIterator, _InputIterator) [with <template-parameter-2-2> = _InputIterator; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
1876 | insert(const_iterator __p, _InputIterator __beg, _InputIterator __end)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1876:9: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/basic_string.h:2069:9: note: candidate: 'template<class _Tp> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv<_Tp, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(size_type, const _Tp&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
2069 | insert(size_type __pos, const _Tp& __svt)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:2069: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 = std::__cxx11::basic_string<char>&]':
/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 = char; _Res = std::__cxx11::basic_string<char>&; _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:2069:2: required by substitution of 'template<class _Tp> std::__cxx11::basic_string<char>::_If_sv<_Tp, std::__cxx11::basic_string<char>&> std::__cxx11::basic_string<char>::insert(size_type, const _Tp&) [with _Tp = char]'
2069 | insert(size_type __pos, const _Tp& __svt)
| ^~~~~~
a.cc:7:32: required from here
7 | if(s1.at(i)=='0') s2.insert(s2.size(),'0');
| ~~~~~~~~~^~~~~~~~~~~~~~~
/usr/include/c++/14/type_traits:2711:11: error: no type named 'type' in 'struct std::enable_if<false, std::__cxx11::basic_string<char>&>'
2711 | using enable_if_t = typename enable_if<_Cond, _Tp>::type;
| ^~~~~~~~~~~
/usr/include/c++/14/bits/basic_string.h:2086:9: note: candidate: 'template<class _Tp> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv<_Tp, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(size_type, const _Tp&, size_type, size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
2086 | insert(size_type __pos1, const _Tp& __svt,
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:2086:9: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/basic_string.h:1831:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::iterator std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(const_iterator, size_type, _CharT) [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; size_type = long unsigned int]'
1831 | insert(const_iterator __p, size_type __n, _CharT __c)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1831:7: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/basic_string.h:1911:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::iterator std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(const_iterator, std::initializer_list<_Tp>) [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]'
1911 | insert(const_iterator __p, initializer_list<_CharT> __l)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1911:29: 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>::const_iterator'
1911 | insert(const_iterator __p, initializer_list<_CharT> __l)
| ~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/basic_string.h:1939:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(size_type, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
1939 | insert(size_type __pos1, const basic_string& __str)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1939:52: note: no known conversion for argument 2 from 'char' to 'const std::__cxx11::basic_string<char>&'
1939 | insert(size_type __pos1, const basic_string& __str)
| ~~~~~~~~~~~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:1963:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(size_type, 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]'
1963 | insert(size_type __pos1, const basic_string& __str,
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1963:7: note: candidate expects 4 arguments, 2 provided
/usr/include/c++/14/bits/basic_string.h:1987:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(size_type, const _CharT*, size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
1987 | insert(size_type __pos, const _CharT* __s, size_type __n)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1987:7: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/basic_string.h:2032:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(size_type, size_type, _CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
2032 | insert(size_type __pos, size_type __n, _CharT __c)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:2032:7: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/basic_string.h:2051:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::iterator std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(__const_iterator, _CharT) [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]'
2051 | insert(__const_iterator __p, _CharT __c)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:2051:31: 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>::__const_iterator' {aka 'std::__cxx11::basic_string<char>::const_iterator'}
2051 | insert(__const_iterator __p, _CharT __c)
| ~~~~~~~~~~~~~~~~~^~~
a.cc:8:32: error: no matching function for call to 'std::__cxx11::basic_string<char>::insert(std::__cxx11::basic_string<char>::size_type, char)'
8 | if(s1.at(i)=='1') s2.insert(s2.size(),'1');
| ~~~~~~~~~^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/basic_string.h:2007:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(size_type, const _CharT*) [with _CharT = char; _Traits = std::c
|
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 unsigned int]' (did you forget the '()' ?)
9 | else s2.erase(s2.size-1)
| ~~~^~~~
| ()
|
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/c++/14/bits/stdc++.h:181,
from a.cc:1:
/usr/include/c++/14/bits/regex.h:1143:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
1143 | operator<(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1143:5: note: template argument deduction/substitution failed:
a.cc:10:12: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
10 | cout<<s2<endl;
| ^~~~
/usr/include/c++/14/bits/regex.h:1224:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)'
1224 | operator<(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1224:5: note: template argument deduction/substitution failed:
a.cc:10:12: note: 'std::basic_ostream<char>' is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>'
10 | cout<<s2<endl;
| ^~~~
/usr/include/c++/14/bits/regex.h:1317:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
1317 | operator<(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1317:5: note: template argument deduction/substitution failed:
a.cc:10:12: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
10 | cout<<s2<endl;
| ^~~~
/usr/include/c++/14/bits/regex.h:1391:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
1391 | operator<(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1391:5: note: template argument deduction/substitution failed:
a.cc:10:12: note: couldn't deduce template parameter '_Bi_iter'
10 | cout<<s2<endl;
| ^~~~
/usr/include/c++/14/bits/regex.h:1485:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
1485 | operator<(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1485:5: note: template argument deduction/substitution failed:
a.cc:10:12: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
10 | cout<<s2<endl;
| ^~~~
/usr/include/c++/14/bits/regex.h:1560:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
1560 | operator<(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1560:5: note: template argument deduction/substitution failed:
a.cc:10:12: note: couldn't deduce template parameter '_Bi_iter'
10 | cout<<s2<endl;
| ^~~~
/usr/include/c++/14/bits/regex.h:1660:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
1660 | operator<(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1660:5: note: template argument deduction/substitution failed:
a.cc:10:12: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
10 | cout<<s2<endl;
| ^~~~
In file included 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/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:12: note: 'std::basic_ostream<char>' is not derived from 'const std::pair<_T1, _T2>'
10 | cout<<s2<endl;
| ^~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/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:12: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>'
10 | cout<<s2<endl;
| ^~~~
/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:12: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>'
10 | cout<<s2<endl;
| ^~~~
/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:12: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>'
10 | cout<<s2<endl;
| ^~~~
/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:12: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>'
10 | cout<<s2<endl;
| ^~~~
In file included from /usr/include/c++/14/bits/basic_string.h:47,
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:
/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:12: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
10 | cout<<s2<endl;
| ^~~~
/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:12: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
10 | cout<<s2<endl;
| ^~~~
/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:12: note: couldn't deduce template parameter '_CharT'
10 | cout<<s2<endl;
| ^~~~
/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:12: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
10 | cout<<s2<endl;
| ^~~~
/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:12: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
10 | cout<<s2<endl;
| ^~~~
/usr
|
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 unsigned int]' (did you forget the '()' ?)
9 | for(int i=0;i<s.length;i++){
| ~~^~~~~~
| ()
|
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() - 1);
| ~~~~~~~^~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:1222:7: note: candidate: 'void std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::clear() [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
1222 | clear() _GLIBCXX_NOEXCEPT
| ^~~~~
/usr/include/c++/14/bits/basic_string.h:1222:7: note: candidate expects 0 arguments, 1 provided
|
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] == '0') {
ans += "0";
}
else if(s[i] == '1') {
ans += "1";
}
else if(s[i] == 'B') {
int m = ans.size();
if(m <= 1) {
ans = "";
}
else if(1 < m) {
ans = substr(0, m-1);
}
}
}
cout << ans;
cout << endl;
return 0;
}
|
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";
else if (s[i] == '1')ans += "1";
else if (s[i] == 'B' && ans != "")ans.replace(ans.length()-1, 1, "");
}
cout << ans << endl;
|
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()
#define rall(v) v.rbegin(),v.rend()
#define th(n) cout<<n<<endl
#define gc getchar_unlocked
#define ms(s, n) memset(s, n, sizeof(s))
#define prec(n) fixed<<setprecision(n)
#define n_l '\n'
// make it python
#define gcd __gcd
#define append push_back
#define str to_string
#define upper(s) transform(s.begin(),s.end(),s.begin(),::toupper)
#define lower(s) transform(s.begin(),s.end(),s.begin(),::tolower)
#define print(arr) for(auto el: arr) cout<<el<<" ";cout<<endl
// utility functions shortcuts
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define sswap(a,b) {a=a^b;b=a^b;a=a^b;}
#define swap(a,b) {auto temp=a; a=b; b=temp;}
#define init(dp) memset(dp,-1,sizeof(dp));
#define set0(dp) memset(dp,0,sizeof(dp));
#define bits(x) __builtin_popcount(x)
#define SORT(v) sort(all(v))
#define endl "\n"
#define forr(i,n) for(ll i=0;i<n;i++)
#define eof (scanf("%d" ,&n))!=EOF
// declaration shortcuts
#define vi vector<int>
#define vll vector<ll>
#define vvi vector<vector<int>>
#define vvl vector<vector<ll>>
#define pll pair<ll,ll>
#define ppl pair<ll,pp>
#define ull unsigned long long
#define ll long long
#define mll map< ll, ll >
#define sll set< ll >
#define uni(v) v.erase(unique(v.begin(),v.end()),v.end());
#define ini(a, v) memset(a, v, sizeof(a))
// Constants
constexpr int dx[] = {-1, 0, 1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, 1, -1};
constexpr ll INF = 1999999999999999997;
constexpr int inf= INT_MAX;
constexpr int MAXSIZE = int(1e6)+5;
constexpr auto PI = 3.14159265358979323846L;
constexpr auto oo = numeric_limits<int>::max() / 2 - 2;
constexpr auto eps = 1e-6;
constexpr auto mod = 1000000007;
constexpr auto MOD = 1000000007;
constexpr auto MOD9 = 1000000009;
// Debugging
// For reference: https://codeforces.com/blog/entry/65311
#define dbg(...) cout << "[" << #__VA_ARGS__ << "]: "; cout << to_string(__VA_ARGS__) << endl
template <typename T, size_t N> int SIZE(const T (&t)[N]){ return N; } template<typename T> int SIZE(const T &t){ return t.size(); } string to_string(string s, int x1=0, int x2=1e9){ return '"' + ((x1 < s.size()) ? s.substr(x1, x2-x1+1) : "") + '"'; } string to_string(const char* s) { return to_string((string) s); } string to_string(bool b) { return (b ? "true" : "false"); } string to_string(char c){ return string({c}); } template<size_t N> string to_string(bitset<N> &b, int x1=0, int x2=1e9){ string t = ""; for(int __iii__ = min(x1,SIZE(b)), __jjj__ = min(x2, SIZE(b)-1); __iii__ <= __jjj__; ++__iii__){ t += b[__iii__] + '0'; } return '"' + t + '"'; } template <typename A, typename... C> string to_string(A (&v), int x1=0, int x2=1e9, C... coords); int l_v_l_v_l = 0, t_a_b_s = 0; template <typename A, typename B> string to_string(pair<A, B> &p) { l_v_l_v_l++; string res = "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; l_v_l_v_l--; return res; } template <typename A, typename... C> string to_string(A (&v), int x1, int x2, C... coords) { int rnk = rank<A>::value; string tab(t_a_b_s, ' '); string res = ""; bool first = true; if(l_v_l_v_l == 0) res += n_l; res += tab + "["; x1 = min(x1, SIZE(v)), x2 = min(x2, SIZE(v)); auto l = begin(v); advance(l, x1); auto r = l; advance(r, (x2-x1) + (x2 < SIZE(v))); for (auto e = l; e != r; e = next(e)) { if (!first) { res += ", "; } first = false; l_v_l_v_l++; if(e != l){ if(rnk > 1) { res += n_l; t_a_b_s = l_v_l_v_l; }; } else{ t_a_b_s = 0; } res += to_string(*e, coords...); l_v_l_v_l--; } res += "]"; if(l_v_l_v_l == 0) res += n_l; return res; } void dbgs(){;} template<typename Heads, typename... Tails> void dbgs(Heads H, Tails... T){ cout << to_string(H) << " | "; dbgs(T...); }
#define dbgm(...) cout << "[" << #__VA_ARGS__ << "]: "; dbgs(__VA_ARGS__); cout << endl;
#define n_l '\n'
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
string s;
cin>>s;
char ans[15];
int j = 0;
for(int i = 0;i<s.size;i++)
{
if(s[i] == '0' or s[i] == '1')
ans[j++] = s[i];
else
j = max(0,j - 1);
}
for(int i = 0;i<j;i++)
cout<<ans[i];
}
|
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 unsigned int]' (did you forget the '()' ?)
107 | for(int i = 0;i<s.size;i++)
| ~~^~~~
| ()
|
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<=cnt;i++)
{
cout<<a[i];
}
cout<<"\n";
}
|
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);
return 0;
}
|
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);
| ^
a.cc:22:3: error: expected unqualified-id before 'return'
22 | return 0;
| ^~~~~~
a.cc:23:1: error: expected declaration before '}' token
23 | }
| ^
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.