submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3 values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s908987545 | p03854 | C++ | if(i+1<n && s[i+1]=='r')
i+=2;
if(i!=n && s[i]=='a')
i-=2;
}
}
else
{
return "NO";
}
}
return "YES";
}
int main()
{
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
ios_base::sync_with_stdio(0); ///cant use scanf, printf
cin.tie(0);cout.tie(0); /// no longer auto flush cout before each cin, remove for interactive
//cout << fixed << setprecision(11); /// no scientific output
ll test=1;
cin>>test;
while(test--)
{
cout<<vfun()<<endl;
// if(vfun())
// cout<<"YES\n";
// else
// cout<<"NO\n";
}
}
///before sub
/// check for value of zero and single input in array
///loop vars,1LL in mult, equal, one, bounds, int v ll, endl, finish taking inputs
/// check whether test cases are given or not
| a.cc:1:7: error: expected unqualified-id before 'if'
1 | if(i+1<n && s[i+1]=='r')
| ^~
a.cc:3:25: error: expected unqualified-id before 'if'
3 | if(i!=n && s[i]=='a')
| ^~
a.cc:5:21: error: expected declaration before '}' token
5 | }
| ^
a.cc:6:17: error: expected declaration before '}' token
6 | }
| ^
a.cc:7:17: error: expected unqualified-id before 'else'
7 | else
| ^~~~
a.cc:11:13: error: expected declaration before '}' token
11 | }
| ^
a.cc:12:9: error: expected unqualified-id before 'return'
12 | return "YES";
| ^~~~~~
a.cc:13:1: error: expected declaration before '}' token
13 | }
| ^
a.cc: In function 'int main()':
a.cc:18:31: error: 'stdin' was not declared in this scope
18 | freopen("input.txt", "r", stdin);
| ^~~~~
a.cc:1:1: note: 'stdin' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
+++ |+#include <cstdio>
1 | if(i+1<n && s[i+1]=='r')
a.cc:18:5: error: 'freopen' was not declared in this scope
18 | freopen("input.txt", "r", stdin);
| ^~~~~~~
a.cc:19:32: error: 'stdout' was not declared in this scope
19 | freopen("output.txt", "w", stdout);
| ^~~~~~
a.cc:19:32: note: 'stdout' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
a.cc:21:5: error: 'ios_base' has not been declared
21 | ios_base::sync_with_stdio(0); ///cant use scanf, printf
| ^~~~~~~~
a.cc:22:5: error: 'cin' was not declared in this scope
22 | cin.tie(0);cout.tie(0); /// no longer auto flush cout before each cin, remove for interactive
| ^~~
a.cc:22:16: error: 'cout' was not declared in this scope
22 | cin.tie(0);cout.tie(0); /// no longer auto flush cout before each cin, remove for interactive
| ^~~~
a.cc:24:5: error: 'll' was not declared in this scope
24 | ll test=1;
| ^~
a.cc:25:10: error: 'test' was not declared in this scope
25 | cin>>test;
| ^~~~
a.cc:28:19: error: 'vfun' was not declared in this scope
28 | cout<<vfun()<<endl;
| ^~~~
a.cc:28:27: error: 'endl' was not declared in this scope
28 | cout<<vfun()<<endl;
| ^~~~
|
s315419759 | 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;
for(int j = 0; j < 4; j++){
string d = divide[j];
if(s.substr(i, d.size()) == d){
can 2 = 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:12: error: expected ';' before numeric constant
19 | can 2 = true;
| ^~
| ;
a.cc:20:11: error: no match for 'operator+=' (operand types are 'int' and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
20 | i += d,size();
| ~~^~~~
a.cc:20:20: error: no matching function for call to 'size()'
20 | i += d,size();
| ~~~~^~
In file included from /usr/include/c++/14/string:53,
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/range_access.h:262:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
262 | size(const _Container& __cont) noexcept(noexcept(__cont.size()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note: candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/range_access.h:272:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
272 | size(const _Tp (&)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidate expects 1 argument, 0 provided
|
s025350427 | p03854 | C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main()
{
int s, i, l = 0, a1, a2, a3, cop;
char a11[6] = { "dream" };
char a22[8] = { "dreamer" };
char a33[6] = { "erase" };
char a44[7] = { "eraser" };
char word[10001];
char* si = word;
for(cop = 0; cop == 1;){
cop = scanf("%s",si);
}
s = strlen(si);
if (s < 6) {
printf("NO");
exit(0);
}
for (i = 0; i < s; i++) {
a1 = i % 6;
a2 = i % 7;
a3 = i % 8;
if (word[i] == a11[a1] || word[i] == a33[a1]) {
word[i] = '@';
}
if (word[i] == a22[a3] || word[i] == a44[a2]) {
if (a3 == 6 && word[i + 1] != 'r' || a2 == 5 && word[i+1] != 'r') {
printf("NO");
exit(0);
}
word[i] = '@';
}
}
for (i = 0; i < s; i++) {
if (word[i] == '@') {
l = 1;
}
else {
l = 0;
}
}
if (l == 1) {
printf("YES");
}
else {
printf("NO");
| main.c: In function 'main':
main.c:48:17: error: expected declaration or statement at end of input
48 | printf("NO");
| ^~~~~~
main.c:48:17: error: expected declaration or statement at end of input
|
s362188710 | p03854 | C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main()
{
int s, i, l = 0, a1, a2, a3, cop;
char a11[6] = { "dream" };
char a22[8] = { "dreamer" };
char a33[6] = { "erase" };
char a44[7] = { "eraser" };
char word[10001];
char* si = word;
for(cop = 0; cop == 1;;){
cop = scanf("%s",si);
}
s = strlen(si);
if (s < 5) {
printf("NO");
exit(0);
}
for (i = 0; i < s; i++) {
a1 = i % 6;
a2 = i % 7;
a3 = i % 9;
if (word[i] == a11[a1] || word[i] == a33[a1]) {
word[i] = '@';
}
if (word[i] == a22[a3] || word[i] == a44[a2]) {
if (a3 == 7 && word[i + 1] != 'r' || a2 == 6 && word[i+1] != 'r') {
printf("NO");
exit(0);
}
word[i] = '@';
}
}
for (i = 0; i < s; i++) {
if (word[i] == '@') {
l = 1;
}
else {
l = 0;
}
}
if (l == 1) {
printf("YES");
}
else {
printf("NO");
}
} | main.c: In function 'main':
main.c:13:25: error: expected expression before ';' token
13 | for(cop = 0; cop == 1;;){
| ^
|
s258917997 | p03854 | C | #include<stdio.h>
#include<string.h>
int main(){
char S[];
//scanf("%s",S);
fgets(S);
int length = strlen(S);
int i,frag = 0;
for(i = 0; i < length; i++){
if(S[i] == 'd' && S[i + 1] == 'r' && S[i + 2] == 'e' && S[i + 3] == 'a' && S[i + 4] == 'm'){
if(S[i + 5] == 'e' && S[i + 6] == 'r'){
i += 6;
} else {
i += 4;
}
} else if(S[i] == 'e' && S[i + 1] == 'r' && S[i + 2] == 'a' && S[i + 3] == 's' && S[i + 4] == 'e'){
if(S[i + 5] == 'r'){
i += 5;
} else {
i += 4;
}
} else {
frag++;
break;
}
}
if(frag == 0){
printf("YES");
} else {
printf("NO");
}
return 0;
} | main.c: In function 'main':
main.c:5:14: error: array size missing in 'S'
5 | char S[];
| ^
main.c:7:9: error: too few arguments to function 'fgets'
7 | fgets(S);
| ^~~~~
In file included from main.c:1:
/usr/include/stdio.h:654:14: note: declared here
654 | extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
| ^~~~~
|
s491812953 | p03854 | C | #include<stdio.h>
#include<string.h>
int main(){
//char S[];
//scanf("%s",S);
fgets(S);
int length = strlen(S);
int i,frag = 0;
for(i = 0; i < length; i++){
if(S[i] == 'd' && S[i + 1] == 'r' && S[i + 2] == 'e' && S[i + 3] == 'a' && S[i + 4] == 'm'){
if(S[i + 5] == 'e' && S[i + 6] == 'r'){
i += 6;
} else {
i += 4;
}
} else if(S[i] == 'e' && S[i + 1] == 'r' && S[i + 2] == 'a' && S[i + 3] == 's' && S[i + 4] == 'e'){
if(S[i + 5] == 'r'){
i += 5;
} else {
i += 4;
}
} else {
frag++;
break;
}
}
if(frag == 0){
printf("YES");
} else {
printf("NO");
}
return 0;
} | main.c: In function 'main':
main.c:7:15: error: 'S' undeclared (first use in this function)
7 | fgets(S);
| ^
main.c:7:15: note: each undeclared identifier is reported only once for each function it appears in
main.c:7:9: error: too few arguments to function 'fgets'
7 | fgets(S);
| ^~~~~
In file included from main.c:1:
/usr/include/stdio.h:654:14: note: declared here
654 | extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
| ^~~~~
|
s943211476 | p03854 | C | #include<stdio.h>
#include<string.h>
int main(){
char S[];
//scanf("%s",S);
gets(S);
int length = strlen(S);
int i,frag = 0;
for(i = 0; i < length; i++){
if(S[i] == 'd' && S[i + 1] == 'r' && S[i + 2] == 'e' && S[i + 3] == 'a' && S[i + 4] == 'm'){
if(S[i + 5] == 'e' && S[i + 6] == 'r'){
i += 6;
} else {
i += 4;
}
} else if(S[i] == 'e' && S[i + 1] == 'r' && S[i + 2] == 'a' && S[i + 3] == 's' && S[i + 4] == 'e'){
if(S[i + 5] == 'r'){
i += 5;
} else {
i += 4;
}
} else {
frag++;
break;
}
}
if(frag == 0){
printf("YES");
} else {
printf("NO");
}
return 0;
} | main.c: In function 'main':
main.c:5:14: error: array size missing in 'S'
5 | char S[];
| ^
main.c:7:9: error: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration]
7 | gets(S);
| ^~~~
| fgets
|
s868378501 | p03854 | C | #include<stdio.h>
#include<string.h>
int main(){
//char S[];
//scanf("%s",S);
gets(S);
int length = strlen(S);
int i,frag = 0;
for(i = 0; i < length; i++){
if(S[i] == 'd' && S[i + 1] == 'r' && S[i + 2] == 'e' && S[i + 3] == 'a' && S[i + 4] == 'm'){
if(S[i + 5] == 'e' && S[i + 6] == 'r'){
i += 6;
} else {
i += 4;
}
} else if(S[i] == 'e' && S[i + 1] == 'r' && S[i + 2] == 'a' && S[i + 3] == 's' && S[i + 4] == 'e'){
if(S[i + 5] == 'r'){
i += 5;
} else {
i += 4;
}
} else {
frag++;
break;
}
}
if(frag == 0){
printf("YES");
} else {
printf("NO");
}
return 0;
} | main.c: In function 'main':
main.c:7:9: error: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration]
7 | gets(S);
| ^~~~
| fgets
main.c:7:14: error: 'S' undeclared (first use in this function)
7 | gets(S);
| ^
main.c:7:14: note: each undeclared identifier is reported only once for each function it appears in
|
s199764909 | p03854 | C | #include<stdio.h>
#include<string.h>
int main(){
char S[];
scanf("%s",S);
int length = strlen(S);
int i,frag = 0;
for(i = 0; i < length; i++){
if(S[i] == 'd' && S[i + 1] == 'r' && S[i + 2] == 'e' && S[i + 3] == 'a' && S[i + 4] == 'm'){
if(S[i + 5] == 'e' && S[i + 6] == 'r'){
i += 6;
} else {
i += 4;
}
} else if(S[i] == 'e' && S[i + 1] == 'r' && S[i + 2] == 'a' && S[i + 3] == 's' && S[i + 4] == 'e'){
if(S[i + 5] == 'r'){
i += 5;
} else {
i += 4;
}
} else {
frag++;
break;
}
}
if(frag == 0){
printf("YES");
} else {
printf("NO");
}
return 0;
} | main.c: In function 'main':
main.c:5:14: error: array size missing in 'S'
5 | char S[];
| ^
|
s487485423 | p03854 | C++ |
int main(){
string s;
cin>>s;
reverse(s.begin(),s.end());
for(int i=0;i<4;i++){
reverse(s[i].begin(),s[i].end());
}
bool can = true;
for(int i=0;i<s.length();){
bool can2 = false;
for(int j =0;j<4;j++){
string d =devide[j];
if(s.substr(i,d.size()) == devide[j])
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:4:2: error: 'string' was not declared in this scope
4 | string s;
| ^~~~~~
a.cc:5:2: error: 'cin' was not declared in this scope
5 | cin>>s;
| ^~~
a.cc:5:7: error: 's' was not declared in this scope
5 | cin>>s;
| ^
a.cc:7:2: error: 'reverse' was not declared in this scope
7 | reverse(s.begin(),s.end());
| ^~~~~~~
a.cc:17:19: error: expected ';' before 'd'
17 | string d =devide[j];
| ^~
| ;
a.cc:18:23: error: 'd' was not declared in this scope
18 | if(s.substr(i,d.size()) == devide[j])
| ^
a.cc:18:36: error: 'devide' was not declared in this scope
18 | if(s.substr(i,d.size()) == devide[j])
| ^~~~~~
a.cc:20:17: error: 'd' was not declared in this scope
20 | i += d.size();
| ^
a.cc:29:5: error: 'cout' was not declared in this scope
29 | cout<<"Yes"<<endl;
| ^~~~
a.cc:29:18: error: 'endl' was not declared in this scope
29 | cout<<"Yes"<<endl;
| ^~~~
a.cc:30:7: error: 'cout' was not declared in this scope
30 | else cout<<"No"<<endl;
| ^~~~
a.cc:30:19: error: 'endl' was not declared in this scope
30 | else cout<<"No"<<endl;
| ^~~~
|
s054099745 | p03854 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
reverse(s.begin(),s.end());
string a[4]={"remaerd", "maerd", "esare", "resare"};
bool can2=false;
for(int i=0;i<s.size();){
can2=false;
for(int j=0;j<4;j++){
string d=a[j];
if(s.sbstr(i,d.size())==d){
can2=true;
i+=d.size();
}
}
if(can2==false){
break;
}
}
if(can2){cout << "YES" << endl;}
else{cout << "NO" << endl;}
}
| a.cc: In function 'int main()':
a.cc:14:12: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'sbstr'; did you mean 'substr'?
14 | if(s.sbstr(i,d.size())==d){
| ^~~~~
| substr
|
s019019053 | p03854 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
reverse(s.begin(),s.end());
string a[4]={"remaerd", "maerd", "esare", "resare"};
bool can2=false;
for(int i=0;i<s.size();){
can2=false;
fir(int j=0;j<4;j++){
string d=a[j];
if(s.sbstr(i,d.size())==d){
can2=true;
i+=d.size();
}
}
if(can2==false){
break;
}
}
if(can2){cout << "YES" << endl;}
else{cout << "NO" << endl;}
}
| a.cc: In function 'int main()':
a.cc:12:13: error: expected primary-expression before 'int'
12 | fir(int j=0;j<4;j++){
| ^~~
a.cc:12:21: error: 'j' was not declared in this scope
12 | fir(int j=0;j<4;j++){
| ^
|
s296046477 | p03854 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
reverse(s.begin(),s.end());
string a[4]={"remaerd", "maerd", "esare", "resare"};
for(int i=0;i<s.size();){
bool can2=false;
fir(int j=0;i<4;j++){
string d=a[j];
if(s.sbstr(i,d.size())==d){
can2=true;
i+=d.size();
}
}
if(can2==false){
break;
}
}
if(can2){cout << "YES" << endl;}
else{cout << "NO" << endl;}
}
| a.cc: In function 'int main()':
a.cc:11:13: error: expected primary-expression before 'int'
11 | fir(int j=0;i<4;j++){
| ^~~
a.cc:11:25: error: 'j' was not declared in this scope
11 | fir(int j=0;i<4;j++){
| ^
a.cc:22:6: error: 'can2' was not declared in this scope
22 | if(can2){cout << "YES" << endl;}
| ^~~~
|
s188945661 | p03854 | C++ | #include<iostream>
using namespace std;
int main(){
string S, T = "";
int i = 0;
cin >> S;
while(i <= S.size() - 1){
if(i + 4 <= S.size() - 1 && S.substr(i, 5) == "dream"){
if(i + 6 <= S.size() - 1 && T.substr(i + 5, 2) == "er"){
T += "dreamer";
i += 7;
}
else{
T += "dream";
i += 5;
}
}
else if(i + 4 <= S.size() - 1 && T.substr(i, 5) == "erase"){
if(i + 5 <= S.size() - 1 && T.substr(i + 5, 1) == 'r'){
T += "eraser";
i += 6;
}
else{
T += "erase";
i += 5; }
}
else break;
}
if(S == T) cout << "YES" << endl;
else cout << "NO" << endl;
} | a.cc: In function 'int main()':
a.cc:22:60: error: no match for 'operator==' (operand types are 'std::__cxx11::basic_string<char>' and 'char')
22 | if(i + 5 <= S.size() - 1 && T.substr(i + 5, 1) == 'r'){
| ~~~~~~~~~~~~~~~~~~ ^~ ~~~
| | |
| | char
| std::__cxx11::basic_string<char>
In file included from /usr/include/c++/14/iosfwd:42,
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/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)'
192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed:
a.cc:22:63: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::fpos<_StateT>'
22 | if(i + 5 <= S.size() - 1 && T.substr(i + 5, 1) == 'r'){
| ^~~
In file included from /usr/include/c++/14/string:43,
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/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)'
235 | operator==(const allocator<_T1>&, const allocator<_T2>&)
| ^~~~~~~~
/usr/include/c++/14/bits/allocator.h:235:5: note: template argument deduction/substitution failed:
a.cc:22:63: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::allocator<_CharT>'
22 | if(i + 5 <= S.size() - 1 && T.substr(i + 5, 1) == 'r'){
| ^~~
In file included from /usr/include/c++/14/string:48:
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
441 | operator==(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed:
a.cc:22:63: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::reverse_iterator<_Iterator>'
22 | if(i + 5 <= S.size() - 1 && T.substr(i + 5, 1) == 'r'){
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
486 | operator==(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed:
a.cc:22:63: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::reverse_iterator<_Iterator>'
22 | if(i + 5 <= S.size() - 1 && T.substr(i + 5, 1) == 'r'){
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1667 | operator==(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed:
a.cc:22:63: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::move_iterator<_IteratorL>'
22 | if(i + 5 <= S.size() - 1 && T.substr(i + 5, 1) == 'r'){
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1737 | operator==(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed:
a.cc:22:63: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::move_iterator<_IteratorL>'
22 | if(i + 5 <= S.size() - 1 && T.substr(i + 5, 1) == 'r'){
| ^~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/string:51:
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed:
a.cc:22:63: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::pair<_T1, _T2>'
22 | if(i + 5 <= S.size() - 1 && T.substr(i + 5, 1) == 'r'){
| ^~~
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54:
/usr/include/c++/14/string_view:629:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)'
629 | operator==(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:629:5: note: template argument deduction/substitution failed:
a.cc:22:63: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
22 | if(i + 5 <= S.size() - 1 && T.substr(i + 5, 1) == 'r'){
| ^~~
/usr/include/c++/14/string_view:637:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
637 | operator==(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:637:5: note: template argument deduction/substitution failed:
a.cc:22:63: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
22 | if(i + 5 <= S.size() - 1 && T.substr(i + 5, 1) == 'r'){
| ^~~
/usr/include/c++/14/string_view:644:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)'
644 | operator==(__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:644:5: note: template argument deduction/substitution failed:
a.cc:22:63: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'char'
22 | if(i + 5 <= S.size() - 1 && T.substr(i + 5, 1) == 'r'){
| ^~~
/usr/include/c++/14/bits/basic_string.h:3755:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3755 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3755:5: note: template argument deduction/substitution failed:
a.cc:22:63: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'char'
22 | if(i + 5 <= S.size() - 1 && T.substr(i + 5, 1) == 'r'){
| ^~~
/usr/include/c++/14/bits/basic_string.h:3772:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3772 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3772:5: note: template argument deduction/substitution failed:
a.cc:22:63: note: mismatched types 'const _CharT*' and 'char'
22 | if(i + 5 <= S.size() - 1 && T.substr(i + 5, 1) == 'r'){
| ^~~
/usr/include/c++/14/bits/basic_string.h:3819:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3819 | operator==(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3819:5: note: template argument deduction/substitution failed:
a.cc:22:63: note: mismatched types 'const _CharT*' and 'std::__cxx11::basic_string<char>'
22 | if(i + 5 <= S.size() - 1 && T.substr(i + 5, 1) == 'r'){
| ^~~
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:2558:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator==(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)'
2558 | operator==(const tuple<_TElements...>& __t,
| ^~~~~~~~
/usr/include/c++/14/tuple:2558:5: note: template argument deduction/substitution failed:
a.cc:22:63: note: 'std::__cxx11::basic_string<char>' is |
s126926677 | p03854 | C++ | //include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include<queue>
using namespace std;
//conversion
//------------------------------------------
inline long long toint(string s) {long long v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
//typedef
//------------------------------------------
typedef long long ll;
typedef long long LL;
typedef vector<int > vi;
typedef vector<long long > VLL;
typedef vector<long long > vll;
typedef vector<string > ves;
typedef vector<char > vech;
typedef pair<long long , long long> pll;
typedef pair<long long , long long> PLL;
typedef map<ll , ll >mll;
typedef map<int , int >mii;
typedef map<char , int >mci;
typedef map<char , ll >mcl;
//container util
//------------------------------------------
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define VECMAX(x) *max_element(ALL(x))
#define VECMIN(x) *min_element(ALL(x))
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
//#define MULTIPLE(i,n,k) for(int i = (k) ; i<(n) ; i+=k+1)//倍数ループ
//constant
//------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
//debug
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define SIZEOF(x) sizeof(x)/sizeof(x[0])
const long long INF = 100000000000000;
const long long NINF = -100000000000000;
//-------------------------------------------------------------
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll nCr(ll n, ll r) {
if (n == 0) { return 0; }
if (r == 0) { return 1; }
if (r == 1) { return n; }
if (n == r) { return 1; }
if (r > n / 2) { r = n / 2; }
ll result = 1;
for (ll i = 1; i <= r; i++) {
result *= (n - i + 1) / i;
}
return(result);
}
//firstが最大値(最小値) , second が index
pair<LL , LL> maxP(vll a , ll size){
pair <ll , ll> p;
vll::iterator iter = max_element(a.begin() , a.end());
p.first = *iter;
p.second = distance(a.begin() , iter);
return p;
}
pair<LL , LL> minP(vll a , ll size){
pair <ll , ll> p;
vll::iterator iter = min_element(a.begin() , a.end());
p.first = *iter;
p.second = distance(a.begin() , iter);
return p;
}
ll sumL(vll a , ll size){
ll sum = 0;
REP(i,size){
sum += a[i];
}
return sum;
}
//aのなかにtがいくつあるか
ll counT(VLL a , ll t ){
sort(a.begin(),a.end());
return upper_bound(a.begin(),a.end(),t)-lower_bound(a.begin() , a.end() , t);
}
#define COUNT(a,b) counT((a),(b))
#define MAX(x) maxP(x,x.size())
#define MIN(x) minP(x,x.size())
#define SUM(x) sumL(x,x.size())
//-------------------DIVIDE----------------------
// DIV[i][j] は i の j分割数 j == 0 && i != 0 なら 0
//並び順を区別しない
ll DIV[1000+1][1000+1];
void divide(ll n ,ll m){
DIV[0][0]= 1;
FOR(i,1,n+1){
DIV[i][0] = 0;
}
REP(i,n+1){
DIV[i][1] = 1;
}
FOR(i,1,m+1){
FOR(t,0,n+1){
if(DIV[t][i] > 0)continue;
if(t>=i){
DIV[t][i]=DIV[t-i][i] + DIV[t][i-1];
}else{
DIV[t][i] = DIV[t][i-1];
}
}
}
}
#define DIVIDE(a,b) (DIV[a][b] - DIV[a][(b)-1]) //DIV[a-b][b]と同じ
//-------要素を見つける-----------
ll search(vll &a , ll n ){//a内のnのindexを返す
std::vector<ll>::iterator iter = std::find(a.begin(), a.end(), n);
size_t index = distance(a.begin(), iter);
return index;
}
//------------素数判定-----------------
//------------素数判定-----------------
class Judge{
public:
vector<bool> IS_PRIME_CONTAINER;
Judge(int max_):IS_PRIME_CONTAINER(max_, true){
max = max_;
}
int max;//この値-1まで素数判定する
//メモリを圧迫する可能性あり
void IsPrime_init(){
IS_PRIME_CONTAINER[0] = false;
IS_PRIME_CONTAINER[1] = false;
FOR(i,2,sqrt(max)+1){
if(IS_PRIME_CONTAINER[i]){
FOR(j,2,(max)/i + 1){
if(j*i<=max){
IS_PRIME_CONTAINER[i*j]=false;
}
}
}
}
}
inline bool IsPrime(ll num){
return IS_PRIME_CONTAINER[num];
}
};
//---------ベルマンフォード----------
class Bellman{
public:
vll DIST;
//max は 頂点の数
Bellman(int max_ ):DIST(max_ , INF){
max = max_;
}
~Bellman(){
std::vector<ll>().swap(DIST);
}
int max;
//int m;//辺の数
struct E{
//classの外で構造体Eを宣言するときは Bellman::E と宣言する
// from から toは一方通行であることに注意
ll from , to, cost;
};
//はじめに必ず初期化
void init(){
REP(i,max){
DIST[i] = INF;
}
}
//startはindex(0から)
//start と 辺の数 m 辺の情報 x を入力
//頂点a,bが両方向に繋がってるなら、
//vector<Bellman::E>には(a,b,c)と(b,a,c)の両方を入れないといけない
void shortest(LL s , vector<E> &x ){
REP(i,100000){
DIST[i] = INF;
}
DIST[s] = 0;
while(1){
bool t = false;
REP(i,x.size()){
E h = x[i];
if(DIST[h.from] != INF && DIST[h.to] > DIST[h.from] + h.cost){
DIST[h.to] = DIST[h.from] + h.cost;
t = true;
}
}
if(!t){
break;
}
}
}
//-----------MAIN------------//
//注意::::DPの配列、vectorはグローバル変数を使え!!そして引数として与えるな!!
// Sqrは2乗 sqrtはルート
#define CIN(a) REP(i,a.size())cin >> a[i];
int main(){
string s;
cin >> s;
string t = "";
map <string , bool> p;
p["esare"] = true;
p["resare"] = true;
p["maerd"] = true;
p["remaerd"] = true;
ll v = s.size();
REP(i,v){
int ind = v- i - 1;
t+= s[ind];
if(p[t]){
t = "";
}
}
if(!t.size())cout << "YES" << endl;
else cout << "NO" <<endl;
return 0;
}
| a.cc:303:2: error: expected '}' at end of input
303 | }
| ^
a.cc:221:14: note: to match this '{'
221 | class Bellman{
| ^
a.cc:303:2: error: expected unqualified-id at end of input
303 | }
| ^
|
s509769114 | p03854 | C++ | #include <bits/stdc++.h>
using namespace std;
bool answer(string s){
if(s=="") return true;
int l=s.size();
if(s.at(l-1)=='m'&&s.at(l-2)=='a'&&s.at(l-3)=='e'&&s.at(l-4)=='r'&&s.at(l-5)=='d') return answer(s.erase(i-5));
if(s.at(l-1)=='e'&&s.at(l-2)=='s'&&s.at(l-3)=='a'&&s.at(l-4)=='r'&&s.at(l-5)=='e') return answer(s.erase(i-5));
if(s.at(l-1)=='r'&&s.at(l-2)=='e'&&s.at(l-3)=='s'&&s.at(l-4)=='a'&&s.at(l-5)=='r'&&s.at(l-6)=='e') return answer(s.erase(i-6));
if(s.at(l-1)=='r'&&s.at(l-2)=='e'&&s.at(l-3)=='m'&&s.at(l-4)=='a'&&s.at(l-5)=='e'&&s.at(l-6)=='r'&&s.at(l-7)=='d') return answer(s.erase(i-7));
return false;
}
int main() {
string s;
cin >> s;
if(answer(s)) cout << "YES" << endl;
else cout << "NO" << endl;
} | a.cc: In function 'bool answer(std::string)':
a.cc:8:108: error: 'i' was not declared in this scope
8 | if(s.at(l-1)=='m'&&s.at(l-2)=='a'&&s.at(l-3)=='e'&&s.at(l-4)=='r'&&s.at(l-5)=='d') return answer(s.erase(i-5));
| ^
a.cc:9:108: error: 'i' was not declared in this scope
9 | if(s.at(l-1)=='e'&&s.at(l-2)=='s'&&s.at(l-3)=='a'&&s.at(l-4)=='r'&&s.at(l-5)=='e') return answer(s.erase(i-5));
| ^
a.cc:10:124: error: 'i' was not declared in this scope
10 | if(s.at(l-1)=='r'&&s.at(l-2)=='e'&&s.at(l-3)=='s'&&s.at(l-4)=='a'&&s.at(l-5)=='r'&&s.at(l-6)=='e') return answer(s.erase(i-6));
| ^
a.cc:11:140: error: 'i' was not declared in this scope
11 | if(s.at(l-1)=='r'&&s.at(l-2)=='e'&&s.at(l-3)=='m'&&s.at(l-4)=='a'&&s.at(l-5)=='e'&&s.at(l-6)=='r'&&s.at(l-7)=='d') return answer(s.erase(i-7));
| ^
|
s775995303 | p03854 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
string S, T;
cin >> S;
reverse(S.bigin(), S.end());
string divide[4] = {"dream", "dreamer", "erase", "eraser"};
for (int i = 0; i < 4; i++) reverse(divide[i].bigin(), 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";
else cout << "NO";
} | a.cc: In function 'int main()':
a.cc:8:13: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'bigin'; did you mean 'begin'?
8 | reverse(S.bigin(), S.end());
| ^~~~~
| begin
a.cc:10:49: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'bigin'; did you mean 'begin'?
10 | for (int i = 0; i < 4; i++) reverse(divide[i].bigin(), divide[i].end());
| ^~~~~
| begin
|
s592886580 | p03854 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
string S;
cin >> S;
reverse(S.begin(), S.end());
vector<string> strs = {"dream", "dreamer", "erase", "eraser"};
for (string& s : strs) {
reverse(s.begin(), s.end());
}
for (int i = 0; i < S.size(); ) {
bool match = false;
for (const string& s : strs) {
if (S.find(S.begin() + i, S.begin() + s.size(), s) != string::npos) {
match = true;
i += s.size();
break;
}
}
if (!match) {
cout << "NO" << endl;
return 0;
}
}
cout << "YES" << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:14:17: error: no matching function for call to 'std::__cxx11::basic_string<char>::find(__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >, __gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >, const std::string&)'
14 | if (S.find(S.begin() + i, S.begin() + s.size(), s) != string::npos) {
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:2720:9: note: candidate: 'template<class _Tp> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv<_Tp, typename __gnu_cxx::__alloc_traits<typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_CharT>::other>::size_type> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::find(const _Tp&, size_type) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
2720 | find(const _Tp& __svt, size_type __pos = 0) const
| ^~~~
/usr/include/c++/14/bits/basic_string.h:2720:9: note: candidate expects 2 arguments, 3 provided
/usr/include/c++/14/bits/basic_string.h:2691:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::find(const _CharT*, size_type, size_type) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
2691 | find(const _CharT* __s, size_type __pos, size_type __n) const
| ^~~~
/usr/include/c++/14/bits/basic_string.h:2691:26: note: no known conversion for argument 1 from '__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >' to 'const char*'
2691 | find(const _CharT* __s, size_type __pos, size_type __n) const
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/basic_string.h:2706:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::find(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, size_type) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
2706 | find(const basic_string& __str, size_type __pos = 0) const
| ^~~~
/usr/include/c++/14/bits/basic_string.h:2706:7: note: candidate expects 2 arguments, 3 provided
/usr/include/c++/14/bits/basic_string.h:2740:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::find(const _CharT*, size_type) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
2740 | find(const _CharT* __s, size_type __pos = 0) const _GLIBCXX_NOEXCEPT
| ^~~~
/usr/include/c++/14/bits/basic_string.h:2740:7: note: candidate expects 2 arguments, 3 provided
/usr/include/c++/14/bits/basic_string.h:2758:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::find(_CharT, size_type) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
2758 | find(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT;
| ^~~~
/usr/include/c++/14/bits/basic_string.h:2758:7: note: candidate expects 2 arguments, 3 provided
|
s708386623 | p03854 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
string S;
cin >> S;
reverse(S.begin(), S.end());
vector<string> strs = {"dream", "dreamer", "erase", "eraser"};
for (string& s : strs) {
reverse(s.begin(), s.end());
}
for (int i = 0; i < S.size(); ) {
bool match = false;
for (const string& s : strs) {
if (S.find(S.begin() + i, S.being() + s.size(), s) != string::npos) {
match = true;
i += s.size();
break;
}
}
if (!match) {
cout << "NO" << endl;
return 0;
}
}
cout << "YES" << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:14:35: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'being'
14 | if (S.find(S.begin() + i, S.being() + s.size(), s) != string::npos) {
| ^~~~~
|
s949654942 | p03854 | C++ | 解説読んだ | a.cc:1:1: error: '\U000089e3\U00008aac\U00008aad\U00003093\U00003060' does not name a type
1 | 解説読んだ
| ^~~~~~~~~~
|
s884532818 | p03854 | Java |
import java.util.*;
public class Main {
static HashMap<String,Boolean> jk=new HashMap<String,Boolean>();
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s=sc.next();
HashSet<String> h=new HashSet<String>();
h.add("dream");
h.add("dreamer");
h.add("erase");
h.add("eraser");
boolean k=compute(s,h);
if(k)
System.out.println("YES");
else
System.out.println("NO");}
public static boolean compute(String s,HashSet<String> h)
{
if(jk.containsKey(s))
return jk.get(s);
else{
if(s.length()==0)
return true;
else{
boolean gh=false;
if(i+5<=s.length()&&h.contains(s.substring(0,i+5)))
{
if(i+5<s.length())
gh=gh||compute(s.substring(i+5),h);
}
if(i+6<=s.length()&&h.contains(s.substring(0,i+6)))
{
if(i+6<s.length())
gh=gh||compute(s.substring(i+6),h);
}
jk.put(s,gh);
return gh;
}}
}}
| Main.java:33: error: cannot find symbol
if(i+5<=s.length()&&h.contains(s.substring(0,i+5)))
^
symbol: variable i
location: class Main
Main.java:33: error: cannot find symbol
if(i+5<=s.length()&&h.contains(s.substring(0,i+5)))
^
symbol: variable i
location: class Main
Main.java:35: error: cannot find symbol
if(i+5<s.length())
^
symbol: variable i
location: class Main
Main.java:36: error: cannot find symbol
gh=gh||compute(s.substring(i+5),h);
^
symbol: variable i
location: class Main
Main.java:38: error: cannot find symbol
if(i+6<=s.length()&&h.contains(s.substring(0,i+6)))
^
symbol: variable i
location: class Main
Main.java:38: error: cannot find symbol
if(i+6<=s.length()&&h.contains(s.substring(0,i+6)))
^
symbol: variable i
location: class Main
Main.java:40: error: cannot find symbol
if(i+6<s.length())
^
symbol: variable i
location: class Main
Main.java:41: error: cannot find symbol
gh=gh||compute(s.substring(i+6),h);
^
symbol: variable i
location: class Main
8 errors
|
s740395803 | p03854 | Java |
import java.util.*;
public class Main {
static HashMap<String,Boolean> jk=new HashMap<String,Boolean>();
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s=sc.next();
HashSet<String> h=new HashSet<String>();
h.add("dream");
h.add("dreamer");
h.add("erase");
h.add("eraser");
boolean k=compute(s,h);
if(k)
System.out.println("YES");
else
System.out.println("NO");}
public static boolean compute(String s,HashSet<String> h)
{
if(jk.containsKey(s))
return jk.get(s);
else{
if(s.length()==0)
return true;
else{
boolean gh=false;
if(i+5<=s.length()&&h.contains(s.substring(0,i+5)))
{
if(i+5<s.length())
gh=gh||compute(s.substring(i+5),h);
}
if(i+6<=s.length()&&h.contains(s.substring(0,i+6))
{
if(i+6<s.length())
gh=gh||compute(s.substring(i+6),h);
}
jk.put(s,gh);
return gh;
}}
}}
| Main.java:38: error: ')' expected
if(i+6<=s.length()&&h.contains(s.substring(0,i+6))
^
1 error
|
s008329064 | 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;
cin >> S;
string dream = "dream";
string dreamer = "dreamer";
string erase = "erase";
string eraser = "eraser";
while(T != S){
int count_all = 0;
int count1 = 0;
for(int i = T.size(); i<T.size()+dream.size(); i++){
if(S[i] != dream[i-T.size()]){
count1++;
}
}
if(count1 == 0) {
T += dream;
continue;
}
if(count1) count_all++;
if(T == S) {
cout << "YES" << endl;
break;
}
int count3 = 0;
for(int i = T.size(); i<T.size()+erase.size(); i++){
if(S[i] != erase[i-T.size()]){
count3++;
}
}
if(count3 == 0) T += erase;
if(count3) count_all++;
if(T == S){
cout << "YES" << endl;
break;
}
int count4 = 0;
for(int i = T.size(); i<T.size()+eraser.size(); i++){
if(S[i] != eraser[i-T.size()]){
count4++;
}
}
if(count4 == 0) T += eraser;
if(count4) count_all++;
if(T == S){
cout << "YES" << endl;
break;
}
int count2 = 0;
for(int i = T.size(); i<T.size()+dreamer.size(); i++){
if(S[i] != dreamer[i-T.size()]){
count2++;
}
}
if(count2 == 0) {
T += dreamer;
if(count2) count_all++;
if(T == S){
cout << "YES" << endl;
break;
}
if(count_all == 4){
cout << "NO" << endl;
break;
}
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:82:2: error: expected '}' at end of input
82 | }
| ^
a.cc:5:11: note: to match this '{'
5 | int main(){
| ^
|
s509878594 | 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;
cin >> S;
string dream = "dream";
string dreamer = "dreamer";
string erase = "erase";
string eraser = "eraser";
stirng dreamerase = "dreamerase";
stirng dreameraser = "dreameraser";
string eraserase = "eraserase";
string eraserase = "eraseraser";
while(T != S){
int count_all = 0;
int count1 = 0;
for(int i = T.size(); i<T.size()+dream.size(); i++){
if(S[i] != dream[i-T.size()]){
count1++;
}
}
if(count1 == 0) {
T += dream;
continue;
}
if(count1) count_all++;
if(T == S) {
cout << "YES" << endl;
break;
}
int count3 = 0;
for(int i = T.size(); i<T.size()+erase.size(); i++){
if(S[i] != erase[i-T.size()]){
count3++;
}
}
if(count3 == 0) T += erase;
if(count3) count_all++;
if(T == S){
cout << "YES" << endl;
break;
}
int count4 = 0;
for(int i = T.size(); i<T.size()+eraser.size(); i++){
if(S[i] != eraser[i-T.size()]){
count4++;
}
}
if(count4 == 0) T += eraser;
if(count4) count_all++;
if(T == S){
cout << "YES" << endl;
break;
}
int count2 = 0;
for(int i = T.size(); i<T.size()+dreamer.size(); i++){
if(S[i] != dreamer[i-T.size()]){
count2++;
}
}
if(count2 == 0) {
T += dreamer;
if(count2) count_all++;
if(T == S){
cout << "YES" << endl;
break;
}
if(count_all == 4){
cout << "NO" << endl;
break;
}
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:13:3: error: 'stirng' was not declared in this scope
13 | stirng dreamerase = "dreamerase";
| ^~~~~~
a.cc:14:9: error: expected ';' before 'dreameraser'
14 | stirng dreameraser = "dreameraser";
| ^~~~~~~~~~~~
| ;
a.cc:16:10: error: redeclaration of 'std::string eraserase'
16 | string eraserase = "eraseraser";
| ^~~~~~~~~
a.cc:15:10: note: 'std::string eraserase' previously declared here
15 | string eraserase = "eraserase";
| ^~~~~~~~~
a.cc:86:2: error: expected '}' at end of input
86 | }
| ^
a.cc:5:11: note: to match this '{'
5 | int main(){
| ^
|
s973673420 | p03854 | C++ | #include <bits/stdc++.h>
using namespace std;
inline bool regex_search(const string &S, const string &T) {
bool flag = true;
for(int i=0; i<S.size(); i++) {
if(S[i]==T[i]) continue;
if(i==T.size()) break;
else {
flag = false;
break;
}
}
return flag;
}
int main(){
string S;
const string dream = "dream";
const string dreamer = "dreamer";
const string erase = "erase";
const string eraser = "eraser";
cin >> S;
/** first filter */
if(S[0]!='d' && S[0]!='e') cout << "NO" << endl;
/** second filter */
else if(!regex_search(S, dream) && !regex_search(S, erase)) cout << "NO" << endl;
/** final filter */
else {
while(S.size()!=0) {
if(regex_search(S, dreamer)) S = replace(S, dreamer, "", true);
else if(regex_search(S, dream)) S = replace(S, dream, "", true);
else if(regex_search(S, eraser)) S = replace(S, eraser, "", true);
else if(regex_search(S, erase)) S = replace(S, erase, "", true);
else break;
}
if(S.size()==0) cout << "YES" << endl;
else cout << "NO" << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:39:53: error: no matching function for call to 'replace(std::string&, const std::string&, const char [1], bool)'
39 | if(regex_search(S, dreamer)) S = replace(S, dreamer, "", true);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
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:4280:5: note: candidate: 'template<class _FIter, class _Tp> void std::replace(_FIter, _FIter, const _Tp&, const _Tp&)'
4280 | replace(_ForwardIterator __first, _ForwardIterator __last,
| ^~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4280:5: note: template argument deduction/substitution failed:
a.cc:39:53: note: deduced conflicting types for parameter 'const _Tp' ('char [1]' and 'bool')
39 | if(regex_search(S, dreamer)) S = replace(S, dreamer, "", true);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:174:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::replace(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&, const _Tp&)'
174 | replace(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __old_value,
| ^~~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:174:1: note: candidate expects 5 arguments, 4 provided
a.cc:40:56: error: no matching function for call to 'replace(std::string&, const std::string&, const char [1], bool)'
40 | else if(regex_search(S, dream)) S = replace(S, dream, "", true);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4280:5: note: candidate: 'template<class _FIter, class _Tp> void std::replace(_FIter, _FIter, const _Tp&, const _Tp&)'
4280 | replace(_ForwardIterator __first, _ForwardIterator __last,
| ^~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4280:5: note: template argument deduction/substitution failed:
a.cc:40:56: note: deduced conflicting types for parameter 'const _Tp' ('char [1]' and 'bool')
40 | else if(regex_search(S, dream)) S = replace(S, dream, "", true);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:174:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::replace(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&, const _Tp&)'
174 | replace(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __old_value,
| ^~~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:174:1: note: candidate expects 5 arguments, 4 provided
a.cc:41:57: error: no matching function for call to 'replace(std::string&, const std::string&, const char [1], bool)'
41 | else if(regex_search(S, eraser)) S = replace(S, eraser, "", true);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4280:5: note: candidate: 'template<class _FIter, class _Tp> void std::replace(_FIter, _FIter, const _Tp&, const _Tp&)'
4280 | replace(_ForwardIterator __first, _ForwardIterator __last,
| ^~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4280:5: note: template argument deduction/substitution failed:
a.cc:41:57: note: deduced conflicting types for parameter 'const _Tp' ('char [1]' and 'bool')
41 | else if(regex_search(S, eraser)) S = replace(S, eraser, "", true);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:174:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::replace(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&, const _Tp&)'
174 | replace(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __old_value,
| ^~~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:174:1: note: candidate expects 5 arguments, 4 provided
a.cc:42:56: error: no matching function for call to 'replace(std::string&, const std::string&, const char [1], bool)'
42 | else if(regex_search(S, erase)) S = replace(S, erase, "", true);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4280:5: note: candidate: 'template<class _FIter, class _Tp> void std::replace(_FIter, _FIter, const _Tp&, const _Tp&)'
4280 | replace(_ForwardIterator __first, _ForwardIterator __last,
| ^~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4280:5: note: template argument deduction/substitution failed:
a.cc:42:56: note: deduced conflicting types for parameter 'const _Tp' ('char [1]' and 'bool')
42 | else if(regex_search(S, erase)) S = replace(S, erase, "", true);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:174:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::replace(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&, const _Tp&)'
174 | replace(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __old_value,
| ^~~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:174:1: note: candidate expects 5 arguments, 4 provided
|
s394734520 | p03854 | C++ | #include <bits/stdc++.h>
using namespace std;
inline bool regex_search(const string &S, const string &T) {
bool flag = true;
for(int i=0; i<S.size(); i++) {
if(S[i]==T[i]) continue;
if(i==T.size()) break;
else {
flag = false;
break;
}
}
return flag;
}
int main(){
string S;
const string dream = "dream";
const string dreamer = "dreamer";
const string erase = "erase";
const string eraser = "eraser";
cin >> S;
/** first filter */
if(S[0]!='d' && S[0]!='e') cout << "NO" << endl;
/** second filter */
else if(!regex_search(S, dream) && !regex_search(S, erase)) cout << "NO" << endl;
/** final filter */
else {
while(S.size()!=0) {
if(regex_search(S, dreamer)) S = replace(S, dreamer, '', true);
else if(regex_search(S, dream)) S = replace(S, dream, '', true);
else if(regex_search(S, eraser)) S = replace(S, eraser, '', true);
else if(regex_search(S, erase)) S = replace(S, erase, '', true);
else break;
}
if(S.size()==0) cout << "YES" << endl;
else cout << "NO" << endl;
}
return 0;
} | a.cc:39:66: error: empty character constant
39 | if(regex_search(S, dreamer)) S = replace(S, dreamer, '', true);
| ^~
a.cc:40:67: error: empty character constant
40 | else if(regex_search(S, dream)) S = replace(S, dream, '', true);
| ^~
a.cc:41:69: error: empty character constant
41 | else if(regex_search(S, eraser)) S = replace(S, eraser, '', true);
| ^~
a.cc:42:67: error: empty character constant
42 | else if(regex_search(S, erase)) S = replace(S, erase, '', true);
| ^~
a.cc: In function 'int main()':
a.cc:39:53: error: no matching function for call to 'replace(std::string&, const std::string&, char, bool)'
39 | if(regex_search(S, dreamer)) S = replace(S, dreamer, '', true);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
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:4280:5: note: candidate: 'template<class _FIter, class _Tp> void std::replace(_FIter, _FIter, const _Tp&, const _Tp&)'
4280 | replace(_ForwardIterator __first, _ForwardIterator __last,
| ^~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4280:5: note: template argument deduction/substitution failed:
a.cc:39:53: note: deduced conflicting types for parameter 'const _Tp' ('char' and 'bool')
39 | if(regex_search(S, dreamer)) S = replace(S, dreamer, '', true);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:174:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::replace(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&, const _Tp&)'
174 | replace(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __old_value,
| ^~~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:174:1: note: candidate expects 5 arguments, 4 provided
a.cc:40:56: error: no matching function for call to 'replace(std::string&, const std::string&, char, bool)'
40 | else if(regex_search(S, dream)) S = replace(S, dream, '', true);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4280:5: note: candidate: 'template<class _FIter, class _Tp> void std::replace(_FIter, _FIter, const _Tp&, const _Tp&)'
4280 | replace(_ForwardIterator __first, _ForwardIterator __last,
| ^~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4280:5: note: template argument deduction/substitution failed:
a.cc:40:56: note: deduced conflicting types for parameter 'const _Tp' ('char' and 'bool')
40 | else if(regex_search(S, dream)) S = replace(S, dream, '', true);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:174:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::replace(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&, const _Tp&)'
174 | replace(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __old_value,
| ^~~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:174:1: note: candidate expects 5 arguments, 4 provided
a.cc:41:57: error: no matching function for call to 'replace(std::string&, const std::string&, char, bool)'
41 | else if(regex_search(S, eraser)) S = replace(S, eraser, '', true);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4280:5: note: candidate: 'template<class _FIter, class _Tp> void std::replace(_FIter, _FIter, const _Tp&, const _Tp&)'
4280 | replace(_ForwardIterator __first, _ForwardIterator __last,
| ^~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4280:5: note: template argument deduction/substitution failed:
a.cc:41:57: note: deduced conflicting types for parameter 'const _Tp' ('char' and 'bool')
41 | else if(regex_search(S, eraser)) S = replace(S, eraser, '', true);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:174:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::replace(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&, const _Tp&)'
174 | replace(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __old_value,
| ^~~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:174:1: note: candidate expects 5 arguments, 4 provided
a.cc:42:56: error: no matching function for call to 'replace(std::string&, const std::string&, char, bool)'
42 | else if(regex_search(S, erase)) S = replace(S, erase, '', true);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4280:5: note: candidate: 'template<class _FIter, class _Tp> void std::replace(_FIter, _FIter, const _Tp&, const _Tp&)'
4280 | replace(_ForwardIterator __first, _ForwardIterator __last,
| ^~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4280:5: note: template argument deduction/substitution failed:
a.cc:42:56: note: deduced conflicting types for parameter 'const _Tp' ('char' and 'bool')
42 | else if(regex_search(S, erase)) S = replace(S, erase, '', true);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:174:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::replace(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&, const _Tp&)'
174 | replace(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __old_value,
| ^~~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:174:1: note: candidate expects 5 arguments, 4 provided
|
s055947371 | p03854 | C++ | #include <bits/stdc++.h>
using namespace std;
inline bool regex_search(const string &S, const string &T) {
bool flag = true;
for(int i=0; i<S.size(); i++) {
if(S[i]==T[i]) continue;
if(i==T.size()) break;
else {
flag = false;
break;
}
}
return flag;
}
int main(){
string S;
const string dream = "dream";
const string dreamer = "dreamer";
const string erase = "erase";
const string eraser = "eraser";
cin >> S;
/** first filter */
if(S[0]!='d' && S[0]!='e') cout << "NO" << endl;
/** second filter */
else if(!regex_search(S, dream) && !regex_search(S, erase)) cout << "NO" << endl;
/** final filter */
else {
while(S.size()!=0) {
if(regex_search(S, dreamer, '')) S = replace(S, dreamer, true);
else if(regex_search(S, dream, '')) S = replace(S, dream, true);
else if(regex_search(S, eraser, '')) S = replace(S, eraser, true);
else if(regex_search(S, erase, '')) S = replace(S, erase, true);
else break;
}
if(S.size()==0) cout << "YES" << endl;
else cout << "NO" << endl;
}
return 0;
} | a.cc:39:41: error: empty character constant
39 | if(regex_search(S, dreamer, '')) S = replace(S, dreamer, true);
| ^~
a.cc:40:44: error: empty character constant
40 | else if(regex_search(S, dream, '')) S = replace(S, dream, true);
| ^~
a.cc:41:45: error: empty character constant
41 | else if(regex_search(S, eraser, '')) S = replace(S, eraser, true);
| ^~
a.cc:42:44: error: empty character constant
42 | else if(regex_search(S, erase, '')) S = replace(S, erase, true);
| ^~
a.cc: In function 'int main()':
a.cc:39:28: error: no matching function for call to 'regex_search(std::string&, const std::string&, char)'
39 | if(regex_search(S, dreamer, '')) S = replace(S, dreamer, true);
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~
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:2418:5: note: candidate: 'template<class _Bi_iter, class _Alloc, class _Ch_type, class _Rx_traits> bool std::regex_search(_Bi_iter, _Bi_iter, __cxx11::match_results<_BiIter, _Alloc>&, const __cxx11::basic_regex<_CharT, _TraitsT>&, regex_constants::match_flag_type)'
2418 | regex_search(_Bi_iter __s, _Bi_iter __e,
| ^~~~~~~~~~~~
/usr/include/c++/14/bits/regex.h:2418:5: note: candidate expects 4 arguments, 3 provided
/usr/include/c++/14/bits/regex.h:2441:5: note: candidate: 'template<class _Bi_iter, class _Ch_type, class _Rx_traits> bool std::regex_search(_Bi_iter, _Bi_iter, const __cxx11::basic_regex<_Ch_type, _Rx_traits>&, regex_constants::match_flag_type)'
2441 | regex_search(_Bi_iter __first, _Bi_iter __last,
| ^~~~~~~~~~~~
/usr/include/c++/14/bits/regex.h:2441:5: note: template argument deduction/substitution failed:
a.cc:39:28: note: mismatched types 'const std::__cxx11::basic_regex<_Ch_type, _Rx_traits>' and 'char'
39 | if(regex_search(S, dreamer, '')) S = replace(S, dreamer, true);
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/regex.h:2464:5: note: candidate: 'template<class _Ch_type, class _Alloc, class _Rx_traits> bool std::regex_search(const _Ch_type*, __cxx11::match_results<const _Ch_type*, _Alloc>&, const __cxx11::basic_regex<_Ch_type, _Rx_traits>&, regex_constants::match_flag_type)'
2464 | regex_search(const _Ch_type* __s,
| ^~~~~~~~~~~~
/usr/include/c++/14/bits/regex.h:2464:5: note: template argument deduction/substitution failed:
a.cc:39:28: note: mismatched types 'const _Ch_type*' and 'std::__cxx11::basic_string<char>'
39 | if(regex_search(S, dreamer, '')) S = replace(S, dreamer, true);
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/regex.h:2483:5: note: candidate: 'template<class _Ch_type, class _Rx_traits> bool std::regex_search(const _Ch_type*, const __cxx11::basic_regex<_Ch_type, _Rx_traits>&, regex_constants::match_flag_type)'
2483 | regex_search(const _Ch_type* __s,
| ^~~~~~~~~~~~
/usr/include/c++/14/bits/regex.h:2483:5: note: template argument deduction/substitution failed:
a.cc:39:28: note: mismatched types 'const _Ch_type*' and 'std::__cxx11::basic_string<char>'
39 | if(regex_search(S, dreamer, '')) S = replace(S, dreamer, true);
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/regex.h:2502:5: note: candidate: 'template<class _Ch_traits, class _String_allocator, class _Ch_type, class _Rx_traits> bool std::regex_search(const __cxx11::basic_string<_Ch_type, _Ch_traits, _Str_allocator>&, const __cxx11::basic_regex<_CharT, _TraitsT>&, regex_constants::match_flag_type)'
2502 | regex_search(const basic_string<_Ch_type, _Ch_traits,
| ^~~~~~~~~~~~
/usr/include/c++/14/bits/regex.h:2502:5: note: template argument deduction/substitution failed:
a.cc:39:28: note: 'const std::string' {aka 'const std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::basic_regex<_CharT, _TraitsT>'
39 | if(regex_search(S, dreamer, '')) S = replace(S, dreamer, true);
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/regex.h:2525:5: note: candidate: 'template<class _Ch_traits, class _Ch_alloc, class _Alloc, class _Ch_type, class _Rx_traits> bool std::regex_search(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)'
2525 | regex_search(const basic_string<_Ch_type, _Ch_traits, _Ch_alloc>& __s,
| ^~~~~~~~~~~~
/usr/include/c++/14/bits/regex.h:2525:5: note: template argument deduction/substitution failed:
a.cc:39:28: note: types 'std::__cxx11::match_results<typename std::__cxx11::basic_string<_Ch_type, _Ch_traits, _Ch_alloc>::const_iterator, _Alloc>' and 'const std::string' {aka 'const std::__cxx11::basic_string<char>'} have incompatible cv-qualifiers
39 | if(regex_search(S, dreamer, '')) S = replace(S, dreamer, true);
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/regex.h:2540:5: note: candidate: 'template<class _Ch_traits, class _Ch_alloc, class _Alloc, class _Ch_type, class _Rx_traits> bool std::regex_search(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)
2540 | regex_search(const basic_string<_Ch_type, _Ch_traits, _Ch_alloc>&&,
| ^~~~~~~~~~~~
/usr/include/c++/14/bits/regex.h:2540:5: note: template argument deduction/substitution failed:
a.cc:39:28: note: types 'std::__cxx11::match_results<typename std::__cxx11::basic_string<_Ch_type, _Ch_traits, _Ch_alloc>::const_iterator, _Alloc>' and 'const std::string' {aka 'const std::__cxx11::basic_string<char>'} have incompatible cv-qualifiers
39 | if(regex_search(S, dreamer, '')) S = replace(S, dreamer, true);
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~
a.cc:6:13: note: candidate: 'bool regex_search(const std::string&, const std::string&)'
6 | inline bool regex_search(const string &S, const string &T) {
| ^~~~~~~~~~~~
a.cc:6:13: note: candidate expects 2 arguments, 3 provided
a.cc:39:57: error: no matching function for call to 'replace(std::string&, const std::string&, bool)'
39 | if(regex_search(S, dreamer, '')) S = replace(S, dreamer, true);
| ~~~~~~~^~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_algo.h:4280:5: note: candidate: 'template<class _FIter, class _Tp> void std::replace(_FIter, _FIter, const _Tp&, const _Tp&)'
4280 | replace(_ForwardIterator __first, _ForwardIterator __last,
| ^~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4280:5: note: candidate expects 4 arguments, 3 provided
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:174:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::replace(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&, const _Tp&)'
174 | replace(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __old_value,
| ^~~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:174:1: note: candidate expects 5 arguments, 3 provided
a.cc:40:33: error: no matching function for call to 'regex_search(std::string&, const std::string&, char)'
40 | else if(regex_search(S, dream, '')) S = replace(S, dream, true);
| ~~~~~~~~~~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/regex.h:2418:5: note: candidate: 'template<class _Bi_iter, class _Alloc, class _Ch_type, class _Rx_traits> bool std::regex_search(_Bi_iter, _Bi_iter, __cxx11::match_results<_BiIter, _Alloc>&, const __cxx11::basic_regex<_CharT, _TraitsT>&, regex_constants::match_flag_type)'
2418 | regex_search(_Bi_iter __s, _Bi_iter __e,
| ^~~~~~~~~~~~
/usr/include/c++/14/bits/regex.h:2418:5: note: candidate expects 4 arguments, 3 provided
/usr/include/c++/14/bits/regex.h:2441:5: note: candidate: 'template<class _Bi_iter, class _Ch_type, class _Rx_traits> bool std::regex_search(_Bi_iter, _Bi_iter, const __cxx11::basic_regex<_Ch_type, _Rx_traits>&, regex_constants::match_flag_type)'
2441 | regex_search(_Bi_iter __first, _Bi_iter __last,
| ^~~~~~~~~~~~
/usr/include/c++/14/bits/regex.h:2441:5: note: template argument deduction/substitution failed:
a.cc:40:33: note: mismatched types 'const std::__cxx11::basic_regex<_Ch_type, _Rx_traits>' and 'char'
40 | else if(regex_search(S, dream, '')) S = replace(S, dream, true);
| ~~~~~~~~~~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/regex.h:2464:5: note: candidate: 'template<class _Ch_type, class _Alloc, class _Rx_traits> bool std::regex_search(const _Ch_type*, __cxx11::match_results<const _Ch_type*, _Alloc>&, const __cxx11::basic_regex<_Ch_type, _Rx_traits>&, regex_constants::match_flag_type)'
2464 | regex_search(const _Ch_type* __s,
| ^~~~~~~~~~~~
/usr/include/c++/14/bits/regex.h:2464:5: note: template argument deduction/substitution failed:
a.cc:40:33: note: mismatched types 'const _Ch_type*' and 'std::__cxx11::basic_string<char>'
40 | else if(regex_search(S, dream, '')) S = replace(S, dream, true);
| ~~~~~~~~~~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/regex.h:2483:5: note: candidate: 'template |
s831996601 | p03854 | C++ | #include <bits/stdc++.h>
using namespace std;
inline bool regex_search(const string &S, const string &T) {
bool flag = true;
for(int i=0; i<S.size(); i++) {
if(S[i]==T[i]) continue;
if(i==T.size()) break;
else {
flag = false;
break;
}
}
return flag;
}
int main(){
string S;
const string dream = "dream";
const string dreamer = "dreamer";
const string erase = "erase";
const string eraser = "eraser";
cin >> S;
/** first filter */
if(S[0]!='d' && S[0]!='e') cout << "NO" << endl;
/** second filter */
else if(!regex_search(S, dream) && !regex_search(S, erase)) cout << "NO" << endl;
/** final filter */
else {
while(S.size()!=0) {
if(regex_search(S, dreamer)) S = replace(S, dreamer, true);
else if(regex_search(S, dream)) S = replace(S, dream, true);
else if(regex_search(S, eraser)) S = replace(S, eraser, true);
else if(regex_search(S, erase)) S = replace(S, erase, true);
else break;
}
if(S.size()==0) cout << "YES" << endl;
else cout << "NO" << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:39:53: error: no matching function for call to 'replace(std::string&, const std::string&, bool)'
39 | if(regex_search(S, dreamer)) S = replace(S, dreamer, true);
| ~~~~~~~^~~~~~~~~~~~~~~~~~
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:4280:5: note: candidate: 'template<class _FIter, class _Tp> void std::replace(_FIter, _FIter, const _Tp&, const _Tp&)'
4280 | replace(_ForwardIterator __first, _ForwardIterator __last,
| ^~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4280:5: note: candidate expects 4 arguments, 3 provided
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:174:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::replace(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&, const _Tp&)'
174 | replace(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __old_value,
| ^~~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:174:1: note: candidate expects 5 arguments, 3 provided
a.cc:40:56: error: no matching function for call to 'replace(std::string&, const std::string&, bool)'
40 | else if(regex_search(S, dream)) S = replace(S, dream, true);
| ~~~~~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4280:5: note: candidate: 'template<class _FIter, class _Tp> void std::replace(_FIter, _FIter, const _Tp&, const _Tp&)'
4280 | replace(_ForwardIterator __first, _ForwardIterator __last,
| ^~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4280:5: note: candidate expects 4 arguments, 3 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:174:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::replace(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&, const _Tp&)'
174 | replace(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __old_value,
| ^~~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:174:1: note: candidate expects 5 arguments, 3 provided
a.cc:41:57: error: no matching function for call to 'replace(std::string&, const std::string&, bool)'
41 | else if(regex_search(S, eraser)) S = replace(S, eraser, true);
| ~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4280:5: note: candidate: 'template<class _FIter, class _Tp> void std::replace(_FIter, _FIter, const _Tp&, const _Tp&)'
4280 | replace(_ForwardIterator __first, _ForwardIterator __last,
| ^~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4280:5: note: candidate expects 4 arguments, 3 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:174:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::replace(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&, const _Tp&)'
174 | replace(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __old_value,
| ^~~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:174:1: note: candidate expects 5 arguments, 3 provided
a.cc:42:56: error: no matching function for call to 'replace(std::string&, const std::string&, bool)'
42 | else if(regex_search(S, erase)) S = replace(S, erase, true);
| ~~~~~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4280:5: note: candidate: 'template<class _FIter, class _Tp> void std::replace(_FIter, _FIter, const _Tp&, const _Tp&)'
4280 | replace(_ForwardIterator __first, _ForwardIterator __last,
| ^~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4280:5: note: candidate expects 4 arguments, 3 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:174:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::replace(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&, const _Tp&)'
174 | replace(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __old_value,
| ^~~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:174:1: note: candidate expects 5 arguments, 3 provided
|
s952296751 | p03854 | C++ | #include <bits.stdc++.h>
using namespace std;
inline bool regex_search(const string &S, const string &T) {
bool flag = true;
for(int i=0; i<S.size(); i++) {
if(S[i]==T[i]) continue;
if(i==T.size()) break;
else {
flag = false;
break;
}
}
return flag;
}
int main(){
string S;
const string dream = "dream";
const string dreamer = "dreamer";
const string erase = "erase";
const string eraser = "eraser";
cin >> S;
/** first filter */
if(S[0]!='d' && S[0]!='e') cout << "NO" << endl;
/** second filter */
else if(!regex_search(S, dream) && !regex_search(S, erase)) cout << "NO" << endl;
/** final filter */
else {
while(S.size()!=0) {
if(regex_search(S, dreamer)) S = replace(S, dreamer, true);
else if(regex_search(S, dream)) S = replace(S, dream, true);
else if(regex_search(S, eraser)) S = replace(S, eraser, true);
else if(regex_search(S, erase)) S = replace(S, erase, true);
else break;
}
if(S.size()==0) cout << "YES" << endl;
else cout << "NO" << endl;
}
return 0;
} | a.cc:1:10: fatal error: bits.stdc++.h: No such file or directory
1 | #include <bits.stdc++.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
|
s214741442 | p03854 | C++ | #include <bits/stdc++.>
#include <regex>
using namespace std;
int main(){
string S;
string dream = "dream";
string dreamer = "dreamer";
string erase = "erase";
string eraser = "eraser";
cin >> S;
/** first filter */
if(S[0]!='d' && S[0]!='e') cout << "YES" << endl;
else cout << "NO" << endl;
} | a.cc:1:10: fatal error: bits/stdc++.: No such file or directory
1 | #include <bits/stdc++.>
| ^~~~~~~~~~~~~~
compilation terminated.
|
s279119645 | 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;
cin >> S;
string dream = "dream";
string dreamer = "dreamer";
string erase = "erase";
string eraser = "eraser";
while(T != S){
int countall = 0;
int count1 = 0;
for(int i = T.size(); i<T.size()+dream.size(); i++){
if(S[i] != dream[i-T.size()]){
count1++;
}
}
if(count1 == 0) T.push_buck(dream);
if(count1) countall++;
if(T == s) {
cout << "YES" << endl;
break;
}
int count2 = 0;
for(int i = T.size(); i<T.size()+dreamer.size(); i++){
if(S[i] != dreamer[i-T.size()]){
count2++;
}
}
if(count2 == 0) T.push_buck(dreamer);
if(count2) countall++;
if(T == s){
cout << "YES" << endl;
break;
}
int count3 = 0;
for(int i = T.size(); i<T.size()+erase.size(); i++){
if(S[i] != erase[i-T.size()]){
count3++;
}
}
if(count3 == 0) T.push_buck(erase);
if(count3) countall++;
if(T == s){
cout << "YES" << endl;
break;
}
int count4 = 0;
for(int i = T.size(); i<T.size()+eraser.size(); i++){
if(S[i] != eraser[i-T.size()]){
count4++;
}
}
if(count4 == 0) T.push_buck(eraser);
if(count4) countall++;
if(T == s){
cout << "YES" << endl;
break;
}
if(countall == 4){
cout << "NO" << endl;
break;
}
}
} | a.cc: In function 'int main()':
a.cc:23:21: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'push_buck'; did you mean 'push_back'?
23 | if(count1 == 0) T.push_buck(dream);
| ^~~~~~~~~
| push_back
a.cc:25:11: error: 's' was not declared in this scope
25 | if(T == s) {
| ^
a.cc:36:21: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'push_buck'; did you mean 'push_back'?
36 | if(count2 == 0) T.push_buck(dreamer);
| ^~~~~~~~~
| push_back
a.cc:38:11: error: 's' was not declared in this scope
38 | if(T == s){
| ^
a.cc:49:21: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'push_buck'; did you mean 'push_back'?
49 | if(count3 == 0) T.push_buck(erase);
| ^~~~~~~~~
| push_back
a.cc:51:11: error: 's' was not declared in this scope
51 | if(T == s){
| ^
a.cc:62:21: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'push_buck'; did you mean 'push_back'?
62 | if(count4 == 0) T.push_buck(eraser);
| ^~~~~~~~~
| push_back
a.cc:64:11: error: 's' was not declared in this scope
64 | if(T == s){
| ^
|
s812983238 | 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;
cin >> S;
string dream = "dream";
string dreamer = "dreamer";
string erase = "erase";
string eraser = "eraser";
while(T != S){
countall = 0;
count1 = 0;
for(int i = T.size(); i<T.size()+dream.size(); i++){
if(S[i] != dream[i-T.size()]){
count1++;
}
}
if(count1 == 0) T.push_buck(dream);
if(count1) countall++;
if(T == s) {
cout << "YES" << endl;
break;
}
count2 = 0;
for(int i = T.size(); i<T.size()+dreamer.size(); i++){
if(S[i] != dreamer[i-T.size()]){
count2++;
}
}
if(count2 == 0) T.push_buck(dreamer);
if(count2) countall++;
if(T == s){
cout << "YES" << endl;
break;
}
count3 = 0;
for(int i = T.size(); i<T.size()+erase.size(); i++){
if(S[i] != erase[i-T.size()]){
count3++;
}
}
if(count3 == 0) T.push_buck(erase);
if(count3) countall++;
if(T == s){
cout << "YES" << endl;
break;
}
count4 = 0;
for(int i = T.size(); i<T.size()+eraser.size(); i++){
if(S[i] != eraser[i-T.size()]){
count4++;
}
}
if(count4 == 0) T.push_buck(eraser);
if(count4) countall++;
if(T == s){
cout << "YES" << endl;
break;
}
if(countall == 4){
cout << "NO" << endl;
break;
}
}
} | a.cc: In function 'int main()':
a.cc:16:5: error: 'countall' was not declared in this scope
16 | countall = 0;
| ^~~~~~~~
a.cc:17:5: error: 'count1' was not declared in this scope
17 | count1 = 0;
| ^~~~~~
a.cc:23:21: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'push_buck'; did you mean 'push_back'?
23 | if(count1 == 0) T.push_buck(dream);
| ^~~~~~~~~
| push_back
a.cc:25:11: error: 's' was not declared in this scope
25 | if(T == s) {
| ^
a.cc:30:6: error: 'count2' was not declared in this scope
30 | count2 = 0;
| ^~~~~~
a.cc:36:21: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'push_buck'; did you mean 'push_back'?
36 | if(count2 == 0) T.push_buck(dreamer);
| ^~~~~~~~~
| push_back
a.cc:38:11: error: 's' was not declared in this scope
38 | if(T == s){
| ^
a.cc:43:5: error: 'count3' was not declared in this scope
43 | count3 = 0;
| ^~~~~~
a.cc:49:21: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'push_buck'; did you mean 'push_back'?
49 | if(count3 == 0) T.push_buck(erase);
| ^~~~~~~~~
| push_back
a.cc:51:11: error: 's' was not declared in this scope
51 | if(T == s){
| ^
a.cc:56:5: error: 'count4' was not declared in this scope
56 | count4 = 0;
| ^~~~~~
a.cc:62:21: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'push_buck'; did you mean 'push_back'?
62 | if(count4 == 0) T.push_buck(eraser);
| ^~~~~~~~~
| push_back
a.cc:64:11: error: 's' was not declared in this scope
64 | if(T == s){
| ^
|
s039289772 | 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;
cin >> S;
string dream = 'dream';
string dreamer = 'dreamer';
string erase = 'erase';
string eraser = 'eraser';
while(T != S){
countall = 0;
count1 = 0;
for(int i = T.size(); i<T.size()+dream.size(); i++){
if(S[i] != dream[i-T.size()]){
count1++;
}
}
if(count1 == 0) T.push_buck(dream);
if(count1) countall++;
if(T == s) {
cout << "YES" << endl;
break;
}
count2 = 0;
for(int i = T.size(); i<T.size()+dreamer.size(); i++){
if(S[i] != dreamer[i-T.size()]){
count2++;
}
}
if(count2 == 0) T.push_buck(dreamer);
if(count2) countall++;
if(T == s){
cout << "YES" << endl;
break;
}
count3 = 0;
for(int i = T.size(); i<T.size()+erase.size(); i++){
if(S[i] != erase[i-T.size()]){
count3++;
}
}
if(count3 == 0) T.push_buck(erase);
if(count3) countall++;
if(T == s){
cout << "YES" << endl;
break;
}
count4 = 0;
for(int i = T.size(); i<T.size()+eraser.size(); i++){
if(S[i] != eraser[i-T.size()]){
count4++;
}
}
if(count4 == 0) T.push_buck(eraser);
if(count4) countall++;
if(T == s){
cout << "YES" << endl;
break;
}
if(countall == 4){
cout << "NO" << endl;
break;
}
}
} | a.cc:9:18: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes
9 | string dream = 'dream';
| ^~~~~~~
a.cc:10:20: warning: multi-character literal with 7 characters exceeds 'int' size of 4 bytes
10 | string dreamer = 'dreamer';
| ^~~~~~~~~
a.cc:11:18: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes
11 | string erase = 'erase';
| ^~~~~~~
a.cc:12:19: warning: multi-character literal with 6 characters exceeds 'int' size of 4 bytes
12 | string eraser = 'eraser';
| ^~~~~~~~
a.cc: In function 'int main()':
a.cc:9:18: error: conversion from 'int' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
9 | string dream = 'dream';
| ^~~~~~~
a.cc:10:20: error: conversion from 'int' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
10 | string dreamer = 'dreamer';
| ^~~~~~~~~
a.cc:11:18: error: conversion from 'int' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
11 | string erase = 'erase';
| ^~~~~~~
a.cc:12:19: error: conversion from 'int' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
12 | string eraser = 'eraser';
| ^~~~~~~~
a.cc:16:5: error: 'countall' was not declared in this scope
16 | countall = 0;
| ^~~~~~~~
a.cc:17:5: error: 'count1' was not declared in this scope
17 | count1 = 0;
| ^~~~~~
a.cc:23:21: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'push_buck'; did you mean 'push_back'?
23 | if(count1 == 0) T.push_buck(dream);
| ^~~~~~~~~
| push_back
a.cc:25:11: error: 's' was not declared in this scope
25 | if(T == s) {
| ^
a.cc:30:6: error: 'count2' was not declared in this scope
30 | count2 = 0;
| ^~~~~~
a.cc:36:21: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'push_buck'; did you mean 'push_back'?
36 | if(count2 == 0) T.push_buck(dreamer);
| ^~~~~~~~~
| push_back
a.cc:38:11: error: 's' was not declared in this scope
38 | if(T == s){
| ^
a.cc:43:5: error: 'count3' was not declared in this scope
43 | count3 = 0;
| ^~~~~~
a.cc:49:21: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'push_buck'; did you mean 'push_back'?
49 | if(count3 == 0) T.push_buck(erase);
| ^~~~~~~~~
| push_back
a.cc:51:11: error: 's' was not declared in this scope
51 | if(T == s){
| ^
a.cc:56:5: error: 'count4' was not declared in this scope
56 | count4 = 0;
| ^~~~~~
a.cc:62:21: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'push_buck'; did you mean 'push_back'?
62 | if(count4 == 0) T.push_buck(eraser);
| ^~~~~~~~~
| push_back
a.cc:64:11: error: 's' was not declared in this scope
64 | if(T == s){
| ^
|
s249995034 | 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 flag = true;
for(int i = 0; i < s.size();){
bool flag2 = false;
for(int j = 0; j < 4; j++){
string div = divide[j];
if(s.substr(i, div.size()) == div){
flag2 = true;
i += div.size();
}
}
if(!flag2){
flag = false;
break;
}
}
if(flag)
cout << "Yes" << endl;
else
cout << "No" << endl;
return 0;
} | a.cc:6:1: error: expected ',' or ';' before 'int'
6 | int main(){
| ^~~
|
s752952003 | p03854 | C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
int main(void) {
int i;
char s[500000];
char *w[] = {"dream", "dreamer", "erase", "eraser"};
char *p, *q;
bool bMatch;
scanf("%s", s);
if ( strlen(s) < 5 ) {
printf("NO\n");
return 0;
}
p = &s[strlen(s) - 1];
while (p >= s) {
bMatch = false;
for (i = 0; i < 4; i++ ) {
q = p - strlen(w[i]) + 1;
if ( q < s ) {
continue;
} else if ( !strncmp(w[i], q, strlen(w[i])) ) {
p -= strlen(w[i]);
bMatch = true;
break;
}
}
if ( bMatch == false ) {
printf("NO\n");
return 0;
}
}
printf("YES\n");
return 0;
}
~ | main.c:48:1: error: expected identifier or '(' before '~' token
48 | ~
| ^
|
s951331546 | p03854 | C++ | int main() {
string S;
cin >> S;
vector<string> inputs = {
"dream",
"dreamer",
"erase",
"eraser"
};
reverse(S.begin(), S.end());
for (int i = 0; i < inputs.size(); i++) reverse(inputs[i].begin(), inputs[i].end());
int pos = 0;
while (true) {
bool update = false;
for (int i = 0; i < inputs.size(); i++) {
if (S.substr(pos, inputs[i].size()) == inputs[i]) {
update = true;
pos += inputs[i].size();
break;
}
}
if (!update) break;
}
if (pos == S.size()) cout << "YES" << endl;
else cout << "NO" << endl;
} | a.cc: In function 'int main()':
a.cc:3:6: error: 'string' was not declared in this scope
3 | string S;
| ^~~~~~
a.cc:4:6: error: 'cin' was not declared in this scope
4 | cin >> S;
| ^~~
a.cc:4:13: error: 'S' was not declared in this scope
4 | cin >> S;
| ^
a.cc:6:6: error: 'vector' was not declared in this scope
6 | vector<string> inputs = {
| ^~~~~~
a.cc:6:21: error: 'inputs' was not declared in this scope
6 | vector<string> inputs = {
| ^~~~~~
a.cc:13:6: error: 'reverse' was not declared in this scope
13 | reverse(S.begin(), S.end());
| ^~~~~~~
a.cc:29:27: error: 'cout' was not declared in this scope
29 | if (pos == S.size()) cout << "YES" << endl;
| ^~~~
a.cc:29:44: error: 'endl' was not declared in this scope
29 | if (pos == S.size()) cout << "YES" << endl;
| ^~~~
a.cc:30:11: error: 'cout' was not declared in this scope
30 | else cout << "NO" << endl;
| ^~~~
a.cc:30:27: error: 'endl' was not declared in this scope
30 | else cout << "NO" << endl;
| ^~~~
|
s706268544 | p03854 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
string sample[4] = {"dream","dreamer","erase","eraser"};
srting s; cin >> s;
reverse(s.begin(), s.end());
for (int i = 0; i < 4; i++) reverse(sample[i].begin(), sample[i].end());
bool count1 = true;
for (int i = 0; i < s.size(); ){
bool count2 = false;
for (int j = 0; j < 4; j++){
string xxx = sample[j];
if (s.substr(i, xxx.size()) == xxx){
count2 = true;
i += xxx.size();
}
}
if (!count2){
count1 = false;
break;
}
}
if (count1) cout << "YES" << endl;
else cout << "NO" << endl;
}
| a.cc:10:32: error: extended character is not valid in an identifier
10 | for (int i = 0; i < s.size(); ){
| ^
a.cc: In function 'int main()':
a.cc:6:3: error: 'srting' was not declared in this scope
6 | srting s; cin >> s;
| ^~~~~~
a.cc:6:20: error: 's' was not declared in this scope
6 | srting s; cin >> s;
| ^
a.cc:10:32: error: '\U00003000' was not declared in this scope
10 | for (int i = 0; i < s.size(); ){
| ^~
|
s163642560 | p03854 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
string sample[4] = {"dream","dreamer","erase","eraser"};
srting a; cin >> s;
reverse(s.begin(), s.end());
for (int i = 0; i < 4; ++i) reverse(divide[i].begin(), divide[i].end());
bool count1 = true;
for (int i = 0; i < s.size(); ){
bool count2 = false;
for (int j = 0; j < 4; j++){
string xxx = sample[j];
if (s.substr(i, xxx.size()) == xxx){
count2 = true;
i += xxx.size();
}
}
if (!count2){
count1 = false;
break;
}
}
if (can) cout << "YES" << endl;
else cout << "NO" << endl;
}
| a.cc:10:32: error: extended character is not valid in an identifier
10 | for (int i = 0; i < s.size(); ){
| ^
a.cc: In function 'int main()':
a.cc:6:3: error: 'srting' was not declared in this scope
6 | srting a; cin >> s;
| ^~~~~~
a.cc:6:20: error: 's' was not declared in this scope
6 | srting a; cin >> s;
| ^
a.cc:8:39: error: 'divide' was not declared in this scope
8 | for (int i = 0; i < 4; ++i) reverse(divide[i].begin(), divide[i].end());
| ^~~~~~
a.cc:10:32: error: '\U00003000' was not declared in this scope
10 | for (int i = 0; i < s.size(); ){
| ^~
a.cc:24:7: error: 'can' was not declared in this scope; did you mean 'tan'?
24 | if (can) cout << "YES" << endl;
| ^~~
| tan
|
s931083636 | p03854 | C++ | #include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main(){
devide[4]={"erase","eraser","dream","dreamer"};
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;i++){
bool can2=false;
for(int j=0;j<4;j++){
string d=devide[j];
if(S.substring(i,d.size())==d){
can2=true;
}
}
if(!can2){
can=false;
break;
}
}
if(!can) {cout << "NO" << endl;}
else cout << "YES" << endl;
} | a.cc: In function 'int main()':
a.cc:8:3: error: 'devide' was not declared in this scope
8 | devide[4]={"erase","eraser","dream","dreamer"};
| ^~~~~~
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 | for(int i=0;i<S.size;i++){
| ~~^~~~
| ()
a.cc:21:12: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'substring'; did you mean 'substr'?
21 | if(S.substring(i,d.size())==d){
| ^~~~~~~~~
| substr
|
s210509324 | p03854 | C++ |
int main() {
string S;
cin >> S;
deque<char> dq;
for (int i; i < S.size(); i++) {
dq.push_back(S.at(i));
}
bool b = 1;
while (!dq.empty()) {
if (dq.at(0)=='d' && dq.at(1)=='r' && dq.at(2)=='e' && dq.at(3)=='a' && dq.at(4)=='m') {
for (int i; i < 5; i++) {
dq.pop_front();
}
if (dq.at(0)=='e' && dq.at(1)=='r' && dq.at(2)!='a') {
for (int i; i < 2; i++) {
dq.pop_front();
}
}
}
if (dq.at(0)=='e' && dq.at(1)=='r' && dq.at(2)=='a' && dq.at(3)=='s' && dq.at(4)=='e') {
for (int i = 0; i < 5; i++) {
dq.pop_front();
}
if (dq.at(0)=='r') {
dq.pop_front();
}
}
else {
b = 0;
break;
}
}
if (b == 0) {
cout << "NO" << endl;
}
if (b == 1) {
cout << "YES" << endl;
}
} | a.cc: In function 'int main()':
a.cc:3:3: error: 'string' was not declared in this scope
3 | string S;
| ^~~~~~
a.cc:4:3: error: 'cin' was not declared in this scope
4 | cin >> S;
| ^~~
a.cc:4:10: error: 'S' was not declared in this scope
4 | cin >> S;
| ^
a.cc:5:3: error: 'deque' was not declared in this scope
5 | deque<char> dq;
| ^~~~~
a.cc:5:9: error: expected primary-expression before 'char'
5 | deque<char> dq;
| ^~~~
a.cc:7:5: error: 'dq' was not declared in this scope
7 | dq.push_back(S.at(i));
| ^~
a.cc:10:11: error: 'dq' was not declared in this scope
10 | while (!dq.empty()) {
| ^~
a.cc:35:5: error: 'cout' was not declared in this scope
35 | cout << "NO" << endl;
| ^~~~
a.cc:35:21: error: 'endl' was not declared in this scope
35 | cout << "NO" << endl;
| ^~~~
a.cc:38:5: error: 'cout' was not declared in this scope
38 | cout << "YES" << endl;
| ^~~~
a.cc:38:22: error: 'endl' was not declared in this scope
38 | cout << "YES" << endl;
| ^~~~
|
s698431407 | p03854 | C++ | a | a.cc:1:1: error: 'a' does not name a type
1 | a
| ^
|
s688853869 | p03854 | C++ | #include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(){
string divide[4] = {"dream", "dreamer", "erase", "eraser"};
string ans;
cin >> ans;
reverse(ans.begin(), ans.end());
for(int i = 0; i < 4; i++) reverse(divide[i].begin(),divide[i].end());
bool can = false;
bool can2 = false;
for(int i = 0; i < ans.size();){
for(int a = 0; a < 4; a++){
if(ans.substr(i, divide[a].size())== divide[a]){
i += divide[a].size();
can2 = true;
break;
} else {
can2 = false;
}
}
if(!can2){
break;
}
if(ans.size() == i) can = true;
}
if (can) cout << "YES" << endl;
else cout << "NO" << endl;
}
} | a.cc:34:1: error: expected declaration before '}' token
34 | }
| ^
|
s739089808 | p03854 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
divide[4]={"dream","dreamer","erase","eraser"}
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;
else cout<<"NO"<<endl;
}
| a.cc: In function 'int main()':
a.cc:5:3: error: 'divide' was not declared in this scope
5 | divide[4]={"dream","dreamer","erase","eraser"}
| ^~~~~~
a.cc:7:8: error: 's' was not declared in this scope
7 | cin>>s;
| ^
a.cc:18:14: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
18 | i+=d.size;
| ~~^~~~
| ()
|
s419029456 | p03854 | C | #include <stdio.h>
#include <string.h>
int main()
{
char a[100000];
char b[100000];
int i;
int k,j=0;
int length;
char rei1[7] = "remaerd";
char rei2[6] = "resare";
char rei3[5] = "maerd";
char rei4[5] = "esare";
scanf("%s", a);
length = strlen(a);
for(i=0; i<length/2; i++){
char tmp;
tmp = a[i];
a[i] = a[length-i-1];
a[length-i-1] = tmp;
}
for(i=0;i < length;)
{
if(strncmp(rei1, a,7) ==0 && a[i] == 'r'){
i+=7;
r1++;
}
else if(strncmp(rei2, a,6) == 0){
i+=6;
r2++;
}
else if(strncmp(rei3,a,5) == 0){
i+=5;
r3++;
}
else if (strncmp(rei4,a,5) == 0){
i+=5;
r4++;
}
else break;
j = i;
for(k = 0;j < length;j++,k++){
b[k] = a[j];
strcpy(a,b);
}
}
if(i == length)
printf("YES\n");
else
printf("NO\n");
return 0;
} | main.c: In function 'main':
main.c:31:18: error: 'r1' undeclared (first use in this function); did you mean 'rei1'?
31 | r1++;
| ^~
| rei1
main.c:31:18: note: each undeclared identifier is reported only once for each function it appears in
main.c:35:18: error: 'r2' undeclared (first use in this function); did you mean 'rei2'?
35 | r2++;
| ^~
| rei2
main.c:39:18: error: 'r3' undeclared (first use in this function); did you mean 'rei3'?
39 | r3++;
| ^~
| rei3
main.c:43:18: error: 'r4' undeclared (first use in this function); did you mean 'rei4'?
43 | r4++;
| ^~
| rei4
|
s478001942 | p03854 | C++ | #include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main() {
string s;
cin >> s;
int n=s.size();
while(s){
if(s.substr(max(0,n-5))=="dream"){
n-=5;
s.erase(n);
}
else if(s.substr(max(0,n-5))=="erase"){
n-=5;
s.erase(n);
}
else if(s.substr(max(0,n-7))=="dreamer"){
n-=7;
s.erase(n);
}
else if(s.substr(max(0,n-6))=="eraser"){
n-=6;
s.erase(n);
}
else{
cout << "NO" << endl;
return 0;
}
}
cout << "YES" << endl;
}
| a.cc: In function 'int main()':
a.cc:10:9: error: could not convert 's' from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'bool'
10 | while(s){
| ^
| |
| std::string {aka std::__cxx11::basic_string<char>}
|
s713705150 | p03854 | C++ | #include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main() {
string s;
cin >> s;
int n=s.size();
while(s){
if(s.substr(max(0,n-5))=="dream"){
n-=5;
s.erase(n)
}
else if(s.substr(max(0,n-5))=="erase"){
n-=5;
s.erase(n)
}
else if(s.substr(max(0,n-7))=="dreamer"){
n-=7;
s.erase(n)
}
else if(s.substr(max(0,n-6))=="eraser"){
n-=6;
s.erase(n)
}
else{
cout << "NO" << endl;
return 0;
}
}
cout << "YES" << endl;
}
| a.cc: In function 'int main()':
a.cc:10:9: error: could not convert 's' from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'bool'
10 | while(s){
| ^
| |
| std::string {aka std::__cxx11::basic_string<char>}
a.cc:13:17: error: expected ';' before '}' token
13 | s.erase(n)
| ^
| ;
14 | }
| ~
a.cc:17:17: error: expected ';' before '}' token
17 | s.erase(n)
| ^
| ;
18 | }
| ~
a.cc:21:17: error: expected ';' before '}' token
21 | s.erase(n)
| ^
| ;
22 | }
| ~
a.cc:25:17: error: expected ';' before '}' token
25 | s.erase(n)
| ^
| ;
26 | }
| ~
|
s408758087 | p03854 | C++ | #include <bits/stdc++.h>
#include <vector> // ヘッダファイルインクルード
#include <iostream>
#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[i];
if(S.substr(i,d.size())==d){
can2=true;
i+=d.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:29:25: error: expected '}' at end of input
29 | else cout<<"NO"<<endl;
| ^
a.cc:8:12: note: to match this '{'
8 | int main() {
| ^
|
s459891432 | p03854 | C++ | #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
reverse(s.begin(), s.end());
vector<string> a = {"dream", "dreamer", "erase", "eraser"};
for (int i = 0; i < 4; i++) {
reverse(a.at(i).begin(), a.at(i).end());
}
bool can = true;
for (int i = 0; i < s.size()) {
bool can2 = false;
for (int j = 0; j < 4; j++) {
int d = a.at(j);
if (substr(i, d.size()) == d) {
i += d.size();
can2 = true;
}
}
if (!can2) {
can = false;
break;
}
}
if (can) {
cout << "YES" << endl;
}
else {
cout << "NO" << endl;
}
}
| a.cc: In function 'int main()':
a.cc:15:33: error: expected ';' before ')' token
15 | for (int i = 0; i < s.size()) {
| ^
| ;
a.cc:18:25: 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 'int' in initialization
18 | int d = a.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>}
a.cc:19:29: error: request for member 'size' in 'd', which is of non-class type 'int'
19 | if (substr(i, d.size()) == d) {
| ^~~~
a.cc:19:17: error: 'substr' was not declared in this scope; did you mean 'strstr'?
19 | if (substr(i, d.size()) == d) {
| ^~~~~~
| strstr
a.cc:20:24: error: request for member 'size' in 'd', which is of non-class type 'int'
20 | i += d.size();
| ^~~~
|
s956906956 | p03854 | C++ | #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
reverse(s.begin(), s.end());
vector<string> a = {"dream", "dreamer", "erase", "eraser"};
for (int i = 0; i < 4; i++) {
reverse(a.at(i).begin(), a.at(i).end());
}
bool can = true;
for (int i = 0; i < s.size()) {
bool can2 = false;
for (int j = 0; j < 4; j++) {
int d = a.at(j);
if (substr(i, d.size()) == d) {
i += d.size();
can2 = true;
}
}
if (!can2) {
can = false;
break;
}
}
if (can)
cout << "YES" << endl;
else
cout << "NO" << endl;
}
| a.cc: In function 'int main()':
a.cc:15:33: error: expected ';' before ')' token
15 | for (int i = 0; i < s.size()) {
| ^
| ;
a.cc:18:25: 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 'int' in initialization
18 | int d = a.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>}
a.cc:19:29: error: request for member 'size' in 'd', which is of non-class type 'int'
19 | if (substr(i, d.size()) == d) {
| ^~~~
a.cc:19:17: error: 'substr' was not declared in this scope; did you mean 'strstr'?
19 | if (substr(i, d.size()) == d) {
| ^~~~~~
| strstr
a.cc:20:24: error: request for member 'size' in 'd', which is of non-class type 'int'
20 | i += d.size();
| ^~~~
|
s680920076 | p03854 | C++ | #define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()
int main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
cout << fixed << setprecision(15);
string s; cin >> s;
rep(i,0,s.size()){
string ts = s.substr(i,5);
//cout << ts << endl;
if(ts != "dream" && ts != "erase"){
cout << "NO" << endl;
return 0;
}
i+=4;
bool dri = true;
if(ts=="dream"){
i++;
ts = s.substr(i,2);
}else{
dri=false;
ts = s.substr(i,2);
}
if(ts != "er"){
//if(!dri) i++;
continue;
}
ts = s.substr(i,3);
if(dri && ts == "era"){ i--; continue;}
i++;
}
cout << "YES" << endl;
} | a.cc: In function 'int main()':
a.cc:5:5: error: 'cin' was not declared in this scope
5 | cin.tie(nullptr);
| ^~~
a.cc:6:5: error: 'ios' has not been declared
6 | ios::sync_with_stdio(false);
| ^~~
a.cc:7:5: error: 'cout' was not declared in this scope
7 | cout << fixed << setprecision(15);
| ^~~~
a.cc:7:13: error: 'fixed' was not declared in this scope
7 | cout << fixed << setprecision(15);
| ^~~~~
a.cc:7:22: error: 'setprecision' was not declared in this scope
7 | cout << fixed << setprecision(15);
| ^~~~~~~~~~~~
a.cc:8:5: error: 'string' was not declared in this scope
8 | string s; cin >> s;
| ^~~~~~
a.cc:8:22: error: 's' was not declared in this scope
8 | string s; cin >> s;
| ^
a.cc:9:9: error: 'i' was not declared in this scope
9 | rep(i,0,s.size()){
| ^
a.cc:9:5: error: 'rep' was not declared in this scope; did you mean 'rel'?
9 | rep(i,0,s.size()){
| ^~~
| rel
a.cc:33:22: error: 'endl' was not declared in this scope
33 | cout << "YES" << endl;
| ^~~~
|
s964434986 | p03854 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
reverse(s.begin(), s.end());
array<string, 4> 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 good= false;
for(int j=0; j<4; j++){
string tmp = divide.at(j);
if( s.substr(i, tmp.size()) == tmp ){
good =true; i+=tmp.size();
break;
}
}
if(!good){
can = false;
break;
}
}
if(can) cout << "NO" <<endl;
else cout << "YES"<< endl;
}
| a.cc: In function 'int main()':
a.cc:8:29: error: 'dream' was not declared in this scope; did you mean 'drem'?
8 | array<string, 4> divide ={dream, dreamer, erase,eraser};
| ^~~~~
| drem
a.cc:8:36: error: 'dreamer' was not declared in this scope
8 | array<string, 4> divide ={dream, dreamer, erase,eraser};
| ^~~~~~~
a.cc:8:45: error: 'erase' was not declared in this scope
8 | array<string, 4> divide ={dream, dreamer, erase,eraser};
| ^~~~~
a.cc:8:51: error: 'eraser' was not declared in this scope
8 | array<string, 4> divide ={dream, dreamer, erase,eraser};
| ^~~~~~
|
s291066718 | p03854 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
reverse(s.begin(), s.end());
array<string, 4> 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 good= false;
for(int j=0; j<4; j++){
string tmp = divide.at(j);
if( s.substr(i, tmp.size()) == tmp ){
good =true; i+=tmp.size();
break;
}
if(!good){
can = false;
break;
}
}
if(can) cout << "NO" <<endl;
else cout << "YES"<< endl;
}
| a.cc: In function 'int main()':
a.cc:8:29: error: 'dream' was not declared in this scope; did you mean 'drem'?
8 | array<string, 4> divide ={dream, dreamer, erase,eraser};
| ^~~~~
| drem
a.cc:8:36: error: 'dreamer' was not declared in this scope
8 | array<string, 4> divide ={dream, dreamer, erase,eraser};
| ^~~~~~~
a.cc:8:45: error: 'erase' was not declared in this scope
8 | array<string, 4> divide ={dream, dreamer, erase,eraser};
| ^~~~~
a.cc:8:51: error: 'eraser' was not declared in this scope
8 | array<string, 4> divide ={dream, dreamer, erase,eraser};
| ^~~~~~
a.cc:30:2: error: expected '}' at end of input
30 | }
| ^
a.cc:4:12: note: to match this '{'
4 | int main() {
| ^
|
s957264964 | p03854 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
reverse(s.begin(), s.end());
array<string, 4> 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 good= false;
for(int j=0; j<4; j++){
string tmp = divide.at(j);
if( s.substr(i, tmp.size()) == tmp ){
good =true; i+=tmp.size();
break;
}
if(!good){
can = false;
break;
}
}
if(can) cout << "NO" <<endl;
else cout << "YES" endl;
}
| a.cc: In function 'int main()':
a.cc:8:29: error: 'dream' was not declared in this scope; did you mean 'drem'?
8 | array<string, 4> divide ={dream, dreamer, erase,eraser};
| ^~~~~
| drem
a.cc:8:36: error: 'dreamer' was not declared in this scope
8 | array<string, 4> divide ={dream, dreamer, erase,eraser};
| ^~~~~~~
a.cc:8:45: error: 'erase' was not declared in this scope
8 | array<string, 4> divide ={dream, dreamer, erase,eraser};
| ^~~~~
a.cc:8:51: error: 'eraser' was not declared in this scope
8 | array<string, 4> divide ={dream, dreamer, erase,eraser};
| ^~~~~~
a.cc:29:23: error: expected ';' before 'endl'
29 | else cout << "YES" endl;
| ^~~~~
| ;
a.cc:30:2: error: expected '}' at end of input
30 | }
| ^
a.cc:4:12: note: to match this '{'
4 | int main() {
| ^
|
s166024383 | p03854 | C++ | #include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; i--)
#define INF 1LL << 60;
#define LLINF 1e12
#define PI 3.14159265359
int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
int ny, nx;
typedef long long ll;
using namespace std;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll m, ll n)
{
if ((0 == m) || (0 == n))
return 0;
return ((m / gcd(m, n)) * n);
}
ll llpow(ll x, ll y)
{
ll ans = 1;
REP(i, y)
ans *= x;
return ans;
}
ll llmin(ll x, ll y) { return x < y ? x : y; }
ll llmax(ll x, ll y) { return x > y ? x : y; }
template <typename Container>
bool exist_in(const Container &c, const typename Container::value_type &v)
{
return (c.end() != std::find(c.begin(), c.end(), v));
}
template <class T>
inline bool chmax(T &a, T b)
{
if (a < b)
{
a = b;
return true;
}
return false;
}
template <class T>
inline bool chmin(T &a, T b)
{
if (a > b)
{
a = b;
return true;
}
return false;
}
ll nCr(int n, int r)
{
if (n == r or n == 0)
return 1;
if (n < r)
return 0;
if (r == 1)
return n;
return nCr(n - 1, r - 1) + nCr(n - 1, r);
}
//std::cout << std::defaultfloat << std::setprecision(10);
////////////////////////////////////////
int main()
{
ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
string S; cin >> S;
reverse(S.begin(), S.end());
int cnt = 0, hold = S.size();
while(cnt <= hold{
cout << "S.size()= " << S.size() << endl;
if(S[0]=='r'){
if(S[1]=='e' and S[2]=='m'){
if(S[3]=='a' and S[4]=='e' and S[5]=='r' and S[6]=='d'){
cnt+=7;
S.erase(0,7);
}else{
cout << "NO" << endl;
return 0;
}
}else if(S[1]=='e' and S[2]=='s'){
if(S[3]=='a' and S[4]=='r' and S[5]=='e'){
cnt+=6;
S.erase(0,6);
}else{
cout << "NO" << endl;
return 0;
}
}else{
cout << "NO" << endl;
return 0;
}
}else if(S[0]=='m'){
if(S[1]=='a' and S[2]=='e' and S[3]=='r' and S[4]=='d'){
cnt+=5;
S.erase(0,5);
}else{
cout << "NO" << endl;
return 0;
}
}else if(S[0]=='e'){
if(S[1]=='s' and S[2]=='a' and S[3]=='r' and S[4]=='e'){
cnt+=5;
S.erase(0,5);
}else{
cout << "NO" << endl;
return 0;
}
}else{
cout << "NO" << endl;
return 0;
}
}
cout << "YES" << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:82:22: error: expected ')' before '{' token
82 | while(cnt <= hold{
| ~ ^
| )
|
s222980066 | p03854 | C++ | (function() {
const str = require('fs').readFileSync('/dev/stdin', 'utf-8').trim();
const i = 0;
while (i < str.length) {
if(str.substring(i, i+7) == 'dreamer') {
i += 7;
} else if (str.substring(i, i+6) == 'eraser') {
i += 6;
} else if (str.substring(i, i+5) == 'erase' || str.substring(i, i+5) == 'dream') {
i += 5;
} else {
console.log('NO');
return
}
}
console.log('YES');
})() | a.cc:2:25: warning: multi-character character constant [-Wmultichar]
2 | const str = require('fs').readFileSync('/dev/stdin', 'utf-8').trim();
| ^~~~
a.cc:2:44: warning: multi-character literal with 10 characters exceeds 'int' size of 4 bytes
2 | const str = require('fs').readFileSync('/dev/stdin', 'utf-8').trim();
| ^~~~~~~~~~~~
a.cc:2:58: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes
2 | const str = require('fs').readFileSync('/dev/stdin', 'utf-8').trim();
| ^~~~~~~
a.cc:5:37: warning: multi-character literal with 7 characters exceeds 'int' size of 4 bytes
5 | if(str.substring(i, i+7) == 'dreamer') {
| ^~~~~~~~~
a.cc:7:45: warning: multi-character literal with 6 characters exceeds 'int' size of 4 bytes
7 | } else if (str.substring(i, i+6) == 'eraser') {
| ^~~~~~~~
a.cc:9:45: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes
9 | } else if (str.substring(i, i+5) == 'erase' || str.substring(i, i+5) == 'dream') {
| ^~~~~~~
a.cc:9:81: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes
9 | } else if (str.substring(i, i+5) == 'erase' || str.substring(i, i+5) == 'dream') {
| ^~~~~~~
a.cc:12:25: warning: multi-character character constant [-Wmultichar]
12 | console.log('NO');
| ^~~~
a.cc:16:17: warning: multi-character character constant [-Wmultichar]
16 | console.log('YES');
| ^~~~~
a.cc:1:12: error: expected ')' before '{' token
1 | (function() {
| ~ ^~
| )
a.cc:17:2: error: expected unqualified-id before ')' token
17 | })()
| ^
|
s997479861 | p03854 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
int main() {
string S;
cin >> S;
string div[]={"dream","dreamer","erase","eraser"};
reverse(S.begin(),S.end());
for (int i = 0; i < 4; i++)
{
reverse(div[i].begin(),div[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 = div[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:15:38: error: expected ')' before '{' token
15 | for (int i = 0; i < S.size(); i++
| ~ ^
| )
16 | {
| ~
|
s452444369 | p03854 | C++ | #include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
using namespace std;
typedef long long ll;
int main(){
string s;
cin>>s;
reverse(all(s));
rep(i,s.size()){
if(s.substr(i,5)=="maerd") i+=5;
else if(s.substr(i,7)=="remaerd") i+=7;
else if(s.substr(i,5)=="esare") i+=5;
else if(s.substr(i,6)=="resare") i+=6;
else flag=0;
if(i==s.size()) flag=1;
}
cout<<(flag?"YES":"NO")<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:16:14: error: 'flag' was not declared in this scope
16 | else flag=0;
| ^~~~
a.cc:17:25: error: 'flag' was not declared in this scope
17 | if(i==s.size()) flag=1;
| ^~~~
a.cc:19:12: error: 'flag' was not declared in this scope
19 | cout<<(flag?"YES":"NO")<<endl;
| ^~~~
|
s001881860 | p03854 | C++ | int main() {
string S; cin >> S;
vector<string> V = {
"dreamer",
"eraser",
"dream",
"erase"};
stack<pair<int,int>> ST;
int pos = 0;
int cur = 0;
while(1) {
string T = V[cur];
if (S.find(T, pos) == pos) {
ST.push({pos,cur+1});
pos += T.size();
if (pos == S.size()) {
cout << "YES" << endl;
return 0;
}
cur = 0;
continue;
}
if (++cur < V.size()) continue;
if (!ST.empty()) {
pair<int,int> P = ST.top(); ST.pop();
pos = P.first;
cur = P.second;
continue;
}
cout << "NO" << endl;
return 0;
}
}
| a.cc: In function 'int main()':
a.cc:2:5: error: 'string' was not declared in this scope
2 | string S; cin >> S;
| ^~~~~~
a.cc:2:15: error: 'cin' was not declared in this scope
2 | string S; cin >> S;
| ^~~
a.cc:2:22: error: 'S' was not declared in this scope
2 | string S; cin >> S;
| ^
a.cc:3:5: error: 'vector' was not declared in this scope
3 | vector<string> V = {
| ^~~~~~
a.cc:3:20: error: 'V' was not declared in this scope
3 | vector<string> V = {
| ^
a.cc:9:5: error: 'stack' was not declared in this scope
9 | stack<pair<int,int>> ST;
| ^~~~~
a.cc:9:11: error: 'pair' was not declared in this scope
9 | stack<pair<int,int>> ST;
| ^~~~
a.cc:9:16: error: expected primary-expression before 'int'
9 | stack<pair<int,int>> ST;
| ^~~
a.cc:13:15: error: expected ';' before 'T'
13 | string T = V[cur];
| ^~
| ;
a.cc:14:20: error: 'T' was not declared in this scope
14 | if (S.find(T, pos) == pos) {
| ^
a.cc:15:13: error: 'ST' was not declared in this scope
15 | ST.push({pos,cur+1});
| ^~
a.cc:18:17: error: 'cout' was not declared in this scope
18 | cout << "YES" << endl;
| ^~~~
a.cc:18:34: error: 'endl' was not declared in this scope
18 | cout << "YES" << endl;
| ^~~~
a.cc:25:14: error: 'ST' was not declared in this scope
25 | if (!ST.empty()) {
| ^~
a.cc:26:18: error: expected primary-expression before 'int'
26 | pair<int,int> P = ST.top(); ST.pop();
| ^~~
a.cc:27:19: error: 'P' was not declared in this scope
27 | pos = P.first;
| ^
a.cc:31:9: error: 'cout' was not declared in this scope
31 | cout << "NO" << endl;
| ^~~~
a.cc:31:25: error: 'endl' was not declared in this scope
31 | cout << "NO" << endl;
| ^~~~
|
s250051208 | p03854 | C++ | l = input()
l = l.replace('eraser','').replace('erase','').replace('dreamer','').replace('dream','')
if (l == ''):
print("YES")
else:
print("NO") | a.cc:3:15: warning: multi-character literal with 6 characters exceeds 'int' size of 4 bytes
3 | l = l.replace('eraser','').replace('erase','').replace('dreamer','').replace('dream','')
| ^~~~~~~~
a.cc:3:24: error: empty character constant
3 | l = l.replace('eraser','').replace('erase','').replace('dreamer','').replace('dream','')
| ^~
a.cc:3:36: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes
3 | l = l.replace('eraser','').replace('erase','').replace('dreamer','').replace('dream','')
| ^~~~~~~
a.cc:3:44: error: empty character constant
3 | l = l.replace('eraser','').replace('erase','').replace('dreamer','').replace('dream','')
| ^~
a.cc:3:56: warning: multi-character literal with 7 characters exceeds 'int' size of 4 bytes
3 | l = l.replace('eraser','').replace('erase','').replace('dreamer','').replace('dream','')
| ^~~~~~~~~
a.cc:3:66: error: empty character constant
3 | l = l.replace('eraser','').replace('erase','').replace('dreamer','').replace('dream','')
| ^~
a.cc:3:78: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes
3 | l = l.replace('eraser','').replace('erase','').replace('dreamer','').replace('dream','')
| ^~~~~~~
a.cc:3:86: error: empty character constant
3 | l = l.replace('eraser','').replace('erase','').replace('dreamer','').replace('dream','')
| ^~
a.cc:4:10: error: empty character constant
4 | if (l == ''):
| ^~
a.cc:1:1: error: 'l' does not name a type
1 | l = input()
| ^
|
s029313852 | p03854 | C | #include<stdio.h>
int main(void){
char s[10000];
char t[10000];
int i;
for(i=0;i<10000;i++){
scanf("%s",&s[i]);
}
for(i=0;i<10000;i++){
if(s[i]=="d" && s[i+1]=="r" && s[i+2]=="e" &&s[i+3]=="a" &&s[i+4]=="m"){
i += 4;
if(s[i]==e&&s[i]==r){
i += 2;
}
}
else if(s[i]=="e" && s[i+1]=="r" && s[i+2]=="a" &&s[i+3]=="s" &&s[i+4]=="e"){
i += 4;
if(s[i]==r){
i += 1;
}
}
else{
printf("NO");
break;
}
}
printf("YES");
//printf("%s",s);
return 0;
} | main.c: In function 'main':
main.c:12:12: warning: comparison between pointer and integer
12 | if(s[i]=="d" && s[i+1]=="r" && s[i+2]=="e" &&s[i+3]=="a" &&s[i+4]=="m"){
| ^~
main.c:12:27: warning: comparison between pointer and integer
12 | if(s[i]=="d" && s[i+1]=="r" && s[i+2]=="e" &&s[i+3]=="a" &&s[i+4]=="m"){
| ^~
main.c:12:42: warning: comparison between pointer and integer
12 | if(s[i]=="d" && s[i+1]=="r" && s[i+2]=="e" &&s[i+3]=="a" &&s[i+4]=="m"){
| ^~
main.c:12:56: warning: comparison between pointer and integer
12 | if(s[i]=="d" && s[i+1]=="r" && s[i+2]=="e" &&s[i+3]=="a" &&s[i+4]=="m"){
| ^~
main.c:12:70: warning: comparison between pointer and integer
12 | if(s[i]=="d" && s[i+1]=="r" && s[i+2]=="e" &&s[i+3]=="a" &&s[i+4]=="m"){
| ^~
main.c:14:16: error: 'e' undeclared (first use in this function)
14 | if(s[i]==e&&s[i]==r){
| ^
main.c:14:16: note: each undeclared identifier is reported only once for each function it appears in
main.c:14:25: error: 'r' undeclared (first use in this function)
14 | if(s[i]==e&&s[i]==r){
| ^
main.c:18:17: warning: comparison between pointer and integer
18 | else if(s[i]=="e" && s[i+1]=="r" && s[i+2]=="a" &&s[i+3]=="s" &&s[i+4]=="e"){
| ^~
main.c:18:32: warning: comparison between pointer and integer
18 | else if(s[i]=="e" && s[i+1]=="r" && s[i+2]=="a" &&s[i+3]=="s" &&s[i+4]=="e"){
| ^~
main.c:18:47: warning: comparison between pointer and integer
18 | else if(s[i]=="e" && s[i+1]=="r" && s[i+2]=="a" &&s[i+3]=="s" &&s[i+4]=="e"){
| ^~
main.c:18:61: warning: comparison between pointer and integer
18 | else if(s[i]=="e" && s[i+1]=="r" && s[i+2]=="a" &&s[i+3]=="s" &&s[i+4]=="e"){
| ^~
main.c:18:75: warning: comparison between pointer and integer
18 | else if(s[i]=="e" && s[i+1]=="r" && s[i+2]=="a" &&s[i+3]=="s" &&s[i+4]=="e"){
| ^~
|
s771104852 | p03854 | C++ | s | a.cc:1:1: error: 's' does not name a type
1 | s
| ^
|
s700509572 | p03854 | C++ | /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
| |
s783441416 | p03854 | C++ | #include<iostream>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep2(i, x, n) for (int i = x; i < (n); ++i)
using namespace std;
// using ll = long long;
// using P = pair<int, int>;
string divider[4] = { "dream", "dreamer", "erase", "eraser" };
int main() {
string S;
cin >> S;
// 後ろから解く代わりにすべての文字を左右反転させる
reverse(S.begin(), S.end());
rep(i, 4) reverse(divider[i].begin(), divider[i].end());
// 端から切っていく
bool can = true;
for (int i = 0; i < S.size();) {
bool can2 = false; // 4 個の文字列たちどれかで divide(割り算できるか)
rep(j, 4) {
string d = divider[j];
if (S.substr(i, d.size()) == d) { // i 番目から d.size() だけ抜き出す
can2 = true;
i += d.size(); // divide できたら i を進める.
}
}
if (!can2) {
can = false;
break;
}
}
if (can) cout << "YES" << endl;
else cout << "NO" << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:16:5: error: 'reverse' was not declared in this scope
16 | reverse(S.begin(), S.end());
| ^~~~~~~
|
s255890010 | p03854 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
string S;
cin >> S;
while(S.size()) {
if (S.substr(S.size()-4) == "dream") {
S = S.erase(S.size() - 4);
} else if (S.substr(S.size() - 6) == "dreamer") {
S = S.erase(S.size() - 6);
} else if (S.substr(S.size() - 4) == "erase") {
S = S.erase(S.size() - 4);
} else if (S.substr(S.size() - 5) == "eraser") {
S = S.erase(S.size() - 5);
} else {
cout << "NO" << endl;
return 0;
}
cout << "YES" << endl;
} | a.cc: In function 'int main()':
a.cc:24:2: error: expected '}' at end of input
24 | }
| ^
a.cc:4:12: note: to match this '{'
4 | int main() {
| ^
|
s292905995 | p03854 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
string S;
cin >> S;
int a = 0;
string t1 = "dream", t2 = "dreamer", t3 = "erase", t4 = "eraser";
while(){
if(S.substr(0,5) == t1) S.erase(0, 5);
if(S.substr(0,7) == t2) S.erase(0, 7);
if(S.substr(0,5) == t3) S.erase(0, 5);
if(S.substr(0,6) == t4) S.erase(0, 6);
if(S.size() == 0)a++;
if(S.size() < 5) break;
if(S.substr(0,5) != t1 && S.substr(0,7) != t2 &&
S.substr(0,5) != t3 && S.substr(0,6) != t4) break;
}
if(a){
cout << "Yes" << endl;
}else{
cout << "No" << endl;
}
} | a.cc: In function 'int main()':
a.cc:9:9: error: expected primary-expression before ')' token
9 | while(){
| ^
|
s814289659 | p03854 | C++ | #include<iostream>
using namespace std;
int main() {
string s;
cin >> s;
reverse(s.begin(), s.end());
int t = 1;
for (int i = 0; i < s.size(); i++) {
if (s[i] == 'm') {
i += 4;
}
else if (s[i] == 'e') {
i += 4;
}
else if (s[i] == 'r') {
i += 2;
if (s[i] == 'm') {
i += 4;
}
else if (s[i] == 's') {
i += 3;
}
else t = 0; break;
}
else t = 0; break;
}
if (t) cout << "YES" << endl;
else cout << "NO" << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:9:9: error: 'reverse' was not declared in this scope
9 | reverse(s.begin(), s.end());
| ^~~~~~~
|
s134537621 | p03854 | C++ | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <functional>
#include <utility>
using namespace std;
int main(){
string s;
cin >> s;
string s2 = s;
s += "0000000000000";
string d = "dream";
string dr = "dreamer";
string e = "erase";
string er = "eraser";
string t;
while(true){
if(s[t.size()] == 'd'){
if(s[t.size()+5] == 'd'){t += d;}
else if(s[t.size()+7] != 'a' && s[t.size()+5] == 'e'){t += dr;}
else{t += d;}
}
else if(s[t.size()] == 'e'){
if([t.size()+5] == 'r'){t += er;}
else{ t += e; }
}
else{break;}
//cout << t << endl;
}
bool f = false;
if(t.size() != s2.size()){f = true;}
else{
for(int i = 0; i < t.size(); i++){
if(t[i] != s2[i]){f = true; break;}
}
}
if(f){ cout << "NO" << endl;}
else{ cout << "YES" << endl;}
} | a.cc: In function 'int main()':
a.cc:28:12: error: expected ',' before '.' token
28 | if([t.size()+5] == 'r'){t += er;}
| ^
| ,
a.cc:28:12: error: expected identifier before '.' token
a.cc: In lambda function:
a.cc:28:23: error: expected '{' before '==' token
28 | if([t.size()+5] == 'r'){t += er;}
| ^~
a.cc: In function 'int main()':
a.cc:28:23: error: no match for 'operator==' (operand types are 'main()::<lambda()>' and 'char')
28 | if([t.size()+5] == 'r'){t += er;}
| ~~~~~~~~~~~~ ^~ ~~~
| | |
| | char
| main()::<lambda()>
In file included from /usr/include/c++/14/iosfwd:42,
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/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)'
192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed:
a.cc:28:26: note: 'main()::<lambda()>' is not derived from 'const std::fpos<_StateT>'
28 | if([t.size()+5] == 'r'){t += er;}
| ^~~
In file included from /usr/include/c++/14/string:43,
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/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)'
235 | operator==(const allocator<_T1>&, const allocator<_T2>&)
| ^~~~~~~~
/usr/include/c++/14/bits/allocator.h:235:5: note: template argument deduction/substitution failed:
a.cc:28:26: note: 'main()::<lambda()>' is not derived from 'const std::allocator<_CharT>'
28 | if([t.size()+5] == 'r'){t += er;}
| ^~~
In file included from /usr/include/c++/14/string:48:
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
441 | operator==(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed:
a.cc:28:26: note: 'main()::<lambda()>' is not derived from 'const std::reverse_iterator<_Iterator>'
28 | if([t.size()+5] == 'r'){t += er;}
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
486 | operator==(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed:
a.cc:28:26: note: 'main()::<lambda()>' is not derived from 'const std::reverse_iterator<_Iterator>'
28 | if([t.size()+5] == 'r'){t += er;}
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1667 | operator==(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed:
a.cc:28:26: note: 'main()::<lambda()>' is not derived from 'const std::move_iterator<_IteratorL>'
28 | if([t.size()+5] == 'r'){t += er;}
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1737 | operator==(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed:
a.cc:28:26: note: 'main()::<lambda()>' is not derived from 'const std::move_iterator<_IteratorL>'
28 | if([t.size()+5] == 'r'){t += er;}
| ^~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/string:51:
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed:
a.cc:28:26: note: 'main()::<lambda()>' is not derived from 'const std::pair<_T1, _T2>'
28 | if([t.size()+5] == 'r'){t += er;}
| ^~~
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54:
/usr/include/c++/14/string_view:629:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)'
629 | operator==(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:629:5: note: template argument deduction/substitution failed:
a.cc:28:26: note: 'main()::<lambda()>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
28 | if([t.size()+5] == 'r'){t += er;}
| ^~~
/usr/include/c++/14/string_view:637:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
637 | operator==(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:637:5: note: template argument deduction/substitution failed:
a.cc:28:26: note: 'main()::<lambda()>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
28 | if([t.size()+5] == 'r'){t += er;}
| ^~~
/usr/include/c++/14/string_view:644:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)'
644 | operator==(__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:644:5: note: template argument deduction/substitution failed:
a.cc:28:26: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'char'
28 | if([t.size()+5] == 'r'){t += er;}
| ^~~
/usr/include/c++/14/bits/basic_string.h:3755:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3755 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3755:5: note: template argument deduction/substitution failed:
a.cc:28:26: note: 'main()::<lambda()>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
28 | if([t.size()+5] == 'r'){t += er;}
| ^~~
/usr/include/c++/14/bits/basic_string.h:3772:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3772 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3772:5: note: template argument deduction/substitution failed:
a.cc:28:26: note: 'main()::<lambda()>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
28 | if([t.size()+5] == 'r'){t += er;}
| ^~~
/usr/include/c++/14/bits/basic_string.h:3819:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3819 | operator==(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3819:5: note: template argument deduction/substitution failed:
a.cc:28:26: note: mismatched types 'const _CharT*' and 'main()::<lambda()>'
28 | if([t.size()+5] == 'r'){t += er;}
| ^~~
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:2558:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator==(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)'
2558 | operator==(const tuple<_TElements...>& __t,
| ^~~~~~~~
/usr/include/c++/14/tuple:2558:5: note: template argument deduction/substitution failed:
a.cc:28:26: note: 'main()::<lambda()>' is not derived from 'const std::tuple<_UTypes ...>'
28 | if([t.size()+5] == 'r'){t += er;}
| ^~~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
from /usr/include/c++/14/bits/basic_ios.h:37,
from /usr/include/c++/14/ios:46:
/usr/include/c++/14/bits/streambuf_iterator.h:234:5: note: candidate: 'template<class _CharT, class _Traits> bool std::operator==(const istreambuf_iterator<_CharT, _Traits>&, const istreambuf_iterator<_CharT, _Traits>&)'
234 | operator==(const istreambuf_iterator<_CharT, _Traits>& __a,
| ^~~~~~~~
/usr/include/c++/14/bits/streambuf_iterator.h:234:5: note: template argument deduction/substitution failed:
a.cc:28: |
s832478210 | p03854 | C++ | #include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for(int i=m;i<(int)(n);i++)
typedef long long ll;
typedef pair<ll,ll> pint;
int main(){
string s;cin>>s;
bool flag=false;
vector<string> a={"dream", "dreamer", "erase", "eraser"};
while(s.size()){
ll seven=s.end()-s.begin()-7;
//cout<<seven<<endl;
seven=max(seven,0);
ll five=(s.end())-s.begin()-5;
five=max(five,0);
ll six=(s.end())-s.begin()-6;
six=max(six,0);
vector<ll> sfs={five,six,seven};
bool flag=false;
rep(i,4){
rep(j,sfs.size()){
//cout<<s.substr(sfs[j])<<" "<<sfs[j]<<endl;
if(s.substr(sfs[j])==a[i]){
s.erase(sfs[j],j+5);
flag=true;
}
}
}
if(!flag){
break;
}
}
if(s.size()==0){
cout<<"YES"<<endl;
}
else{
cout<<"NO"<<endl;
}
} | a.cc: In function 'int main()':
a.cc:17:18: error: no matching function for call to 'max(ll&, int)'
17 | seven=max(seven,0);
| ~~~^~~~~~~~~
In file included 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_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:17:18: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
17 | seven=max(seven,0);
| ~~~^~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:17:18: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
17 | seven=max(seven,0);
| ~~~^~~~~~~~~
a.cc:19:17: error: no matching function for call to 'max(ll&, int)'
19 | five=max(five,0);
| ~~~^~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:19:17: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
19 | five=max(five,0);
| ~~~^~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:19:17: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
19 | five=max(five,0);
| ~~~^~~~~~~~
a.cc:21:16: error: no matching function for call to 'max(ll&, int)'
21 | six=max(six,0);
| ~~~^~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:21:16: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
21 | six=max(six,0);
| ~~~^~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:21:16: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
21 | six=max(six,0);
| ~~~^~~~~~~
|
s873590337 | p03854 | C++ | #include <bits/stdc++.h>
#include <algorithm>
using namespace std;
int main (){
string S,T;
cin >> S;
T="";
bool z1=false;
string d,D,e,E;
d="maerd",D="remaerd",e="esare",E="resare";
int i=0;
reverse(S.begin(),S.end());
while(true){
int N=T.size();
T+=d;
for(i=0;i<T.size();i++){
if(S.at(i)!=T.at(i)){
z1=true;
}
}
if(z1){
T.subster(0,N);
z1=false;
}
T+=D;
for(i=0;i<T.size();i++){
if(S.at(i)!=T.at(i)){
z1=true;
}
}
if(z1){
T.subster(0,N);
z1=false;
}
T+=e;
for(i=0;i<T.size();i++){
if(S.at(i)!=T.at(i)){
z1=true;
}
}
if(z1){
T.subster(0,N);
T.erase(T.end()-5);
z1=false;
}
T+=E;
for(i=0;i<T.size();i++){
if(S.at(i)!=T.at(i)){
z1=true;
}
}
if(z1){
T.subster(0,N);
T.erase(T.end()-6);
z1=false;
}
if(T.size()==S.size()){
cout << "YES" << endl;
break;
}
else if(N==T.size()){
cout << "NO" << endl;
break;
}
}
}
| a.cc: In function 'int main()':
a.cc:24:16: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'subster'; did you mean 'substr'?
24 | T.subster(0,N);
| ^~~~~~~
| substr
a.cc:34:15: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'subster'; did you mean 'substr'?
34 | T.subster(0,N);
| ^~~~~~~
| substr
a.cc:44:26: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'subster'; did you mean 'substr'?
44 | T.subster(0,N);
| ^~~~~~~
| substr
a.cc:55:26: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'subster'; did you mean 'substr'?
55 | T.subster(0,N);
| ^~~~~~~
| substr
|
s354430462 | p03854 | Java | import java.util.*;
class Main
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
String s1 = sc.next();
StringBuffer sb = new StringBuffer(s1);
String s2 = sb.reverse().toString();
dream dreamer erase eraser
String s3 = s2.replace("maerd","").replace("remaerd","").replace("esare","").replace("resare","");
if(s3.size==0){
System.out.println("YES");
}else{
System.out.println("NO");
}
}
} | Main.java:12: error: ';' expected
dream dreamer erase eraser
^
Main.java:12: error: ';' expected
dream dreamer erase eraser
^
2 errors
|
s367746121 | p03854 | C++ | #include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for(int i=m;i<(int)(n);i++)
typedef long long ll;
typedef pair<ll,ll> pint;
string dfs(string s,string s1,vector<string> a){
if(s.size()<=s1.size()){
return s1;
}
else if(s.substr(0,s1.size())!=s1){
return "NO";
}
rep(i,4){
string l=dfs(s,s1+a[i],a);
if(l==s||l=="YES"){
return "YES";
}
else if(l=="NO"){
return "NO"
}
}
return"NO";
}
int main(){
string s;cin>>s;
bool flag=false;
vector<string> a={"dream", "dreamer", "erase", "eraser"};
cout<<dfs(s,"",a)<<endl;
} | a.cc: In function 'std::string dfs(std::string, std::string, std::vector<std::__cxx11::basic_string<char> >)':
a.cc:22:24: error: expected ';' before '}' token
22 | return "NO"
| ^
| ;
23 | }
| ~
|
s517817473 | p03854 | C++ | #include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <queue>
using namespace std;
int main(){
string devide[4]={"dream","dreamer","erase","eraser"};
for(int i=0;i<4;i++)reverse(devide[i].begin(),devide[j].end());
string S; cin>>S;
for(int i=0;i<S.size();i++){
bool can2=0;
for(int j=0;j<4;j++){
string d = devide[j];
if(S.substr(i,d.size())==d){
can2=1;
i+=d.size();
}
}
if(!can2){
cout<<"NO"<<endl;
return 0;
}
}
cout<<"YES"<<endl;
} | a.cc: In function 'int main()':
a.cc:12:58: error: 'j' was not declared in this scope
12 | for(int i=0;i<4;i++)reverse(devide[i].begin(),devide[j].end());
| ^
|
s735662923 | p03854 | C++ | #include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <queue>
using namespace std;
int main(){
string devide[4]={"dream","dreamer","erase","eraser"};
for(int i=0;i<4;i++)reverse(devide[i].begin(),devide.end());
string S; cin>>S;
for(int i=0;i<S.size();i++){
bool can2=0;
for(int j=0;j<4;j++){
string d = devide[j];
if(S.substr(i,d.size())==d){
can2=1;
i+=d.size();
}
}
if(!can2){
cout<<"NO"<<endl;
return 0;
}
}
cout<<"YES"<<endl;
} | a.cc: In function 'int main()':
a.cc:12:58: error: request for member 'end' in 'devide', which is of non-class type 'std::string [4]' {aka 'std::__cxx11::basic_string<char> [4]'}
12 | for(int i=0;i<4;i++)reverse(devide[i].begin(),devide.end());
| ^~~
|
s918137151 | p03854 | C++ | #include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <queue>
using namespace std;
int main(){
string devide[4]={"dream","dreamer","erase","eraser"};
fot(int i=0;i<4;i++)reverse(devide[i].begin(),devide.end());
string S; cin>>S;
for(int i=0;i<S.size();i++){
bool can2=0;
for(int i=0;i<4;i++){
string d = devide[i];
if(S.substr(i.d.size())==d){
can2=1;
i+=d.size();
}
}
if(!can2){
cout<<"No"<<endl;
return 0;
}
}
cout<<"Yes"<<endl;
} | a.cc: In function 'int main()':
a.cc:12:9: error: expected primary-expression before 'int'
12 | fot(int i=0;i<4;i++)reverse(devide[i].begin(),devide.end());
| ^~~
a.cc:12:17: error: 'i' was not declared in this scope
12 | fot(int i=0;i<4;i++)reverse(devide[i].begin(),devide.end());
| ^
a.cc:18:27: error: request for member 'd' in 'i', which is of non-class type 'int'
18 | if(S.substr(i.d.size())==d){
| ^
|
s675315148 | p03854 | Java | import java.util.Scanner;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
StringBuffer str = new StringBuffer(sc.next());
String S = str.reverse().toString();
sc.close();
System.out.println(solve(S));
}
public static String solve(String S) {
int index = 0;
while(index+5<S.length()) {
if(S.substring(index,index+5).equals("esare")) {
index += 5;
}else if(S.substring(index,index+5).equals("maerd")) {
index += 5;
}else if(S.substring(index,index+6).equals("resare")) {
index += 6;
}else if(S.substring(index,index+7).equals("remaerd")) {
index += 7;
}else {
return "No";
}
}
return "Yes";
} | Main.java:3: error: unnamed classes are a preview feature and are disabled by default.
public static void main(String[] args) {
^
(use --enable-preview to enable unnamed classes)
1 error
|
s406496505 | p03854 | Java | import java.util.Scanner;
public class AssignmentD {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
StringBuffer str = new StringBuffer(sc.next());
String S = str.reverse().toString();
sc.close();
System.out.println(solve(S));
}
public static String solve(String S) {
int index = 0;
while(index+5<S.length()) {
if(S.substring(index,index+5).equals("esare")) {
index += 5;
}else if(S.substring(index,index+5).equals("maerd")) {
index += 5;
}else if(S.substring(index,index+6).equals("resare")) {
index += 6;
}else if(S.substring(index,index+7).equals("remaerd")) {
index += 7;
}else {
return "No";
}
}
return "Yes";
}
} | Main.java:3: error: class AssignmentD is public, should be declared in a file named AssignmentD.java
public class AssignmentD {
^
1 error
|
s733549642 | p03854 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
reverse(s.begin(), s.end());
for (int i = 0; i < s.size();) {
string t = s.substr(i, 7);
if (t = "remaerd")
i += 7;
else if (t = "resare")
i += 6;
else if (t = "maerd")
i += 5;
else if (t = "esare")
i += 5;
else {
cout << "NO" << endl;
return 0;
}
}
cout << "YES" << endl;
} | a.cc: In function 'int main()':
a.cc:12:11: error: could not convert 't.std::__cxx11::basic_string<char>::operator=(((const char*)"remaerd"))' from 'std::__cxx11::basic_string<char>' to 'bool'
12 | if (t = "remaerd")
| ~~^~~~~~~~~~~
| |
| std::__cxx11::basic_string<char>
a.cc:14:16: error: could not convert 't.std::__cxx11::basic_string<char>::operator=(((const char*)"resare"))' from 'std::__cxx11::basic_string<char>' to 'bool'
14 | else if (t = "resare")
| ~~^~~~~~~~~~
| |
| std::__cxx11::basic_string<char>
a.cc:16:16: error: could not convert 't.std::__cxx11::basic_string<char>::operator=(((const char*)"maerd"))' from 'std::__cxx11::basic_string<char>' to 'bool'
16 | else if (t = "maerd")
| ~~^~~~~~~~~
| |
| std::__cxx11::basic_string<char>
a.cc:18:16: error: could not convert 't.std::__cxx11::basic_string<char>::operator=(((const char*)"esare"))' from 'std::__cxx11::basic_string<char>' to 'bool'
18 | else if (t = "esare")
| ~~^~~~~~~~~
| |
| std::__cxx11::basic_string<char>
|
s478859540 | p03854 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
reverse(s.begin(), s.end());
for (int i = 0; i < s.size();) {
string t = s。substr(i, 7);
if (t = "remaerd")
i += 7;
else if (t = "resare")
i += 6;
else if (t = "maerd")
i += 5;
else if (t = "esare")
i += 5;
else {
cout << "NO" << endl;
return 0;
}
}
cout << "YES" << endl;
} | a.cc:11:16: error: extended character 。 is not valid in an identifier
11 | string t = s。substr(i, 7);
| ^
a.cc: In function 'int main()':
a.cc:11:16: error: 's\U00003002substr' was not declared in this scope
11 | string t = s。substr(i, 7);
| ^~~~~~~~~
a.cc:12:11: error: could not convert 't.std::__cxx11::basic_string<char>::operator=(((const char*)"remaerd"))' from 'std::__cxx11::basic_string<char>' to 'bool'
12 | if (t = "remaerd")
| ~~^~~~~~~~~~~
| |
| std::__cxx11::basic_string<char>
a.cc:14:16: error: could not convert 't.std::__cxx11::basic_string<char>::operator=(((const char*)"resare"))' from 'std::__cxx11::basic_string<char>' to 'bool'
14 | else if (t = "resare")
| ~~^~~~~~~~~~
| |
| std::__cxx11::basic_string<char>
a.cc:16:16: error: could not convert 't.std::__cxx11::basic_string<char>::operator=(((const char*)"maerd"))' from 'std::__cxx11::basic_string<char>' to 'bool'
16 | else if (t = "maerd")
| ~~^~~~~~~~~
| |
| std::__cxx11::basic_string<char>
a.cc:18:16: error: could not convert 't.std::__cxx11::basic_string<char>::operator=(((const char*)"esare"))' from 'std::__cxx11::basic_string<char>' to 'bool'
18 | else if (t = "esare")
| ~~^~~~~~~~~
| |
| std::__cxx11::basic_string<char>
|
s495168773 | p03854 | C++ | #include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define fi first
#define se second
#define sz size()
#define bgn begin()
#define en end()
#define pb push_back
#define pp() pop_back()
#define V vector
#define P pair
#define yuko(a) setprecision(a)
#define uni(a) a.erase(unique(a.begin(),a.end()),a.end())
#define Q queue
#define pri priority_queue
#define Pri priority_queue<int,vector<int>,greater<int>>
#define PriP priority_queue<P<int,int>,vector<P<int,int>>,greater<P<int,int>>>
#define ff first.first
#define fs first.second
#define sf second.first
#define ss second.second
#define all(a) (a).begin(),(a).end()
#define elif else if
int low(V<int> a,int b){
decltype(a)::iterator c=lower_bound(a.begin(),a.end(),b);
int d=c-a.bgn;
return d;
}
int upp(V<int> a,int b){
decltype(a)::iterator c=upper_bound(a.begin(),a.end(),b);
int d=c-a.bgn;
return d;
}
template<class T>
void cou(vector<vector<T>> a){
int b=a.size();
int c=a[0].size();
fo(i,b){
fo(j,c){
cout<<a[i][j];
if(j==c-1)
cout<<endl;
else
cout<<' ';
}
}
}
int wari(int a,int b) {
if(a%b==0)
return a/b;
else
return a/b+1;
}
int keta(int a){
double b=a;
b=log10(b);
int c=b;
return c+1;
}
int souwa(int a){
return a*(a+1)/2;
}
int gcm(int a,int b){
if(a%b==0)
return b;
return gcm(b,a%b);
}
bool prime(int a){
if(a<2)
return false;
else if(a==2)
return true;
else if(a%2==0)
return false;
for(int i=3;i<=sqrt(a)+1;i+=2){
if (a%i==0)
return false;
}
return true;
}
struct Union{
vector<int> par;
Union(int a){
par=vector<int>(a,-1);
}
int find(int a){
if(par[a]<0)
return a;
else
return par[a]=find(par[a]);
}
bool same(int a,int b){
return find(a)==find(b);
}
int Size(int a){
return -par[find(a)];
}
void unite(int a,int b){
a=find(a);
b=find(b);
if(a==b)
return;
if(Size(b)>Size(a))
swap<int>(a,b);
par[a]+=par[b];
par[b]=a;
}
};
int ketas(int a){
string b=to_string(a);
int c=0;
fo(i,keta(a)){
c+=b[i]-'0';
}
return c;
}
bool fe(int a,int b){
a%=10;
b%=10;
if(a==0)
a=10;
if(b==0)
b=10;
if(a>b)
return true;
else
return false;
}
int INF=1000000007;
struct edge{int s,t,d; };
V<int> mojisyu(string a){
V<int> b(26,0);
fo(i,a.sz){
b[a[i]-'a']++;
}
return b;
}
int wa2(int a){
if(a%2==1)
return a/2;
return a/2-1;
}
/*signed main(){
int a,b,c;
cin>>a>>b>>c;
V<V<edge>> d(a);
fo(i,b){
edge e;
cin>>e.s>>e.t>>e.d;
d[e.s].pb(e);
}
V<int> e(a,INF);
e[c]=0;
priority_queue<P<int,int>,V<P<int,int>>,greater<P<int,int>>> f;
f.push({0,c});
int h=INF;
while(!f.empty()){
P<int,int> g;
g=f.top();
f.pop();
int v = g.second, i = g.first;
for(edge l : d[v]){
if(e[l.t] > i + l.d){
e[l.t] = i + l.d;
f.push({i+l.d , l.t});
}
}
}
fo(i,a){
if(e[i]==INF)
cout<<"INF"<<endl;
else
cout<<e[i]<<endl;
}
}
?*/
int nCr(int n,int r){
if(n<r)
return 0;
int a=1;
r=min(r,n-r);
for(int i=n;i>n-r;i--){
a*=i;
a/=n-i+1;
}
return a;
}
/*void sea(int x,int y){
if(x<0||a<=x||y<0||b<=y||c[x][y]=='#')
return;
if(d[x][y])
return;
d[x][y]++;
sea(x+1,y);
sea(x-1,y);
sea(x,y+1);
sea(x,y-1);
}*/
int kaijou(int a){
int b=1;
fo(i,a)
b*=i+1;
return b;
}
int nPr(int a,int b){
if(a<b)
return 0;
if(b==0)
return 1;
int c=1;
for(int i=a;i>a-b;i--){
c*=i;
c%=INF;
}
return c;
}
int modinv(int a,int m){
int b=m,u=1,v=0;
while(b){
int t=a/b;
a-=t*b;
swap(a,b);
u-=t*v;
swap(u,v);
}
u%=m;
if(u<0)
u+=m;
return u;
}
int lcm(int a,int b){
int c=modinv(gcm(a,b),INF);
return ((a*c)%INF)*(b%INF)%INF;
}
int MOD=INF;
int fac[1000010], finv[1000010], inv[1000010];
// テーブルを作る前処理
//先にCOMinit()で前処理をする
//ABC145D
void COMinit() {
fac[0]=fac[1]=1;
finv[0]=finv[1]=1;
inv[1]=1;
for(int i=2;i<1000010;i++){
fac[i]=fac[i-1]*i%MOD;
inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
finv[i]=finv[i-1]*inv[i]%MOD;
}
}
// 二項係数計算
int COM(int n,int k){
if(n<k)
return 0;
if(n<0||k<0)
return 0;
return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}
bool naka(int a,int b,V<V<char>> c){
return (a>=0&&b>=0&&a<c.sz&&b<c[0].sz);
}
V<P<int,int>> mawari8={{0,-1},{0,1},{1,0},{-1,0},{-1,-1},{1,1},{1,-1},{-1,-1}};
int inf=1000000000000000007;
/*
signed main(){
int a,b,c;
cin>>a>>b>>c;
V<V<edge>> d(a);
fo(i,b){
edge e;
cin>>e.s>>e.t>>e.d;
d[e.s].pb(e);
}
V<int> e(a,INF);
e[c]=0;
priority_queue<P<int,int>,V<P<int,int>>,greater<P<int,int>>> f;
f.push({0,c});
int h=INF;
while(!f.empty()){
P<int,int> g;
g=f.top();
f.pop();
int v = g.second, i = g.first;
for(edge l : d[v]){
if(e[l.t] > i + l.d){
e[l.t] = i + l.d;
f.push({i+l.d , l.t});
}
}
}
fo(i,a){
if(e[i]==INF)
cout<<"INF"<<endl;
else
cout<<e[i]<<endl;
}
}*/
V<P<int,int>> mawari4={{0,-1},{0,1},{1,0},{-1,0}};
//最短経路の表 a(全部INFで初期化)
//縦横 x,y
//迷路 f
//スタートsx,sy
//ゴールgx,gy
//文字はgから使おうね
/*int bfs_haba(){
Q<P<int,int>> b;
a[sx][sy]=0;
b.push({sx,sy});
while(!b.empty()){
P<int,int> c=b.front();
b.pop();
if(c.fi==gx&&c.se==gy){
break;
}
fo(i,4){
int d=c.fi+mawari4[i].fi;
int e=c.se+mawari4[i].se;
if(0<=d&&0<=e&&d<x&&e<y&&f[d][e]!='#'&&a[d][e]==INF){
b.push({d,e});
a[d][e]=1+a[c.fi][c.se];
}
}
}
return a[gx][gy];
}*/
V<int> onajibubun(string a){
V<int> b(a.sz);
for(int i=1,j=0;i<a.sz;i++){
if(i+b[i-j]<j+b[j])
b[i]=b[i-j];
else{
int c=max<int>(0,j+b[j]-i);
while(i+c<a.sz&&a[c]==a[i+c])
c++;
b[i]=c;
j=i;
}
}
b[0]=a.sz;
return b;
}
//各頂点ごとにどこに辺が出てるかの表がc
//各頂点ごとの色を表すV<int>(頂点数max)のcolorを用意する
//aはどこ塗るか、bは何で塗るかなので、(0,1,c)でよぶとおけ
V<int> color(205);
bool nibu_hantei(int a,int b,V<V<int>> c){
color[a]=b;
fo(i,c[a].sz){
if(b==color[c[a][i]])
return false;
if(color[c[a][i]]==0&&!nibu_hantei(c[a][i],-b,c))
return false;
}
return true;
}
//aは頂点数
//nibu_hanteiの上にcolorを用意する
//各頂点ごとにどこに辺が出てるかの表がc
bool renketujanai_nibu_hantei(int a,V<V<int>> c){
fo(i,a){
if(color[i]==0){
if(!nibu_hantei(i,1,c))
return false;
}
}
return true;
}
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
signed main(){
string m="maerd";
string rd="remaerd";
string e="esare";
string re="resare";
string s;
cin>>s;
reverse(s);
int a=1;
int b=0;
while(s.size()>b){
if(s.substr(b,5)==m){
b+=5;
}
else if(s.substr(b,7)==rd){
b+=7;
}
else if(s.substr(b,6)==re){
b+=6;
}
else if(s.substr(b,5)==e){
b+=5;
}
else{
a=0;
break;
}
}
if(a)
cout<<"YES"<<endl;
else
cout<<"NO"<<endl;
} | a.cc: In function 'int main()':
a.cc:384:10: error: no matching function for call to 'reverse(std::string&)'
384 | reverse(s);
| ~~~~~~~^~~
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: candidate expects 2 arguments, 1 provided
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, 1 provided
|
s864267372 | p03854 | C++ | #include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define fi first
#define se second
#define sz size()
#define bgn begin()
#define en end()
#define pb push_back
#define pp() pop_back()
#define V vector
#define P pair
#define yuko(a) setprecision(a)
#define uni(a) a.erase(unique(a.begin(),a.end()),a.end())
#define Q queue
#define pri priority_queue
#define Pri priority_queue<int,vector<int>,greater<int>>
#define PriP priority_queue<P<int,int>,vector<P<int,int>>,greater<P<int,int>>>
#define ff first.first
#define fs first.second
#define sf second.first
#define ss second.second
#define all(a) (a).begin(),(a).end()
#define elif else if
int low(V<int> a,int b){
decltype(a)::iterator c=lower_bound(a.begin(),a.end(),b);
int d=c-a.bgn;
return d;
}
int upp(V<int> a,int b){
decltype(a)::iterator c=upper_bound(a.begin(),a.end(),b);
int d=c-a.bgn;
return d;
}
template<class T>
void cou(vector<vector<T>> a){
int b=a.size();
int c=a[0].size();
fo(i,b){
fo(j,c){
cout<<a[i][j];
if(j==c-1)
cout<<endl;
else
cout<<' ';
}
}
}
int wari(int a,int b) {
if(a%b==0)
return a/b;
else
return a/b+1;
}
int keta(int a){
double b=a;
b=log10(b);
int c=b;
return c+1;
}
int souwa(int a){
return a*(a+1)/2;
}
int gcm(int a,int b){
if(a%b==0)
return b;
return gcm(b,a%b);
}
bool prime(int a){
if(a<2)
return false;
else if(a==2)
return true;
else if(a%2==0)
return false;
for(int i=3;i<=sqrt(a)+1;i+=2){
if (a%i==0)
return false;
}
return true;
}
struct Union{
vector<int> par;
Union(int a){
par=vector<int>(a,-1);
}
int find(int a){
if(par[a]<0)
return a;
else
return par[a]=find(par[a]);
}
bool same(int a,int b){
return find(a)==find(b);
}
int Size(int a){
return -par[find(a)];
}
void unite(int a,int b){
a=find(a);
b=find(b);
if(a==b)
return;
if(Size(b)>Size(a))
swap<int>(a,b);
par[a]+=par[b];
par[b]=a;
}
};
int ketas(int a){
string b=to_string(a);
int c=0;
fo(i,keta(a)){
c+=b[i]-'0';
}
return c;
}
bool fe(int a,int b){
a%=10;
b%=10;
if(a==0)
a=10;
if(b==0)
b=10;
if(a>b)
return true;
else
return false;
}
int INF=1000000007;
struct edge{int s,t,d; };
V<int> mojisyu(string a){
V<int> b(26,0);
fo(i,a.sz){
b[a[i]-'a']++;
}
return b;
}
int wa2(int a){
if(a%2==1)
return a/2;
return a/2-1;
}
/*signed main(){
int a,b,c;
cin>>a>>b>>c;
V<V<edge>> d(a);
fo(i,b){
edge e;
cin>>e.s>>e.t>>e.d;
d[e.s].pb(e);
}
V<int> e(a,INF);
e[c]=0;
priority_queue<P<int,int>,V<P<int,int>>,greater<P<int,int>>> f;
f.push({0,c});
int h=INF;
while(!f.empty()){
P<int,int> g;
g=f.top();
f.pop();
int v = g.second, i = g.first;
for(edge l : d[v]){
if(e[l.t] > i + l.d){
e[l.t] = i + l.d;
f.push({i+l.d , l.t});
}
}
}
fo(i,a){
if(e[i]==INF)
cout<<"INF"<<endl;
else
cout<<e[i]<<endl;
}
}
?*/
int nCr(int n,int r){
if(n<r)
return 0;
int a=1;
r=min(r,n-r);
for(int i=n;i>n-r;i--){
a*=i;
a/=n-i+1;
}
return a;
}
/*void sea(int x,int y){
if(x<0||a<=x||y<0||b<=y||c[x][y]=='#')
return;
if(d[x][y])
return;
d[x][y]++;
sea(x+1,y);
sea(x-1,y);
sea(x,y+1);
sea(x,y-1);
}*/
int kaijou(int a){
int b=1;
fo(i,a)
b*=i+1;
return b;
}
int nPr(int a,int b){
if(a<b)
return 0;
if(b==0)
return 1;
int c=1;
for(int i=a;i>a-b;i--){
c*=i;
c%=INF;
}
return c;
}
int modinv(int a,int m){
int b=m,u=1,v=0;
while(b){
int t=a/b;
a-=t*b;
swap(a,b);
u-=t*v;
swap(u,v);
}
u%=m;
if(u<0)
u+=m;
return u;
}
int lcm(int a,int b){
int c=modinv(gcm(a,b),INF);
return ((a*c)%INF)*(b%INF)%INF;
}
int MOD=INF;
int fac[1000010], finv[1000010], inv[1000010];
// テーブルを作る前処理
//先にCOMinit()で前処理をする
//ABC145D
void COMinit() {
fac[0]=fac[1]=1;
finv[0]=finv[1]=1;
inv[1]=1;
for(int i=2;i<1000010;i++){
fac[i]=fac[i-1]*i%MOD;
inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
finv[i]=finv[i-1]*inv[i]%MOD;
}
}
// 二項係数計算
int COM(int n,int k){
if(n<k)
return 0;
if(n<0||k<0)
return 0;
return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}
bool naka(int a,int b,V<V<char>> c){
return (a>=0&&b>=0&&a<c.sz&&b<c[0].sz);
}
V<P<int,int>> mawari8={{0,-1},{0,1},{1,0},{-1,0},{-1,-1},{1,1},{1,-1},{-1,-1}};
int inf=1000000000000000007;
/*
signed main(){
int a,b,c;
cin>>a>>b>>c;
V<V<edge>> d(a);
fo(i,b){
edge e;
cin>>e.s>>e.t>>e.d;
d[e.s].pb(e);
}
V<int> e(a,INF);
e[c]=0;
priority_queue<P<int,int>,V<P<int,int>>,greater<P<int,int>>> f;
f.push({0,c});
int h=INF;
while(!f.empty()){
P<int,int> g;
g=f.top();
f.pop();
int v = g.second, i = g.first;
for(edge l : d[v]){
if(e[l.t] > i + l.d){
e[l.t] = i + l.d;
f.push({i+l.d , l.t});
}
}
}
fo(i,a){
if(e[i]==INF)
cout<<"INF"<<endl;
else
cout<<e[i]<<endl;
}
}*/
V<P<int,int>> mawari4={{0,-1},{0,1},{1,0},{-1,0}};
//最短経路の表 a(全部INFで初期化)
//縦横 x,y
//迷路 f
//スタートsx,sy
//ゴールgx,gy
//文字はgから使おうね
/*int bfs_haba(){
Q<P<int,int>> b;
a[sx][sy]=0;
b.push({sx,sy});
while(!b.empty()){
P<int,int> c=b.front();
b.pop();
if(c.fi==gx&&c.se==gy){
break;
}
fo(i,4){
int d=c.fi+mawari4[i].fi;
int e=c.se+mawari4[i].se;
if(0<=d&&0<=e&&d<x&&e<y&&f[d][e]!='#'&&a[d][e]==INF){
b.push({d,e});
a[d][e]=1+a[c.fi][c.se];
}
}
}
return a[gx][gy];
}*/
V<int> onajibubun(string a){
V<int> b(a.sz);
for(int i=1,j=0;i<a.sz;i++){
if(i+b[i-j]<j+b[j])
b[i]=b[i-j];
else{
int c=max<int>(0,j+b[j]-i);
while(i+c<a.sz&&a[c]==a[i+c])
c++;
b[i]=c;
j=i;
}
}
b[0]=a.sz;
return b;
}
//各頂点ごとにどこに辺が出てるかの表がc
//各頂点ごとの色を表すV<int>(頂点数max)のcolorを用意する
//aはどこ塗るか、bは何で塗るかなので、(0,1,c)でよぶとおけ
V<int> color(205);
bool nibu_hantei(int a,int b,V<V<int>> c){
color[a]=b;
fo(i,c[a].sz){
if(b==color[c[a][i]])
return false;
if(color[c[a][i]]==0&&!nibu_hantei(c[a][i],-b,c))
return false;
}
return true;
}
//aは頂点数
//nibu_hanteiの上にcolorを用意する
//各頂点ごとにどこに辺が出てるかの表がc
bool renketujanai_nibu_hantei(int a,V<V<int>> c){
fo(i,a){
if(color[i]==0){
if(!nibu_hantei(i,1,c))
return false;
}
}
return true;
}
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const string a[4]={"dream","dreamr","erase","eraser"};
signed main(){
string s;
cin>>s;
rev(s);
fo(i,4){
rev(a[i]);
}
int b=1;
fo(i,s.size()){
int c=0;
fo(j,4){
string d=a[j];
if(s.substr(i,d.size())==d){
c=1;
i+=d.size();
}
}
if(!c){
b=0;
break;
}
}
if(b)
cout<<"Yes"<<endl;
else
cout<<"No"<<endl;
}
| In file included 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_algobase.h: In instantiation of 'void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 = __gnu_cxx::__normal_iterator<const char*, __cxx11::basic_string<char> >; _ForwardIterator2 = __gnu_cxx::__normal_iterator<const char*, __cxx11::basic_string<char> >]':
/usr/include/c++/14/bits/stl_algo.h:1062:18: required from 'void std::__reverse(_RandomAccessIterator, _RandomAccessIterator, random_access_iterator_tag) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<const char*, __cxx11::basic_string<char> >]'
1062 | std::iter_swap(__first, __last);
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1089:21: required from 'void std::reverse(_BIter, _BIter) [with _BIter = __gnu_cxx::__normal_iterator<const char*, __cxx11::basic_string<char> >]'
1089 | std::__reverse(__first, __last, std::__iterator_category(__first));
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:382:5: required from here
7 | #define rev(a) reverse(a.begin(),a.end())
| ~~~~~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:185:11: error: no matching function for call to 'swap(const char&, const char&)'
185 | swap(*__a, *__b);
| ~~~~^~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:61,
from /usr/include/c++/14/bits/stl_algobase.h:64:
/usr/include/c++/14/bits/move.h:226:5: note: candidate: 'template<class _Tp> std::_Require<std::__not_<std::__is_tuple_like<_Tp> >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&)'
226 | swap(_Tp& __a, _Tp& __b)
| ^~~~
/usr/include/c++/14/bits/move.h:226:5: note: template argument deduction/substitution failed:
In file included from /usr/include/c++/14/bits/stl_pair.h:60:
/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/type_traits:2323:11: required by substitution of 'template<class ... _Cond> using std::_Require = std::__enable_if_t<((bool)std::__and_<_Bn>::value)> [with _Cond = {std::__not_<std::__is_tuple_like<const char> >, std::is_move_constructible<const char>, std::is_move_assignable<const char>}]'
2323 | using _Require = __enable_if_t<__and_<_Cond...>::value>;
| ^~~~~~~~
/usr/include/c++/14/bits/move.h:226:5: required by substitution of 'template<class _Tp> std::_Require<std::__not_<std::__is_tuple_like<_Tp> >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&) [with _Tp = const char]'
226 | swap(_Tp& __a, _Tp& __b)
| ^~~~
/usr/include/c++/14/bits/stl_algobase.h:185:11: required from 'void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 = __gnu_cxx::__normal_iterator<const char*, __cxx11::basic_string<char> >; _ForwardIterator2 = __gnu_cxx::__normal_iterator<const char*, __cxx11::basic_string<char> >]'
185 | swap(*__a, *__b);
| ~~~~^~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1062:18: required from 'void std::__reverse(_RandomAccessIterator, _RandomAccessIterator, random_access_iterator_tag) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<const char*, __cxx11::basic_string<char> >]'
1062 | std::iter_swap(__first, __last);
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1089:21: required from 'void std::reverse(_BIter, _BIter) [with _BIter = __gnu_cxx::__normal_iterator<const char*, __cxx11::basic_string<char> >]'
1089 | std::__reverse(__first, __last, std::__iterator_category(__first));
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:382:5: required from here
7 | #define rev(a) reverse(a.begin(),a.end())
| ~~~~~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/type_traits:138:11: error: no type named 'type' in 'struct std::enable_if<false, void>'
138 | using __enable_if_t = typename enable_if<_Cond, _Tp>::type;
| ^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 = __gnu_cxx::__normal_iterator<const char*, __cxx11::basic_string<char> >; _ForwardIterator2 = __gnu_cxx::__normal_iterator<const char*, __cxx11::basic_string<char> >]':
/usr/include/c++/14/bits/stl_algo.h:1062:18: required from 'void std::__reverse(_RandomAccessIterator, _RandomAccessIterator, random_access_iterator_tag) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<const char*, __cxx11::basic_string<char> >]'
1062 | std::iter_swap(__first, __last);
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1089:21: required from 'void std::reverse(_BIter, _BIter) [with _BIter = __gnu_cxx::__normal_iterator<const char*, __cxx11::basic_string<char> >]'
1089 | std::__reverse(__first, __last, std::__iterator_category(__first));
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:382:5: required from here
7 | #define rev(a) reverse(a.begin(),a.end())
| ~~~~~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/move.h:250:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> std::__enable_if_t<((bool)std::__is_swappable<_Tp>::value)> std::swap(_Tp (&)[_Nm], _Tp (&)[_Nm])'
250 | swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])
| ^~~~
/usr/include/c++/14/bits/move.h:250:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algobase.h:185:11: note: mismatched types '_Tp [_Nm]' and 'const char'
185 | swap(*__a, *__b);
| ~~~~^~~~~~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1089:5: note: candidate: 'template<class _T1, class _T2> typename std::enable_if<std::__and_<std::__is_swappable<_T1>, std::__is_swappable<_T2> >::value>::type std::swap(pair<_T1, _T2>&, pair<_T1, _T2>&)'
1089 | swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y)
| ^~~~
/usr/include/c++/14/bits/stl_pair.h:1089:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algobase.h:185:11: note: mismatched types 'std::pair<_T1, _T2>' and 'const char'
185 | swap(*__a, *__b);
| ~~~~^~~~~~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1106:5: note: candidate: 'template<class _T1, class _T2> typename std::enable_if<(! std::__and_<std::__is_swappable<_T1>, std::__is_swappable<_T2> >::value)>::type std::swap(pair<_T1, _T2>&, pair<_T1, _T2>&)' (deleted)
1106 | swap(pair<_T1, _T2>&, pair<_T1, _T2>&) = delete;
| ^~~~
/usr/include/c++/14/bits/stl_pair.h:1106:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algobase.h:185:11: note: mismatched types 'std::pair<_T1, _T2>' and 'const char'
185 | swap(*__a, *__b);
| ~~~~^~~~~~~~~~~~
|
s166653242 | p03854 | C++ | //#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const long long INF= 1e+18+1;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MOD=1000000007LL;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int main(){
string s;cin>>s;
while(true){
if(s.substr(n-7)=="dreamer")s.erase(n-7);
else if(s.substr(n-5)=="dream")s.erase(n-5);
else if(s.substr(n-6)=="eraser")s.erase(n-6);
else if(s.substr(n-5)=="erase")s.erase(n-5);
else break;
}
if(s.size()==0)cout<<"YES"<<endl;
else cout<<"NO"<<endl;
} | a.cc: In function 'int main()':
a.cc:18:17: error: 'n' was not declared in this scope
18 | if(s.substr(n-7)=="dreamer")s.erase(n-7);
| ^
|
s883846819 | p03854 | C++ | #include <bits/stdc++.h>
using namespace std;
int test1(string s) {
int r=0;
if (s.substr(0,6)=="dreamer") r=7;
else if (s.substr(0,4)=="dream") r=5;
else if (s.substr(0,5)=="eraser") r=6;
else if (s.substr(0,4)=="erase") r=5;
return r;
}
int main() {
string str;
cin >> str;
int r;
while(str.size()>0) {
r=test1(str);
if(r==0) break;
if(r>5) {
if (test1(str.substr(r-1))==0) r=5;}
str=str.substr(r-1);
}
if(r==0) cout << "NO" <<endl;
else cout << "YES" <<endl
}
| a.cc: In function 'int main()':
a.cc:31:28: error: expected ';' before '}' token
31 | else cout << "YES" <<endl
| ^
| ;
32 | }
| ~
|
s207643537 | p03854 | C++ | #include <bits/stdc++.h>
using namespace std;
int test1(string s) {
int r=0;
if (s.substr(0,6)=="dreamer") r=7;
else if (s.substr(0,4)=="dream") r=5;
else if (s.substr(0,5)=="eraser") r=6;
else if (s.substr(0,4)=="erase") r=5;
return r;
}
int main() {
string str;
cin >> str;
int r;
while(str.size()>0) {
r=test1(str);
if(r==0) break;
if(r>5) {
if test1(str.substr(r-1))==0) r=5;}
str=str.substr(r-1);
}
if(r==0) cout << "NO" <<endl;
else cout << "YES" <<endl
}
| a.cc: In function 'int main()':
a.cc:26:10: error: expected '(' before 'test1'
26 | if test1(str.substr(r-1))==0) r=5;}
| ^~~~~
| (
a.cc:31:28: error: expected ';' before '}' token
31 | else cout << "YES" <<endl
| ^
| ;
32 | }
| ~
|
s476748524 | p03854 | C++ | #include <bits/stdc++.h>
using namespace std;
int test1(string s) {
int r=0;
if s.substr(0,6)=="dreamer" r=7;
else if s.substr(0,4)=="dream" r=5;
else if s.substr(0,5)=="eraser" r=6;
else if s.substr(0,4)=="erase" r=5;
return r;
}
int main() {
string str;
cin >> str;
int r;
while(str.size()>0) {
r=test1(str);
if(r==0) break;
if(r>5) {
if test1(str.substr(r-1))==0) r=5;}
str=str.substr(r-1);
}
if(r==0) cout << "NO" <<endl;
else cout << "YES" <<endl
}
| a.cc: In function 'int test1(std::string)':
a.cc:8:6: error: expected '(' before 's'
8 | if s.substr(0,6)=="dreamer" r=7;
| ^
| (
a.cc:9:3: error: 'else' without a previous 'if'
9 | else if s.substr(0,4)=="dream" r=5;
| ^~~~
a.cc:9:11: error: expected '(' before 's'
9 | else if s.substr(0,4)=="dream" r=5;
| ^
| (
a.cc:10:3: error: 'else' without a previous 'if'
10 | else if s.substr(0,5)=="eraser" r=6;
| ^~~~
a.cc:10:11: error: expected '(' before 's'
10 | else if s.substr(0,5)=="eraser" r=6;
| ^
| (
a.cc:11:3: error: 'else' without a previous 'if'
11 | else if s.substr(0,4)=="erase" r=5;
| ^~~~
a.cc:11:11: error: expected '(' before 's'
11 | else if s.substr(0,4)=="erase" r=5;
| ^
| (
a.cc: In function 'int main()':
a.cc:26:10: error: expected '(' before 'test1'
26 | if test1(str.substr(r-1))==0) r=5;}
| ^~~~~
| (
a.cc:31:28: error: expected ';' before '}' token
31 | else cout << "YES" <<endl
| ^
| ;
32 | }
| ~
|
s263319913 | p03854 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
string str;
cin >> str;
int r;
while(str.size()>0) {
r=test1(str);
if(r==0) break;
if(r>5) {
if test1(str.substr(r-1))==0) r=5;}
srt=str.substr(r-1);
}
if(r==0) cout << "NO" <<endl;
else cout << "YES" <<endl
}
int test1(string s) {
int r=0;
if s.substr(0,6)=="dreamer" r=7;
else if s.substr(0,4)=="dream" r=5;
else if s.substr(0,5)=="eraser" r=6;
else if s.substr(0,4)=="erase" r=5;
return r;
}
| a.cc: In function 'int main()':
a.cc:10:7: error: 'test1' was not declared in this scope
10 | r=test1(str);
| ^~~~~
a.cc:14:10: error: expected '(' before 'test1'
14 | if test1(str.substr(r-1))==0) r=5;}
| ^~~~~
| (
a.cc:15:5: error: 'srt' was not declared in this scope; did you mean 'str'?
15 | srt=str.substr(r-1);
| ^~~
| str
a.cc:19:28: error: expected ';' before '}' token
19 | else cout << "YES" <<endl
| ^
| ;
20 | }
| ~
a.cc: In function 'int test1(std::string)':
a.cc:25:6: error: expected '(' before 's'
25 | if s.substr(0,6)=="dreamer" r=7;
| ^
| (
a.cc:26:3: error: 'else' without a previous 'if'
26 | else if s.substr(0,4)=="dream" r=5;
| ^~~~
a.cc:26:11: error: expected '(' before 's'
26 | else if s.substr(0,4)=="dream" r=5;
| ^
| (
a.cc:27:3: error: 'else' without a previous 'if'
27 | else if s.substr(0,5)=="eraser" r=6;
| ^~~~
a.cc:27:11: error: expected '(' before 's'
27 | else if s.substr(0,5)=="eraser" r=6;
| ^
| (
a.cc:28:3: error: 'else' without a previous 'if'
28 | else if s.substr(0,4)=="erase" r=5;
| ^~~~
a.cc:28:11: error: expected '(' before 's'
28 | else if s.substr(0,4)=="erase" r=5;
| ^
| (
|
s116073976 | p03854 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
string str;
cin >> str;
int r
while(str.size()>0) {
r=test1(str);
if(r==0) break;
if(r>5) {
if test1(str.substr(r-1))==0) r=5;}
srt=str.substr(r-1);
}
if(r==0) cout << "NO" <<endl;
else cout << "YES" <<endl
}
int test1(string s) {
int r=0;
if s.substr(0,6)=="dreamer" r=7;
else if s.substr(0,4)=="dream" r=5;
else if s.substr(0,5)=="eraser" r=6;
else if s.substr(0,4)=="erase" r=5;
return r;
}
| a.cc: In function 'int main()':
a.cc:9:3: error: expected initializer before 'while'
9 | while(str.size()>0) {
| ^~~~~
a.cc:18:6: error: 'r' was not declared in this scope
18 | if(r==0) cout << "NO" <<endl;
| ^
a.cc:19:28: error: expected ';' before '}' token
19 | else cout << "YES" <<endl
| ^
| ;
20 | }
| ~
a.cc: In function 'int test1(std::string)':
a.cc:25:6: error: expected '(' before 's'
25 | if s.substr(0,6)=="dreamer" r=7;
| ^
| (
a.cc:26:3: error: 'else' without a previous 'if'
26 | else if s.substr(0,4)=="dream" r=5;
| ^~~~
a.cc:26:11: error: expected '(' before 's'
26 | else if s.substr(0,4)=="dream" r=5;
| ^
| (
a.cc:27:3: error: 'else' without a previous 'if'
27 | else if s.substr(0,5)=="eraser" r=6;
| ^~~~
a.cc:27:11: error: expected '(' before 's'
27 | else if s.substr(0,5)=="eraser" r=6;
| ^
| (
a.cc:28:3: error: 'else' without a previous 'if'
28 | else if s.substr(0,4)=="erase" r=5;
| ^~~~
a.cc:28:11: error: expected '(' before 's'
28 | else if s.substr(0,4)=="erase" r=5;
| ^
| (
|
s013135271 | p03854 | C++ | #abc049 c
s=input()
divide=["dream","dreamer","erase","eraser"]
s=s[::-1]
for i,x in enumerate(divide):
divide[i]=x[::-1]
ans=True
i=0
while i<len(s):
flag=False
for x in divide:
lx=len(x)
if s[i:i+lx] in divide:
flag=True
i+=lx
if flag==False:
ans=False
break
if flag:
print("YES")
else:
print("NO")
| a.cc:1:2: error: invalid preprocessing directive #abc049
1 | #abc049 c
| ^~~~~~
a.cc:2:1: error: 's' does not name a type
2 | s=input()
| ^
|
s990174644 | p03854 | C++ | #include <iostream>
#include <vector>
int main()
{
std::vector<std::string> candidates = {"dream", "dreamer", "erase", "eraser"};
for (auto &c : candidates)
{
std::reverse(c.begin(), c.end());
}
std::string S;
std::cin >> S;
std::reverse(S.begin(), S.end());
while (0 < S.size())
{
bool canReplace = false;
// 一致する文字列を探す
for (auto &c : candidates)
{
auto str = S.substr(0, c.size());
if (str == c)
{
S = S.substr(c.size(), S.size());
canReplace = true;
continue;
}
}
if (!canReplace)
{
std::cout << "No";
return 0;
}
}
std::cout << "Yes";
} | a.cc: In function 'int main()':
a.cc:9:14: error: 'reverse' is not a member of 'std'
9 | std::reverse(c.begin(), c.end());
| ^~~~~~~
a.cc:14:10: error: 'reverse' is not a member of 'std'
14 | std::reverse(S.begin(), S.end());
| ^~~~~~~
|
s315274936 | p03854 | C++ | int main(){
string s;
cin >> s;
reverse(s.begin(),s.end());
string divide[4] = {"maerd","remaerd","esare","resare"};
rep(i,s.size()){
bool ok = false;
rep(j,4){
if(s.substr(i, divide[j].size()) == divide[j]){
ok = true;
i += divide[j].size() - 1;
}
}
if(!ok){
cout << "NO" << endl;
return 0;
}
}
cout << "YES" << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:2:9: error: 'string' was not declared in this scope
2 | string s;
| ^~~~~~
a.cc:3:9: error: 'cin' was not declared in this scope
3 | cin >> s;
| ^~~
a.cc:3:16: error: 's' was not declared in this scope
3 | cin >> s;
| ^
a.cc:4:9: error: 'reverse' was not declared in this scope
4 | reverse(s.begin(),s.end());
| ^~~~~~~
a.cc:5:15: error: expected ';' before 'divide'
5 | string divide[4] = {"maerd","remaerd","esare","resare"};
| ^~~~~~~
| ;
a.cc:6:13: error: 'i' was not declared in this scope
6 | rep(i,s.size()){
| ^
a.cc:6:9: error: 'rep' was not declared in this scope
6 | rep(i,s.size()){
| ^~~
a.cc:19:9: error: 'cout' was not declared in this scope
19 | cout << "YES" << endl;
| ^~~~
a.cc:19:26: error: 'endl' was not declared in this scope
19 | cout << "YES" << endl;
| ^~~~
|
s670054839 | p03854 | C++ | if(c=="remaerd"){
size-=7;
if(size>0){
t.erase(t.begin(),t.begin()+7);
dp(t,size,ans);
}
else{
if(size==0){
*ans="YES";
}
}
} | a.cc:1:1: error: expected unqualified-id before 'if'
1 | if(c=="remaerd"){
| ^~
|
s977833886 | p03854 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
string s;
cin >> s;
reverse(s.begin(), s.end());
string vec[4] = {"dream", "dreamer", "erase", "eraser"};
for (int i=0; i<4; i++){
reverse(vec[i].begin(), vec[i].end());
}
int i=0; bool can=false;
while(i<s.size()){
can=false;
for(int j=0; j<4; j++){
if(vec.substr(i, vec[j].size())==vec[j]){
i+=vec[j].size();
can=true;
}
if(can) break;
}
}
if(can) cout << "YES" << endl;
else cout << "NO" << endl;
} | a.cc: In function 'int main()':
a.cc:16:16: error: request for member 'substr' in 'vec', which is of non-class type 'std::string [4]' {aka 'std::__cxx11::basic_string<char> [4]'}
16 | if(vec.substr(i, vec[j].size())==vec[j]){
| ^~~~~~
|
s200127287 | p03854 | C++ | #include <iostream>
#include <string>
std::string divide[4] = {"dream", "dreamer", "erase", "eraser"};
int main(int argc, char *argv[]) {
std::string S;
std::cin >> S;
std::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) {
std::string d = divide[j];
if (S.substr(i, d.size()) == d) {
can2 = true;
i += d.size();
}
}
if (!can2) {
can = false;
break;
}
}
std::cout << (can ? "YES" : "NO") << std::endl;
}
| a.cc: In function 'int main(int, char**)':
a.cc:10:8: error: 'reverse' is not a member of 'std'
10 | std::reverse(S.begin(), S.end());
| ^~~~~~~
a.cc:12:5: error: 'reverse' was not declared in this scope
12 | reverse(divide[i].begin(), divide[i].end());
| ^~~~~~~
|
s801569394 | p03854 | C++ | #include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
using namespace std;
int main(){
string s;
string divide[4] = {"dream", "dreamer", "erase", "eraser"};
cin>>s;
//各文字列を反転させ、後ろから考える
reverse(s.begin(), s.end());
for (int i = 0; i < 4; i++){
reverse(divide[i].begin(), divide[i].end());
}
bool canDivide = false;
bool ans = true;
for(int i=0;i<s.size()){
canDivide = false;
for (int j = 0; j < 4; j++){
if(s.substr(i, divide[j].size()) == divide[j]){
// cout<<"j:"<<j<<", before s:"<<s;
canDivide = true;
// cout<<", after s:"<<s<<endl;
i += divide[j].size();
}
}
if(canDivide==false){
ans = false;
break;
}
}
if(ans==true) cout<<"YES"<<endl;
else cout<<"NO"<<endl;
}
| a.cc: In function 'int main()':
a.cc:26:27: error: expected ';' before ')' token
26 | for(int i=0;i<s.size()){
| ^
| ;
|
s018595597 | p03854 | C++ | #include <bits/stdc++.h>
using namespace std;
string divide[4] = {"dream","dreamer","erase","eraser"};
int main(){
string s;
cin >> s;
reverse(s.bigin(),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: In function 'int main()':
a.cc:10:15: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'bigin'; did you mean 'begin'?
10 | reverse(s.bigin(),s.end());
| ^~~~~
| begin
|
s413708510 | p03854 | C++ | #include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<(int)(N);i++
bool c(vector<char> &N,int i){
char front=N.at(i-1);
if(front=='d'){
if(N.at(i)=='r')
return true;
else
return false;
}
else if(front=='r'){
if(N.at(i)=='e'||N.at(i)=='d'||N.at(i)=='a')
return true;
else
return false;
}
else if(front=='e'){
if(N.at(i)=='a'||N.at(i)=='r'||N.at(i)=='d')
return true;
else
return false;
}
else if(front=='a'){
if(N.at(i)=='m'||N.at(i)=='s')
return true;
else
return false;
}
else if(front=='m'){
if(N.at(i)=='e'||N.at(i)=='d')
return true;
else
return false;
}
else if(front=='s'){
if(N.at(i)=='e')
return true;
else
return false;
}
}
int main(){
vector<char> N;
bool check=true;
rep(i,N)
cin>>N.at(i);
rep(i,N){
if(check==false){
cout<<"NO"<<endl;
break;
}
if(i=0){
if(N.at(i)=='d'||N.at(i)=='e')
continue;
else{
check=false;
break;
}
}
if(check=true)
check=c(N,i);
}
if(check=true)
cout<<"YES"<<endl;
} | a.cc: In function 'int main()':
a.cc:3:32: error: invalid cast from type 'std::vector<char>' to type 'int'
3 | #define rep(i,N) for(int i=0;i<(int)(N);i++
| ^~~~~~~~
a.cc:49:3: note: in expansion of macro 'rep'
49 | rep(i,N)
| ^~~
a.cc:50:5: error: expected ')' before 'cin'
50 | cin>>N.at(i);
| ^~~
a.cc:3:21: note: to match this '('
3 | #define rep(i,N) for(int i=0;i<(int)(N);i++
| ^
a.cc:49:3: note: in expansion of macro 'rep'
49 | rep(i,N)
| ^~~
a.cc:3:32: error: invalid cast from type 'std::vector<char>' to type 'int'
3 | #define rep(i,N) for(int i=0;i<(int)(N);i++
| ^~~~~~~~
a.cc:51:3: note: in expansion of macro 'rep'
51 | rep(i,N){
| ^~~
a.cc:51:11: error: expected ')' before '{' token
51 | rep(i,N){
| ^
a.cc:3:21: note: to match this '('
3 | #define rep(i,N) for(int i=0;i<(int)(N);i++
| ^
a.cc:51:3: note: in expansion of macro 'rep'
51 | rep(i,N){
| ^~~
a.cc: In function 'bool c(std::vector<char>&, int)':
a.cc:44:1: warning: control reaches end of non-void function [-Wreturn-type]
44 | }
| ^
|
s998189410 | p03854 | C++ | S = input()
temp = ['dream', 'dreamer', 'erase', 'eraser']
while(1):
for i in temp:
if S.startswith(i):
S = S.lstrip(i)
break
else:
break
print(S)
if len(S) == 0:
print('YES')
else:
print('NO')
| a.cc:2:9: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes
2 | temp = ['dream', 'dreamer', 'erase', 'eraser']
| ^~~~~~~
a.cc:2:18: warning: multi-character literal with 7 characters exceeds 'int' size of 4 bytes
2 | temp = ['dream', 'dreamer', 'erase', 'eraser']
| ^~~~~~~~~
a.cc:2:29: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes
2 | temp = ['dream', 'dreamer', 'erase', 'eraser']
| ^~~~~~~
a.cc:2:38: warning: multi-character literal with 6 characters exceeds 'int' size of 4 bytes
2 | temp = ['dream', 'dreamer', 'erase', 'eraser']
| ^~~~~~~~
a.cc:14:11: warning: multi-character character constant [-Wmultichar]
14 | print('YES')
| ^~~~~
a.cc:16:11: warning: multi-character character constant [-Wmultichar]
16 | print('NO')
| ^~~~
a.cc:1:1: error: 'S' does not name a type
1 | S = input()
| ^
|
s225376156 | 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>div={"dream","dreamer","erase","eraser"};
reverse(s.begin(),s.end());
rep(i,4){reverse(div[i].begin(),div[i].end());}
bool ex=true;
rep(i,s.size()){
bool ex2=false;
rep(j,4){
string d=div[j];
if(d==substr(i,d.size()){
ex2=true;
i+=d.size();
}
}
if(ex2==false){
ex=false;
break;
}
}
if(ex==true)
cout<<"YES"<<endl;
else
cout<<"NO"<<endl;
} | a.cc: In function 'int main()':
a.cc:19:13: error: 'substr' was not declared in this scope; did you mean 'strstr'?
19 | if(d==substr(i,d.size()){
| ^~~~~~
| strstr
a.cc:19:31: error: expected ')' before '{' token
19 | if(d==substr(i,d.size()){
| ~ ^
| )
a.cc:23:5: error: expected primary-expression before '}' token
23 | }
| ^
|
s071610731 | p03854 | C++ | #include <iostream>
using namespace std;
int main()
{
string divide[4] = { "dream", "dreamer", "erase", "eraser" };
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;
else cout << "NO" << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:9:9: error: 'reverse' was not declared in this scope
9 | reverse(S.begin(), S.end());
| ^~~~~~~
|
s711544199 | p03854 | C++ | #include <iostream>
usign namespace std;
int main()
{
string divide[4] = { "dream", "dreamer", "erase", "eraser" };
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;
else cout << "NO" << endl;
return 0;
} | a.cc:2:1: error: 'usign' does not name a type
2 | usign namespace std;
| ^~~~~
a.cc: In function 'int main()':
a.cc:5:9: error: 'string' was not declared in this scope
5 | string divide[4] = { "dream", "dreamer", "erase", "eraser" };
| ^~~~~~
a.cc:5:9: 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:6:15: error: expected ';' before 'S'
6 | string S;
| ^~
| ;
a.cc:7:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
7 | cin >> S;
| ^~~
| std::cin
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
a.cc:7:16: error: 'S' was not declared in this scope
7 | cin >> S;
| ^
a.cc:9:9: error: 'reverse' was not declared in this scope
9 | reverse(S.begin(), S.end());
| ^~~~~~~
a.cc:10:45: error: 'divide' was not declared in this scope
10 | for (int i = 0; i < 4; ++i) reverse(divide[i].begin(), divide[i].end());
| ^~~~~~
a.cc:17:31: error: expected ';' before 'd'
17 | string d = divide[j];
| ^~
| ;
a.cc:18:41: error: 'd' was not declared in this scope
18 | if (S.substr(i, d.size()) == d) {
| ^
a.cc:29:18: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
29 | if (can) 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:35: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
29 | if (can) 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:14: 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:30: 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)
| ^~~~
|
s820132755 | p03854 | C++ | #include <iostream>
#include <string>
std::string divide[4] = {"dream", "dreamer", "erase", "eraser"};
int main(int argc, char *argv[]) {
std::string S;
std::cin >> S;
std::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) {
std::string d = divide[j];
if (S.substr(i, d.size()) == d) {
can2 = true;
i += d.size();
}
}
if (!can2) {
can = false;
break;
}
}
std::cout << (can ? "YES" : "NO") << std::endl;
}
| a.cc: In function 'int main(int, char**)':
a.cc:10:8: error: 'reverse' is not a member of 'std'
10 | std::reverse(S.begin(), S.end());
| ^~~~~~~
a.cc:12:5: error: 'reverse' was not declared in this scope
12 | reverse(divide[i].begin(), divide[i].end());
| ^~~~~~~
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.