criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;

const int MOD=1000000007;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;
 
int main(){
  //input
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  
  scanf("%s",s);
  
  reverse(s.begin(),s.end());
  
  while(s.size()>4){
    if(s.substr(0,5)=="maerd") s=s.substr(5);
    else if(s.substr(0,5)=="esare") s=s.substr(5);
    else if(s.substr(0,6)=="resare") s=s.substr(6);
    else if(s.substr(0,7)=="remaerd") s=s.substr(7);
    else break;
  }
  if(s.size()==0) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
  
}
  



Compiler output:
a.cc: In function 'int main()':
a.cc:15:14: error: 's' was not declared in this scope
   15 |   scanf("%s",s);
      |              ^
Language: C++

#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;

const int MOD=1000000007;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;
 
int main(){
  //input
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  
  scanf("s%",s);
  
  reverse(s.begin(),s.end());
  
  while(s.size()>4){
    if(s.substr(0,5)=="maerd") s=s.substr(5);
    else if(s.substr(0,5)=="esare") s=s.substr(5);
    else if(s.substr(0,6)=="resare") s=s.substr(6);
    else if(s.substr(0,7)=="remaerd") s=s.substr(7);
    else break;
  }
  if(s.size()==0) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
  
}
  



Compiler output:
a.cc: In function 'int main()':
a.cc:15:14: error: 's' was not declared in this scope
   15 |   scanf("s%",s);
      |              ^
Language: C++

#include <iostream>
#include <string>
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){
                can2 = true;
                i += d.size();
            }
        }
        if(!can2) {
            can = false;
            break;
        }
    }
    
    if(can) cout << "YES" << endl;
    else cout << "NO" << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:5: error: 'reverse' was not declared in this scope
   11 |     reverse(S.begin(), S.end());
      |     ^~~~~~~
Language: C++

#include <string>
#include <algorithm>
using namespace std;

string divide[4] = {"dream", "dreamer", "erase", "eraser"};

int main() {
    string S;
    cin >> S;
    
    reverse(S.begin(), S.end());
    for(int 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(!can) {
            can = false;
            break;
        }
    }
    
    if(can) cout << "YES" << endl;
    else cout << "NO" << endl;
    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:5: error: 'cin' was not declared in this scope
    9 |     cin >> S;
      |     ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include <algorithm>
  +++ |+#include <iostream>
    3 | using namespace std;
a.cc:31:13: error: 'cout' was not declared in this scope
   31 |     if(can) cout << "YES" << endl;
      |             ^~~~
a.cc:31:13: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:31:30: error: 'endl' was not declared in this scope
   31 |     if(can) cout << "YES" << endl;
      |                              ^~~~
a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    2 | #include <algorithm>
  +++ |+#include <ostream>
    3 | using namespace std;
a.cc:32:10: error: 'cout' was not declared in this scope
   32 |     else cout << "NO" << endl;
      |          ^~~~
a.cc:32:10: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:32:26: error: 'endl' was not declared in this scope
   32 |     else cout << "NO" << endl;
      |                          ^~~~
a.cc:32:26: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
Language: C++

#include <iostream>
using namespace std;
 
string divide[4] = {"dream", "dreamer", "erase", "eraser"};


int main() {
  string S;
  cin >> S;
  
  reverse(S.begin(),S.end());
  for(int i=0;i<4;++i) reverse(divide[i].begin(), divide[i].end());
  
  bool can = true;
  
  for(int i =0 ; i < S.size() ; ++i){
  	bool can2 = false;
    for (int j =0 ; j < 4 ; ++j){
      string d = divide[j];
      if(S.substr(i,d.size()) ==d ){
        can2 = true;
        i += d.size(); // divide できたら i を進める
      }
    }
    if(!can2){
      can=false;
      break;
    }
  }
  
  if (can) cout << "YES" << endl;
  else cout << "NO" << endl;
  
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:3: error: 'reverse' was not declared in this scope
   11 |   reverse(S.begin(),S.end());
      |   ^~~~~~~
Language: C++

#include<algorithm>//sort(all(変数),greater<型名>())　で降順に
#include<cmath>//切り上げceil(値)
#include<deque>
#include<iomanip>//setprecision(数字)
#include<iostream>
#include<list>
#include<map>
#include<numeric> //xとyの最大公約数は__gcd(x,y),xとyの最小公倍数は(x*y)/__gcd
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<vector>

#include<bits/stdc++.h>
#include<cstdio>
#include<cstdlib>
#include<tuple>
#include<utility>
#define rep(i,n) for(ll i=0; i<n; i++)
#define vll vector<ll>
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
using ll = long long;
using namespace std;

int main(){
  string s;  cin >> s;
  string t[4] ={"dream","dreamer","erase","eraser"};
  reverse(all(s));
  rep(i,4){
    reverse(all(t));
  }
  bool can = true;
  for(int i = 0; i < s.size();){
    bool div = false;
    rep(j,4){
      if(s.substr(i,t[j].size()) == t[j]){
        i += t[j].size();
        div = true;
      }
    }
    if(!div){
      can = false;
      break;
    }
  }
  if(can){
    cout << "YES";
  }else{
    cout << "NO";
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:20: error: request for member 'begin' in 't', which is of non-class type 'std::string [4]' {aka 'std::__cxx11::basic_string<char> [4]'}
   23 | #define all(x) (x).begin(),(x).end()
      |                    ^~~~~
a.cc:33:13: note: in expansion of macro 'all'
   33 |     reverse(all(t));
      |             ^~~
a.cc:23:32: error: request for member 'end' in 't', which is of non-class type 'std::string [4]' {aka 'std::__cxx11::basic_string<char> [4]'}
   23 | #define all(x) (x).begin(),(x).end()
      |                                ^~~
a.cc:33:13: note: in expansion of macro 'all'
   33 |     reverse(all(t));
      |             ^~~
Language: Java

import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    String s=sc.next();
    boolean isOK=false;
    sc.close();
    while(s!=null){
      cut(s);
      if(s="wrong"){
        System.out.println("NO");
        return;
      }
    }
    System.out.println("YES");
    return;
  }
  public static String cut(String str){
    if(str.length()>=5){
      if(str.substring(str.length()-5,str.length()).equals("dream")||str.substring(str.length()-5,str.length()).equals("erase")){
        str=str.substring(0, str.length()-5);
        return str;
      }
    }
    if(str.length()>=6){
      if(str.substring(str.length()-6,str.length()).equals("eraser")){
        str=str.substring(0, str.length()-6);
        return str;
      }
    }
    if(str.length()>=7){
      if(str.substring(str.length()-6,str.length()).equals("dreamer")){
        str=str.substring(0, str.length()-7);
        return str;
      }
    }
    return "wrong";
  }
}

Compiler output:
Main.java:10: error: incompatible types: String cannot be converted to boolean
      if(s="wrong"){
          ^
1 error
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

string divide[4]={"dream","deramer","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 =ture;
  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(!cans){
      can=false;
      break;
    }
  }
  if (can) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
}
        
    

Compiler output:
a.cc: In function 'int main()':
a.cc:14:13: error: 'ture' was not declared in this scope
   14 |   bool can =ture;
      |             ^~~~
a.cc:24:9: error: 'cans' was not declared in this scope; did you mean 'can2'?
   24 |     if(!cans){
      |         ^~~~
      |         can2
Language: C++

#include<bits/stdc++.h>
using namespace std;
char s[10000000000];
int lo;
bool flag=false;
int main()
{
    cin>>s;
    lo=strlen(s);
    if(lo<5)
    {
    	cout<<"NO";
    	return 0;
	}
    if(s[lo-1]=='m')
    	if(s[lo-2]=='a')
    		if(s[lo-3]=='e')
    			if(s[lo-4]=='r')
    				if(s[lo-5]=='d')
    					flag=true;
    if(s[lo-1]=='r')
    	if(s[lo-2]=='e')
    		if(s[lo-3]=='m')
    			if(s[lo-4]=='a')
    				if(s[lo-5]=='e')
    					if(s[lo-6]=='r')
    						if(s[lo-7]=='d')
    							flag=true;
	if(s[lo-1]=='e')
    	if(s[lo-2]=='s')
    		if(s[lo-3]=='a')
    			if(s[lo-4]=='r')
    				if(s[lo-5]=='e')
    					flag=true;
    if(s[lo-1]=='r')
    	if(s[lo-2]=='e')
    		if(s[lo-3]=='s')
    			if(s[lo-4]=='a')
    				if(s[lo-5]=='r')
    					if(s[lo-6]=='e')
    							flag=true;
    if(flag==true) cout<<"YES";
	else cout<<"NO";	
    return 0;
}

Compiler output:
/tmp/cct9ynZr.o: in function `main':
a.cc:(.text+0x2e): relocation truncated to fit: R_X86_64_PC32 against symbol `lo' defined in .bss section in /tmp/cct9ynZr.o
a.cc:(.text+0x34): relocation truncated to fit: R_X86_64_PC32 against symbol `lo' defined in .bss section in /tmp/cct9ynZr.o
a.cc:(.text+0x62): relocation truncated to fit: R_X86_64_PC32 against symbol `lo' defined in .bss section in /tmp/cct9ynZr.o
a.cc:(.text+0x7c): relocation truncated to fit: R_X86_64_PC32 against symbol `lo' defined in .bss section in /tmp/cct9ynZr.o
a.cc:(.text+0x96): relocation truncated to fit: R_X86_64_PC32 against symbol `lo' defined in .bss section in /tmp/cct9ynZr.o
a.cc:(.text+0xb0): relocation truncated to fit: R_X86_64_PC32 against symbol `lo' defined in .bss section in /tmp/cct9ynZr.o
a.cc:(.text+0xca): relocation truncated to fit: R_X86_64_PC32 against symbol `lo' defined in .bss section in /tmp/cct9ynZr.o
a.cc:(.text+0xe4): relocation truncated to fit: R_X86_64_PC32 against symbol `flag' defined in .bss section in /tmp/cct9ynZr.o
a.cc:(.text+0xeb): relocation truncated to fit: R_X86_64_PC32 against symbol `lo' defined in .bss section in /tmp/cct9ynZr.o
a.cc:(.text+0x109): relocation truncated to fit: R_X86_64_PC32 against symbol `lo' defined in .bss section in /tmp/cct9ynZr.o
a.cc:(.text+0x127): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include<iostream>
#include<string>
#include<vector>
using namespace std;

int main(){
    string s;
    cin >> s;
    reverse(s.begin(),s.end());
    int i=0;
    bool sw = true;
    while(i < s.size()){
        if(s.size()-i < 5){
            sw = false;
            break;
        }
        string t = s.substr(i,5);
        if(t == "maerd"){
            i += 5;
        }
        else if(t == "esare"){
            i += 5;
        }
        else if(s.size()-i >=6){
            string u = s.substr(i,6);
            if(u == "resare"){
                i += 6;
            }
            else if(s.size()-i >=7){
                string r = s.substr(i,7);
                if(r == "remaerd"){
                    i += 7;
                }
                else{
                    sw = false;
                    break;
                }
            }
            else{
                sw = false;
                break;
            }
        }
        else{
            sw = false;
            break;
        }
    }
    if(sw){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:5: error: 'reverse' was not declared in this scope
    9 |     reverse(s.begin(),s.end());
      |     ^~~~~~~
Language: C++

// C - 白昼夢 / Daydream
#include <bits/stdc++.h>
using namespace std;

int solve();
string S;
vector<string> st = {"dream",  "dreamer", "erase", "eraser"};

int main(){
  cin >> S;
  solve();
}


int solve(){
  reverse(S.begin(), S.end());
  for(int i = 0; i<4;i++){
    reverse(st.at(i).begin(), st.at(i).end());
  }

  bool can = true;

  for(int i = 0; i<S.size()){
    bool can2 = false;
    for(int j  = 0 ; j<4;  j++){
      string d = st.at(j);
      if(S.substr(i, d.size()) == d){
        can2 = true;
        i += d.size();
      }
    }

    if(!can2){
      can = false;
      break;
    }
  }

  if (can) cout << "YES" << endl;
  else cout << "N0" << endl;
}


Compiler output:
a.cc: In function 'int solve()':
a.cc:23:28: error: expected ';' before ')' token
   23 |   for(int i = 0; i<S.size()){
      |                            ^
      |                            ;
a.cc:41:1: warning: no return statement in function returning non-void [-Wreturn-type]
   41 | }
      | ^
Language: C++

#include <bits/stdc++.h>
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" << ednl;
  else cout << "No" << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:28: error: 'ednl' was not declared in this scope
   28 |   if(can) cout << "Yes" << ednl;
      |                            ^~~~
Language: C++

#include <bits/stdc++.h>
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(divede[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;
    }


}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:17: error: 'divede' was not declared in this scope; did you mean 'divide'?
   11 |         reverse(divede[i].begin(),divide[i].end());
      |                 ^~~~~~
      |                 divide
Language: C++

#include <bits/stdc++.h>
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(divede[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;
    }


}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:5: error: 'String' was not declared in this scope
    5 |     String S;
      |     ^~~~~~
a.cc:6:12: error: 'S' was not declared in this scope
    6 |     cin >> S;
      |            ^
a.cc:7:11: error: expected ';' before 'divide'
    7 |     String divide[4] ={"dream", "dreamer","erase","eraser"};
      |           ^~~~~~~
      |           ;
a.cc:11:17: error: 'divede' was not declared in this scope
   11 |         reverse(divede[i].begin(),divide[i].end());
      |                 ^~~~~~
a.cc:11:35: error: 'divide' was not declared in this scope
   11 |         reverse(divede[i].begin(),divide[i].end());
      |                                   ^~~~~~
a.cc:18:24: error: 'divide' was not declared in this scope
   18 |             string d = divide[j];
      |                        ^~~~~~
Language: C++

#include <iostream>
using namespace std;

int main(){
    string S;
    cin >> S;
    string A[4] = {"dream", "dreamer", "erase", "eraser"};
    int k = 0;

    bool a = true;
    bool b = false;

    reverse(S.begin(), S.end());

    for(int i = 0; i < 4; i++){
        reverse(A[i].begin(), A[i].end());
    }

    for(int i = 0; i < S.size();){
        if(a){
            for(int j = 0; j < 4; j++){
                if(S.substr(i, A[j].size()) == A[j]){
                    i += A[j].size();
                    b = true;
                }
                a = b;
            }   
        }
        else{
            break;
        }
    }

    if(a){
        cout << "YES" << endl;
    }

    else{
        cout << "NO" << endl;
    }

}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:5: error: 'reverse' was not declared in this scope
   13 |     reverse(S.begin(), S.end());
      |     ^~~~~~~
Language: C++

#include <iostream>
using namespace std;

int main(){
    string S;
    cin >> S;
    string A[4] = {"dream", "dreamer", "erase", "eraser"};
    int k = 0;

    bool a = true;
    bool b = false;

    reverse(S.begin(), S.end());

    for(int i = 0; i < 4; i++){
        reverse(A[i].begin(), A[i].end());
    }

    for(int i = 0; i < S.size();){
        if(a){
            for(int j = 0; j < 4; j++){
                if(S.substr(i, A[j].size()) == A[j]){
                    i += A[j].size();
                    b = true;
                }
                a = b;
            }   
        }
        else{
            break;
        }
    }

    if(a){
        cout << "Yes" << endl;
    }

    else{
        cout << "No" << endl;
    }

}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:5: error: 'reverse' was not declared in this scope
   13 |     reverse(S.begin(), S.end());
      |     ^~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;

string devide[4] = {"dream","dreamer","erase","eraser"};

int main(){
  string S;
  cin >> S;
  
  reverse (S.begin(),S.end());
  for(int i=0;i<4;++i){
    reverse(divide[i].begin(),devide[i].end());
  }
  
  bool can = true;
  for(int i=0;i<S.size());{
    bool can2 =false;
    for(int j=0;j<4;++j){
      string d = 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;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:13: error: 'divide' was not declared in this scope; did you mean 'devide'?
   12 |     reverse(divide[i].begin(),devide[i].end());
      |             ^~~~~~
      |             devide
a.cc:16:25: error: expected ';' before ')' token
   16 |   for(int i=0;i<S.size());{
      |                         ^
      |                         ;
a.cc:19:18: error: 'divide' was not declared in this scope; did you mean 'devide'?
   19 |       string d = divide[j];
      |                  ^~~~~~
      |                  devide
a.cc:20:19: error: 'i' was not declared in this scope
   20 |       if(S.substr(i,d.size()) == d){
      |                   ^
a.cc:27:3: error: break statement not within loop or switch
   27 |   break;
      |   ^~~~~
Language: C++

#include<iostream>
#include<cstdio>

using namespace std;
 
int main()
{
	int i=0;
	char s[100001]={0};
	int slong;
	
	char d[]="dream";
	char dr[]="dreamer";
	char e[]="erase";
	char er[]="eraser";
	
	scanf("%s",s);
	slong=strlen(s);
	
	while(1)
	{
		int hantei=i;
		
		if(!strncmp(s+i,d,5))
			if(!strncmp(s+i,dr,7) && strncmp(s+i+5,e,5))i+=7;
			else i+=5;
		else if(!strncmp(s+i,e,5))
			if(!strncmp(s+i,er,6))i+=6;
			else i+=5;
		
		if(hantei==i)break;
	}
	
	if(i==slong)
		printf("YES");
	else
		printf("NO");
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:15: error: 'strlen' was not declared in this scope
   18 |         slong=strlen(s);
      |               ^~~~~~
a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include<cstdio>
  +++ |+#include <cstring>
    3 | 
a.cc:24:21: error: 'strncmp' was not declared in this scope
   24 |                 if(!strncmp(s+i,d,5))
      |                     ^~~~~~~
a.cc:24:21: note: 'strncmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
Language: C++

#include<bits/stdc++.h>
using namespace std;

int main()
{
  string s[] = {"dreamer","dream","eraser","erase"};
  string t;
  cin>>t;
  int i=0;
  for(;i<t.size();)
  {
    bool flag = false;
    for(auto l:s)
    {
      if(i+l.length()>=t.size())
        break;
      if(strcmp(t.substr(i,l.length()),l)==0)
      {
        flag=true;
        i+=l.length();
        break;
        if(i>=t.size())
          break;
      }
    }
    if(!flag)
      {
        cout<<"NO\n";
        return 0;
      }
  }
  cout<<"YES\n";
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:25: error: cannot convert 'std::__cxx11::basic_string<char>' to 'const char*'
   17 |       if(strcmp(t.substr(i,l.length()),l)==0)
      |                 ~~~~~~~~^~~~~~~~~~~~~~
      |                         |
      |                         std::__cxx11::basic_string<char>
In file included from /usr/include/c++/14/cstring:43,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:121,
                 from a.cc:1:
/usr/include/string.h:156:32: note:   initializing argument 1 of 'int strcmp(const char*, const char*)'
  156 | extern int strcmp (const char *__s1, const char *__s2)
      |                    ~~~~~~~~~~~~^~~~
Language: C++

#include <iostream>
#include <string>

using namespace std;

int main(){
	string s[4] = { "dream", "dreamer", "erase", "eraser" };
	for (int i = 0; i < 4; ++i){
		std::reverse(s[i].begin(), s[i].end());
	}
	string t;
	cin >> t;
	std::reverse(t.begin(), t.end());
	int offset = 0;
	bool compare_flg = false;
	while (offset < t.size()){
		compare_flg = false;
		for (int j = 0; j < 4; ++j){
			if (t.substr(offset, s[j].size()) == s[j]){
				offset += s[j].size();
				compare_flg = true;
				break;
			}
		}
		if (compare_flg == false)break;
	}
	if (offset == t.size())cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:22: error: 'reverse' is not a member of 'std'
    9 |                 std::reverse(s[i].begin(), s[i].end());
      |                      ^~~~~~~
a.cc:13:14: error: 'reverse' is not a member of 'std'
   13 |         std::reverse(t.begin(), t.end());
      |              ^~~~~~~
Language: C++

#include <iostream>
#include <string>

using namespace std;

int main(){
	string s[4] = { "dream", "dreamer", "erase", "eraser" };
	for (int i = 0; i < 4; ++i){
		reverse(s[i].begin(), s[i].end());
	}
	string t;
	cin >> t;
	reverse(t.begin(), t.end());
	int offset = 0;
	bool compare_flg = false;
	while(offset < t.size()){
		compare_flg = false;
		for (int j = 0; j < 4; ++j){
			if (t.substr(offset, s[j].size()) == s[j]){
				offset += s[j].size();
				compare_flg = true;
				break;
			}
		}
		if (compare_flg == false)break;
	}
	if (offset == t.size())cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:17: error: 'reverse' was not declared in this scope
    9 |                 reverse(s[i].begin(), s[i].end());
      |                 ^~~~~~~
a.cc:13:9: error: 'reverse' was not declared in this scope
   13 |         reverse(t.begin(), t.end());
      |         ^~~~~~~
Language: C++

function Main(input){
  var S = input[0].toString();
  
  var revS = S.split('').reverse().join('');
  var divide = ['dream', 'dreamer', 'erase', 'eraser'].map(s => {
    return s.split('').reverse().join('');
  });
  
  var stringN = 0;
  
  while(stringN < revS.length){
    var word = divide.find(w => {
      return revS.startsWith(w, stringN);
    });
    
    if(!word){
      console.log('NO');
    } else {
      stringN += word.length;
    }
  }
  
  console.log('YES');
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Compiler output:
a.cc:4:22: error: empty character constant
    4 |   var revS = S.split('').reverse().join('');
      |                      ^~
a.cc:4:41: error: empty character constant
    4 |   var revS = S.split('').reverse().join('');
      |                                         ^~
a.cc:5:17: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes
    5 |   var divide = ['dream', 'dreamer', 'erase', 'eraser'].map(s => {
      |                 ^~~~~~~
a.cc:5:26: warning: multi-character literal with 7 characters exceeds 'int' size of 4 bytes
    5 |   var divide = ['dream', 'dreamer', 'erase', 'eraser'].map(s => {
      |                          ^~~~~~~~~
a.cc:5:37: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes
    5 |   var divide = ['dream', 'dreamer', 'erase', 'eraser'].map(s => {
      |                                     ^~~~~~~
a.cc:5:46: warning: multi-character literal with 6 characters exceeds 'int' size of 4 bytes
    5 |   var divide = ['dream', 'dreamer', 'erase', 'eraser'].map(s => {
      |                                              ^~~~~~~~
a.cc:6:20: error: empty character constant
    6 |     return s.split('').reverse().join('');
      |                    ^~
a.cc:6:39: error: empty character constant
    6 |     return s.split('').reverse().join('');
      |                                       ^~
a.cc:17:19: warning: multi-character character constant [-Wmultichar]
   17 |       console.log('NO');
      |                   ^~~~
a.cc:23:15: warning: multi-character character constant [-Wmultichar]
   23 |   console.log('YES');
      |               ^~~~~
a.cc:1:1: error: 'function' does not name a type; did you mean 'union'?
    1 | function Main(input){
      | ^~~~~~~~
      | union
a.cc:26:5: error: expected constructor, destructor, or type conversion before '(' token
   26 | Main(require("fs").readFileSync("/dev/stdin", "utf8"));
      |     ^
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;

// Problem https://atcoder.jp/contests/abc049/tasks/arc065_a

int main(void){
    string S,answer;
    vector<string> strs(4);
    answer = "YES";
    strs.at(0)="dream";
    strs.at(1)="dreamer";
    strs.at(2)="erase";
    strs.at(3)="eraser";
    cin >> S;
    reverse(S.begin(),S.end());
    for(int j=0;j<4;j++){
        reverse(strs.at(j).begin(),strs.at(j).end());
    }
/**     cout << S << endl;
    for(int j=0;j<4;j++){
        cout << strs.at(j) << " ";
    }
    cout << endl;**/
    bool cancut=true;
    for(int j=0;j<S.size();){
        bool cancutS=false;
        for(int k=0:k<4;k++){
            string checkingStr=strs.at(k);
            string checkedStr=S.substr(j,checkingStr.size());
            if(checkingStr == checkedStr){
                cancutS=true;
                j=j+checkedStr.size();}
        }
        if(cancutS == false){
            cancut=false;
            break;
        }
    }
    if(cancut){
        answer="YES";
    }
    else{
        answer="NO";}
    cout << answer << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:18: error: initializer in range-based 'for' loop
   30 |         for(int k=0:k<4;k++){
      |                  ^
a.cc:30:24: error: expected ')' before ';' token
   30 |         for(int k=0:k<4;k++){
      |            ~           ^
      |                        )
a.cc:30:25: error: 'k' was not declared in this scope
   30 |         for(int k=0:k<4;k++){
      |                         ^
Language: 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){
        can2 = true;
        i += d.size();
      }
    }
    if (!can2){
      can = false;
      break;
    }
  }
  
  if (can) cout << "YES" << endl;
  else cout << "NO" << endl;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:21: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
   14 |   for (int i=0; i<s.size;){
      |                   ~~^~~~
      |                         ()
Language: C++

#include<cstdio>
#include<string>
#include<algorithm>
using namespace std;

string divide[4] = {"dream", "dreamer", "erase", "eraser"};

int main() {
  char s[];
  scanf("%s", s);
  string S = s;

  // 後ろから解くかわりにすべての文字列を「左右反転」する
  reverse(S.begin(), S.end());
  for(int i = 0; i < 4; ++i)
    reverse(divide[i].begin(), divide[i].end());

  // 端から切っていく
  bool can = true;
  for(int i = 0; i < S.size();){
    bool can2 = false; // 4 個の文字列たちどれかで divide できるか
    for(int j = 0; j < 4; ++j){
      string d = divide[j];
      if(S.substr(i, d.size()) == d){ // d で divide できるか
        can2 = true;
        i += d.size(); // divide できたら i を進める
      }
    }
    if(!can2){ // divide できなかったら
      can = false;
      break;
    }
  }

  if(can)
    printf("YES");
  else
    printf("NO");
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:8: error: storage size of 's' isn't known
    9 |   char s[];
      |        ^
Language: C++

#include<cstdio>
#include<string>
#include<algorithm>
using namespace std;

string divide[4] = {"dream", "dreamer", "erase", "eraser"};

int main() {
  char s;
  scanf("%s", s);
  string S = s;

  // 後ろから解くかわりにすべての文字列を「左右反転」する
  reverse(S.begin(), S.end());
  for(int i = 0; i < 4; ++i)
    reverse(divide[i].begin(), divide[i].end());

  // 端から切っていく
  bool can = true;
  for(int i = 0; i < S.size();){
    bool can2 = false; // 4 個の文字列たちどれかで divide できるか
    for(int j = 0; j < 4; ++j){
      string d = divide[j];
      if(S.substr(i, d.size()) == d){ // d で divide できるか
        can2 = true;
        i += d.size(); // divide できたら i を進める
      }
    }
    if(!can2){ // divide できなかったら
      can = false;
      break;
    }
  }

  if(can)
    printf("YES");
  else
    printf("NO");
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:14: error: conversion from 'char' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
   11 |   string S = s;
      |              ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  string d[4]={"dream","dreamer","erase","eraser"};
  reverse(s.begin(),s.end());
  for(int i = 0; i < 4; ++i) reverse(d[i].begin(),d[i].end());
  bool can = true;
  for(int i = 0; i < s.size();){
    bool anko = false;
    for(int j = 0; j < 4; ++j){
      string t = d[j];
      if(s.substr(i,t.size()) = t){
        anko = true;
        i += t.size();
      }
    }
    if(!anko){
      can = false;
      break;
    }
  }
  if(can) cout << "YES" << endl;
  else cout << "NO" << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:31: error: could not convert 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::substr(size_type, size_type) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int](((std::__cxx11::basic_string<char>::size_type)i), t.std::__cxx11::basic_string<char>::size()).std::__cxx11::basic_string<char>::operator=(t)' from 'std::__cxx11::basic_string<char>' to 'bool'
   14 |       if(s.substr(i,t.size()) = t){
      |          ~~~~~~~~~~~~~~~~~~~~~^~~
      |                               |
      |                               std::__cxx11::basic_string<char>
Language: C++

#include<bits/stdc++.h>
using namespace std;
template<typename T>inline void read(T &x){
	register short f=1;x=0;char c=getchar();
	while(!isdigit(c)){ if(c=='-')f=-1;c=getchar();}
	while(isdigit(c))x=(x<<3)+(x<<1)+(c^48),c=getchar();
	x*=f;
}
template<typename T>inline void write(T x){
	if(x<0)putchar('-'),x=-x;
	if(x>9)write(x/10);
	putchar(x%10+'0');
}
template<typename T>inline void writeln(T x){
	write(x),putchar('\n');
}
const string str[5]={"","dream","dreamer","erase","eraser"};
int main(){
	string s;cin>>s;
	while(1){
		if(s.size()==0)cout<<"YES"<<endl,exit(0);
		for(int i=1;i<=4;i++){
			if(s.size()<str[i].size())cout<<"NO"<<endl,exit(0);
			else if(s.substr(0,str[i].size())==str[i])s.erase(0,str[i].size()),break;
		}
	}
	return 0;
}


Compiler output:
a.cc: In function 'void read(T&)':
a.cc:4:24: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
    4 |         register short f=1;x=0;char c=getchar();
      |                        ^
a.cc: In function 'int main()':
a.cc:24:92: error: expected primary-expression before 'break'
   24 |                         else if(s.substr(0,str[i].size())==str[i])s.erase(0,str[i].size()),break;
      |                                                                                            ^~~~~
Language: 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(),devide[i].end());
  
  bool can = true;
   for(int i=0;i<s.size();){
     bool can2=false;
     for(int j=0;j<4;j++){
       string d = divide[j];
       if(s.substr(i,d.size()) == d){
         can2=true;
         i+=d.size();
       }
     }
     if(!can2){
       can=false;
       break;
     }
   }
  cout<<(can ? "YES" : "NO")<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:49: error: 'devide' was not declared in this scope; did you mean 'divide'?
    9 |   for(int i=0;i<4;i++)reverse(divide[i].begin(),devide[i].end());
      |                                                 ^~~~~~
      |                                                 divide
Language: C

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define MOD 1e9+7
using namespace std;
typedef long long ll;

int main(){
    string s;
    cin >> s;
    ll len = s.size() - 1;
    while (1){
        if (len < 4)
            break;
        if (s.substr(len - 4, 5) == "dream" || s.substr(len - 4, 5) == "erase"){
            len -= 5;
        }else if (s.substr(len - 5, 6) == "eraser"){
            len -= 6;
        }else if (s.substr(len - 6, 7) == "dreamer"){
            len -= 7;
        }else{
            cout << "NO" << endl;
            return 0;
        }
	}
	cout << "YES"<<endl;
	return 0;
}



Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;

  while 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:1: error: expected '(' before '}' token
    8 | }
      | ^
      | (
a.cc:8:1: error: expected primary-expression before '}' token
a.cc:7:8: error: expected ')' before '}' token
    7 |   while
      |        ^
      |        )
    8 | }
      | ~       
a.cc:8:1: error: expected primary-expression before '}' token
    8 | }
      | ^
Language: C++

#include <iostream>
#include <string>

using namespace std;

int main() {
  string str[4] {"maerd","remaerd","esare","resare"};
  
  string S;
  cin>>S;
  
  reverse(S.begin(), S.end());
  
  bool a = true;
  for (int i=0;i<S.size();) {
    bool b=false;
    for (int j=0;j<4;j++) {
      string d = str[j];
      if (S.substr(i,d.size())==d) {
        b=true;
        i+=d.size();
      }
    }
    if (!b) {
      a = false;
      break;
    }
  }
  
  if (a) {
    cout<<"YES"<<endl;
  }
  else {
    cout<<"NO"<<endl;
  }
  
}



Compiler output:
a.cc: In function 'int main()':
a.cc:12:3: error: 'reverse' was not declared in this scope
   12 |   reverse(S.begin(), S.end());
      |   ^~~~~~~
Language: C++

#include <iostream>
#include <string>

using namespace std;

int main() {
  string str[4] {"maerd","remaerd","esare","resare"};
  
  string S;
  cin>>S;
  
  reverse(S.begin(),S.end());
  
  bool a = true;
  for (int i=0;i<S.size;) {
    bool b=false;
    for (int j=0;j<4;j++) {
      string d = str[j];
      if (S.substr(i,d.size())==d) {
        b=true;
        i+=d.size();
      }
    }
    if (!b) {
      a = false;
      break;
    }
  }
  
  if (a) {
    cout<<"YES"<<endl;
  }
  else {
    cout<<"NO"<<endl;
  }
  
}



Compiler output:
a.cc: In function 'int main()':
a.cc:12:3: error: 'reverse' was not declared in this scope
   12 |   reverse(S.begin(),S.end());
      |   ^~~~~~~
a.cc:15:20: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
   15 |   for (int i=0;i<S.size;) {
      |                  ~~^~~~
      |                        ()
Language: C++

#include <iostream>
#include <string>

using namespace std;

int main() {
  string str[4] {"maerd","remaerd","esare","resare"};
  
  int S;
  cin>>S;
  
  reverse(S.begin(),S.end());
  
  bool a = true;
  for (int i=0;i<S.size;) {
    bool b=false;
    for (int j=0;j<4;j++) {
      string d = str[j];
      if (S.substr(i,d.size())==d) {
        b=true;
        i+=d.size();
      }
    }
    if (!b) {
      a = false;
      break;
    }
  }
  
  if (a) {
    cout<<"YES"<<endl;
  }
  else {
    cout<<"NO"<<endl;
  }
  
}



Compiler output:
a.cc: In function 'int main()':
a.cc:12:13: error: request for member 'begin' in 'S', which is of non-class type 'int'
   12 |   reverse(S.begin(),S.end());
      |             ^~~~~
a.cc:12:23: error: request for member 'end' in 'S', which is of non-class type 'int'
   12 |   reverse(S.begin(),S.end());
      |                       ^~~
a.cc:12:3: error: 'reverse' was not declared in this scope
   12 |   reverse(S.begin(),S.end());
      |   ^~~~~~~
a.cc:15:20: error: request for member 'size' in 'S', which is of non-class type 'int'
   15 |   for (int i=0;i<S.size;) {
      |                    ^~~~
a.cc:19:13: error: request for member 'substr' in 'S', which is of non-class type 'int'
   19 |       if (S.substr(i,d.size())==d) {
      |             ^~~~~~
Language: C++

#include <iostream>

using namespace std;

int main() {
  string str[4] {"maerd","remaerd","esare","resare"};
  
  int S;
  cin>>S;
  
  reverse(S.begin(),S.end());
  
  bool a = true;
  for (int i=0;i<S.size;) {
    bool b=false;
    for (int j=0;j<4;j++) {
      string d = str[j];
      if (S.substr(i,d.size())==d) {
        b=true;
        i+=d.size();
      }
    }
    if (!b) {
      a = false;
      break;
    }
  }
  
  if (a) {
    cout<<"YES"<<endl;
  }
  else {
    cout<<"NO"<<endl;
  }
  
}



Compiler output:
a.cc: In function 'int main()':
a.cc:11:13: error: request for member 'begin' in 'S', which is of non-class type 'int'
   11 |   reverse(S.begin(),S.end());
      |             ^~~~~
a.cc:11:23: error: request for member 'end' in 'S', which is of non-class type 'int'
   11 |   reverse(S.begin(),S.end());
      |                       ^~~
a.cc:11:3: error: 'reverse' was not declared in this scope
   11 |   reverse(S.begin(),S.end());
      |   ^~~~~~~
a.cc:14:20: error: request for member 'size' in 'S', which is of non-class type 'int'
   14 |   for (int i=0;i<S.size;) {
      |                    ^~~~
a.cc:18:13: error: request for member 'substr' in 'S', which is of non-class type 'int'
   18 |       if (S.substr(i,d.size())==d) {
      |             ^~~~~~
Language: C++

#include <iostream>

using namespace std;

int main() {
  vector<string> vec(4) {"maerd""remaerd""esare""resare"};
  
  int S;
  cin>>S;
  
  reverse(S.begin(),S.end());
  
  bool a = true;
  for (int i=0;i<S.size;) {
    bool b=false;
    for (int j=0;j<4;j++) {
      string d = vec.at(j);
      if (S.substr(i,d.size())==d) {
        b=true;
        i+=d.size();
      }
    }
    if (!b) {
      a = false;
      break;
    }
  }
  
  if (a) {
    cout<<"YES"<<endl;
  }
  else {
    cout<<"NO"<<endl;
  }
  
}



Compiler output:
a.cc: In function 'int main()':
a.cc:6:3: error: 'vector' was not declared in this scope
    6 |   vector<string> vec(4) {"maerd""remaerd""esare""resare"};
      |   ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include <iostream>
  +++ |+#include <vector>
    2 | 
a.cc:6:16: error: expected primary-expression before '>' token
    6 |   vector<string> vec(4) {"maerd""remaerd""esare""resare"};
      |                ^
a.cc:6:18: error: 'vec' was not declared in this scope
    6 |   vector<string> vec(4) {"maerd""remaerd""esare""resare"};
      |                  ^~~
a.cc:11:13: error: request for member 'begin' in 'S', which is of non-class type 'int'
   11 |   reverse(S.begin(),S.end());
      |             ^~~~~
a.cc:11:23: error: request for member 'end' in 'S', which is of non-class type 'int'
   11 |   reverse(S.begin(),S.end());
      |                       ^~~
a.cc:11:3: error: 'reverse' was not declared in this scope
   11 |   reverse(S.begin(),S.end());
      |   ^~~~~~~
a.cc:14:20: error: request for member 'size' in 'S', which is of non-class type 'int'
   14 |   for (int i=0;i<S.size;) {
      |                    ^~~~
a.cc:18:13: error: request for member 'substr' in 'S', which is of non-class type 'int'
   18 |       if (S.substr(i,d.size())==d) {
      |             ^~~~~~
Language: C++

#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
int main(void){
    // Your code here!
    string S;
    cin >> S;
    int tail = S.length();
    for(int i = 0 ;i < S.length(); i++){
        if(tail <= 0){
            cout << "YES";
            break;
        }else if(6 <= tail && S.substr(max(0,tail-7), 7) == "dreamer"){ 
            tail -= 7;
        }else if(5 <= tail && S.substr(max(0,tail-6), 6) == "eraser"){
            tail -= 6;
        }else if(4 <= tail && S.substr(max(0,tail-5), 5) == "erase" || S.substr(max(0,tail-5), 5) == "dream"){
            tail -= 5;
        }else{
            cout << "NO";
            break;
        }        
    }
}
}

Compiler output:
a.cc:26:1: error: expected declaration before '}' token
   26 | }
      | ^
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

string divide[4] = {"dream", "dreamer", "erase", "eraser"};

int main(){
  string S;
  cin >> S;

  reverse(S.begin(),S.end());
  for (int 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;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:37: error: no matching function for call to 'reverse(std::__cxx11::basic_string<char>::iterator, <unresolved overloaded function type>)'
   13 |   for (int i = 0; i < 4; i++)reverse(divide[i].begin(),divide[i].end);
      |                              ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_algo.h:1083:5: note: candidate: 'void std::reverse(_BIter, _BIter) [with _BIter = __gnu_cxx::__normal_iterator<char*, __cxx11::basic_string<char> >]'
 1083 |     reverse(_BidirectionalIterator __first, _BidirectionalIterator __last)
      |     ^~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1083:68: note:   no known conversion for argument 2 from '<unresolved overloaded function type>' to '__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >'
 1083 |     reverse(_BidirectionalIterator __first, _BidirectionalIterator __last)
      |                                             ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note: candidate: 'template<class _ExecutionPolicy, class _BidirectionalIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::reverse(_ExecutionPolicy&&, _BidirectionalIterator, _BidirectionalIterator)'
  249 | reverse(_ExecutionPolicy&& __exec, _BidirectionalIterator __first, _BidirectionalIterator __last);
      | ^~~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note:   candidate expects 3 arguments, 2 provided
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

string divide[4] = {"dream", "dreamer", "erase", "eraser"};

int main(){
  string S;
  cin >> S;

  reverse(S.begin(),S.end());
  for (int i = 0; i < 4; i++)reverse(divide[i].begin(),devide[i].end);

  bool can = true;
  for (int i = 0; i < S.size();){
    bool can2 = false;
    for (int j = 0; j < 4; j++){
      string d = 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;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:56: error: 'devide' was not declared in this scope; did you mean 'divide'?
   13 |   for (int i = 0; i < 4; i++)reverse(divide[i].begin(),devide[i].end);
      |                                                        ^~~~~~
      |                                                        divide
Language: C++

#include <bits/stdc++.h>
using namespace std;





int main(){
	string S;
	cin>>S;
	
	int endflg =0;
	int ookisa = S.size()
	
	for(int i=0;i<ookisa;i++){
		if(S[i]=='d'){
			if(S[i+1=='r']&&S[i+2=='e']&&S[i+3=='a']&&S[i+4=='m']){
				if(S[i+5=='r']){
					i+=5;
				}else{
					i+=4;
				}
			}else{
				endflg =1;
				break;
			}
		
		}else if(S[i]=='e'){
			if(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{
				endflg =1;
				break;
			}
		}else{
			endflg=1;
			break;
		}
	}
	

	if(endflg == 1){
		cout<<"No";
	}else{
		cout<<"Yes";
	}
	
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:9: error: expected ',' or ';' before 'for'
   15 |         for(int i=0;i<ookisa;i++){
      |         ^~~
a.cc:15:21: error: 'i' was not declared in this scope
   15 |         for(int i=0;i<ookisa;i++){
      |                     ^