submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3 values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s515007027 | p03854 | C++ | #include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
int main() {
string s;
cin>>s;
vector<string>tdiv(4)={"dream","dreamer","erase","eraser"};
reverse(s.begin(),s.end());
rep(i,4){
reverse(tdiv[i].begin(),tdiv[i].end());
}
bool candiv=true;
rep(i,s.size()){
bool candiv2=false;
rep(j,4){
if(s.substr(i,tdiv[j].size())==tdiv[j]){
candiv2=true;
i+=tdiv[j].size();
}
}
if(candiv2==false){
candiv=false;
break;
}
}
if(candiv==true)
cout<<"Yes"<<endl;
else
cout<<"No"<<endl;
} | a.cc: In function 'int main()':
a.cc:11:24: error: expected ',' or ';' before '=' token
11 | vector<string>tdiv(4)={"dream","dreamer","erase","eraser"};
| ^
|
s793298111 | p03854 | C++ | #include <string>
#include <iostream>
#include <vector>
#include <type_traits>
#include <algorithm>s
using namespace std;
int main() {
string s;
cin >> s;
string divide[4] = { "dream", "dreamer", "erase", "eraser" };
reverse(s.begin(), s.end());
for (auto i = 0; i < 4; i++) reverse(divide[i].begin(), divide[i].end());
bool can = true;
for (int i = 0; i < s.size(); i++) {
bool can2 = false;
for (int j = 0; j < 4; j++) {
string d = divide[j];
if (s.substr(i, d.size()) == d) {
can2 = true;
i += d.size();
}
}
if (!can) {
can = false;
break;
}
}
if (can) cout << "YES" << endl;
else cout << "NO" << endl;
} | a.cc:5:10: fatal error: algorithm>: No such file or directory
5 | #include <algorithm>s
| ^~~~~~~~~~~~
compilation terminated.
|
s097315190 | p03854 | C++ | #include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main() {
string S;
cin >> S;
string divide[4] = {"dream", "dreamer", "erase", "eraser"};
reverse(S.begin(), S.end());
for(int i = 0; i <4; i++;) reverse(divide[i].begin(), divide[i].end());
bool can = true;
for(int i = 0; i < S.size()) {
bool can2 = false;
for (int j = 0; j< 4; j++) {
string d = divide[j];
if (S.substr(i, d.size()) == d) {
can2 = true;
i += d.size();
}
}
if (!can2) {
can = false;
break;
}
}
if (can) cout << "YES" << endl;
else cout << "NO" << endl;
}
| a.cc:5:11: error: extended character is not valid in an identifier
5 | int main() {
| ^
a.cc:5:11: error: expected initializer before '\U00003000'
5 | int main() {
| ^~
|
s204186922 | p03854 | C++ | #include <iostream>
#include <string>
#include <algorithm>
using namespace std;
string divide[4]={"dream","dreamer","erase","eraser"};
int main(){
string S;
cin>>S;
reverse(S.begin(),S.end());
for(int=0;i<4;i++) reverse(divide[i].begin(),divide[i].end());
bool can=1;
for(int i=0;i<S.size();){
bool can2=0;
for(int j=0;j<4;j++){
string d = divide[4];
if((S.substr(i,d.size()))==d){
can2=true;
i+=d.size();
}
}
if(!can2){
can=0;
break;
}
}
if(can)cout<<"YES"<<endl;
else cout<<"NO"<<endl;
} | a.cc: In function 'int main()':
a.cc:12:12: error: expected unqualified-id before '=' token
12 | for(int=0;i<4;i++) reverse(divide[i].begin(),divide[i].end());
| ^
a.cc:12:12: error: expected ';' before '=' token
12 | for(int=0;i<4;i++) reverse(divide[i].begin(),divide[i].end());
| ^
| ;
a.cc:12:12: error: expected primary-expression before '=' token
a.cc:12:15: error: 'i' was not declared in this scope
12 | for(int=0;i<4;i++) reverse(divide[i].begin(),divide[i].end());
| ^
a.cc:12:18: error: expected ')' before ';' token
12 | for(int=0;i<4;i++) reverse(divide[i].begin(),divide[i].end());
| ~ ^
| )
a.cc:12:19: error: 'i' was not declared in this scope
12 | for(int=0;i<4;i++) reverse(divide[i].begin(),divide[i].end());
| ^
|
s451595856 | p03854 | C++ | #include <iostream>
#include <string>
#include <algorithm>
using namespace std;
string divide[4]={"dream","dreamer","erase","eraser"}
int main(){
string S;
cin>>S;
reverse(S.begin(),S.end());
for(int=0;i<4;i++) reverse(divide[i].begin(),divide[i].end());
bool can=1;
for(int i=0;i<S.size();){
bool can2=0;
for(int j=0;j<4;j++){
string d = divide[4];
if((S.substr(i,d.size()))==d){
can2=true;
i+=d.size();
}
}
if(!can2){
can=0;
break;
}
}
if(can)cout<<"YES"<<endl;
else cout<<"NO"<<endl;
} | a.cc:8:1: error: expected ',' or ';' before 'int'
8 | int main(){
| ^~~
|
s968322672 | p03854 | C++ | #include <stdio#include <bits/stdc++.h>
using namespace std;
int main() {
string S;
cin >> S;
vector<string> devide = {"maerd", "remaerd", "esare", "resare"};
reverse(S.begin(), S.end());
int i = 0;
bool can = true;
while (i < S.size() && can == true) {
for (int j = 0; i < 4; j++) {
string d = devide.at(j);
if (S.substr(i, d.size()) == d) {
i += d.size();
break;
}
else {
can = false;
}
}
}
if (can) cout << "Yes" << endl;
else cout << "No" << endl;
}
| a.cc:1:10: fatal error: stdio#include <bits/stdc++.h: No such file or directory
1 | #include <stdio#include <bits/stdc++.h>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
|
s044004881 | p03854 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define in3(n, m, l) cin >> n >> m >> l
#define out(n) cout << n
const ll mei = (ll)1e9 + 7;
int main(){
ll a = 0;
string s;
in(s);
ll n;
while(s.size() > 4){
n = s.size();
if(s[n - 1] == 'm' && s[n - 2] == 'a' && s[n - 3] == 'e' && s[n - 4] == 'r' && s[n - 5] == 'd'){
rep(i, 5)
s.pop_back();
}
else if(s[n - 1] == 'e' && s[n - 2] == 's' && s[n - 3] == 'a' && s[n - 4] == 'r' && s[n - 5] == 'e'){
rep(i, 5)
s.pop_back();
}
else if(n >= 7 && s[n - 1] == 'r' && s[n - 2] == 'e' && s[n - 3] == 'm' && s[n - 4] == 'a' && s[n - 5] == 'e' && s[n - 6] == 'r' && s[s - 7] == 'd'){
rep(i, 7)
s.pop_back();
}
else if(n >= 6 && s[n - 1] == 'r' && s[n - 2] == 'e' && s[n - 3] == 's' && s[n - 4] == 'a' && s[n - 5] == 'r' && s[n - 6] == 'e'){
rep(i, 6)
s.pop_back();
}
else break;
if(s.size() == 0)
a = 1;
}
if(a == 1)
out("YES");
else
out("NO");
memi;
} | a.cc: In function 'int main()':
a.cc:32:141: error: no match for 'operator-' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'int')
32 | else if(n >= 7 && s[n - 1] == 'r' && s[n - 2] == 'e' && s[n - 3] == 'm' && s[n - 4] == 'a' && s[n - 5] == 'e' && s[n - 6] == 'r' && s[s - 7] == 'd'){
| ~ ^ ~
| | |
| | int
| std::string {aka std::__cxx11::basic_string<char>}
In file included from /usr/include/c++/14/bits/stl_algobase.h:67,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_iterator.h:618:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__y.base() - __x.base())) std::operator-(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
618 | operator-(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:618:5: note: template argument deduction/substitution failed:
a.cc:32:143: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
32 | else if(n >= 7 && s[n - 1] == 'r' && s[n - 2] == 'e' && s[n - 3] == 'm' && s[n - 4] == 'a' && s[n - 5] == 'e' && s[n - 6] == 'r' && s[s - 7] == 'd'){
| ^
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__x.base() - __y.base())) std::operator-(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1790 | operator-(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note: template argument deduction/substitution failed:
a.cc:32:143: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
32 | else if(n >= 7 && s[n - 1] == 'r' && s[n - 2] == 'e' && s[n - 3] == 'm' && s[n - 4] == 'a' && s[n - 5] == 'e' && s[n - 6] == 'r' && s[s - 7] == 'd'){
| ^
In file included from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/complex:370:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const complex<_Tp>&, const complex<_Tp>&)'
370 | operator-(const complex<_Tp>& __x, const complex<_Tp>& __y)
| ^~~~~~~~
/usr/include/c++/14/complex:370:5: note: template argument deduction/substitution failed:
a.cc:32:143: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::complex<_Tp>'
32 | else if(n >= 7 && s[n - 1] == 'r' && s[n - 2] == 'e' && s[n - 3] == 'm' && s[n - 4] == 'a' && s[n - 5] == 'e' && s[n - 6] == 'r' && s[s - 7] == 'd'){
| ^
/usr/include/c++/14/complex:379:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const complex<_Tp>&, const _Tp&)'
379 | operator-(const complex<_Tp>& __x, const _Tp& __y)
| ^~~~~~~~
/usr/include/c++/14/complex:379:5: note: template argument deduction/substitution failed:
a.cc:32:143: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::complex<_Tp>'
32 | else if(n >= 7 && s[n - 1] == 'r' && s[n - 2] == 'e' && s[n - 3] == 'm' && s[n - 4] == 'a' && s[n - 5] == 'e' && s[n - 6] == 'r' && s[s - 7] == 'd'){
| ^
/usr/include/c++/14/complex:388:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const _Tp&, const complex<_Tp>&)'
388 | operator-(const _Tp& __x, const complex<_Tp>& __y)
| ^~~~~~~~
/usr/include/c++/14/complex:388:5: note: template argument deduction/substitution failed:
a.cc:32:143: note: mismatched types 'const std::complex<_Tp>' and 'int'
32 | else if(n >= 7 && s[n - 1] == 'r' && s[n - 2] == 'e' && s[n - 3] == 'm' && s[n - 4] == 'a' && s[n - 5] == 'e' && s[n - 6] == 'r' && s[s - 7] == 'd'){
| ^
/usr/include/c++/14/complex:465:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const complex<_Tp>&)'
465 | operator-(const complex<_Tp>& __x)
| ^~~~~~~~
/usr/include/c++/14/complex:465:5: note: candidate expects 1 argument, 2 provided
In file included from /usr/include/c++/14/valarray:605,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166:
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const _Expr<_Dom2, typename _Dom2::value_type>&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed:
a.cc:32:143: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
32 | else if(n >= 7 && s[n - 1] == 'r' && s[n - 2] == 'e' && s[n - 3] == 'm' && s[n - 4] == 'a' && s[n - 5] == 'e' && s[n - 6] == 'r' && s[s - 7] == 'd'){
| ^
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed:
a.cc:32:143: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
32 | else if(n >= 7 && s[n - 1] == 'r' && s[n - 2] == 'e' && s[n - 3] == 'm' && s[n - 4] == 'a' && s[n - 5] == 'e' && s[n - 6] == 'r' && s[s - 7] == 'd'){
| ^
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const typename _Dom::value_type&, const _Expr<_Dom1, typename _Dom1::value_type>&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed:
a.cc:32:143: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int'
32 | else if(n >= 7 && s[n - 1] == 'r' && s[n - 2] == 'e' && s[n - 3] == 'm' && s[n - 4] == 'a' && s[n - 5] == 'e' && s[n - 6] == 'r' && s[s - 7] == 'd'){
| ^
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const valarray<typename _Dom::value_type>&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed:
a.cc:32:143: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
32 | else if(n >= 7 && s[n - 1] == 'r' && s[n - 2] == 'e' && s[n - 3] == 'm' && s[n - 4] == 'a' && s[n - 5] == 'e' && s[n - 6] == 'r' && s[s - 7] == 'd'){
| ^
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const valarray<typename _Dom::value_type |
s895256690 | p03854 | C++ | #include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include <functional>
#include<time.h>
#include <stack>
#include<iomanip>
using namespace std;
#define rep(i,a,n) for(int i=(a);i<(n);i++)
#define ll long long
#define llint long long int
#define sort(s) sort(s.begin(),s.end())
#define reverse(v) reverse(v.begin(), v.end());
#define Yes(ans) if(ans)cout<<"Yes"<<endl; else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl; else cout<<"NO"<<endl;
#define hei(a) vector<a>
#define whei(a) vector<vector<a>>
#define UF UnionFind
constexpr auto mod = 1000000007;
//辞書順はnext_permutation( begin( v ), end( v ) );やで!
//2のn乗を求めるよ!!!
int ni(int n) {
if (n == 0)return 1;
int x = ni(n / 2);
x *= x;
if (n % 2 == 1)x *= 2;
return x;
}
//フィボナッチ数列のx番目を求めるよ!
llint f(int x, vector<llint> &s) {
if (x == 0)return 0;
if (x == 1)return 1;
if (s[x] != 0)return s[x];
return s[x] = f(x - 1, s) + f(x - 2, s);
}
//aとbの最大公約数を求めるよ!
llint gcd(llint a, llint b) {
if (a < b)swap(a, b);
if (b == 0)return a;
return gcd(b, a % b);
}
// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
long long res = 1;
while (n > 0) {
if (n & 1) res = res * a % mod;
a = a * a % mod;
n >>= 1;
}
return res;
}
// mod. m での a の逆元 a^{-1} を計算するよ!
long long modinv(long long a, long long m) {
long long b = m, u = 1, v = 0;
while (b) {
long long t = a / b;
a -= t * b; swap(a, b);
u -= t * v; swap(u, v);
}
u %= m;
if (u < 0) u += m;
return u;
}
//aCbをmod.mで割った余りを求める
ll int c(ll int a, ll int b, ll int m) {
ll int ans = 1;
for (ll int i = 0; i < b; i++) {
ans *= a - i;
ans %= m;
}
for (ll int i = 1; i <= b; i++) {
ans *= modinv(i, m);
ans %= m;
}
return ans;
}
//m進数のn桁を全列挙やで
int dfs(int m, int n,llint k,hei(llint) a) {
stack<string> st;
st.push("");
while (!st.empty()) {
string now = st.top();
st.pop();
if (now.size() == n) {
llint ans = 0;
rep(i, 0, n) {
if (now[i] == '1')ans += a[i];
}
if (ans == k) {
cout << "Yes" << endl;
return 0;
}
}
else {
for (int i = m - 1; i >= 0; i--) {
string next = now + to_string(i);
st.push(next);
}
}
}
return 1;
}
void press(vector<int>& v) { v.erase(unique((v).begin(), (v).end()), v.end()); }
void press(vector<char>& v) { v.erase(unique((v).begin(), (v).end()), v.end()); }
llint min(llint a, llint b) {
if (a < b)return a;
return b;
}
llint max(llint a, llint b) {
if (a < b)swap(a, b);
return a;
}
llint p(int n) {
if(n==1)return 1;
return n * p(n - 1);
}
struct UnionFind {
vector<int> par; // par[i]:iの親の番号 (例) par[3] = 2 : 3の親が2
UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
for (int i = 0; i < N; i++) par[i] = i;
}
int size(int a) {
return par[root(a)];
}
int root(int x) { // データxが属する木の根を再帰で得る:root(x) = {xの木の根}
if (par[x] == x) return x;
return par[x] = root(par[x]);
}
void unite(int x, int y) { // xとyの木を併合
int rx = root(x); //xの根をrx
int ry = root(y); //yの根をry
if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時:xの根rxをyの根ryにつける
}
bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
int rx = root(x);
int ry = root(y);
return rx == ry;
}
};
int main(){
hei(string) t(4);
t[0] = "maerd";
t[1] = "remaerd";
t[2] = "esare";
t[3] = "resare";
string s;
cin >> s;
s=reverse(s);
rep(i, 0, 4) {
if (s == t[i]) {
s = "";
break;
}
if (s.find(t[i]) != 18446744073709551615) {
s = s.erase(s.find(t[i]), t[i].size());
i = 0;
}
}
YES(s=="")
return 0;
} | a.cc:184:37: warning: integer constant is so large that it is unsigned
184 | if (s.find(t[i]) != 18446744073709551615) {
| ^~~~~~~~~~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:21:47: error: no match for 'operator=' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'void')
21 | #define reverse(v) reverse(v.begin(), v.end());
| ^
a.cc:178:11: note: in expansion of macro 'reverse'
178 | s=reverse(s);
| ^~~~~~~
In file included from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:941:8: 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>::operator=(const _Tp&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
941 | operator=(const _Tp& __svt)
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:941:8: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/basic_string.h: In 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 = void; _Res = std::__cxx11::basic_string<char>&; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]':
/usr/include/c++/14/bits/basic_string.h:941:8: 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>::operator=(const _Tp&) [with _Tp = void]'
a.cc:178:4: required from here
21 | #define reverse(v) reverse(v.begin(), v.end());
| ^
/usr/include/c++/14/bits/basic_string.h:152:70: error: forming reference to void
152 | __not_<is_convertible<const _Tp&, const _CharT*>>>::value,
| ^~~~~
/usr/include/c++/14/bits/basic_string.h:817:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
817 | operator=(const basic_string& __str)
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:817:37: note: no known conversion for argument 1 from 'void' to 'const std::__cxx11::basic_string<char>&'
817 | operator=(const basic_string& __str)
| ~~~~~~~~~~~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:828:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const _CharT*) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
828 | operator=(const _CharT* __s)
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:828:31: note: no known conversion for argument 1 from 'void' to 'const char*'
828 | operator=(const _CharT* __s)
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/basic_string.h:840:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(_CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
840 | operator=(_CharT __c)
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:840:24: note: no known conversion for argument 1 from 'void' to 'char'
840 | operator=(_CharT __c)
| ~~~~~~~^~~
/usr/include/c++/14/bits/basic_string.h:858:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
858 | operator=(basic_string&& __str)
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:858:32: note: no known conversion for argument 1 from 'void' to 'std::__cxx11::basic_string<char>&&'
858 | operator=(basic_string&& __str)
| ~~~~~~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:926:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(std::initializer_list<_Tp>) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
926 | operator=(initializer_list<_CharT> __l)
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:926:42: note: no known conversion for argument 1 from 'void' to 'std::initializer_list<char>'
926 | operator=(initializer_list<_CharT> __l)
| ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
|
s596994900 | p03854 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
string S, T;
T = "";
cin >> S;
vector<string> vec = {"dream", "dreamer", "erase", "eraser"};
reverse(S.begin(), S.end());
for(int i = 0; i < 4; i++){
string s = vec.at(i);
reverse(s.begin(), s.end());
}
bool F = false;
for(int i = 0; i < S.size(); ){
bool f = false;
for(int j = 0; j < 4; j++){
string t = S.substr(i, vec.at(j).size());
if(t == vec.at(j)){
i += t.size();
f = true;
}
}
if(!f){
F = true;
break;
}
}
if(F){
cout << "NO" << enddl;
}else{
cout << "YES" << endl;
}
}
| a.cc: In function 'int main()':
a.cc:30:25: error: 'enddl' was not declared in this scope
30 | cout << "NO" << enddl;
| ^~~~~
|
s298117261 | p03854 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
string S, T;
T = "";
cin >> S;
vector<string> vec = {"dream", "dreamer", "erase", "eraser"};
reverse(S.begin(), S.end());
for(int i = 0; i < 4; i++){
string s = vec.at(i);
reverse(s.begin(), s.end());
}
bool F = false;
for(int i = 0; i < S.size(); ){
bool f = false;
for(int j = 0; j < 4; j++){
string t = S.substr(i, vec.at(j));
if(t == vec.at(j)){
i += t.size();
f = true;
}
}
if(!f){
F = true;
break;
}
}
if(F){
cout << "NO" << enddl;
}else{
cout << "YES" << endl;
}
} | a.cc: In function 'int main()':
a.cc:18:46: error: cannot convert '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'} to 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'}
18 | string t = S.substr(i, vec.at(j));
| ~~~~~~^~~
| |
| __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/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:3208:45: note: initializing argument 2 of 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::substr(size_type, size_type) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
3208 | substr(size_type __pos = 0, size_type __n = npos) const
| ~~~~~~~~~~^~~~~~~~~~
a.cc:30:25: error: 'enddl' was not declared in this scope
30 | cout << "NO" << enddl;
| ^~~~~
|
s099481950 | p03854 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
string s;
cin >> s;
reverse(s.begin(), s.end());
string divide[4] = {"dream", "dreamer", "erase", "eraser"};
for(int i = 0; i < 4; i++){
reverse((divide[i]).begin(), (divide[i]).end());
}
bool can = true;
for(int i = 0; i < s.size()){
bool can2 = false;
for(int j = 0; j < 4; j++){
if(s.substr(i, divide[j].size()) == divide[j]){
can2 = true;
i+=(divide[j]).size();
}
}
if(!can2){
can = false;
break;
}
}
if(can) cout << "YES" << endl;
else cout << "NO" << endl;
}
| a.cc: In function 'int main()':
a.cc:13:30: error: expected ';' before ')' token
13 | for(int i = 0; i < s.size()){
| ^
| ;
|
s931423717 | p03854 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
string s;
cin >> s;
reverse(s.begin(), s.end());
string divide[4] = {"dream", "dreamer", "erase", "eraser"};
for(int i = 0; i < 4; i++){
reverse((divide[i]).begin(), (divide[i]).end());
}
bool can = true;
for(int i = 0; i < s.size()){
bool can2 = false;
for(int j = 0; j < 4; j++){
if(s.substr(i, divide[j].size()) == divide[j]){
can2 = true;
i+=d.size();
}
}
if(!can2){
can = false;
break;
}
}
if(can) cout << "YES" << endl;
else cout << "NO" << endl;
}
| a.cc: In function 'int main()':
a.cc:13:30: error: expected ';' before ')' token
13 | for(int i = 0; i < s.size()){
| ^
| ;
a.cc:18:12: error: 'd' was not declared in this scope
18 | i+=d.size();
| ^
|
s937759326 | p03854 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
string s;
cin >> s;
reverse(s.begin(), s.end());
string divide = {"dream", "dreamer", "erase", "eraser"};
for(int i = 0; i < 4; i++){
reverse(divide[i].begin(), divide[i].end());
}
bool can = true;
for(int i = 0; i < s.size()){
bool can2 = false;
for(int j = 0; j < 4; j++){
if(s.substr(i, divide[j].size()) == divide[j]){
can2 = true;
i+=d.size();
}
}
if(!can2){
can = false;
break;
}
}
if(can) cout << "YES" << endl;
else cout << "NO" << endl;
} | a.cc: In function 'int main()':
a.cc:8:57: error: could not convert '{"dream", "dreamer", "erase", "eraser"}' from '<brace-enclosed initializer list>' to 'std::string' {aka 'std::__cxx11::basic_string<char>'}
8 | string divide = {"dream", "dreamer", "erase", "eraser"};
| ^
| |
| <brace-enclosed initializer list>
a.cc:10:23: error: request for member 'begin' in 'divide.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'}
10 | reverse(divide[i].begin(), divide[i].end());
| ^~~~~
a.cc:10:42: error: request for member 'end' in 'divide.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'}
10 | reverse(divide[i].begin(), divide[i].end());
| ^~~
a.cc:13:30: error: expected ';' before ')' token
13 | for(int i = 0; i < s.size()){
| ^
| ;
a.cc:16:32: error: request for member 'size' in 'divide.std::__cxx11::basic_string<char>::operator[](((std::__cxx11::basic_string<char>::size_type)j))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
16 | if(s.substr(i, divide[j].size()) == divide[j]){
| ^~~~
a.cc:18:12: error: 'd' was not declared in this scope
18 | i+=d.size();
| ^
|
s583923037 | p03854 | C++ | #include <iostream>
#include <string>
#include <vector>
using namespace std;
bool IsComposable(const vector<string>& keys, string &strings, int i) {
if (i == strings.length()) return true;
for (string key : keys) {
if (strings.substr(i, key.length()) == key) return IsComposable(keys, strings,i+ key.length());
}
return false;
}
int main() {
vector<string> keys = { "dream", "dreamer", "erase", "eraser" };
for (string & key : keys) reverse(key.begin(), key.end());
string S;
cin >> S;
reverse(S.begin(), S.end());
if (IsComposable(keys, S, 0)) cout << "YES" << endl;
else cout << "NO" << endl;
} | a.cc: In function 'int main()':
a.cc:16:35: error: 'reverse' was not declared in this scope
16 | for (string & key : keys) reverse(key.begin(), key.end());
| ^~~~~~~
a.cc:20:9: error: 'reverse' was not declared in this scope
20 | reverse(S.begin(), S.end());
| ^~~~~~~
|
s147834654 | p03854 | C++ | #include <iostream>
#include <string>
#include <algorithm>
using namespace std;
string divs[4] = {"dream", "dreamer", "erase", "eraser"};
int main() {
string S;
cin >> S;
reverse(S.begin(), S.end());
for (int i = 0; i < 4; ++i) reverse(divs[i].begin(), divs[i].end())
bool flag = true;
for (int i = 0; i < S.size();) {
bool flag2 = false;
for (int j = 0; j < 4; ++j) {
string d = divs[j];
if (S.substr(i, d.size()) == d) {
flag2 = true;
i += d.size();
}
}
if (!flag2) {
flag = false;
break;
}
}
if (flag) cout << "YES" << endl;
else cout << "NO" << endl;
}
| a.cc: In function 'int main()':
a.cc:13:70: error: expected ';' before 'bool'
13 | for (int i = 0; i < 4; ++i) reverse(divs[i].begin(), divs[i].end())
| ^
| ;
14 |
15 | bool flag = true;
| ~~~~
a.cc:26:7: error: 'flag' was not declared in this scope; did you mean 'flag2'?
26 | flag = false;
| ^~~~
| flag2
a.cc:30:7: error: 'flag' was not declared in this scope
30 | if (flag) cout << "YES" << endl;
| ^~~~
|
s467741664 | p03854 | C++ | #include <iostream>
#include <string>
#include <algorithm>
using namespace std;
string div[4] = {"dream", "dreamer", "erase", "eraser"};
int main() {
string S;
cin >> S;
reverse(S.begin(), S.end());
for (int i = 0; i < 4; ++i) reverse(div[i].begin(), div[i].end())
bool flag = true;
for (int i = 0; i < S.size();) {
bool flag2 = false;
for (int j = 0; j < 4; ++j) {
string d = div[j];
if (S.substr(i, d.size()) == d) {
flag2 = true;
i += d.size();
}
}
if (!flag2) {
flag = false;
break;
}
}
if (flag) cout << "YES" << endl;
else cout << "NO" << endl;
}
| a.cc:6:13: error: 'std::string div [4]' redeclared as different kind of entity
6 | string div[4] = {"dream", "dreamer", "erase", "eraser"};
| ^
In file included from /usr/include/c++/14/cstdlib:79,
from /usr/include/c++/14/ext/string_conversions.h:43,
from /usr/include/c++/14/bits/basic_string.h:4154,
from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/stdlib.h:992:14: note: previous declaration 'div_t div(int, int)'
992 | extern div_t div (int __numer, int __denom)
| ^~~
a.cc: In function 'int main()':
a.cc:13:42: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
13 | for (int i = 0; i < 4; ++i) reverse(div[i].begin(), div[i].end())
| ^
a.cc:13:58: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
13 | for (int i = 0; i < 4; ++i) reverse(div[i].begin(), div[i].end())
| ^
a.cc:19:21: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
19 | string d = div[j];
| ^
a.cc:26:7: error: 'flag' was not declared in this scope; did you mean 'flag2'?
26 | flag = false;
| ^~~~
| flag2
a.cc:30:7: error: 'flag' was not declared in this scope
30 | if (flag) cout << "YES" << endl;
| ^~~~
|
s789497691 | p03854 | C++ | #include <iostream>
#include <string>
#include <algorithm>
string div[4] = {"dream", "dreamer", "erase", "eraser"};
int main() {
string S;
cin >> S;
reverse(S.begin(), S.end());
for (int i = 0; i < 4; ++i) reverse(div[i].begin(), div[i].end())
bool flag = true;
for (int i = 0; i < S.size();) {
bool flag2 = false;
for (int j = 0; j < 4; ++j) {
string d = div[j];
if (S.substr(i, d.size()) == d) {
flag2 = true;
i += d.size();
}
}
if (!flag2) {
flag = false;
break;
}
}
if (flag) cout << "YES" << endl;
else cout << "NO" << endl;
}
| a.cc:5:1: error: 'string' does not name a type; did you mean 'stdin'?
5 | string div[4] = {"dream", "dreamer", "erase", "eraser"};
| ^~~~~~
| stdin
a.cc: In function 'int main()':
a.cc:8:3: error: 'string' was not declared in this scope
8 | string S;
| ^~~~~~
a.cc:8: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:9:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
9 | 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:9:10: error: 'S' was not declared in this scope
9 | cin >> S;
| ^
a.cc:11:3: error: 'reverse' was not declared in this scope; did you mean 'std::reverse'?
11 | reverse(S.begin(), S.end());
| ^~~~~~~
| std::reverse
In file included from /usr/include/c++/14/algorithm:86,
from a.cc:3:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note: 'std::reverse' declared here
249 | reverse(_ExecutionPolicy&& __exec, _BidirectionalIterator __first, _BidirectionalIterator __last);
| ^~~~~~~
a.cc:12:44: warning: pointer to a function used in arithmetic [-Wpointer-arith]
12 | for (int i = 0; i < 4; ++i) reverse(div[i].begin(), div[i].end())
| ^
a.cc:12:46: error: request for member 'begin' in '*(div + ((sizetype)i))', which is of non-class type 'div_t(int, int) noexcept'
12 | for (int i = 0; i < 4; ++i) reverse(div[i].begin(), div[i].end())
| ^~~~~
a.cc:12:60: warning: pointer to a function used in arithmetic [-Wpointer-arith]
12 | for (int i = 0; i < 4; ++i) reverse(div[i].begin(), div[i].end())
| ^
a.cc:12:62: error: request for member 'end' in '*(div + ((sizetype)i))', which is of non-class type 'div_t(int, int) noexcept'
12 | for (int i = 0; i < 4; ++i) reverse(div[i].begin(), div[i].end())
| ^~~
a.cc:18:13: error: expected ';' before 'd'
18 | string d = div[j];
| ^~
| ;
a.cc:19:23: error: 'd' was not declared in this scope
19 | if (S.substr(i, d.size()) == d) {
| ^
a.cc:25:7: error: 'flag' was not declared in this scope; did you mean 'flag2'?
25 | flag = false;
| ^~~~
| flag2
a.cc:29:7: error: 'flag' was not declared in this scope
29 | if (flag) cout << "YES" << endl;
| ^~~~
a.cc:29:13: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
29 | if (flag) cout << "YES" << endl;
| ^~~~
| std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
a.cc:29:30: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
29 | if (flag) cout << "YES" << endl;
| ^~~~
| std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
a.cc:30:8: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
30 | else cout << "NO" << endl;
| ^~~~
| std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
a.cc:30:24: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
30 | else cout << "NO" << endl;
| ^~~~
| std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
|
s287948276 | p03854 | C++ | #include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
string divide[4] = {"dream","dreamer","erase", "eraser"};
int main(){
string s;
cin >> s;
reverse(s.begin(),s.end());
rep(i,4) reverse(divide[i].begin(),divide.end());
bool can = true;
for(int i = 0; i < s.size();){
bool can2 = false;
rep(j,4){
if(divide[j] == s.substr(i,divide[j].size())){
can2 = true;
i += divide[j].size;
}
if(!can2){
can = false;
break;
}
}
}
if(can) cout << "YES" << endl;
else cout << "NO" << endl;
}
| a.cc: In function 'int main()':
a.cc:14:51: error: request for member 'end' in 'divide', which is of non-class type 'std::string [4]' {aka 'std::__cxx11::basic_string<char> [4]'}
14 | rep(i,4) reverse(divide[i].begin(),divide.end());
| ^~~
a.cc:25:30: 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 '()' ?)
25 | i += divide[j].size;
| ~~~~~~~~~~^~~~
| ()
|
s720342063 | p03854 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
string s;
cin >> s;
reverse(s.begin(), s.end());
string divide[4] = {"dream", "dreamer", "erase", "eraser"};
for(int i = 0; i < 4;i++){
reverse((divide[i]).begin(), (divide[i]).end());
}
bool can = true;
for(int i = 0; i < s.size(), i++){
bool can2 = false;
for(int j = 0; j < 4; j++){
string d = divide[j];
if(s.substr(i, d.size()) == d){
can2 = true;
i += d.size();
}
}
if(!can2){
can = false;
break;
}
}
if(can) cout << "YES" << endl;
else cout << "NO" << endl;
}
| a.cc: In function 'int main()':
a.cc:13:35: error: expected ';' before ')' token
13 | for(int i = 0; i < s.size(), i++){
| ^
| ;
|
s356777077 | p03854 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
string s;
cin >> s;
reverse(s.begin(), s.end());
string divide[4] = {"dream", "dreamer", "erase", "eraser"};
for(int i = 0; i < 4;i++){
reverse((divide[i]).begin(), (divide[i]).end());
}
bool can = true;
for(int i = 0; i < s.size()){
bool can2 = false;
for(int j = 0; j < 4; j++){
string d = divide[j];
if(s.substr(i, d.size()) == d){
can2 = true;
i += d.size();
}
}
if(!can2){
can = false;
break;
}
}
if(can) cout << "YES" << endl;
else cout << "NO" << endl;
}
| a.cc: In function 'int main()':
a.cc:13:30: error: expected ';' before ')' token
13 | for(int i = 0; i < s.size()){
| ^
| ;
|
s853664758 | p03854 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
string s;
cin >> s;
reverse(s.begin(), s.end());
string divide[4] = {"dream", "dreamer", "erase", "eraser"};
for(int i = 0; i < 4;i++){
reverse((divide.at(i)).begin(), (divide.at(i)).end());
}
bool can = true;
for(int i = 0; i < s.size()){
bool can2 = false;
for(int j = 0; j < 4; j++){
string d = divide.at(j);
if(s.substr(i, d.size()) == d){
can2 = true;
i += d.size();
}
}
if(!can2){
can = false;
break;
}
}
if(can) cout << "YES" << endl;
else cout << "NO" << endl;
}
| a.cc: In function 'int main()':
a.cc:10:21: error: request for member 'at' in 'divide', which is of non-class type 'std::string [4]' {aka 'std::__cxx11::basic_string<char> [4]'}
10 | reverse((divide.at(i)).begin(), (divide.at(i)).end());
| ^~
a.cc:10:45: error: request for member 'at' in 'divide', which is of non-class type 'std::string [4]' {aka 'std::__cxx11::basic_string<char> [4]'}
10 | reverse((divide.at(i)).begin(), (divide.at(i)).end());
| ^~
a.cc:13:30: error: expected ';' before ')' token
13 | for(int i = 0; i < s.size()){
| ^
| ;
a.cc:16:25: error: request for member 'at' in 'divide', which is of non-class type 'std::string [4]' {aka 'std::__cxx11::basic_string<char> [4]'}
16 | string d = divide.at(j);
| ^~
|
s764406606 | p03854 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
string s;
cin >> s;
reverse(s.begin(), s.end());
string divide(4) = {"dream", "dreamer", "erase", "eraser"};
for(int i = 0; i < 4;i++){
reverse((divide.at(i)).begin(), (divide.at(i)).end());
}
bool can = true;
for(int i = 0; i < s.size()){
bool can2 = false;
for(int j = 0; j < 4; j++){
string d = divide.at(j);
if(s.substr(i, d.size()) == d){
can2 = true;
i += d.size();
}
}
if(!can2){
can = false;
break;
}
}
if(can) cout << "YES" << endl;
else cout << "NO" << endl;
}
| a.cc: In function 'int main()':
a.cc:8:18: error: no matching function for call to 'std::__cxx11::basic_string<char>::basic_string(int)'
8 | string divide(4) = {"dream", "dreamer", "erase", "eraser"};
| ^
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:8:17: note: cannot convert '4' (type 'int') to type 'const char*'
8 | string divide(4) = {"dream", "dreamer", "erase", "eraser"};
| ^
/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_string.h:527:7: note: candidate: 'std |
s538558923 | p03854 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
string s;
cin >> s;
reverse(s.begin(), s.end());
string divide = {"dream", "dreamer", "erase", "eraser"};
for(int i = 0; i < 4;i++){
reverse((divide.at(i)).begin(), (divide.at(i)).end());
}
bool can = true;
for(int i = 0; i < s.size()){
bool can2 = false;
for(int j = 0; j < 4; j++){
string d = divide.at(j);
if(s.substr(i, d.size()) == d){
can2 = true;
i += d.size();
}
}
if(!can2){
can = false;
break;
}
}
if(can) cout << "YES" << endl;
else cout << "NO" << endl;
}
| a.cc: In function 'int main()':
a.cc:8:57: error: could not convert '{"dream", "dreamer", "erase", "eraser"}' from '<brace-enclosed initializer list>' to 'std::string' {aka 'std::__cxx11::basic_string<char>'}
8 | string divide = {"dream", "dreamer", "erase", "eraser"};
| ^
| |
| <brace-enclosed initializer list>
a.cc:10:28: error: request for member 'begin' in 'divide.std::__cxx11::basic_string<char>::at(((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'}
10 | reverse((divide.at(i)).begin(), (divide.at(i)).end());
| ^~~~~
a.cc:10:52: error: request for member 'end' in 'divide.std::__cxx11::basic_string<char>::at(((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'}
10 | reverse((divide.at(i)).begin(), (divide.at(i)).end());
| ^~~
a.cc:13:30: error: expected ';' before ')' token
13 | for(int i = 0; i < s.size()){
| ^
| ;
a.cc:16:27: error: conversion from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
16 | string d = divide.at(j);
| ~~~~~~~~~^~~
|
s187510229 | p03854 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
string s;
cin >> s;
reverse(s.begin(), s.end());
string divide = {"dream", "dreamer", "erase", "eraser"};
for(int i = 0; i < 4;i++){
reverse(divide.at(i).begin(), divide.at(i).end());
}
bool can = true;
for(int i = 0; i < s.size()){
bool can2 = false;
for(int j = 0; j < 4; j++){
string d = divide.at(j);
if(s.substr(i, d.size()) == d){
can2 = true;
i += d.size();
}
}
if(!can2){
can = false;
break;
}
}
if(can) cout << "YES" << endl;
else cout << "NO" << endl;
}
| a.cc: In function 'int main()':
a.cc:8:57: error: could not convert '{"dream", "dreamer", "erase", "eraser"}' from '<brace-enclosed initializer list>' to 'std::string' {aka 'std::__cxx11::basic_string<char>'}
8 | string divide = {"dream", "dreamer", "erase", "eraser"};
| ^
| |
| <brace-enclosed initializer list>
a.cc:10:26: error: request for member 'begin' in 'divide.std::__cxx11::basic_string<char>::at(((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'}
10 | reverse(divide.at(i).begin(), divide.at(i).end());
| ^~~~~
a.cc:10:48: error: request for member 'end' in 'divide.std::__cxx11::basic_string<char>::at(((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'}
10 | reverse(divide.at(i).begin(), divide.at(i).end());
| ^~~
a.cc:13:30: error: expected ';' before ')' token
13 | for(int i = 0; i < s.size()){
| ^
| ;
a.cc:16:27: error: conversion from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
16 | string d = divide.at(j);
| ~~~~~~~~~^~~
|
s867897056 | p03854 | Java | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
new Main();
}
public Main() {
try (Scanner sc = new Scanner(System.in)) {
String S = sc.next();
String rev = "";
for (int i = S.length() - 1;i >= 0;-- i) {
rev += S.charAt(i);
switch(rev) {
case "maerd":
case "remaerd":
case "esare":
case "resare":
rev = "";
}
System.out.println(rev.isEmpty() ? "YES" : "NO");
}
}
} | Main.java:22: error: reached end of file while parsing
}
^
1 error
|
s393832006 | p03854 | C++ | #include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
int main() {
string s;
cin>>s;
string devide[4]={"dream","dreamer","erase","eraser"};
reverse(s.begin(),s.end());
for(int i=0;i<4;i++) reverse(devide[i].begin(),devide[i].end());
bool can=true;
for(int i=0;i<s.size();){
bool can2=false;
for(int j=0;j<4;j++){
string d=devide[j];
if(s.substr(i,d.size())==d){
can2=true;
i+=d.size()
}
}
if(!can2){
can=false;
break;
}
}
if(can)cout<<"YES"<<endl;
else cout<<"NO"<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:19:20: error: expected ';' before '}' token
19 | i+=d.size()
| ^
| ;
20 | }
| ~
|
s287162612 | p03854 | C++ | #include<bits/stdc++.h>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO" ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
int main(){
string s;
cin>>s;
bool ans=true;
for(int i=sz(s)-1;i>=0;i--){
if(i-4>=0){
if(s[i]=='m'&&s[i-1]=='a'&&s[i-2]=='e'&&s[i-3]=='r'&&s[i-4]=='d'){
i-=4;
continue;
}
else if(s[i]=='e'&&s[i-1]=='s'&&s[i-2]=='a'&&s[i-3]=='r'&&s[i-4]=='e'){
i-=4;
continue;
}
}
if(i-6>=0){
if(s[i]=='r'&&s[i-1]=='e'&&s[i-2]=='m'&&s[i-3]=='a'&&s[i-4]=='e'&&s[i-5]=='r'&&s[i-6]=='d'){
i-=6;
continue;
}
}
if(i-5>=0){
else if(s[i]=='r'&&s[i-1]=='e'&&s[i-2]=='s'&&s[i-3]=='a'&&s[i-4]=='r'&&s[i-5]=='e'){
i-=5;
continue;
}
}
ans=false;
break;
}
YES(ans);
}
| a.cc: In function 'int main()':
a.cc:58:7: error: expected '}' before 'else'
58 | else if(s[i]=='r'&&s[i-1]=='e'&&s[i-2]=='s'&&s[i-3]=='a'&&s[i-4]=='r'&&s[i-5]=='e'){
| ^~~~
a.cc:57:15: note: to match this '{'
57 | if(i-5>=0){
| ^
a.cc:65:5: error: break statement not within loop or switch
65 | break;
| ^~~~~
a.cc: At global scope:
a.cc:20:16: error: 'cout' does not name a type
20 | #define YES(n) cout << ((n) ? "YES" : "NO" ) << endl
| ^~~~
a.cc:67:3: note: in expansion of macro 'YES'
67 | YES(ans);
| ^~~
a.cc:68:1: error: expected declaration before '}' token
68 | }
| ^
|
s354949732 | p03854 | C++ | #include<bits/stdc++.h>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO" ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
int main(){
string s;
cin>>s;
bool ans=true;
for(int i=sz(s)-1;i>=0;i--){
if(i-4>=0){
if(s[i]=='m'&&s[i-1]=='a'&&s[i-2]=='e'&&s[i-3]=='r'&&s[i-4]=='d'){
i-=4;
continue;
}
else if(s[i]=='e'&&s[i-1]=='s'&&s[i-2]=='a'&&s[i-3]=='r'&&s[i-4]=='e'){
i-=4;
continue;
}
}
if(i-6>=0){
if(s[i]=='r'&&s[i-1]=='e'&&s[i-2]=='m'&&s[i-3]=='a'&&s[i-4]=='e'&&s[i-5]=='r'&&s[i-6]=='d'){
i-=6;
continue;
}
}
if(i-5>=0){
else if(s[i]=='r'&&s[i-1]=='e'&&s[i-2]=='s'&&s[i-3]=='a'&&s[i-4]=='r'&&s[i-5]=='e'){
i-=5;
continue;
}
}
}
ans=false;
break;
}
YES(ans);
}
| a.cc: In function 'int main()':
a.cc:58:7: error: expected '}' before 'else'
58 | else if(s[i]=='r'&&s[i-1]=='e'&&s[i-2]=='s'&&s[i-3]=='a'&&s[i-4]=='r'&&s[i-5]=='e'){
| ^~~~
a.cc:57:15: note: to match this '{'
57 | if(i-5>=0){
| ^
a.cc: At global scope:
a.cc:64:5: error: 'ans' does not name a type
64 | ans=false;
| ^~~
a.cc:65:5: error: expected unqualified-id before 'break'
65 | break;
| ^~~~~
a.cc:66:3: error: expected declaration before '}' token
66 | }
| ^
a.cc:20:16: error: 'cout' does not name a type
20 | #define YES(n) cout << ((n) ? "YES" : "NO" ) << endl
| ^~~~
a.cc:67:3: note: in expansion of macro 'YES'
67 | YES(ans);
| ^~~
a.cc:68:1: error: expected declaration before '}' token
68 | }
| ^
|
s121882740 | p03854 | C++ | #include <iostream>
#include <string>
using namespace std;
string divide[4] = {"dream", "dreamer", "erase", "eraser"};
int main (void) {
string s;
cin >> s;
reverse (s.begin(), s.end());
for (int i=0; i<4; i++) reverse(divide[i].begin(), divide[i].end());
bool end_flag = false;
bool f;
int i = 0;
while (!end_flag) {
f = false;
for (int j=0; j<4; j++) {
if (s.substr(i, divide[j].size()) == divide[j]) {
i += divide[j].size();
f = true;
break;
}
}
if (!f || i == s.size()) end_flag = true;
}
if (f) cout << "YES" << endl;
else cout << "NO" << endl;
} | a.cc: In function 'int main()':
a.cc:11:3: error: 'reverse' was not declared in this scope
11 | reverse (s.begin(), s.end());
| ^~~~~~~
|
s182213910 | p03854 | C++ | #include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int(i)=0;i<(n);i++)
int main(){
string s,t[4]={"dream","dreamer","erase","eraser"};cin>>s;
while(s.size()){
bool f=0;
REP(i,4) if(!(s.find(t[i]))){
string ss=s.substr(t[i].size());
if(!ss.size()) f=1;
else REP(k,4) if(!(ss.find(t[k]))) f=1;
if(f){
s=ss;
break;
}
}
if(!f) break;
}
cout<<(f?"YES":"NO");
} | a.cc: In function 'int main()':
a.cc:22:10: error: 'f' was not declared in this scope
22 | cout<<(f?"YES":"NO");
| ^
|
s434186232 | p03854 | C++ | #include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
string divide[4] = {"dream","dreamer","erase","eraser"};
string S;
cin >> S;
reverse(S.begin(),S.end());
for(int i=0; i < 4; ++i) reverse(devide[i].begin(), devide[i].end());
bool can = true;
for(int i=0; i < S.size();){
bool can2 = false;
for(int j = 0; j < 4; ++j){
string d = devide[j];
if(S.substr(i, d.size()) == d){
can2 = true;
i += d.size();
}
}
if(!can2){
can = false;
break;
}
}
if(can) cout << "YES" << "\n";
else cout << "NO" << "\n";
} | a.cc: In function 'int main()':
a.cc:15:38: error: 'devide' was not declared in this scope; did you mean 'divide'?
15 | for(int i=0; i < 4; ++i) reverse(devide[i].begin(), devide[i].end());
| ^~~~~~
| divide
a.cc:21:28: error: 'devide' was not declared in this scope; did you mean 'divide'?
21 | string d = devide[j];
| ^~~~~~
| divide
|
s691791411 | p03854 | C++ | #include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
string divide[4] = {"dream","dreamer","erase","eraser"};
string S;
cin >> S;
reverse(S.begin(),S.end());
rep(i,4) reverse(devide[i].begin(), devide[i].end());
bool can = true;
for(int i=0; i < S.size();){
bool can2 = false;
for(int j = 0; j < 4; ++j){
string d = devide[j];
if(S.substr(i, d.size()) == d){
can2 = true;
i += d.size();
}
}
if(!can2){
can = false;
break;
}
}
if(can) cout << "YES" << "\n";
else cout << "NO" << "\n";
} | a.cc: In function 'int main()':
a.cc:15:9: error: 'i' was not declared in this scope
15 | rep(i,4) reverse(devide[i].begin(), devide[i].end());
| ^
a.cc:15:5: error: 'rep' was not declared in this scope
15 | rep(i,4) reverse(devide[i].begin(), devide[i].end());
| ^~~
a.cc:21:28: error: 'devide' was not declared in this scope; did you mean 'divide'?
21 | string d = devide[j];
| ^~~~~~
| divide
|
s352846467 | p03854 | C++ | #include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
string divide[4] = ["dream","dreamer","erase","eraser"];
string S;
cin >> S;
reverse(S.begin(),S.end());
rep(i,4) reverse(devide[i].begin(), devide[i].end());
bool can = true;
for(int i=0; i < S.size();){
bool can2 = false;
for(int j = 0; j < 4; ++j){
string d = devide[j];
if(S.substr(i, d.size()) == d){
can2 = true;
i += d.size();
}
}
if(!can2){
can = false;
break;
}
}
if(can) cout << "YES" << "\n";
else cout << "NO" << "\n";
} | a.cc: In function 'int main()':
a.cc:10:29: error: expected identifier before string constant
10 | string divide[4] = ["dream","dreamer","erase","eraser"];
| ^~~~~~~
a.cc:10:36: error: expected ']' before ',' token
10 | string divide[4] = ["dream","dreamer","erase","eraser"];
| ^
| ]
a.cc: In lambda function:
a.cc:10:36: error: expected '{' before ',' token
a.cc: In function 'int main()':
a.cc:10:28: error: array must be initialized with a brace-enclosed initializer
10 | string divide[4] = ["dream","dreamer","erase","eraser"];
| ^~~~~~~~
a.cc:10:37: error: expected unqualified-id before string constant
10 | string divide[4] = ["dream","dreamer","erase","eraser"];
| ^~~~~~~~~
a.cc:15:9: error: 'i' was not declared in this scope
15 | rep(i,4) reverse(devide[i].begin(), devide[i].end());
| ^
a.cc:15:5: error: 'rep' was not declared in this scope
15 | rep(i,4) reverse(devide[i].begin(), devide[i].end());
| ^~~
a.cc:21:28: error: 'devide' was not declared in this scope; did you mean 'divide'?
21 | string d = devide[j];
| ^~~~~~
| divide
|
s122037061 | p03854 | C++ | #include <bits/stdc++.h>
using namespace std;
string div[4] = {"dream","dreamer","erase","eraser"};
int main() {
string s;
cin>>s;
reverse(s.begin(),s.end());
for(int i=0; i<4; i++) reverse(div[i].begin(),div[i].end());
bool j1 = true;
for(int i=0; i<s.size();){
bool j2 = false;
for(int j=0; j<4; j++){
string t = div[j];
if(s.substr(i,t.size()) == t){
j2 = true;
i += t.size();
}
}
if(!j2){
j1 = false;
break;
}
}
if(j1) cout << "YES" << endl;
else cout << "NO" << endl;
} | a.cc:4:13: error: 'std::string div [4]' redeclared as different kind of entity
4 | string div[4] = {"dream","dreamer","erase","eraser"};
| ^
In file included from /usr/include/c++/14/cstdlib:79,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:42,
from a.cc:1:
/usr/include/stdlib.h:992:14: note: previous declaration 'div_t div(int, int)'
992 | extern div_t div (int __numer, int __denom)
| ^~~
a.cc: In function 'int main()':
a.cc:10:37: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
10 | for(int i=0; i<4; i++) reverse(div[i].begin(),div[i].end());
| ^
a.cc:10:52: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
10 | for(int i=0; i<4; i++) reverse(div[i].begin(),div[i].end());
| ^
a.cc:16:21: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
16 | string t = div[j];
| ^
|
s927843673 | p03854 | C |
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s=sc.next();
String[] t = {"eraser","erase","dreamer","dream"};
for(int i=0;i<4;i++)s=s.replace(t[i],"");
System.out.println(s.equals("")?"YES":"NO");
}
}
| main.c:2:1: error: unknown type name 'import'
2 | import java.util.*;
| ^~~~~~
main.c:2:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
2 | import java.util.*;
| ^
main.c:4:1: error: unknown type name 'public'
4 | public class Main {
| ^~~~~~
main.c:4:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Main'
4 | public class Main {
| ^~~~
|
s963538602 | p03854 | C++ | using namespace std;
int main(){
string S,T;
int pos = 0;
cin >> S;
while (pos <= S.length()) {
if (S.compare(pos, pos+7, "dreamer") == 0) {
pos = pos+7;
if (S.compare(pos, pos+4, "aser") == 0) {
pos = pos-2;
} else
if (S.compare(pos, pos+3, "ase") == 0) {
pos = pos-2;
}
} else
if (S.compare(pos, pos+5, "dream") == 0) {
pos = pos+5;
} else
if (S.compare(pos, pos+6, "eraser") == 0) {
pos = pos+6;
if (S.compare(pos, pos+4, "aser") == 0) {
pos = pos-2;
} else
if (S.compare(pos, pos+3, "ase") == 0) {
pos = pos-2;
}
} else
if (S.compare(pos, pos+5, "erase") == 0) {
pos = pos+5;
if (S.compare(pos, pos+5, "raser") == 0) {
pos = pos-1;
} else
if (S.compare(pos, pos+4, "rase") == 0) {
pos = pos-1;
}
} else {
break;
}
if (pos == S.length()) {
cout << "YES";
return 0;
}
cout << pos << " ";
}
cout << "NO";
return 0;
} | a.cc: In function 'int main()':
a.cc:3:3: error: 'string' was not declared in this scope
3 | string S,T;
| ^~~~~~
a.cc:1:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
+++ |+#include <string>
1 | using namespace std;
a.cc:5:3: error: 'cin' was not declared in this scope
5 | cin >> S;
| ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
+++ |+#include <iostream>
1 | using namespace std;
a.cc:5:10: error: 'S' was not declared in this scope
5 | cin >> S;
| ^
a.cc:40:7: error: 'cout' was not declared in this scope
40 | cout << "YES";
| ^~~~
a.cc:40:7: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:43:5: error: 'cout' was not declared in this scope
43 | cout << pos << " ";
| ^~~~
a.cc:43:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:45:3: error: 'cout' was not declared in this scope
45 | cout << "NO";
| ^~~~
a.cc:45:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
|
s326578247 | p03854 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
/*Sを反転させ、前から順に見ていって,dream,dreamer,erase,eraserのいずれかを反転させ
たもので、切れるかどうかを判定最後まで切れたらok
*/
//単純に前から切るとdreamで切るかdreamerで切るべきかわからない
int main(){
string S;
cin >> S
vector<string> d = {"dream","dreamer","erase","eraser"};
rep(i,4){
reverse(d[i].begin(),d[i].end());
}
reverse(S.begin(),S.end());
bool flag1 = true;
for(int i = 0;i<S.size();){
bool flag2 = false;//分割できるかどうか
for(int j= 0;j<4;j++){
if(S.substr(i,d[j].size()) == d[j]){
i += d[j].size();
flag2 = true;
}
}
if(flag2 == false){//切れない時はflag1をfalseにしてループを終える
flag1 = false;
break;
}
}
if(flag1) cout << "YES" <<endl;
else cout << "NO" <<endl;
} | a.cc: In function 'int main()':
a.cc:11:11: error: expected ';' before 'vector'
11 | cin >> S
| ^
| ;
12 | vector<string> d = {"dream","dreamer","erase","eraser"};
| ~~~~~~
a.cc:14:13: error: 'd' was not declared in this scope
14 | reverse(d[i].begin(),d[i].end());
| ^
a.cc:22:21: error: 'd' was not declared in this scope
22 | if(S.substr(i,d[j].size()) == d[j]){
| ^
|
s608595578 | p03854 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
/*Sを反転させ、前から順に見ていって,dream,dreamer,erase,eraserのいずれかを反転させ
たもので、切れるかどうかを判定最後まで切れたらok
*/
//単純に前から切るとdreamで切るかdreamerで切るべきかわからない
int main(){
string S;
cin >> S
vector<string> d = {"dream","dreamer","erase","eraser"};
rep(i,4){
reverse(d[i].begin(),d[i].end());
}
reverse(S.begin(),S.end());
bool flag1 = true;
for(int i = 0;i<S.size();){
bool flag2 = false;//分割できるかどうか
for(int j= 0;j<4;j++){
if(S.substr(i,d[j].size()) == d[j]){
i += d[j].size();
flag2 = true;
break;
}
}
if(flag2 == false){//切れない時はflag1をfalseにしてループを終える
flag1 = false;
break;
}
}
if(flag1) cout << "YES" <<endl;
else cout << "NO" <<endl;
} | a.cc: In function 'int main()':
a.cc:11:11: error: expected ';' before 'vector'
11 | cin >> S
| ^
| ;
12 | vector<string> d = {"dream","dreamer","erase","eraser"};
| ~~~~~~
a.cc:14:13: error: 'd' was not declared in this scope
14 | reverse(d[i].begin(),d[i].end());
| ^
a.cc:22:21: error: 'd' was not declared in this scope
22 | if(S.substr(i,d[j].size()) == d[j]){
| ^
|
s179587864 | p03854 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
/*Sを反転させ、前から順に見ていって,dream,dreamer,erase,eraserのいずれかを反転させ
たもので、切れるかどうかを判定最後まで切れたらok
*/
//単純に前から切るとdreamで切るかdreamerで切るべきかわからない
int main(){
string S;
vector<string> d(4) = {"dream","dreamer","erase","eraser"};
rep(i,4){
reverse(d[i].begin(),d[i].end());
}
reverse(S.begin(),S.end());
bool flag1 = true;
for(int i = 0;i<S.size();){
bool flag2 = false;//分割できるかどうか
for(int j= 0;j<4;j++){
if(S.substr(i,d[j].size()) == d[j]){
i += d[j].size();
flag2 = true;
break;
}
}
if(flag2 == false){//切れない時はflag1をfalseにしてループを終える
flag1 = false;
break;
}
}
if(flag1) cout << "YES" <<endl;
else cout << "NO" <<endl;
} | a.cc: In function 'int main()':
a.cc:11:23: error: expected ',' or ';' before '=' token
11 | vector<string> d(4) = {"dream","dreamer","erase","eraser"};
| ^
|
s537078378 | p03854 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
/*Sを反転させ、前から順に見ていって,dream,dreamer,erase,eraserのいずれかを反転させ
たもので、切れるかどうかを判定最後まで切れたらok
*/
//単純に前から切るとdreamで切るかdreamerで切るべきかわからない
int main(){
string S;
vector<string> d(4) = {"dream","dreamer","erase","eraser"};
rep(i,4){
reverse(d[i].begin(),d[i].end());
}
reverse(S.begin(),S.end());
bool flag1 = true;
for(int i = 0;i<S.size();i++){
bool flag2 = false;//分割できるかどうか
for(int j= 0;j<4;j++){
if(S.substr(i,d[j].size()) == d[j]){
i += d[j].size();
flag2 = true;
break;
}
}
if(flag2 == false){//切れない時はflag1をfalseにしてループを終える
flag1 = false;
break;
}
}
if(flag1) cout << "YES" <<endl;
else cout << "NO" <<endl;
} | a.cc: In function 'int main()':
a.cc:11:23: error: expected ',' or ';' before '=' token
11 | vector<string> d(4) = {"dream","dreamer","erase","eraser"};
| ^
|
s718112434 | p03854 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
string S;
cin >> S;
vector<string> div = {"dream","dreamer","erase","eraser"};
reverse(S.begin(),S.end());
for (x:div){
reverse(x.begin(),x.end());
}
bool = can;
for (int i = 0; i < S.size();){
bool can2 = false;
can = false;
for (x: div){
if(S.substr(i,x.size()) == x){
can2 = true;
i+=x.size();
}
}
if(!can2)break;
can = true;
}
if(can) cout << "YES" << endl;
else cout << "NO" << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:9:9: error: found ':' in nested-name-specifier, expected '::'
9 | for (x:div){
| ^
| ::
a.cc:9:8: error: 'x' has not been declared
9 | for (x:div){
| ^
a.cc:12:8: error: expected unqualified-id before '=' token
12 | bool = can;
| ^
a.cc:13:3: error: expected primary-expression before 'for'
13 | for (int i = 0; i < S.size();){
| ^~~
a.cc:12:14: error: expected ')' before 'for'
12 | bool = can;
| ^
| )
13 | for (int i = 0; i < S.size();){
| ~~~
a.cc:9:7: note: to match this '('
9 | for (x:div){
| ^
a.cc:15:5: error: 'can' was not declared in this scope; did you mean 'can2'?
15 | can = false;
| ^~~
| can2
a.cc:16:11: error: found ':' in nested-name-specifier, expected '::'
16 | for (x: div){
| ^
| ::
a.cc:16:10: error: 'x' has not been declared
16 | for (x: div){
| ^
a.cc:22:5: error: expected primary-expression before 'if'
22 | if(!can2)break;
| ^~
a.cc:21:6: error: expected ';' before 'if'
21 | }
| ^
| ;
22 | if(!can2)break;
| ~~
a.cc:22:5: error: expected primary-expression before 'if'
22 | if(!can2)break;
| ^~
a.cc:21:6: error: expected ')' before 'if'
21 | }
| ^
| )
22 | if(!can2)break;
| ~~
a.cc:16:9: note: to match this '('
16 | for (x: div){
| ^
a.cc:26:6: error: 'can' was not declared in this scope; did you mean 'tan'?
26 | if(can) cout << "YES" << endl;
| ^~~
| tan
|
s512905262 | p03854 | Java | public class Main {
public static void main(String[] args) {
solve(System.in, System.out);
}
static void solve(InputStream is, PrintStream os) {
Scanner sc = new Scanner(is);
/* read */
String s = sc.next();
String[] words = {"dream", "dreamer", "erase", "eraser"};
List<String> prefixes = new ArrayList<>();
prefixes.add("");
if (bfs(prefixes, words, s)) {
os.println("YES");
} else {
os.println("NO");
}
}
private static boolean bfs(List<String> prefixes, String[] words, String s) {
while (!prefixes.isEmpty()) {
List<String> matches = new ArrayList<>();
for (String p : prefixes) {
for (String w : words) {
String t = p + w;
if (s.equals(t)) return true;
if (s.startsWith(t)) matches.add(t);
}
}
prefixes = matches;
}
return false;
}
}
| Main.java:7: error: cannot find symbol
static void solve(InputStream is, PrintStream os) {
^
symbol: class InputStream
location: class Main
Main.java:7: error: cannot find symbol
static void solve(InputStream is, PrintStream os) {
^
symbol: class PrintStream
location: class Main
Main.java:25: error: cannot find symbol
private static boolean bfs(List<String> prefixes, String[] words, String s) {
^
symbol: class List
location: class Main
Main.java:8: error: cannot find symbol
Scanner sc = new Scanner(is);
^
symbol: class Scanner
location: class Main
Main.java:8: error: cannot find symbol
Scanner sc = new Scanner(is);
^
symbol: class Scanner
location: class Main
Main.java:15: error: cannot find symbol
List<String> prefixes = new ArrayList<>();
^
symbol: class List
location: class Main
Main.java:15: error: cannot find symbol
List<String> prefixes = new ArrayList<>();
^
symbol: class ArrayList
location: class Main
Main.java:27: error: cannot find symbol
List<String> matches = new ArrayList<>();
^
symbol: class List
location: class Main
Main.java:27: error: cannot find symbol
List<String> matches = new ArrayList<>();
^
symbol: class ArrayList
location: class Main
9 errors
|
s984789930 | p03854 | Java | public class Main {
public static void main(String[] args) {
solve(System.in, System.out);
}
static void solve(InputStream is, PrintStream os) {
Scanner sc = new Scanner(is);
/* read */
String s = sc.next();
String[] words = {"dream", "dreamer", "erase", "eraser"};
List<String> prefixes = new ArrayList<>();
prefixes.add("");
if (bfs(prefixes, words, s)) {
os.println("Yes");
} else {
os.println("No");
}
}
private static boolean bfs(List<String> prefixes, String[] words, String s) {
while (!prefixes.isEmpty()) {
List<String> matches = new ArrayList<>();
for (String p : prefixes) {
for (String w : words) {
String t = p + w;
if (s.equals(t)) return true;
if (s.startsWith(t)) matches.add(t);
}
}
prefixes = matches;
}
return false;
}
}
| Main.java:7: error: cannot find symbol
static void solve(InputStream is, PrintStream os) {
^
symbol: class InputStream
location: class Main
Main.java:7: error: cannot find symbol
static void solve(InputStream is, PrintStream os) {
^
symbol: class PrintStream
location: class Main
Main.java:25: error: cannot find symbol
private static boolean bfs(List<String> prefixes, String[] words, String s) {
^
symbol: class List
location: class Main
Main.java:8: error: cannot find symbol
Scanner sc = new Scanner(is);
^
symbol: class Scanner
location: class Main
Main.java:8: error: cannot find symbol
Scanner sc = new Scanner(is);
^
symbol: class Scanner
location: class Main
Main.java:15: error: cannot find symbol
List<String> prefixes = new ArrayList<>();
^
symbol: class List
location: class Main
Main.java:15: error: cannot find symbol
List<String> prefixes = new ArrayList<>();
^
symbol: class ArrayList
location: class Main
Main.java:27: error: cannot find symbol
List<String> matches = new ArrayList<>();
^
symbol: class List
location: class Main
Main.java:27: error: cannot find symbol
List<String> matches = new ArrayList<>();
^
symbol: class ArrayList
location: class Main
9 errors
|
s960057156 | p03854 | C++ | #include <bits/stdc++.h>
using namespace std;
string divide[4] = {"dream", "dreamer", "erase", "eraser"};
int main(){
string s;
cin >> s;
//後ろから解く代わりに全ての文字列を「左右反転」する
reverse(s.begin(), s.end());
for (int i=0; i<4; ++i)
reverse(divide[i].begin, divide[i].end());
//端から切っていく
bool can = true;
for (int i=0; i<s.size();){
bool can2 = false; //4個の文字列たちどれかでdevideできるか
for (int j=0; j<4; ++j){
string d = divide[j];
if (s.substr(i, d.size()) == d){
can2 = true;
i += d.size();
}
}
if(!can2){
can = false;
break;
}
}
if(can)
cout << "YES" << endl;
else
cout << "NO" << endl;
}
| a.cc: In function 'int main()':
a.cc:13:12: error: no matching function for call to 'reverse(<unresolved overloaded function type>, std::__cxx11::basic_string<char>::iterator)'
13 | reverse(divide[i].begin, divide[i].end());
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:1083:5: note: candidate: 'void std::reverse(_BIter, _BIter) [with _BIter = __gnu_cxx::__normal_iterator<char*, __cxx11::basic_string<char> >]'
1083 | reverse(_BidirectionalIterator __first, _BidirectionalIterator __last)
| ^~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1083:36: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to '__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >'
1083 | reverse(_BidirectionalIterator __first, _BidirectionalIterator __last)
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note: candidate: 'template<class _ExecutionPolicy, class _BidirectionalIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::reverse(_ExecutionPolicy&&, _BidirectionalIterator, _BidirectionalIterator)'
249 | reverse(_ExecutionPolicy&& __exec, _BidirectionalIterator __first, _BidirectionalIterator __last);
| ^~~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note: candidate expects 3 arguments, 2 provided
|
s437806466 | p03854 | C++ | #include <bits/stdc++.h>
using namespace std;
string devide[4] = {"dream", "dreamer", "erase", "eraser"};
int main(){
string s;
cin >> s;
//後ろから解く代わりに全ての文字列を「左右反転」する
reverse(s.begin(), s.end());
for (int i=0; i<4; ++i)
reverse(devide[i].begin, devide[i].end());
//端から切っていく
bool can = true;
for (int i=0; i<s.size();){
bool can2 = false; //4個の文字列たちどれかでdevideできるか
for (int j=0; j<4; ++j){
string d = divide[j];
if (s.substr(i, d.size()) == d){
can2 = true;
i += d.size();
}
}
if(!can2){
can = false;
break;
}
}
if(can)
cout << "YES" << endl;
else
cout << "NO" << endl;
}
| a.cc: In function 'int main()':
a.cc:13:12: error: no matching function for call to 'reverse(<unresolved overloaded function type>, std::__cxx11::basic_string<char>::iterator)'
13 | reverse(devide[i].begin, devide[i].end());
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:1083:5: note: candidate: 'void std::reverse(_BIter, _BIter) [with _BIter = __gnu_cxx::__normal_iterator<char*, __cxx11::basic_string<char> >]'
1083 | reverse(_BidirectionalIterator __first, _BidirectionalIterator __last)
| ^~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1083:36: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to '__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >'
1083 | reverse(_BidirectionalIterator __first, _BidirectionalIterator __last)
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note: candidate: 'template<class _ExecutionPolicy, class _BidirectionalIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::reverse(_ExecutionPolicy&&, _BidirectionalIterator, _BidirectionalIterator)'
249 | reverse(_ExecutionPolicy&& __exec, _BidirectionalIterator __first, _BidirectionalIterator __last);
| ^~~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note: candidate expects 3 arguments, 2 provided
a.cc:20:18: error: 'divide' was not declared in this scope; did you mean 'devide'?
20 | string d = divide[j];
| ^~~~~~
| devide
|
s563312731 | p03854 | C++ | #include <bits/stdc++.h>
using namespace std;
string divide[4] = {"dream", "dreamer", "erase", "eraser"};
int main(){
string s;
cin >> s;
//後ろから解く代わりに全ての文字列を「左右反転」する
reverse(s.begin(), s.end());
for (int i=0; i<4; ++i)
reverse(devide[i].begin, devide[i].end());
//端から切っていく
bool can = true;
for (int i=0; i<s.size();){
bool can2 = false; //4個の文字列たちどれかでdevideできるか
for (int j=0; j<4; ++j){
string d = divide[j];
if (s.substr(i, d.size()) == d){
can2 = true;
i += d.size();
}
}
if(!can2){
can = false;
break;
}
}
if(can)
cout << "YES" << endl;
else
cout << "NO" << endl;
} | a.cc: In function 'int main()':
a.cc:13:13: error: 'devide' was not declared in this scope; did you mean 'divide'?
13 | reverse(devide[i].begin, devide[i].end());
| ^~~~~~
| divide
|
s384806715 | p03854 | C++ | #include <iostream>
#include <string>
using namespace std;
int main()
{
string s;
cin >> s;
std::reverse(s.begin(),s.end());
int i = 0;
while(i<s.size()){
int flag = 1;
string subs5 = s.substr(i,5);
string subs6 = s.substr(i,6);
string subs7 = s.substr(i,7);
if(subs5=="maerd"){
i += 5;
flag = 0;
}
if(subs5=="esare"){
i += 5;
flag = 0;
}
if(subs7=="remaerd"){
i += 7;
flag = 0;
}
if(subs6=="resare"){
i += 6;
flag = 0;
}
if(flag == 1){
cout << "NO" << endl;
return 0;
}
}
cout << "YES" << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:11:8: error: 'reverse' is not a member of 'std'
11 | std::reverse(s.begin(),s.end());
| ^~~~~~~
|
s452328837 | p03854 | C++ | #include <iostream>
#include <string>
using namespace std;
int main()
{
string s;
cin >> s;
std::reverse(s.begin(),s.end());
int i = 0;
while(i<s.size()){
int flag = 1;
string subs5 = s.substr(i,5);
string subs6 = s.substr(i,6);
string subs7 = s.substr(i,7);
if(subs5=="maerd"){
i += 5;
flag = 0;
}
if(subs5=="esare"){
i += 5;
flag = 0;
}
if(subs7=="remaerd"){
i += 7;
flag = 0;
}
if(subs6=="resare"){
i += 6;
flag = 0;
}
if(flag == 1){
cout << "NO" << endl;
return 0;
}
}
cout << "YES" << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:11:8: error: 'reverse' is not a member of 'std'
11 | std::reverse(s.begin(),s.end());
| ^~~~~~~
|
s928989156 | p03854 | C++ | #include <iostream>
#include <string>
using namespace std;
int main()
{
string s;
cin >> s;
reverse(s.begin(),s.end());
int i = 0;
while(i<s.size()){
int flag = 1;
string subs5 = s.substr(i,5);
string subs6 = s.substr(i,6);
string subs7 = s.substr(i,7);
if(subs5=="maerd"){
i += 5;
flag = 0;
}
if(subs5=="esare"){
i += 5;
flag = 0;
}
if(subs7=="remaerd"){
i += 7;
flag = 0;
}
if(subs6=="resare"){
i += 6;
flag = 0;
}
if(flag == 1){
cout << "NO" << endl;
return 0;
}
}
cout << "YES" << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:11:3: error: 'reverse' was not declared in this scope
11 | reverse(s.begin(),s.end());
| ^~~~~~~
|
s370043044 | p03854 | C++ | #include <iostream>
#include <string>
using namespace std;
int main()
{
string s;
cin >> s;
reverse(s.begin(),s.end());
int i = 0;
while(i<s.size()){
int flag = 1;
string subs5 = s.substr(i,5);
string subs6 = s.substr(i,6);
string subs7 = s.substr(i,7);
if(subs5=="maerd"){
i += 5;
flag = 0;
}
if(subs5=="esare"){
i += 5;
flag = 0;
}
if(subs7=="remaerd"){
i += 7;
flag = 0;
}
if(subs6=="resare"){
i += 6;
flag = 0;
}
if(flag == 1){
cout << "NO" << endl;
return 0;
}
}
cout << "YES" << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:11:3: error: 'reverse' was not declared in this scope
11 | reverse(s.begin(),s.end());
| ^~~~~~~
|
s377933815 | p03854 | C++ | s = str(input())
if s.replace("eraser","").replace("erase","").replace("dream","").replace("dreamer","")=="":
print("YES")
else:
print("NO") | a.cc:1:1: error: 's' does not name a type
1 | s = str(input())
| ^
|
s913261131 | p03854 | C++ | #include<bits/stdc++.h>
using namespace std;
int main()
{
string s, t;
cin>>s;
string d[] = {"dream", "dreamer", "erase", "eraser"};
while(s.find("dreamer") != string::npos)
s.erase(t, 7);
while(s.find("dream") != string::npos)
s.erase(t, 5);
while(s.find("eraser") != string::npos)
s.erase(t, 6);
while(s.find("erase") != string::npos)
s.erase(t, 5);
if(s.length() == t)
cout<<"YES\n";
else
cout<<"NO\n";
return 0;
} | a.cc: In function 'int main()':
a.cc:10:24: error: no matching function for call to 'std::__cxx11::basic_string<char>::erase(std::string&, int)'
10 | s.erase(t, 7);
| ~~~~~~~^~~~~~
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 'std::string' {aka '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:30: note: no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'std::__cxx11::basic_string<char>::__const_iterator' {aka 'std::__cxx11::basic_string<char>::const_iterator'}
2154 | erase(__const_iterator __first, __const_iterator __last)
| ~~~~~~~~~~~~~~~~~^~~~~~~
a.cc:12:24: error: no matching function for call to 'std::__cxx11::basic_string<char>::erase(std::string&, int)'
12 | s.erase(t, 5);
| ~~~~~~~^~~~~~
/usr/include/c++/14/bits/basic_string.h:2114:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::erase(size_type, size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
2114 | erase(size_type __pos = 0, size_type __n = npos)
| ^~~~~
/usr/include/c++/14/bits/basic_string.h:2114:23: note: no known conversion for argument 1 from 'std::string' {aka '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:30: note: no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'std::__cxx11::basic_string<char>::__const_iterator' {aka 'std::__cxx11::basic_string<char>::const_iterator'}
2154 | erase(__const_iterator __first, __const_iterator __last)
| ~~~~~~~~~~~~~~~~~^~~~~~~
a.cc:14:24: error: no matching function for call to 'std::__cxx11::basic_string<char>::erase(std::string&, int)'
14 | s.erase(t, 6);
| ~~~~~~~^~~~~~
/usr/include/c++/14/bits/basic_string.h:2114:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::erase(size_type, size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
2114 | erase(size_type __pos = 0, size_type __n = npos)
| ^~~~~
/usr/include/c++/14/bits/basic_string.h:2114:23: note: no known conversion for argument 1 from 'std::string' {aka '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:30: note: no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'std::__cxx11::basic_string<char>::__const_iterator' {aka 'std::__cxx11::basic_string<char>::const_iterator'}
2154 | erase(__const_iterator __first, __const_iterator __last)
| ~~~~~~~~~~~~~~~~~^~~~~~~
a.cc:16:24: error: no matching function for call to 'std::__cxx11::basic_string<char>::erase(std::string&, int)'
16 | s.erase(t, 5);
| ~~~~~~~^~~~~~
/usr/include/c++/14/bits/basic_string.h:2114:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::erase(size_type, size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
2114 | erase(size_type __pos = 0, size_type __n = npos)
| ^~~~~
/usr/include/c++/14/bits/basic_string.h:2114:23: note: no known conversion for argument 1 from 'std::string' {aka '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:30: note: no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'std::__cxx11::basic_string<char>::__const_iterator' {aka 'std::__cxx11::basic_string<char>::const_iterator'}
2154 | erase(__const_iterator __first, __const_iterator __last)
| ~~~~~~~~~~~~~~~~~^~~~~~~
a.cc:17:23: error: no match for 'operator==' (operand types are 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
17 | if(s.length() == t)
| ~~~~~~~~~~ ^~ ~
| | |
| | std::string {aka std::__c |
s233113863 | p03854 | C++ | import java.util.*;
class Main{
static boolean dp[] = new boolean[(int)1e5+10];
public static void main(String[] args){
Scanner in = new Scanner(System.in);
char[] s = in.next().toCharArray();
dp[0] = true;
for(int i = 0 ; i < s.length; i++){
if(!dp[i])continue;
if(i+5<=s.length&&s[i]=='d'&&s[i+1]=='r'&&s[i+2]=='e'&&s[i+3]=='a'&&s[i+4]=='m')
dp[i+5] = true;
if(i+7<=s.length&&s[i]=='d'&&s[i+1]=='r'&&s[i+2]=='e'&&s[i+3]=='a'&&s[i+4]=='m'&&s[i+5]=='e'&&s[i+6]=='r')
dp[i+7] = true;
if(i+5<=s.length&&s[i]=='e'&&s[i+1]=='r'&&s[i+2]=='a'&&s[i+3]=='s'&&s[i+4]=='e')
dp[i+5] = true;
if(i+6<=s.length&&s[i]=='e'&&s[i+1]=='r'&&s[i+2]=='a'&&s[i+3]=='s'&&s[i+4]=='e'&&s[i+5]=='r')
dp[i+6] = true;
}
if(dp[s.length])
System.out.println("YES");
else System.out.println("NO");
}
} | a.cc:1:1: error: 'import' does not name a type
1 | import java.util.*;
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:12: error: 'boolean' does not name a type; did you mean 'bool'?
4 | static boolean dp[] = new boolean[(int)1e5+10];
| ^~~~~~~
| bool
a.cc:5:11: error: expected ':' before 'static'
5 | public static void main(String[] args){
| ^~~~~~~
| :
a.cc:5:29: error: 'String' has not been declared
5 | public static void main(String[] args){
| ^~~~~~
a.cc:5:38: error: expected ',' or '...' before 'args'
5 | public static void main(String[] args){
| ^~~~
a.cc:25:2: error: expected ';' after class definition
25 | }
| ^
| ;
a.cc: In static member function 'static void Main::main(int*)':
a.cc:6:9: error: 'Scanner' was not declared in this scope
6 | Scanner in = new Scanner(System.in);
| ^~~~~~~
a.cc:7:13: error: structured binding declaration cannot have type 'char'
7 | char[] s = in.next().toCharArray();
| ^~
a.cc:7:13: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:7:13: error: empty structured binding declaration
a.cc:7:16: error: expected initializer before 's'
7 | char[] s = in.next().toCharArray();
| ^
a.cc:8:9: error: 'dp' was not declared in this scope
8 | dp[0] = true;
| ^~
a.cc:9:29: error: 's' was not declared in this scope
9 | for(int i = 0 ; i < s.length; i++){
| ^
a.cc:21:15: error: 's' was not declared in this scope
21 | if(dp[s.length])
| ^
a.cc:22:13: error: 'System' was not declared in this scope
22 | System.out.println("YES");
| ^~~~~~
a.cc:23:14: error: 'System' was not declared in this scope
23 | else System.out.println("NO");
| ^~~~~~
|
s563076007 | p03854 | C++ | #include<bits/stdc++.h>
using namespace std;
string divide[4] = {"dream", "dreamer", "erase", "eraser"};
int main(){
string S;
cin >> S;
// 反転
reverse(S.begin, S.end);
for(int i=0; i<4; i++)
reverse(divide[i].begin, divide[i].end);
bool can = true;
for(int i=0; i<S.size();i++){
bool can2 = false;
for(int j=0; j<4; j++){
string d = divide[j];
if(S.substr(i, d.size) == d){
can2 = true;
i += d.size();
}
}
if(!can2){
can = false;
break;
}
}
if(can){
cout << "YES" <<endl;
}else{
cout << "NO" << endl;
}
}
| a.cc: In function 'int main()':
a.cc:11:12: error: no matching function for call to 'reverse(<unresolved overloaded function type>, <unresolved overloaded function type>)'
11 | reverse(S.begin, S.end);
| ~~~~~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:1083:5: note: candidate: 'template<class _BIter> void std::reverse(_BIter, _BIter)'
1083 | reverse(_BidirectionalIterator __first, _BidirectionalIterator __last)
| ^~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1083:5: note: template argument deduction/substitution failed:
a.cc:11:12: note: couldn't deduce template parameter '_BIter'
11 | reverse(S.begin, S.end);
| ~~~~~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note: candidate: 'template<class _ExecutionPolicy, class _BidirectionalIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::reverse(_ExecutionPolicy&&, _BidirectionalIterator, _BidirectionalIterator)'
249 | reverse(_ExecutionPolicy&& __exec, _BidirectionalIterator __first, _BidirectionalIterator __last);
| ^~~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note: candidate expects 3 arguments, 2 provided
a.cc:13:15: error: no matching function for call to 'reverse(<unresolved overloaded function type>, <unresolved overloaded function type>)'
13 | reverse(divide[i].begin, divide[i].end);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1083:5: note: candidate: 'template<class _BIter> void std::reverse(_BIter, _BIter)'
1083 | reverse(_BidirectionalIterator __first, _BidirectionalIterator __last)
| ^~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1083:5: note: template argument deduction/substitution failed:
a.cc:13:15: note: couldn't deduce template parameter '_BIter'
13 | reverse(divide[i].begin, divide[i].end);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note: candidate: 'template<class _ExecutionPolicy, class _BidirectionalIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::reverse(_ExecutionPolicy&&, _BidirectionalIterator, _BidirectionalIterator)'
249 | reverse(_ExecutionPolicy&& __exec, _BidirectionalIterator __first, _BidirectionalIterator __last);
| ^~~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note: candidate expects 3 arguments, 2 provided
a.cc:20:30: error: invalid use of non-static 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]'
20 | if(S.substr(i, d.size) == d){
| ~~^~~~
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:
/usr/include/c++/14/bits/basic_string.h:1076:7: note: declared here
1076 | size() const _GLIBCXX_NOEXCEPT
| ^~~~
|
s847903330 | p03854 | C++ | #include<bits/stdc++.h>
using namespace std;
string divide[4] = {"dream", "dreamer", "erase", "eraser"};
int main(){
string S;
cin >> S;
// 反転
reverse(S.begin, S.end);
for(int i=0; i<4; i++)
reverse(divide[i].begin, divide[i].end);
bool can = true;
for(int i=0; i<S.size();i++){
bool can2 = false;
for(int j=0; j<4; j++){
string d = divide[j];
if(S.substr(i, d.size) == d){
can2 = true;
i += d.size();
}
}
if(!can2){
can = false;
break;
}
}
if(can){
cout << "YES" <<endl;
}else{
cout << "NO" << endl;
}
}
s | a.cc: In function 'int main()':
a.cc:11:12: error: no matching function for call to 'reverse(<unresolved overloaded function type>, <unresolved overloaded function type>)'
11 | reverse(S.begin, S.end);
| ~~~~~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:1083:5: note: candidate: 'template<class _BIter> void std::reverse(_BIter, _BIter)'
1083 | reverse(_BidirectionalIterator __first, _BidirectionalIterator __last)
| ^~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1083:5: note: template argument deduction/substitution failed:
a.cc:11:12: note: couldn't deduce template parameter '_BIter'
11 | reverse(S.begin, S.end);
| ~~~~~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note: candidate: 'template<class _ExecutionPolicy, class _BidirectionalIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::reverse(_ExecutionPolicy&&, _BidirectionalIterator, _BidirectionalIterator)'
249 | reverse(_ExecutionPolicy&& __exec, _BidirectionalIterator __first, _BidirectionalIterator __last);
| ^~~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note: candidate expects 3 arguments, 2 provided
a.cc:13:15: error: no matching function for call to 'reverse(<unresolved overloaded function type>, <unresolved overloaded function type>)'
13 | reverse(divide[i].begin, divide[i].end);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1083:5: note: candidate: 'template<class _BIter> void std::reverse(_BIter, _BIter)'
1083 | reverse(_BidirectionalIterator __first, _BidirectionalIterator __last)
| ^~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1083:5: note: template argument deduction/substitution failed:
a.cc:13:15: note: couldn't deduce template parameter '_BIter'
13 | reverse(divide[i].begin, divide[i].end);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note: candidate: 'template<class _ExecutionPolicy, class _BidirectionalIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::reverse(_ExecutionPolicy&&, _BidirectionalIterator, _BidirectionalIterator)'
249 | reverse(_ExecutionPolicy&& __exec, _BidirectionalIterator __first, _BidirectionalIterator __last);
| ^~~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note: candidate expects 3 arguments, 2 provided
a.cc:20:30: error: invalid use of non-static 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]'
20 | if(S.substr(i, d.size) == d){
| ~~^~~~
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:
/usr/include/c++/14/bits/basic_string.h:1076:7: note: declared here
1076 | size() const _GLIBCXX_NOEXCEPT
| ^~~~
a.cc: At global scope:
a.cc:36:1: error: 's' does not name a type
36 | s
| ^
|
s825452926 | p03854 | C++ | #include<iostream>
bool solve(int n, int y){
y /= 1000;
for(int a = 0; a <= 2000; a++){
for(int b = 0; b <= 4000; b++){
int c = n - a - b;
if(0 <= c && c <= 20000 && 10*x + 5*y + z == y){
std::cout << a << " " << b << " " << c << std::endl;
return true;
}
}
}
return false;
}
int main(){
int n, y;
std::cin >> n >> y;
if(!solve(n,y)) std::cout << -1 << " " << -1 << " " << -1 << std::endl;
} | a.cc: In function 'bool solve(int, int)':
a.cc:9:43: error: 'x' was not declared in this scope
9 | if(0 <= c && c <= 20000 && 10*x + 5*y + z == y){
| ^
a.cc:9:53: error: 'z' was not declared in this scope
9 | if(0 <= c && c <= 20000 && 10*x + 5*y + z == y){
| ^
|
s341810938 | p03854 | C++ | //ABC081A
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <math.h>
#include<stdio.h>
#include<climits>
#include<cfloat>
using namespace std;
int main(){
string s;
int i = s.size()-1;
cin >> s;
while(1){
if(s.substr(i-4,5) == "erase" || s.substr(i-4,5) == "dream"){
i -= 5;
}else if{s.substr(i-5,6) == "eraser"){
i -= 6;
}else if(s.substr(i-6,7) == "dreamer"){
i -= 7;
}else{
cout << "NO" << endl;
return 0;
}
if(i == -1){
cout << "YES" << endl;
return 0;
}
}
} | a.cc: In function 'int main()':
a.cc:19:13: error: expected '(' before '{' token
19 | }else if{s.substr(i-5,6) == "eraser"){
| ^
| (
a.cc:32:4: error: expected '}' at end of input
32 | }
| ^
a.cc:12:11: note: to match this '{'
12 | int main(){
| ^
|
s451159576 | p03854 | C++ | #include<algorithm>
#include<string>
using namespace std;
int main(){
string divide[4]={"dream","dreamer","erase","eraser"};
string s;
cin>>s;
for(int i=0;i<4;i++){
reverse(divide[i].begin(),divide[i].end());
}
reverse(s.begin(),s.end());
bool can=true;
for(int i=0;i<s.size();){
bool can2=false;
for(int j=0;j<4;j++){
if(s.substr(i,divide[j].size())==divide[j]){
can2=true;
i+=divide[j].size();
}
if(can2==false){
can=false;
break;
}
}
}
if(can==true){
cout<<"YES"<<endl;
}
else{
cout<<"NO"<<endl;
}
} | a.cc: In function 'int main()':
a.cc:7:3: error: 'cin' was not declared in this scope
7 | cin>>s;
| ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
2 | #include<string>
+++ |+#include <iostream>
3 | using namespace std;
a.cc:27:5: error: 'cout' was not declared in this scope
27 | cout<<"YES"<<endl;
| ^~~~
a.cc:27:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:27:18: error: 'endl' was not declared in this scope
27 | cout<<"YES"<<endl;
| ^~~~
a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
2 | #include<string>
+++ |+#include <ostream>
3 | using namespace std;
a.cc:30:5: error: 'cout' was not declared in this scope
30 | cout<<"NO"<<endl;
| ^~~~
a.cc:30:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:30:17: error: 'endl' was not declared in this scope
30 | cout<<"NO"<<endl;
| ^~~~
a.cc:30:17: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
|
s443457526 | p03854 | C++ | #include<iostream>
#include<string>
#include<vector>
#include<algorithm>
int main() {
std::string str;
std::cin >> str;
std::vector<std::string> check = {"maerd", "remaerd","esare","resare"};
str = std::reverse(str.begin(), str.end());
int flag = 0;
for (int i; i<str.size();) {
int temp_flag = 1;
for (int j; j < 4; j++) {
if (str.substr(i,check.at(j).size()) == check.at(j)) {
temp_flag = 0;
i += check.at(j).size();
break;
}
}
if (temp_flag) {
flag = 1;
break;
}
}
if (flag) {
std::cout << "NO" << std::endl;
}
else {
std::cout << "YES" << std::endl;
}
} | a.cc: In function 'int main()':
a.cc:10:44: error: no match for 'operator=' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'void')
10 | str = std::reverse(str.begin(), str.end());
| ^
In file included from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:941:8: 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>::operator=(const _Tp&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
941 | operator=(const _Tp& __svt)
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:941:8: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/basic_string.h: In 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 = void; _Res = std::__cxx11::basic_string<char>&; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]':
/usr/include/c++/14/bits/basic_string.h:941:8: 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>::operator=(const _Tp&) [with _Tp = void]'
a.cc:10:44: required from here
10 | str = std::reverse(str.begin(), str.end());
| ^
/usr/include/c++/14/bits/basic_string.h:152:70: error: forming reference to void
152 | __not_<is_convertible<const _Tp&, const _CharT*>>>::value,
| ^~~~~
/usr/include/c++/14/bits/basic_string.h:817:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
817 | operator=(const basic_string& __str)
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:817:37: note: no known conversion for argument 1 from 'void' to 'const std::__cxx11::basic_string<char>&'
817 | operator=(const basic_string& __str)
| ~~~~~~~~~~~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:828:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const _CharT*) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
828 | operator=(const _CharT* __s)
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:828:31: note: no known conversion for argument 1 from 'void' to 'const char*'
828 | operator=(const _CharT* __s)
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/basic_string.h:840:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(_CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
840 | operator=(_CharT __c)
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:840:24: note: no known conversion for argument 1 from 'void' to 'char'
840 | operator=(_CharT __c)
| ~~~~~~~^~~
/usr/include/c++/14/bits/basic_string.h:858:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
858 | operator=(basic_string&& __str)
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:858:32: note: no known conversion for argument 1 from 'void' to 'std::__cxx11::basic_string<char>&&'
858 | operator=(basic_string&& __str)
| ~~~~~~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:926:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(std::initializer_list<_Tp>) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
926 | operator=(initializer_list<_CharT> __l)
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:926:42: note: no known conversion for argument 1 from 'void' to 'std::initializer_list<char>'
926 | operator=(initializer_list<_CharT> __l)
| ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
|
s409472887 | p03854 | C++ | #include<iostream>
#include<string>
#include<vector>
#include<algorithm>
int main() {
std::string str;
std::cin >> str;
std::vector<std::string> check = {"maerd", "remaerd","esare","resare"};
str = std::revers(str.begin(), str.end());
int flag = 0;
for (int i; i<str.size();) {
int temp_flag = 1;
for (int j; j < 4; j++) {
if (str.substr(i,check.at(j).size()) == check.at(j)) {
temp_flag = 0;
i += check.at(j).size();
break;
}
}
if (temp_flag) {
flag = 1;
break;
}
}
if (flag) {
std::cout << "NO" << std::endl;
}
else {
std::cout << "YES" << std::endl;
}
} | a.cc: In function 'int main()':
a.cc:10:14: error: 'revers' is not a member of 'std'; did you mean 'reverse'?
10 | str = std::revers(str.begin(), str.end());
| ^~~~~~
| reverse
|
s432876537 | p03854 | C++ | #include<iostream>
#include<string>
#include<vector>
#include<algorithm>
int main() {
std::string str;
std::cin >> str;
std::vector<std::string> check = {"maerd", "remaerd","esare","resare"};
str = std::revers(str.begin(), str.end());
int flag = 0;
for (int i; i<str.size();) {
int temp_flag = 1;
for (int j; j < 4; j++) {
if (str.substring(i,i+check.at(j).size()) == check.at(j)) {
temp_flag = 0;
i += check.at(j).size();
break;
}
}
if (temp_flag) {
flag = 1;
break;
}
}
if (flag) {
std::cout << "NO" << std::endl;
}
else {
std::cout << "YES" << std::endl;
}
} | a.cc: In function 'int main()':
a.cc:10:14: error: 'revers' is not a member of 'std'; did you mean 'reverse'?
10 | str = std::revers(str.begin(), str.end());
| ^~~~~~
| reverse
a.cc:15:15: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'substring'; did you mean 'substr'?
15 | if (str.substring(i,i+check.at(j).size()) == check.at(j)) {
| ^~~~~~~~~
| substr
|
s338370396 | p03854 | Java | import java.util.Scanner;
/**
* @author a-pz
*
*/
public class Main {
/**
* @param args
*/
public static void main(String[] args) {
DayDream dd = new DayDream();
Scanner sc = new Scanner(System.in);
String S = sc.next();
sc.close();
System.out.println(dd.matchToDelete(S));
}
enum Word {
DREAMERDREAMER, DREAMERERASER, DREAMERDREAM, DREAMERERASE,
ERASERDREAMER , ERASERERASER , ERASERDREAM , ERASERERASE,
DREAMDREAMER, DREAMERASER, DREAMDREAM, DREAMERASE,
ERASEDREAMER, ERASEERASER, ERASEDREAM, ERASEERASE,
DREAMER, ERASER, DREAM, ERASE
;
public String getValue() {
return this.name().toLowerCase();
}
}
public String matchToDelete(String S) {
for (Word word:Word.values()) {
S = S.replace(word.getValue(), "");
}
return S.length() == 0 ? "YES" : "NO";
}
}
| Main.java:13: error: cannot find symbol
DayDream dd = new DayDream();
^
symbol: class DayDream
location: class Main
Main.java:13: error: cannot find symbol
DayDream dd = new DayDream();
^
symbol: class DayDream
location: class Main
2 errors
|
s639101908 | p03854 | Java | import java.util.Scanner;
/**
* @author a-pz
*
*/
public class DayDream {
/**
* @param args
*/
public static void main(String[] args) {
DayDream dd = new DayDream();
Scanner sc = new Scanner(System.in);
String S = sc.next();
sc.close();
System.out.println(dd.matchToDelete(S));
}
enum Word {
DREAMERDREAMER, DREAMERERASER, DREAMERDREAM, DREAMERERASE,
ERASERDREAMER , ERASERERASER , ERASERDREAM , ERASERERASE,
DREAMDREAMER, DREAMERASER, DREAMDREAM, DREAMERASE,
ERASEDREAMER, ERASEERASER, ERASEDREAM, ERASEERASE,
DREAMER, ERASER, DREAM, ERASE
;
public String getValue() {
return this.name().toLowerCase();
}
}
public String matchToDelete(String S) {
for (Word word:Word.values()) {
S = S.replace(word.getValue(), "");
}
return S.length() == 0 ? "YES" : "NO";
}
}
| Main.java:7: error: class DayDream is public, should be declared in a file named DayDream.java
public class DayDream {
^
1 error
|
s682945350 | p03854 | C++ | #include <bits/stdc++.h>
using namespace std;
char a[101000];
long long k,m,n;
int main()
{
cin>>a;
n=strlen(a);
for(int i=0;i<n;i++)
{
if(a[i]=='e')
if(a[i+1]=='r'&&a[i+2]=='a'&&a[i+3]=='s'&&a[i+4]=='e')
if(a[i+5]=='r') i+=5;
else i+=4;
else if(a[i]=='d')
if(a[i+1]=='r'&&a[i+2]=='e'&&a[i+3]=='a'&&a[i+4]=='m')
if(a[i+5]=='e'&&a[i+6]=='r'&&a[i+7]=='a'&&a[i+8]=='s'&&a[i+9]=='e') i+=4;
else
if(a[i+5]=='e'&&a[i+6]=='r') i+=6;
else i+=4;
if(a[i]!=='e'&&a[i]!=='d') {cout<<"NO\n";return 0;}
}
cout<<"YES\n";
return 0;
} | a.cc: In function 'int main()':
a.cc:21:18: error: expected primary-expression before '=' token
21 | if(a[i]!=='e'&&a[i]!=='d') {cout<<"NO\n";return 0;}
| ^
a.cc:21:30: error: expected primary-expression before '=' token
21 | if(a[i]!=='e'&&a[i]!=='d') {cout<<"NO\n";return 0;}
| ^
|
s432525795 | p03854 | C++ | /*Function Template*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int mod = 1000000007;
const ll MOD = 1000000000000000001;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define ALL(a) (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll Len(ll n) {
ll s=0;
while(n!=0) s++, n/=10;
return s;
}
ll Sint(ll n) {
ll m=0,s=0,a=n;
while(a!=0) s++, a/=10;
for(ll i=s-1;i>=0;i--) m+=n/((ll)pow(10,i))-(n/((ll)pow(10,i+1)))*10;
return m;
}
ll Svec(vector<ll> v){
ll n=0;
for(ll i=0;i<v.size();i++) n+=v[i];
return n;
}
ll GCD(ll a,ll b){
ll 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;
}
ll LCM(ll a,ll b){
ll c=a,d=b,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 c/b*d;
}
ll Factorial(ll n){
ll m=1;
while(n>=1) m*=n,n--;
return m;
}
vector<pair<char,ll>> runlength(string s,vector<pair<char,ll>> p){
ll x=1;
if(s.size()==1){
p.push_back(pair<char,ll>(s[0],1));
return p;
}
for(ll i=0;i<s.size()-1;i++){
if(s[i]==s[i+1]){
x++;
if(i==s.size()-2){
p.push_back(pair<char,ll>(s[i],x));
}
}else{
p.push_back(pair<char,ll>(s[i],x));
x=1;
if(i==s.size()-2){
p.push_back(pair<char,ll>(s[s.size()-1],x));
}
}
}
return p;
}
/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
int main() {
IOS;
string s;
reverse(ALL(s));
vector<string> v{maerd,remaerd,esare,resare};
while(s.size()>0){
rep(i,4){
if(v[i]==s.substr(0,v[i].size())){
s.erase(0,v[i].size());
break;
}
cout<<"NO"<<endl;
return 0;
}
}
cout<<"YES"<<endl;
} | a.cc: In function 'int main()':
a.cc:100:20: error: 'maerd' was not declared in this scope
100 | vector<string> v{maerd,remaerd,esare,resare};
| ^~~~~
a.cc:100:26: error: 'remaerd' was not declared in this scope; did you mean 'read'?
100 | vector<string> v{maerd,remaerd,esare,resare};
| ^~~~~~~
| read
a.cc:100:34: error: 'esare' was not declared in this scope; did you mean 'unshare'?
100 | vector<string> v{maerd,remaerd,esare,resare};
| ^~~~~
| unshare
a.cc:100:40: error: 'resare' was not declared in this scope; did you mean 'rename'?
100 | vector<string> v{maerd,remaerd,esare,resare};
| ^~~~~~
| rename
a.cc:100:46: error: no matching function for call to 'std::vector<std::__cxx11::basic_string<char> >::vector(<brace-enclosed initializer list>)'
100 | vector<string> v{maerd,remaerd,esare,resare};
| ^
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:2:
/usr/include/c++/14/bits/stl_vector.h:707:9: note: candidate: 'template<class _InputIterator, class> std::vector<_Tp, _Alloc>::vector(_InputIterator, _InputIterator, const allocator_type&) [with <template-parameter-2-2> = _InputIterator; _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >]'
707 | vector(_InputIterator __first, _InputIterator __last,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:707:9: note: candidate expects 3 arguments, 4 provided
/usr/include/c++/14/bits/stl_vector.h:678:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::initializer_list<_Tp>, const allocator_type&) [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >; allocator_type = std::allocator<std::__cxx11::basic_string<char> >]'
678 | vector(initializer_list<value_type> __l,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:678:7: note: candidate expects 2 arguments, 4 provided
/usr/include/c++/14/bits/stl_vector.h:659:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, std::__type_identity_t<_Alloc>&) [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >; std::__type_identity_t<_Alloc> = std::allocator<std::__cxx11::basic_string<char> >]'
659 | vector(vector&& __rv, const __type_identity_t<allocator_type>& __m)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:659:7: note: candidate expects 2 arguments, 4 provided
/usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::false_type) [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >; allocator_type = std::allocator<std::__cxx11::basic_string<char> >; std::false_type = std::false_type]'
640 | vector(vector&& __rv, const allocator_type& __m, false_type)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate expects 3 arguments, 4 provided
/usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::true_type) [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >; allocator_type = std::allocator<std::__cxx11::basic_string<char> >; std::true_type = std::true_type]'
635 | vector(vector&& __rv, const allocator_type& __m, true_type) noexcept
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate expects 3 arguments, 4 provided
/usr/include/c++/14/bits/stl_vector.h:624:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&, std::__type_identity_t<_Alloc>&) [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >; std::__type_identity_t<_Alloc> = std::allocator<std::__cxx11::basic_string<char> >]'
624 | vector(const vector& __x, const __type_identity_t<allocator_type>& __a)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:624:7: note: candidate expects 2 arguments, 4 provided
/usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&) [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >]'
620 | vector(vector&&) noexcept = default;
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate expects 1 argument, 4 provided
/usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&) [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >]'
601 | vector(const vector& __x)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate expects 1 argument, 4 provided
/usr/include/c++/14/bits/stl_vector.h:569:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const value_type&, const allocator_type&) [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >; size_type = long unsigned int; value_type = std::__cxx11::basic_string<char>; allocator_type = std::allocator<std::__cxx11::basic_string<char> >]'
569 | vector(size_type __n, const value_type& __value,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:569:7: note: candidate expects 3 arguments, 4 provided
/usr/include/c++/14/bits/stl_vector.h:556:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const allocator_type&) [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >; size_type = long unsigned int; allocator_type = std::allocator<std::__cxx11::basic_string<char> >]'
556 | vector(size_type __n, const allocator_type& __a = allocator_type())
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:556:7: note: candidate expects 2 arguments, 4 provided
/usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const allocator_type&) [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >; allocator_type = std::allocator<std::__cxx11::basic_string<char> >]'
542 | vector(const allocator_type& __a) _GLIBCXX_NOEXCEPT
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate expects 1 argument, 4 provided
/usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector() [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >]'
531 | vector() = default;
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate expects 0 arguments, 4 provided
|
s234307590 | p03854 | C++ | // ABC049_C
#include <iostream>
#include <string>
using namespace std;
int main () {
// input
string str;
cin >> str;
// calculation
string five, six, seven;
unsigned long len = str.length ();
if (len < 5 ) {
cout << "NO";
return 0 ;
} else if (len == 5 ) {
if (str == "dream" || str == "erase" ) {
cout << "YES";
return 0 ;
} else {
cout << "NO";
return 0 ;
}
} else if (len == 6 ) {
if (str == "eraser" ) {
cout << "YES";
return 0 ;
} else {
cout << "NO";
return 0 ;
}
} else if (len == 7 ) {
if (str == "dreamer" ) {
cout << "YES";
return 0 ;
} else {
cout << "NO";
return 0 ;
}
} else {
while (str.length() != 0 ) {
= Str.Substr five (Str.Size () - 1 - 4 , 5 );
an if (five == "dream" || five == "erase" ) {
Str.Erase (Str.End () - 5 , Str.End ());
} else {
= Str.Substr six (Str.Size () - 1 - 5 , 6 );
an if (six == "eraser" ) {
Str.Erase (Str.End () - 6 , Str.End ());
} else {
= Str.Substr seven (Str.Size () - 1 - 6 , 7 );
an if (seven == "dreamer" ) {
Str.Erase (Str.End () - 7 , Str.End ());
} else {
cout << "NO" << "\n" ;
return 0 ;
}
}
}
}
cout << "YES" << "\n" ;
return 0 ;
}
}
| a.cc: In function 'int main()':
a.cc:44:13: error: expected primary-expression before '=' token
44 | = Str.Substr five (Str.Size () - 1 - 4 , 5 );
| ^
a.cc:44:15: error: 'Str' was not declared in this scope; did you mean 'str'?
44 | = Str.Substr five (Str.Size () - 1 - 4 , 5 );
| ^~~
| str
a.cc:45:14: error: 'an' was not declared in this scope
45 | an if (five == "dream" || five == "erase" ) {
| ^~
a.cc:47:15: error: 'else' without a previous 'if'
47 | } else {
| ^~~~
a.cc:48:17: error: expected primary-expression before '=' token
48 | = Str.Substr six (Str.Size () - 1 - 5 , 6 );
| ^
a.cc:49:20: error: expected ';' before 'if'
49 | an if (six == "eraser" ) {
| ^~~
| ;
a.cc:51:19: error: 'else' without a previous 'if'
51 | } else {
| ^~~~
a.cc:52:21: error: expected primary-expression before '=' token
52 | = Str.Substr seven (Str.Size () - 1 - 6 , 7 );
| ^
a.cc:53:24: error: expected ';' before 'if'
53 | an if (seven == "dreamer" ) {
| ^~~
| ;
a.cc:55:23: error: 'else' without a previous 'if'
55 | } else {
| ^~~~
|
s440601683 | p03854 | C++ | // ABC049_C
#include <iostream>
#include <string>
using namespace std;
int main () {
// input
string str;
cin >> str;
// calculation
string five, six, seven;
unsigned long len = str.length ();
if (len < 5 ) {
cout << "NO";
return 0 ;
} else if (len == 5 ) {
if (str == "dream" || str == "erase" ) {
cout << "YES";
return 0 ;
} else {
cout << "NO";
return 0 ;
}
} else if (len == 6 ) {
if (str == "eraser" ) {
cout << "YES";
return 0 ;
} else {
cout << "NO";
return 0 ;
}
} else if (len == 7 ) {
if (str == "dreamer" ) {
cout << "YES";
return 0 ;
} else {
cout << "NO";
return 0 ;
}
} else {
while (str.length ()! = 0 ) {
= Str.Substr five (Str.Size () - 1 - 4 , 5 );
an if (five == "dream" || five == "erase" ) {
Str.Erase (Str.End () - 5 , Str.End ());
} else {
= Str.Substr six (Str.Size () - 1 - 5 , 6 );
an if (six == "eraser" ) {
Str.Erase (Str.End () - 6 , Str.End ());
} else {
= Str.Substr seven (Str.Size () - 1 - 6 , 7 );
an if (seven == "dreamer" ) {
Str.Erase (Str.End () - 7 , Str.End ());
} else {
cout << "NO" << "\n" ;
return 0 ;
}
}
}
}
cout << "YES" << "\n" ;
return 0 ;
}
}
| a.cc: In function 'int main()':
a.cc:43:30: error: expected ')' before '!' token
43 | while (str.length ()! = 0 ) {
| ~ ^
| )
a.cc:43:32: error: expected primary-expression before '=' token
43 | while (str.length ()! = 0 ) {
| ^
|
s615635005 | p03854 | C++ | // ABC049_C
#include <iostream>
#include <string>
using namespace std;
int main () {
// input
string str;
cin >> str;
// calculation
string five, six, seven;
unsigned long len = str.length ();
if (len < 5 ) {
cout << "NO" << " \ n " ;
return 0 ;
} else if (len == 5 ) {
if (str == "dream" || str == "erase" ) {
cout << "YES" << " \ n " ;
return 0 ;
} else {
cout << "NO" << " \ n " ;
return 0 ;
}
} else if (len == 6 ) {
if (str == "eraser" ) {
cout << "YES" << " \ n " ;
return 0 ;
} else {
cout << "NO" << " \ n " ;
return 0 ;
}
} else if (len == 7 ) {
if (str == "dreamer" ) {
cout << "YES" << " \ n " ;
return 0 ;
} else {
cout << "NO" << " \ n " ;
return 0 ;
}
} else {
while (str.length ()! = 0 ) {
= Str.Substr five (Str.Size () - 1 - 4 , 5 );
an if (five == "dream" || five == "erase" ) {
Str.Erase (Str.End () - 5 , Str.End ());
} else {
= Str.Substr six (Str.Size () - 1 - 5 , 6 );
an if (six == "eraser" ) {
Str.Erase (Str.End () - 6 , Str.End ());
} else {
= Str.Substr seven (Str.Size () - 1 - 6 , 7 );
an if (seven == "dreamer" ) {
Str.Erase (Str.End () - 7 , Str.End ());
} else {
cout << "NO" << " \ n " ;
return 0 ;
}
}
}
}
cout << "YES" << " \ n " ;
return 0 ;
}
}
| a.cc: In function 'int main()':
a.cc:16:25: warning: unknown escape sequence: '\040'
16 | cout << "NO" << " \ n " ;
| ^~~~~~~
a.cc:20:30: warning: unknown escape sequence: '\040'
20 | cout << "YES" << " \ n " ;
| ^~~~~~~
a.cc:23:29: warning: unknown escape sequence: '\040'
23 | cout << "NO" << " \ n " ;
| ^~~~~~~
a.cc:28:30: warning: unknown escape sequence: '\040'
28 | cout << "YES" << " \ n " ;
| ^~~~~~~
a.cc:31:29: warning: unknown escape sequence: '\040'
31 | cout << "NO" << " \ n " ;
| ^~~~~~~
a.cc:36:30: warning: unknown escape sequence: '\040'
36 | cout << "YES" << " \ n " ;
| ^~~~~~~
a.cc:39:29: warning: unknown escape sequence: '\040'
39 | cout << "NO" << " \ n " ;
| ^~~~~~~
a.cc:43:30: error: expected ')' before '!' token
43 | while (str.length ()! = 0 ) {
| ~ ^
| )
a.cc:43:32: error: expected primary-expression before '=' token
43 | while (str.length ()! = 0 ) {
| ^
a.cc:62:26: warning: unknown escape sequence: '\040'
62 | cout << "YES" << " \ n " ;
| ^~~~~~~
|
s834202250 | p03854 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
string s1,s2;
cin>>s1;
int n=s1.size();
for(int i=n-1;i>=0;i--){
s2.insert(s1.substr(i,1));
if(s2=="dream"||s2=="dreamer"||s2=="erase"||s2=="eraser"){
s2="";
}
}
if(s2=="")printf("YES");
else printf("NO");
} | a.cc: In function 'int main()':
a.cc:8:14: error: no matching function for call to 'std::__cxx11::basic_string<char>::insert(std::__cxx11::basic_string<char>)'
8 | s2.insert(s1.substr(i,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: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, 1 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: candidate expects 2 arguments, 1 provided
/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, 1 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, 1 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:7: note: candidate expects 2 arguments, 1 provided
/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:7: note: candidate expects 2 arguments, 1 provided
/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, 1 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, 1 provided
/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]'
2007 | insert(size_type __pos, const _CharT* __s)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:2007:7: note: candidate expects 2 arguments, 1 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, 1 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:7: note: candidate expects 2 arguments, 1 provided
|
s006153887 | p03854 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
string s1,s2;
cin>>s1;
int n=s1.size();
for(int i=n-1;i>=0;i--){
s2.insert(s1.substr(i,1))
if(s2=="dream"||s2=="dreamer"||s2=="erase"||s2=="eraser"){
s2="";
}
}
if(s2=="")printf("YES");
else printf("NO");
} | a.cc: In function 'int main()':
a.cc:8:14: error: no matching function for call to 'std::__cxx11::basic_string<char>::insert(std::__cxx11::basic_string<char>)'
8 | s2.insert(s1.substr(i,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: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, 1 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: candidate expects 2 arguments, 1 provided
/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, 1 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, 1 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:7: note: candidate expects 2 arguments, 1 provided
/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:7: note: candidate expects 2 arguments, 1 provided
/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, 1 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, 1 provided
/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]'
2007 | insert(size_type __pos, const _CharT* __s)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:2007:7: note: candidate expects 2 arguments, 1 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, 1 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:7: note: candidate expects 2 arguments, 1 provided
|
s373427427 | p03854 | C++ | #include<iostream>
#include<fstream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<string>
#include<cstring>
#include<cstdlib>
using namespace std;
string s,st;
void digui(int w)
{
if(s[w]=='e')
{
st="";
for(int i=w;i<=min(w+4,s.size()-1);i++)
{
st+=s[i];
}
if(st=="erase")
{
if(w+4==s.size()-1)
{
cout<<"YES";
exit(0);
}
if(s[w+5]=='r')
{
if(w+5==s.size()-1)
{
cout<<"YES";
exit(0);
}
digui(w+5+1);
}
else
{
digui(w+4+1);
}
}
else
return ;
}
if(s[w]=='d')
{
st="";
for(int i=w;i<=min(w+4,s.size()-1);i++)
{
st+=s[i];
}
if(st=="dream")
{
if(w+4==s.size()-1)
{
cout<<"YES";
exit(0);
}
if(s[w+5]=='r')
{
if(w+5==s.size()-1)
{
cout<<"YES";
exit(0);
}
digui(w+5+1);
}
else
{
digui(w+4+1);
}
}
else
return ;
}
}
int main()
{
cin>>s;
if(s[0]!='d'&&s[0]!='e')
{
cout<<"NO";
return 0;
}
digui(0);
cout<<"NO";
return 0;
} | a.cc: In function 'void digui(int)':
a.cc:17:35: error: no matching function for call to 'min(int, std::__cxx11::basic_string<char>::size_type)'
17 | for(int i=w;i<=min(w+4,s.size()-1);i++)
| ~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed:
a.cc:17:35: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'})
17 | for(int i=w;i<=min(w+4,s.size()-1);i++)
| ~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:3:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
5686 | min(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
5696 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed:
a.cc:17:35: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
17 | for(int i=w;i<=min(w+4,s.size()-1);i++)
| ~~~^~~~~~~~~~~~~~~~
a.cc:48:35: error: no matching function for call to 'min(int, std::__cxx11::basic_string<char>::size_type)'
48 | for(int i=w;i<=min(w+4,s.size()-1);i++)
| ~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed:
a.cc:48:35: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'})
48 | for(int i=w;i<=min(w+4,s.size()-1);i++)
| ~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
5686 | min(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
5696 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed:
a.cc:48:35: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
48 | for(int i=w;i<=min(w+4,s.size()-1);i++)
| ~~~^~~~~~~~~~~~~~~~
|
s246309321 | p03854 | C++ | #define DBG 0 //submit 0
#define ll long long
#if DBG
#include <algorithm>
#include <array>
#include <ctime>
#include <cstdlib>
#include <string>
#include <vector>
#include <unordered_map>
#include <iostream>
#include <cmath>
#include <queue>
#include <numeric>
#else
#include <bits/stdc++.h>
#endif
using namespace std;
int main(){
string divide[4] = {"dream", "dreamer", "erase", "eraser"};
string S;
cin >> S;
queue<int> BFS;
bool flag = false;
BFS.push(0);
while(!BFS.empty()){ // キューが空になるまで続ける
int t = BFS.front();
BFS.pop();
if(t == S.size()){ // 最後まで切れたら成功
can = true;
break;
}
for(string s : divide){
if(S.substr(t, s.size()) == s){ // 切れたらとりあえず切ったことにしてみる
BFS.push(t + s.size());
}
}
}
cout << (flag ? "YES" : "NO") << endl;
//cout << ans << endl;
}
| a.cc: In function 'int main()':
a.cc:35:13: error: 'can' was not declared in this scope; did you mean 'tan'?
35 | can = true;
| ^~~
| tan
|
s248449891 | p03854 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
string S, T = "", "";
int i = 0;
cin >> S;
while (i < S.size()-1) {
if (S.at(i) == 'd' && S.at(i+1) == 'r' && S.at(i+2) == 'e' && S.at(i+3) == 'a' && S.at(i+4) == 'm') {
if (S.at(i+5) == 'e' && S.at(i+6) == 'r') {
if (S.at(i+7) == 'a' && S.at(i+8) == 's' && S.at(i+9) == 'e') {
if (S.at(i+10) == 'r') {
T += "dreameraser";
i += 10;
}
else {
T += "dreamerase";
i += 9;
}
}
else {
T += "dreamer";
i += 6;
}
}
else {
T += "dream";
i += 4;
}
}
else if (S.at(i) == 'e' && S.at(i+1) == 'r' && S.at(i+2) == 'a' && S.at(i+3) == 's' && S.at(i+4) == 'e') {
if (S.at(i+5) == 'r') {
T += "eraser";
i += 5;
}
else {
T += "erase";
i += 4;
}
}
else {
cout << "NO" << endl;
break;
}
}
if (S == T) {
cout << "YES" << endl;
}
} | a.cc: In function 'int main()':
a.cc:5:21: error: expected unqualified-id before string constant
5 | string S, T = "", "";
| ^~
|
s398936841 | p03854 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
String S, T = "", "";
int i = 0;
cin >> S;
while (i < S.size()-1) {
if (S.at(i) == 'd' && S.at(i+1) == 'r' && S.at(i+2) == 'e' && S.at(i+3) == 'a' && S.at(i+4) == 'm') {
if (S.at(i+5) == 'e' && S.at(i+6) == 'r') {
if (S.at(i+7) == 'a' && S.at(i+8) == 's' && S.at(i+9) == 'e') {
if (S.at(i+10) == 'r') {
T += "dreameraser";
i += 10;
}
else {
T += "dreamerase";
i += 9;
}
}
else {
T += "dreamer";
i += 6;
}
}
else {
T += "dream";
i += 4;
}
}
else if (S.at(i) == 'e' && S.at(i+1) == 'r' && S.at(i+2) == 'a' && S.at(i+3) == 's' && S.at(i+4) == 'e') {
if (S.at(i+5) == 'r') {
T += "eraser";
i += 5;
}
else {
T += "erase";
i += 4;
}
}
else {
cout << "NO" << endl;
break;
}
}
if (S == T) {
cout << "YES" << endl;
}
} | a.cc: In function 'int main()':
a.cc:5:3: error: 'String' was not declared in this scope
5 | String S, T = "", "";
| ^~~~~~
a.cc:7:10: error: 'S' was not declared in this scope
7 | cin >> S;
| ^
a.cc:13:13: error: 'T' was not declared in this scope
13 | T += "dreameraser";
| ^
a.cc:17:13: error: 'T' was not declared in this scope
17 | T += "dreamerase";
| ^
a.cc:22:11: error: 'T' was not declared in this scope
22 | T += "dreamer";
| ^
a.cc:27:9: error: 'T' was not declared in this scope
27 | T += "dream";
| ^
a.cc:33:9: error: 'T' was not declared in this scope
33 | T += "eraser";
| ^
a.cc:37:9: error: 'T' was not declared in this scope
37 | T += "erase";
| ^
a.cc:46:12: error: 'T' was not declared in this scope
46 | if (S == T) {
| ^
|
s454752861 | p03854 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
String S, T;
int i;
cin >> S;
while (i < S.size()-1) {
if (S.at(i) == 'd' && S.at(i+1) == 'r' && S.at(i+2) == 'e' && S.at(i+3) == 'a' && S.at(i+4) == 'm') {
if (S.at(i+5) == 'e' && S.at(i+6) == 'r') {
if (S.at(i+7) == 'a' && S.at(i+8) == 's' && S.at(i+9) == 'e') {
if (S.at(i+10) == 'r') {
T += "dreameraser";
i += 10;
}
else {
T += "dreamerase";
i += 9;
}
}
else {
T += "dreamer";
i += 6;
}
}
else {
T += "dream";
i += 4;
}
}
else if (S.at(i) == 'e' && S.at(i+1) == 'r' && S.at(i+2) == 'a' && S.at(i+3) == 's' && S.at(i+4) == 'e') {
if (S.at(i+5) == 'r') {
T += "eraser";
i += 5;
}
else {
T += "erase";
i += 4;
}
}
else {
cout << "NO" << endl;
break;
}
}
if (S == T) {
cout << "YES" << endl;
}
} | a.cc: In function 'int main()':
a.cc:5:3: error: 'String' was not declared in this scope
5 | String S, T;
| ^~~~~~
a.cc:7:10: error: 'S' was not declared in this scope
7 | cin >> S;
| ^
a.cc:13:13: error: 'T' was not declared in this scope
13 | T += "dreameraser";
| ^
a.cc:17:13: error: 'T' was not declared in this scope
17 | T += "dreamerase";
| ^
a.cc:22:11: error: 'T' was not declared in this scope
22 | T += "dreamer";
| ^
a.cc:27:9: error: 'T' was not declared in this scope
27 | T += "dream";
| ^
a.cc:33:9: error: 'T' was not declared in this scope
33 | T += "eraser";
| ^
a.cc:37:9: error: 'T' was not declared in this scope
37 | T += "erase";
| ^
a.cc:46:12: error: 'T' was not declared in this scope
46 | if (S == T) {
| ^
|
s547352222 | p03854 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(int argc, char const* argv[]) {
string S, current;
cin >> S;
S = reverse(S.begin(), S.end());
set<string> candidates{"maerd", "remaerd", "esare", "resare"};
while (S.size() > 0) {
if (S.size() >= 5 && candidates.find(S.substr(0, 5)) != candidates.end()) {
S = S.substr(5);
continue;
}
if (S.size() >= 6 && S.substr(0, 6) == get<3>(candidates)) {
S = S.substr(6);
continue;
}
if (S.size() >= 7 && S.substr(0, 7) == get<1>(candidates)) {
S = S.substr(7);
continue;
}
cout << "NO" << endl;
return 0;
}
if (S.size() == 0) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
return 0;
}
| a.cc: In function 'int main(int, const char**)':
a.cc:7:33: error: no match for 'operator=' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'void')
7 | S = reverse(S.begin(), S.end());
| ^
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:941:8: 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>::operator=(const _Tp&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
941 | operator=(const _Tp& __svt)
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:941:8: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/basic_string.h: In 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 = void; _Res = std::__cxx11::basic_string<char>&; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]':
/usr/include/c++/14/bits/basic_string.h:941:8: 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>::operator=(const _Tp&) [with _Tp = void]'
a.cc:7:33: required from here
7 | S = reverse(S.begin(), S.end());
| ^
/usr/include/c++/14/bits/basic_string.h:152:70: error: forming reference to void
152 | __not_<is_convertible<const _Tp&, const _CharT*>>>::value,
| ^~~~~
/usr/include/c++/14/bits/basic_string.h:817:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
817 | operator=(const basic_string& __str)
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:817:37: note: no known conversion for argument 1 from 'void' to 'const std::__cxx11::basic_string<char>&'
817 | operator=(const basic_string& __str)
| ~~~~~~~~~~~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:828:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const _CharT*) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
828 | operator=(const _CharT* __s)
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:828:31: note: no known conversion for argument 1 from 'void' to 'const char*'
828 | operator=(const _CharT* __s)
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/basic_string.h:840:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(_CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
840 | operator=(_CharT __c)
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:840:24: note: no known conversion for argument 1 from 'void' to 'char'
840 | operator=(_CharT __c)
| ~~~~~~~^~~
/usr/include/c++/14/bits/basic_string.h:858:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
858 | operator=(basic_string&& __str)
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:858:32: note: no known conversion for argument 1 from 'void' to 'std::__cxx11::basic_string<char>&&'
858 | operator=(basic_string&& __str)
| ~~~~~~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:926:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(std::initializer_list<_Tp>) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
926 | operator=(initializer_list<_CharT> __l)
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:926:42: note: no known conversion for argument 1 from 'void' to 'std::initializer_list<char>'
926 | operator=(initializer_list<_CharT> __l)
| ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
a.cc:15:50: error: no matching function for call to 'get<3>(std::set<std::__cxx11::basic_string<char> >&)'
15 | if (S.size() >= 6 && S.substr(0, 6) == get<3>(candidates)) {
| ~~~~~~^~~~~~~~~~~~
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:1250:5: note: candidate: 'template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type& std::get(pair<_Tp1, _Tp2>&)'
1250 | get(pair<_Tp1, _Tp2>& __in) noexcept
| ^~~
/usr/include/c++/14/bits/stl_pair.h:1250:5: note: template argument deduction/substitution failed:
a.cc:15:50: note: 'std::set<std::__cxx11::basic_string<char> >' is not derived from 'std::pair<_Tp1, _Tp2>'
15 | if (S.size() >= 6 && S.substr(0, 6) == get<3>(candidates)) {
| ~~~~~~^~~~~~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1255:5: note: candidate: 'template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&& std::get(pair<_Tp1, _Tp2>&&)'
1255 | get(pair<_Tp1, _Tp2>&& __in) noexcept
| ^~~
/usr/include/c++/14/bits/stl_pair.h:1255:5: note: template argument deduction/substitution failed:
a.cc:15:50: note: 'std::set<std::__cxx11::basic_string<char> >' is not derived from 'std::pair<_Tp1, _Tp2>'
15 | if (S.size() >= 6 && S.substr(0, 6) == get<3>(candidates)) {
| ~~~~~~^~~~~~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1260:5: note: candidate: 'template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr const typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type& std::get(const pair<_Tp1, _Tp2>&)'
1260 | get(const pair<_Tp1, _Tp2>& __in) noexcept
| ^~~
/usr/include/c++/14/bits/stl_pair.h:1260:5: note: template argument deduction/substitution failed:
a.cc:15:50: note: 'std::set<std::__cxx11::basic_string<char> >' is not derived from 'const std::pair<_Tp1, _Tp2>'
15 | if (S.size() >= 6 && S.substr(0, 6) == get<3>(candidates)) {
| ~~~~~~^~~~~~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1265:5: note: candidate: 'template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr const typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&& std::get(const pair<_Tp1, _Tp2>&&)'
1265 | get(const pair<_Tp1, _Tp2>&& __in) noexcept
| ^~~
/usr/include/c++/14/bits/stl_pair.h:1265:5: note: template argument deduction/substitution failed:
a.cc:15:50: note: 'std::set<std::__cxx11::basic_string<char> >' is not derived from 'const std::pair<_Tp1, _Tp2>'
15 | if (S.size() >= 6 && S.substr(0, 6) == get<3>(candidates)) {
| ~~~~~~^~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
from /usr/include/c++/14/string:68:
/usr/include/c++/14/tuple:2445:5: note: candidate: 'template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >& std::get(tuple<_Elements ...>&)'
2445 | get(tuple<_Elements...>& __t) noexcept
| ^~~
/usr/include/c++/14/tuple:2445:5: note: template argument deduction/substitution failed:
a.cc:15:50: note: 'std::set<std::__cxx11::basic_string<char> >' is not derived from 'std::tuple<_Elements ...>'
15 | if (S.size() >= 6 && S.substr(0, 6) == get<3>(candidates)) {
| ~~~~~~^~~~~~~~~~~~
/usr/include/c++/14/tuple:2451:5: note: candidate: 'template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >& std::get(const tuple<_Elements ...>&)'
2451 | get(const tuple<_Elements...>& __t) noexcept
| ^~~
/usr/include/c++/14/tuple:2451:5: note: template argument deduction/substitution failed:
a.cc:15:50: note: 'std::set<std::__cxx11::basic_string<char> >' is not derived from 'const std::tuple<_Elements ...>'
15 | if (S.size() >= 6 && S.substr(0, 6) == get<3>(candidates)) {
| ~~~~~~^~~~~~~~~~~~
/usr/include/c++/14/tuple:2457:5: note: candidate: 'template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >&& std::get(tuple<_Elements ...>&&)'
2457 | get(tuple<_Elements...>&& __t) noexcept
| ^~~
/usr/include/c++/14/tuple:2457:5: note: template argument deduction/substitution failed:
a.cc:15:50: note: 'std::set<std::__cxx11::basic_string<char> >' is not derived from 'std::tuple<_Elements ...>'
15 | if (S.size() >= 6 && S.substr(0, 6) == get<3>(can |
s683571347 | p03854 | C++ | #include <bits/stdc++.h>
#define FOR(i, m, n) for (int i = m; i < (n); i++)
#define RFOR(i, m, n) for (int i = (m - 1); i >= 0; i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
int main() {
string s;
cin >> s;
if (regex_match(s), regex("(dream(er)?|(erase(r)?))*"))
cout << "YES" << endl;
else
cout << "NO" << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:18:18: error: no matching function for call to 'regex_match(std::string&)'
18 | if (regex_match(s), regex("(dream(er)?|(erase(r)?))*"))
| ~~~~~~~~~~~^~~
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:2261:5: note: candidate: 'template<class _Bi_iter, class _Alloc, class _Ch_type, class _Rx_traits> bool std::regex_match(_Bi_iter, _Bi_iter, __cxx11::match_results<_BiIter, _Alloc>&, const __cxx11::basic_regex<_CharT, _TraitsT>&, regex_constants::match_flag_type)'
2261 | regex_match(_Bi_iter __s,
| ^~~~~~~~~~~
/usr/include/c++/14/bits/regex.h:2261:5: note: candidate expects 4 arguments, 1 provided
/usr/include/c++/14/bits/regex.h:2288:5: note: candidate: 'template<class _Bi_iter, class _Ch_type, class _Rx_traits> bool std::regex_match(_Bi_iter, _Bi_iter, const __cxx11::basic_regex<_Ch_type, _Rx_traits>&, regex_constants::match_flag_type)'
2288 | regex_match(_Bi_iter __first, _Bi_iter __last,
| ^~~~~~~~~~~
/usr/include/c++/14/bits/regex.h:2288:5: note: candidate expects 3 arguments, 1 provided
/usr/include/c++/14/bits/regex.h:2313:5: note: candidate: 'template<class _Ch_type, class _Alloc, class _Rx_traits> bool std::regex_match(const _Ch_type*, __cxx11::match_results<const _Ch_type*, _Alloc>&, const __cxx11::basic_regex<_Ch_type, _Rx_traits>&, regex_constants::match_flag_type)'
2313 | regex_match(const _Ch_type* __s,
| ^~~~~~~~~~~
/usr/include/c++/14/bits/regex.h:2313:5: note: candidate expects 3 arguments, 1 provided
/usr/include/c++/14/bits/regex.h:2337:5: note: candidate: 'template<class _Ch_traits, class _Ch_alloc, class _Alloc, class _Ch_type, class _Rx_traits> bool std::regex_match(const __cxx11::basic_string<_Ch_type, _Ch_traits, _Ch_alloc>&, __cxx11::match_results<typename __cxx11::basic_string<_Ch_type, _Ch_traits, _Ch_alloc>::const_iterator, _Alloc>&, const __cxx11::basic_regex<_Ch_type, _Rx_traits>&, regex_constants::match_flag_type)'
2337 | regex_match(const basic_string<_Ch_type, _Ch_traits, _Ch_alloc>& __s,
| ^~~~~~~~~~~
/usr/include/c++/14/bits/regex.h:2337:5: note: candidate expects 3 arguments, 1 provided
/usr/include/c++/14/bits/regex.h:2351:5: note: candidate: 'template<class _Ch_traits, class _Ch_alloc, class _Alloc, class _Ch_type, class _Rx_traits> bool std::regex_match(const __cxx11::basic_string<_Ch_type, _Ch_traits, _Ch_alloc>&&, __cxx11::match_results<typename __cxx11::basic_string<_Ch_type, _Ch_traits, _Ch_alloc>::const_iterator, _Alloc>&, const __cxx11::basic_regex<_Ch_type, _Rx_traits>&, regex_constants::match_flag_type)' (deleted)
2351 | regex_match(const basic_string<_Ch_type, _Ch_traits, _Ch_alloc>&&,
| ^~~~~~~~~~~
/usr/include/c++/14/bits/regex.h:2351:5: note: candidate expects 3 arguments, 1 provided
/usr/include/c++/14/bits/regex.h:2373:5: note: candidate: 'template<class _Ch_type, class _Rx_traits> bool std::regex_match(const _Ch_type*, const __cxx11::basic_regex<_Ch_type, _Rx_traits>&, regex_constants::match_flag_type)'
2373 | regex_match(const _Ch_type* __s,
| ^~~~~~~~~~~
/usr/include/c++/14/bits/regex.h:2373:5: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/regex.h:2395:5: note: candidate: 'template<class _Ch_traits, class _Str_allocator, class _Ch_type, class _Rx_traits> bool std::regex_match(const __cxx11::basic_string<_Ch_type, _Ch_traits, _Str_allocator>&, const __cxx11::basic_regex<_CharT, _TraitsT>&, regex_constants::match_flag_type)'
2395 | regex_match(const basic_string<_Ch_type, _Ch_traits, _Str_allocator>& __s,
| ^~~~~~~~~~~
/usr/include/c++/14/bits/regex.h:2395:5: note: candidate expects 2 arguments, 1 provided
|
s738102409 | p03854 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD = 1000000007;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define ALL(a) begin(a),end(a)
#define COUNTOF(a) (sizeof(a)/sizeof(a[0]))
template<class T> istream& operator >> (istream& s, vector<T>& v)
{ for (T& x: v) { s >> x; } return s;}
template<class T> void cout_v(const vector<T>& c)
{ for (int i = 0; i < c.size(); i++) cout << c[i] << endl; }
template<class K, class V> void cout_v(map<K, V>& m)
{ for(auto it=m.begin();it!=m.end();it++)cout<<it->first<<":"<<it->second<<endl;}
template<class T> void cout_h(const vector<T>& c)
{ for (int i = 0; i < c.size(); i++) cout << c[i] << (i==c.size()-1?"\n":" "); }
template<class T> inline bool chmin(T& a, T b) {return a>b?a=b,true:false;}
template<class T> inline bool chmax(T& a, T b) {return a<b?a=b,true:false;}
inline int powi(int x,int y) {int p=1; while(y--) p*=x; return p;}
template<class T> inline bool is_overlap(const T& a, const T& b, const T& p, const T& q)
{ return p <=b && a <= q; }
#define SP << " " <<
#define FMT(a) #a<<":"<<a
#define FMT2(a,b) #a<<":"<<a<<", "<<#b<<":"<<b
#define FMT3(a,b,c) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c
#define FMT4(a,b,c,d) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c<<", "<<#d<<":"<<d
#define ANS(a) cout<<a<<endl
void yes(bool f){cout<<(f?"yes":"no")<<endl;}
void Yes(bool f){cout<<(f?"Yes":"No")<<endl;}
void YES(bool f){cout<<(f?"YES":"NO")<<endl;}
inline template<class T> void sort_uniq(T& c) { sort(ALL(c)); c.erase(unique(ALL(c)), c.end()); }
int main()
{
cin.tie(0); ios::sync_with_stdio(false);
//cout<<std::fixed<<std::setprecision(10);
string S; cin >>S;
vector<string> words = {"dream", "dreamer", "erase", "eraser" };
deque<int> q = { 0 };
while (q.size() != 0) {
int p = q.front(); q.pop_front();
vector<int> uniq;
for (auto& w: words) {
if (S.substr(p, w.size()) == w) {
int next_p = p + w.size();
if (next_p == S.size()) {
YES(true);
return 0;
} else {
uniq.push_back(next_p);
}
}
}
sort_uniq(uniq);
q.insert(q.end(), ALL(uniq));
}
YES(false);
}
| a.cc:31:16: error: expected unqualified-id before '<' token
31 | inline template<class T> void sort_uniq(T& c) { sort(ALL(c)); c.erase(unique(ALL(c)), c.end()); }
| ^
a.cc:31:98: error: expected ';' before 'int'
31 | inline template<class T> void sort_uniq(T& c) { sort(ALL(c)); c.erase(unique(ALL(c)), c.end()); }
| ^
| ;
32 |
33 | int main()
| ~~~
|
s999499820 | p03854 | C++ | #include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; };
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; };
string divide[4] = { "dream","dreamer","erase","eraser" };
int main() {
string s;
cin >> s;
reverse(s.begin(), s.end());
for (int i = 0;i < 4;++i)reverse(divide[i].begin(), divide[i].end());
bool can = true;
for (int i = 0;i < s.size();++i) {
bool can2 = false;
for (int j = 0;j < 4;++j) {
string d = divide[j];
if (s.substr(i, d.size()) == d) {
can2 = true;
i += d.size();
}
}
}
if (!can2) {
can = false;
break;
}
if (can)cout << "YES" << endl;
else cout << "NO" << endl;
} | a.cc: In function 'int main()':
a.cc:27:14: error: 'can2' was not declared in this scope; did you mean 'can'?
27 | if (!can2) {
| ^~~~
| can
a.cc:29:17: error: break statement not within loop or switch
29 | break;
| ^~~~~
|
s037848995 | p03854 | C++ | #include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
string divide[4] = { "dream","dreamer","erase","eraser" };
int main() {
string s;
cin >> s;
reverse(s.begin(), s.end());
for (int i = 0;i < 4;++i)reverse(divide[i].begin(), divide[i].end());
bool can = true;
for (int i = 0;i < s.size();++i) {
bool can2 = false;
for (int j = 0;j < 4;++j) {
string d = divide[j];
if (s.substr(i, d.size()) == d) {
can2 = true;
i += d.size();
}
}
}
if (!can2) {
can = false;
break;
}
if (can)cout << "YES" << endl;
else cout << "NO" << endl;
} | a.cc: In function 'int main()':
a.cc:27:14: error: 'can2' was not declared in this scope; did you mean 'can'?
27 | if (!can2) {
| ^~~~
| can
a.cc:29:17: error: break statement not within loop or switch
29 | break;
| ^~~~~
|
s940303958 | p03854 | C++ | #include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
string divide[4]={"dream","dreamer","erase","eraser"}
int main() {
string s;
cin >> s;
reverse(s.begin(), s.end());
for (int i = 0;i < 4;++i)reverse(divide[i].begin(), divide[i].end());
bool can = true;
for (int i = 0;i < s.size();++i) {
bool can2 = false;
for (int j = 0;j < 4;++j) {
string d = divide[j];
if (s.substr(i, d.size()) == d) {
can2 = true;
i += d.size();
}
}
}
if (!can2) {
can = false;
break;
}
if (can)cout << "YES" << endl;
else cout << "NO" << endl;
} | a.cc:10:1: error: expected ',' or ';' before 'int'
10 | int main() {
| ^~~
|
s179134359 | p03854 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
string s, t;
cin >> s;
t = "";
while (t.size() < s.size()) {
if (s.at(t.size()) == 'd' && s.at(t.size()+1) == 'r' && s.at(t.size()+2) == 'e' && s.at(t.size()+3) == 'a' && s.at(t.size()+4) == 'm') {
if (s.at(t.size()+5) == 'e' && s.at(t.size()+6) == 'r')
t += "dreamer";
else
t += "dream";
}
else if (s.at(t.size()) == 'e' && s.at(t.size()+1) == 'r' && s.at(t.size()+2) == 'a' && s.at(t.size()+3) == 's' && s.at(t.size()+4) == 'e') {
if (s.at(t.size())+5 == 'r')
t += "eraser";
else
t += "erase";
}
else {
cout << "NO" << endl;
}
if (t == s)
cout << "YES" << endl;
} | a.cc: In function 'int main()':
a.cc:26:2: error: expected '}' at end of input
26 | }
| ^
a.cc:4:11: note: to match this '{'
4 | int main(){
| ^
|
s808323797 | p03854 | C++ | #include <iostream>
#icnlude <vector>
using namespace std;
int main(){
string s;
cin >> s;
int p = s.size();
string v[4] = {"dream", "dreamer", "erase", "eraser"};
bool f = true;
while(p != 0){
bool matched = false;
for(int i = 0; i < v.size(); i++){
if(s.substr(p-v[i].size(), v[i].size) == v[i]){
matched = true;
p -= v[i].size;
}
}
if(!matched){
break;
f = false;
}
}
if(f) cout << "YES";
else cout << "NO";
} | a.cc:2:2: error: invalid preprocessing directive #icnlude; did you mean #include?
2 | #icnlude <vector>
| ^~~~~~~
| include
a.cc: In function 'int main()':
a.cc:14:26: error: request for member 'size' in 'v', which is of non-class type 'std::string [4]' {aka 'std::__cxx11::basic_string<char> [4]'}
14 | for(int i = 0; i < v.size(); i++){
| ^~~~
a.cc:15:39: error: invalid use of non-static 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]'
15 | if(s.substr(p-v[i].size(), v[i].size) == v[i]){
| ~~~~~^~~~
In file included from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:1076:7: note: declared here
1076 | size() const _GLIBCXX_NOEXCEPT
| ^~~~
a.cc:17:19: 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 '()' ?)
17 | p -= v[i].size;
| ~~~~~^~~~
| ()
|
s934281807 | p03854 | Java | import java.util.*;
public class Main {
public static void main(String[] args) {
try(Scanner sc = new Scanner(System.in);) {
String src = sc.nextLine();
String res = src.replaceAll(word, "dream").replaceAll(word, "dreamer").replaceAll(word, "erase").replaceAll(word, "eraser");
System.out.println(res.length() == 0 ? "YES" : "NO");
}
}
} | Main.java:7: error: cannot find symbol
String res = src.replaceAll(word, "dream").replaceAll(word, "dreamer").replaceAll(word, "erase").replaceAll(word, "eraser");
^
symbol: variable word
location: class Main
Main.java:7: error: cannot find symbol
String res = src.replaceAll(word, "dream").replaceAll(word, "dreamer").replaceAll(word, "erase").replaceAll(word, "eraser");
^
symbol: variable word
location: class Main
Main.java:7: error: cannot find symbol
String res = src.replaceAll(word, "dream").replaceAll(word, "dreamer").replaceAll(word, "erase").replaceAll(word, "eraser");
^
symbol: variable word
location: class Main
Main.java:7: error: cannot find symbol
String res = src.replaceAll(word, "dream").replaceAll(word, "dreamer").replaceAll(word, "erase").replaceAll(word, "eraser");
^
symbol: variable word
location: class Main
4 errors
|
s489441221 | p03854 | Java | import java.util.*;
public class Main {
public static void main(String[] args) {
final List<String> wordPoolReversed = Arrays.asList("dream", "dreamer", "erase", "eraser");
try(Scanner sc = new Scanner(System.in);) {
String src = sc.nextLine();
wordList.forEach(word -> {
src.replaceAll("word", "");
});
System.out.println(src.length() == 0 ? "YES" : "NO");
}
}
} | Main.java:8: error: cannot find symbol
wordList.forEach(word -> {
^
symbol: variable wordList
location: class Main
1 error
|
s384043266 | p03854 | Java | import java.util.*;
public class Main {
public static void main(String[] args) {
final List<String> wordPoolReversed = {"maerd", "remaerd", "esare", "resare"};
try(Scanner sc = new Scanner(System.in);) {
StringBuilder srcReversedStringBuilder = new StringBuilder().append(sc.nextLine());
String srcReversed = srcReversedStringBuilder.reverse().toString();
boolean canCompose = true;
for (int i = 0; i < srcReversed.length() - 2; i++) {
boolean canDevide = false;
for (String word : wordPoolReversed) {
if (word.equals(srcReversed.substring(i, word.length()))) {
canDevide = true;
i += word.length();
}
}
if (!canDevide) {
canCompose = false;
break;
}
}
System.out.println(canCompose ? "YES" : "NO");
}
}
} | Main.java:5: error: illegal initializer for List<String>
final List<String> wordPoolReversed = {"maerd", "remaerd", "esare", "resare"};
^
1 error
|
s381735142 | p03854 | Java | public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String S = sc.next();
S = S.replace("eraser", "").replace("erase", "").replace("dreamer", "").replace("dream", "");
if (S.length() == 0) {
System.out.println("YES");
} else {
System.out.println("NO");
}
}
} | Main.java:3: error: cannot find symbol
Scanner sc = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
Main.java:3: error: cannot find symbol
Scanner sc = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
2 errors
|
s498644008 | p03854 | Java | class Main {
public static void main(String[] args) {
String[] strs = {
"dream",
"dreamer",
"erase",
"eraser"
};
Scanner sc = new Scanner(System.in);
String S = sc.next();
while (true) {
boolean endsWithStr = false;
for (String str: strs) {
if (S.endsWith(str)) {
endsWithStr = true;
S = S.substring(0, S.length() - str.length());
break;
}
}
if (!endsWithStr) {
System.out.println("NO");
break;
}
if (S.length() <= 0) {
System.out.println("YES");
break;
}
}
}
} | Main.java:9: error: cannot find symbol
Scanner sc = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
Main.java:9: error: cannot find symbol
Scanner sc = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
2 errors
|
s354635640 | p03854 | Java | class Main {
static String[] strs = {
"dream",
"dreamer",
"erase",
"eraser"
};
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String S = sc.next();
while (true) {
boolean endsWithStr = false;
for (String str: strs) {
if (S.endsWith(str)) {
endsWithStr = true;
S = S.substring(0, S.length() - str.length());
break;
}
}
if (!endsWithStr) {
System.out.println("NO");
break;
}
if (S.length() <= 0) {
System.out.println("YES");
break;
}
}
}
} | Main.java:10: error: cannot find symbol
Scanner sc = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
Main.java:10: error: cannot find symbol
Scanner sc = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
2 errors
|
s362830251 | p03854 | Java | public class Main {
static String[] strs = {"dream", "dreamer", "erase", "eraser"};
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
String S = sc.next();
while (true) {
boolean endsWithStr = false;
for (String str: strs) {
if (S.endsWith(str)) {
endsWithStr = true;
S = S.substring(0, S.length() - str.length());
break;
}
}
if (!endsWithStr) {
System.out.println("NO");
break;
}
if (S.length() <= 0 ) {
System.out.println("YES");
break;
}
}
}
} | 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
|
s852173679 | p03854 | C++ | #include<iostream>
#include<string>
#include<algorithm>
using namespace std;
#define rep(i,n) for (int (i)=0;(i)<(n);(i)++)
typedef long long ll;
int main(){
string hantei[4] = {"dream","dreamer","erase","eraser"};
string S;
bool can = true;
cin >> S;
reverse(S.begin(),S.end());
rep(i,4) reverse(hantei[i].begin(),hantei[i].end());
for(int i=0;i<S.size();){
bool can2 = false;
rep(j,4){
if (S.substr(i,hantei[j].size) == hantei[j]){
can2 = true;
i += hantei[j].size();
break;
}
}
if (!can2){
can = false;
break;
}
}
if (can) cout << "YES" << endl;
else cout << "NO" << endl;
} | a.cc: In function 'int main()':
a.cc:19:38: error: invalid use of non-static 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]'
19 | if (S.substr(i,hantei[j].size) == hantei[j]){
| ~~~~~~~~~~^~~~
In file included from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:1076:7: note: declared here
1076 | size() const _GLIBCXX_NOEXCEPT
| ^~~~
|
s412904069 | p03854 | C++ | #include<iostream>
#include<string>
#include<algorithm>
using namespace std;
#define rep(i,n) for (int (i)=0;(i)<(n);(i)++)
typedef long long ll;
int main(){
string hantei[4] = {"dream","dreamer","erase","eraser"};
string S;
bool can = true;
cin >> S;
reverse(S.begin(),S.end());
rep(i,4) reverse(hantei[i].begin(),hantei[i].end());
for(int i=0;i<S.size();){
bool can2 = false;
rep(j,4){
if (S.substr == i,hantei[j].size()){
can2 = true;
i += hantei[j].size();
break;
}
}
if (!can2){
can = false;
break;
}
}
if (can) cout << "YES" << endl;
else cout << "NO" << endl;
} | a.cc: In function 'int main()':
a.cc:19:19: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::substr(size_type, size_type) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
19 | if (S.substr == i,hantei[j].size()){
| ~~^~~~~~
|
s093359316 | p03854 | Java | import java.util.Scanner;
import java.util.Arrays;
public class Main{
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
String S = scan.next();
StringBuffer S1 = new StringBuffer(S);
String S2 = S1.reverse().toString();
int flag = 0;
String error = "NO";
int a = 0;
String[] T = {"dream" ,"dreamer" ,"erase" ,"eraser"};
for(int i = 0 ; i < T.length ; i++){
StringBuffer T1 = new StringBuffer(T[i]);
String T2 = T1.reverse().toString();
T[i] = T2;
}
do{
for(int i = 0 ; i < T.length ; i++){
if(S2.length() >= T[i].length() && S2.substring(0,T[i].length()).equals(T[i])){
if(S2.length() == T[i].length()){
flag = 1;
error = "YES";
break;
}
else{
// S2 = S2.substring((T[i].length()));
S2 = S2.delete(0,(T[i].length()));
flag = 0;
break;
}
}
else{
flag = 1;
error = "NO";
}
}
}while(flag == 0);
System.out.println(error);
}
} | Main.java:35: error: cannot find symbol
S2 = S2.delete(0,(T[i].length()));
^
symbol: method delete(int,int)
location: variable S2 of type String
1 error
|
s149315691 | p03854 | Java | import java.util.Scanner;
import java.util.Arrays;
public class Main{
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
String S = scan.next();
StringBuffer S1 = new StringBuffer(S);
String S2 = S1.reverse().toString();
int flag = 0;
String error = "NO";
int a = 0;
String[] T = {"dream" ,"dreamer" ,"erase" ,"eraser"};
for(int i = 0 ; i < T.length ; i++){
StringBuffer T1 = new StringBuffer(T[i]);
String T2 = T1.reverse().toString();
T[i] = T2;
}
do{
for(int i = 0 ; i < T.length ; i++){
if(S2.length() >= T[i].length() && S2.substring(0,T[i].length()).equals(T[i])){
if(S2.length() == T[i].length()){
flag = 1;
error = "YES";
break;
}
else{
// S2 = S2.substring((T[i].length()));
S2 = S2.delte(0,(T[i].length()));
flag = 0;
break;
}
}
else{
flag = 1;
error = "NO";
}
}
}while(flag == 0);
System.out.println(error);
}
} | Main.java:35: error: cannot find symbol
S2 = S2.delte(0,(T[i].length()));
^
symbol: method delte(int,int)
location: variable S2 of type String
1 error
|
s538888473 | p03854 | Java | import java.util.Scanner;
import java.util.Arrays;
public class C049{
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
String S = scan.next();
StringBuffer S1 = new StringBuffer(S);
String S2 = S1.reverse().toString();
int flag = 0;
String error = "NO";
int a = 0;
String[] T = {"dream" ,"dreamer" ,"erase" ,"eraser"};
for(int i = 0 ; i < T.length ; i++){
StringBuffer T1 = new StringBuffer(T[i]);
String T2 = T1.reverse().toString();
T[i] = T2;
}
// System.out.println(Arrays.toString(T));
do{
a = a + 1;
// System.out.println(a);
for(int i = 0 ; i < T.length ; i++){
if(S2.length() >= T[i].length() && S2.substring(0,T[i].length()).equals(T[i])){
// System.out.println(S2.length());
// System.out.println(T[i].length());
if(S2.length() == T[i].length()){
// System.out.println(S2.length());
// System.out.println(T[i].length());
flag = 1;
error = "YES";
break;
}
else{
S2 = S2.substring((T[i].length()));
// System.out.println(S2);
flag = 0;
break;
}
}
else{
flag = 1;
error = "NO";
// System.out.println("MISS");
}
}
}while(flag == 0);
System.out.println(error);
}
} | Main.java:4: error: class C049 is public, should be declared in a file named C049.java
public class C049{
^
1 error
|
s847687621 | p03854 | Java | //第 4 問: ABC 087 B - Coinsi (200 点)
import java.util.Scanner;
public class ABC049C{
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
String S = scan.next();
StringBuilder sb = new StringBuilder();
sb.append(S);
/*
String A = "";
String B = "";
String C = "";
*/
while(true) {
int counter = sb.length();
if (counter > 7) {
if (sb.substring(0,8).equals("dreamera")){
sb = sb.delete(0,5);
}
else if(sb.substring(0,7).equals("dreamer")){
sb = sb.delete(0,6);
}
else if(S.substring(0,6).equals("eraser")){
sb = sb.delete(0,5);
}
else if ((sb.substring(0,5).equals("dream")) || (sb.substring(0,5).equals("erase"))) {
sb = sb.delete(0,5);
}
else {
System.out.println("NO");
//System.out.println("A");
break;
}
//System.out.println(sb);
}
else if (counter == 7) {
if(sb.toString().equals("dreamer")) {
System.out.println("YES");
break;
}
else {
System.out.println("NO");
//System.out.println("B");
break;
}
}
else if (counter == 6) {
if(sb.toString().equals("eraser")) {
System.out.println("YES");
break;
}
else {
System.out.println("NO");
//System.out.println("C");
break;
}
}
else if (counter == 5) {
if ((sb.toString().equals("dream")) || (sb.toString().equals("erase"))) {
System.out.println("YES");
break;
}
else{
System.out.println("NO");
//System.out.println("D");
break;
}
}
else {
System.out.println("NO");
//System.out.println("E");
break;
}
//System.out.println(sb);
}
}
}
| Main.java:5: error: class ABC049C is public, should be declared in a file named ABC049C.java
public class ABC049C{
^
1 error
|
s060121211 | p03854 | Java | import java.util.Scanner;
public class Atcoder9 {
public static void main(String[] args) {
// Scanner sc = new Scanner(System.in);
// String S = sc.next();
//
// String[] strList = {"eraser", "erase", "dreamer", "dream"};
// for (String str : strList) {
// S = S.replace(str, "");
// if (S.isEmpty()) {
// System.out.print("YES");
// return;
// }
// }
//
// System.out.print("NO");
Scanner sc = new Scanner(System.in);
String S = sc.next();
S = S.replaceAll("dreamer", "-");
S = S.replaceAll("dreame", "-");
S = S.replaceAll("eraser", "-");
S = S.replaceAll("erase", "-");
S = S.replaceAll("-", "");
if (S.length() == 0)
System.out.println("YES");
else
System.out.println("NO");
}
} | Main.java:3: error: class Atcoder9 is public, should be declared in a file named Atcoder9.java
public class Atcoder9 {
^
1 error
|
s848028643 | p03854 | Java | import java.util.*;
class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
String S = sc.next();
S=S.replaceAll("eraser","-");
S=S.replaceAll("erase","-");
S=S.replaceAll("dreamer","-");
S=S.replaceAll("dream","-");
S=S.replaceAll("-","");
if(S.length()==0){
System.out.println("YES");
}else{
System.out.println("NO")
}
}
} | Main.java:16: error: ';' expected
System.out.println("NO")
^
1 error
|
s808305726 | p03854 | C++ | #include <iostream>
#include <string>
#include <algorithm>
using namespace std;
string divide[4] = {"dream", "dreamer", "erase", "sraser"};
int main() {
string S;
cin >> S;
reverse(S.begin(),S.end());
for (int i = 0; i < 4; ++i) reverse(divide[i].begin(), divide[i].end());
bool can = true;
for (int i = 0; i < S.size();) {
bool can2 = false;
for (int j = 0; j < 4; ++j) {
string d = divide[j];
if (S.substr(i,d.size()) == d) {
can2 = true;
i += d.size();
}
}
if (!can2) {
can = false;
break;
}
}
if (can) cout << "YES" << endl;
elce cout << "NO" << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:31:5: error: 'elce' was not declared in this scope
31 | elce cout << "NO" << endl;
| ^~~~
|
s780701335 | p03854 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
bool flag;
string S;
string T[4] = {"dream", "dreamer", "erase", "eraser"};
cin >> S;
reverse(S.begin(), S.end());
for(int i = 0;i < S.size();i++){
flag = false;
for(int j = 0;j < 4;j++){
if(substr(0,T[j].size()) == T[j]){
i += T[j].size();
flag = true;
}
}
if(!flag){
flag = false;
break;
}
}
if(flag){
cout << "Yes" << endl;
}else{
cout << "No"<< endl;
}
}
| a.cc: In function 'int main()':
a.cc:15:10: error: 'substr' was not declared in this scope; did you mean 'strstr'?
15 | if(substr(0,T[j].size()) == T[j]){
| ^~~~~~
| strstr
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.