Language: C++

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Math;
using static System.Console;
using static CS_Contest.Utils;

namespace CS_Contest {
	using Li = List<int>;
	using LLi = List<List<int>>;
	class Program {
        static void Main(string[] args) {
			new Calc().Solve();
			return;
        }

		private class Calc {
			public void Solve() {
				string S = ReadLine();
				string[] tag = new string[] { "dream", "dreamer", "erase", "eraser" };

				while (S.Length>5) {
					var l = S.Length;
					if (S.Substring(l-5, 5) == tag[0] || S.Substring(l-5, 5) == tag[2]) {
						S = S.Remove(l-5, 5);
					}
					else
					if (S.Substring(l-7, 7) == tag[1]) S = S.Remove(l-7, 7);
					else
					if (S.Substring(l-6, 6) == tag[3]) S = S.Remove(l-6, 6);
					else break;
				}

				if (tag.Contains(S)) YES();
				else NO();
				return;
			}
		}
    }

	
	
    public static class Utils {
		public static int INF = (int)(1e9);
        public static void WL(this object obj) => WriteLine(obj);
        public static void WL(this string obj) => WriteLine(obj);
        public static void WL<T>(this IEnumerable<T> list) => list.ToList().ForEach(x => x.WL());
		public static int ReadInt() => int.Parse(ReadLine());
		public static List<int> ReadInt(char s) => ReadLine().Split(s).Select(int.Parse).ToList();
		public static long ReadLong() => long.Parse(ReadLine());
		public static List<long> ReadLong(char s) => ReadLine().Split(s).Select(long.Parse).ToList();
		public static void REP(int n,Action<int> act) {
			for (int i = 0; i < n; i++) {
				act(i);
			}
		}
		public static void RREP(int n,Action<int> act) {
			for (int i = n-1; i >=0; i--) {
				act(i);
			}
		}
		public static void REP(long n, Action<int> act) => REP((int)n, act);
		public static void RREP(long n, Action<int> act) => RREP((int)n, act);

		public static void Yes() => "Yes".WL();
		public static void No() => "No".WL();
		public static void YES() => "YES".WL();
		public static void NO() => "NO".WL();


		public static int ManhattanDistance(int x1, int y1, int x2, int y2) => Abs(x2 - x1) + Abs(y2 - y1);

		public class Tree {
			public LLi Graph;
			public Tree(int nodes) {
				Graph = new LLi();
				REP(nodes, x => {
					Graph.Add(new Li());
				});
			}
			public void Add(int x,int y) {
				Graph[x].Add(y);
				Graph[y].Add(x);
			}
		}
    }
}


Compiler output:
a.cc:1:7: error: expected nested-name-specifier before 'System'
    1 | using System;
      |       ^~~~~~
a.cc:2:7: error: expected nested-name-specifier before 'System'
    2 | using System.Collections.Generic;
      |       ^~~~~~
a.cc:3:7: error: expected nested-name-specifier before 'System'
    3 | using System.Linq;
      |       ^~~~~~
a.cc:4:7: error: expected nested-name-specifier before 'System'
    4 | using System.Text;
      |       ^~~~~~
a.cc:5:7: error: expected nested-name-specifier before 'System'
    5 | using System.Threading.Tasks;
      |       ^~~~~~
a.cc:6:7: error: expected nested-name-specifier before 'static'
    6 | using static System.Math;
      |       ^~~~~~
a.cc:7:7: error: expected nested-name-specifier before 'static'
    7 | using static System.Console;
      |       ^~~~~~
a.cc:8:7: error: expected nested-name-specifier before 'static'
    8 | using static CS_Contest.Utils;
      |       ^~~~~~
a.cc:11:20: error: 'List' does not name a type
   11 |         using Li = List<int>;
      |                    ^~~~
a.cc:12:21: error: 'List' does not name a type
   12 |         using LLi = List<List<int>>;
      |                     ^~~~
a.cc:14:26: error: 'string' has not been declared
   14 |         static void Main(string[] args) {
      |                          ^~~~~~
a.cc:14:35: error: expected ',' or '...' before 'args'
   14 |         static void Main(string[] args) {
      |                                   ^~~~
a.cc:19:24: error: expected ':' before 'class'
   19 |                 private class Calc {
      |                        ^~~~~~
      |                        :
a.cc:20:31: error: expected ':' before 'void'
   20 |                         public void Solve() {
      |                               ^~~~~
      |                               :
a.cc:40:18: error: expected ';' after class definition
   40 |                 }
      |                  ^
      |                  ;
a.cc:41:6: error: expected ';' after class definition
   41 |     }
      |      ^
      |      ;
a.cc: In static member function 'static void CS_Contest::Program::Main(int*)':
a.cc:15:35: error: expected ';' before '.' token
   15 |                         new Calc().Solve();
      |                                   ^
a.cc: In member function 'void CS_Contest::Program::Calc::Solve()':
a.cc:21:33: error: 'string' was not declared in this scope
   21 |                                 string S = ReadLine();
      |                                 ^~~~~~
a.cc:22:40: error: expected primary-expression before ']' token
   22 |                                 string[] tag = new string[] { "dream", "dreamer", "erase", "eraser" };
      |                                        ^
a.cc:24:40: error: 'S' was not declared in this scope
   24 |                                 while (S.Length>5) {
      |                                        ^
a.cc:25:41: error: 'var' was not declared in this scope
   25 |                                         var l = S.Length;
      |                                         ^~~
a.cc:26:57: error: 'l' was not declared in this scope
   26 |                                         if (S.Substring(l-5, 5) == tag[0] || S.Substring(l-5, 5) == tag[2]) {
      |                                                         ^
a.cc:26:68: error: 'tag' was not declared in this scope
   26 |                                         if (S.Substring(l-5, 5) == tag[0] || S.Substring(l-5, 5) == tag[2]) {
      |                                                                    ^~~
a.cc:36:37: error: 'tag' was not declared in this scope
   36 |                                 if (tag.Contains(S)) YES();
      |                                     ^~~
a.cc:36:50: error: 'S' was not declared in this scope
   36 |                                 if (tag.Contains(S)) YES();
      |                                                  ^
a.cc:36:54: error: 'YES' was not declared in this scope
   36 |                                 if (tag.Contains(S)) YES();
      |                                                      ^~~
a.cc:37:38: error: 'NO' was not declared in this scope
   37 |                                 else NO();
      |                                      ^~
a.cc: At global scope:
a.cc:45:5: error: expected unqualified-id before 'public'
   45 |     public static class Utils {
      |     ^~~~~~