s_id
stringlengths
10
10
p_id
stringlengths
6
6
u_id
stringlengths
10
10
date
stringlengths
10
10
language
stringclasses
1 value
original_language
stringclasses
11 values
filename_ext
stringclasses
1 value
status
stringclasses
1 value
cpu_time
stringlengths
1
5
memory
stringlengths
1
7
code_size
stringlengths
1
6
code
stringlengths
1
539k
s424155764
p03854
u397496203
1600311828
Python
PyPy3 (7.3.0)
py
Runtime Error
295
256372
739
import sys # sys.setrecursionlimit(100000) def input(): return sys.stdin.readline().strip() def input_int(): return int(input()) def input_int_list(): return [int(i) for i in input().split()] def main(): S = input() # 再帰的に解いて解く def solver(T): if T == "": print("YES") quit() if len(T) >= 5: if T[:5] == "dream" or T[:5] == "erase": solver(T[5:]) if len(T) >= 6: if T[:6] == "eraser": solver(T[6:]) if len(T) >= 7: if T[:7] == "dreamer": solver(T[7:]) return solver(S) print("NO") return if __name__ == "__main__": main()
s759062611
p03854
u301590311
1600060195
Python
Python (3.8.2)
py
Runtime Error
29
9868
409
S = input() def is_equal_to(str, start_ind): words = ["dream", "dreamer", "erase", "eraser"] if start_ind == len(str): return True for i in range(len(words)): if str[start_ind : start_ind+len(words[i])] == words[i]: if is_equal_to(str, start_ind+len(words[i])): return True return False if is_equal_to(S, 0): print("YES") else: print("NO")
s107988426
p03854
u301590311
1600060029
Python
Python (3.8.2)
py
Runtime Error
34
9944
392
S = input() def is_equal_to(str, start_ind): words = ["dream", "dreamer", "erase", "eraser"] if start_ind == len(str): return True for i in range(len(words)): if str[start_ind : start_ind+len(words[i])] == words[i]: if is_equal_to(str, start_ind+len(words[i])): return True if is_equal_to(S, 0): print("YES") else: print("NO")
s554440350
p03854
u794448346
1600028715
Python
Python (3.8.2)
py
Runtime Error
38
9152
320
S = input() i = 0 while i <= len(S)-5: if S[i:i+5] == "dream": i += 5 if S[i:i+2] == "er" and S[i:i+5] != "erase": i += 2 elif S[i:i+5] == "erase": i += 5 if S[i] == "r": i += 1 else: break if i != len(S): print("NO") else: print("YES")
s100228879
p03854
u980205854
1599782148
Python
PyPy3 (7.3.0)
py
Runtime Error
91
74568
2627
import sys from sys import exit from collections import deque from bisect import bisect_left, bisect_right, insort_left, insort_right from heapq import heapify, heappop, heappush from itertools import product, permutations, combinations, combinations_with_replacement from functools import reduce from math import gcd, sin, cos, tan, asin, acos, atan, degrees, radians sys.setrecursionlimit(10**6) INF = 10**20 eps = 1.0e-20 MOD = 10**9+7 def lcm(x,y): return x*y//gcd(x,y) def lgcd(l): return reduce(gcd,l) def llcm(l): return reduce(lcm,l) def powmod(n,i,mod): return pow(n,mod-1+i,mod) if i<0 else pow(n,i,mod) def div2(x): return x.bit_length() def div10(x): return len(str(x))-(x==0) def perm(n,mod=None): ans = 1 for i in range(1,n+1): ans *= i if mod!=None: ans %= mod return ans def intput(): return int(input()) def mint(): return map(int,input().split()) def lint(): return list(map(int,input().split())) def ilint(): return int(input()), list(map(int,input().split())) def judge(x, l=['Yes', 'No']): print(l[0] if x else l[1]) def lprint(l, sep='\n'): for x in l: print(x, end=sep) def ston(c, c0='a'): return ord(c)-ord(c0) def ntos(x, c0='a'): return chr(x+ord(c0)) class counter(dict): def __init__(self, *args): super().__init__(args) def add(self,x,d=1): self.setdefault(x,0) self[x] += d def list(self): l = [] for k in self: l.extend([k]*self[k]) return l class comb(): def __init__(self, n, mod=None): self.l = [1] self.n = n self.mod = mod def get(self,k): l,n,mod = self.l, self.n, self.mod k = n-k if k>n//2 else k while len(l)<=k: i = len(l) l.append(l[i-1]*(n+1-i)//i if mod==None else (l[i-1]*(n+1-i)*powmod(i,-1,mod))%mod) return l[k] def pf(x): C = counter() p = 2 while x>1: k = 0 while x%p==0: x //= p k += 1 if k>0: C.add(p,k) p = p+2-(p==2) if p*p<x else x return C S=input() N=len(S) ans=True i=0 while ans: if i==N: break if S[i]=='e': if S[i:i+6]=='eraser': i+=6 elif S[i:i+5]=='erase': i+=5 else: ans=False if S[i]=='d': if S[i:i+10]=='dreamerase': i+=5 elif S[i:i+7]=='dreamer': i+=7 elif S[i:i+5]=='dream': i+=5 else: ans=False else: ans=False judge(ans,['YES','NO'])
s990654670
p03854
u755180064
1599708850
Python
Python (3.8.2)
py
Runtime Error
28
9168
243
url = "https://atcoder.jp//contests/abc049/tasks/abc049_b" def main(): h, w = list(map(int, input().split())) ss = [input() for _ in range(h)] for s in ss: print(s) print(s) if __name__ == '__main__': main()
s469554434
p03854
u419963262
1599605484
Python
Python (3.8.2)
py
Runtime Error
421
712236
470
import sys sys.setrecursionlimit(10000) s = 'HAKUTYUMU' + input() def check(s): next_s = s if s[-5:] == 'dream': next_s = s[:-5] if s[-7:] == 'dreamer': next_s = s[:-7] if s[-5:] == 'erase': next_s = s[:-5] if s[-6:] == 'eraser': next_s = s[:-6] if s == 'HAKUTYUMU': return True if s == next_s: return False return check(next_s) if check(s): print('YES') else: print('NO')
s924205497
p03854
u419963262
1599604028
Python
PyPy3 (7.3.0)
py
Runtime Error
242
252892
429
s = 'HAKUTYUMU' + input() def check(s): next_s = s if s[-5:] == 'dream': next_s = s[:-5] if s[-7:] == 'dreamer': next_s = s[:-7] if s[-5:] == 'erase': next_s = s[:-5] if s[-6:] == 'eraser': next_s = s[:-6] if s == 'HAKUTYUMU': return True if s == next_s: return False return check(next_s) if check(s): print('YES') else: print('NO')
s698922951
p03854
u419963262
1599603784
Python
Python (3.8.2)
py
Runtime Error
81
104064
429
s = 'HAKUTYUMU' + input() def check(s): next_s = s if s[-5:] == 'dream': next_s = s[:-5] if s[-7:] == 'dreamer': next_s = s[:-7] if s[-5:] == 'erase': next_s = s[:-5] if s[-6:] == 'eraser': next_s = s[:-6] if s == 'HAKUTYUMU': return True if s == next_s: return False return check(next_s) if check(s): print('YES') else: print('NO')
s957655834
p03854
u985085517
1599424523
Python
Python (3.8.2)
py
Runtime Error
28
10036
664
#!/user/bin/env pypy3 import itertools import sys def fast_input(): return sys.stdin.readline()[:-1] def print_format(b: bool) -> str: return "YES" if b else "NO" def solve(s: str) -> bool: tokens = ["dream", "erase", "eraser", "dreamer"] def dfs(pos: int) -> bool: if pos == len(s): return True for token in tokens: if (pos + len(token)) > len(s): break if s[pos:pos + len(token)] == token: if dfs(pos + len(token)): return True return dfs(0) def main(): result = solve(fast_input()) print(print_format(result)) main()
s595199315
p03854
u549579601
1599363746
Python
PyPy3 (7.3.0)
py
Runtime Error
265
255192
514
ans = [] def solve(s): if s == 'dream' or s == 'dreamer' or s == 'erase' or s == 'eraser': ans.append(1) else: if len(s) >=5 and s[:5] == 'dream': solve(s[5:]) if len(s) >=7 and s[:7] == 'dreamer': solve(s[7:]) if len(s) >=5 and s[:5] == 'erase': solve(s[5:]) if len(s) >=6 and s[:6] == 'eraser': solve(s[6:]) else: ans.append(0) solve(input()) if 1 in ans: print("YES") else: print("NO")
s440128065
p03854
u231095456
1599299494
Python
Python (3.8.2)
py
Runtime Error
110
105456
948
S = input() def trans(s,i): if s == "": return "YES" if i == 0: t = s[:5] if t == "dream": return trans(s[5:],1) elif t == "erase": return trans(s[5:],2) else: return "NO" elif i == 1: if s[:5] == "dream": return trans(s[5:],1) elif s[:2] == "er": return trans(s[2:],3) else: return "NO" elif i == 2: if s[:5] == "dream": return trans(s[5:],1) elif s[:5] == "erase": return trans(s[5:],2) elif s[:1] == "r": return trans(s[1:],0) else: return "NO" elif i == 3: if s[:5] == "dream": return trans(s[5:],1) elif s[:3] == "ase": return trans(s[3:],2) elif s[:5] == "erase": return trans(s[5:],2) else: return "NO" print(trans(S,0))
s094666234
p03854
u819135704
1598908503
Python
Python (3.8.2)
py
Runtime Error
27
9124
1473
S = list(input()) N = len(S) def f(x): print(x) exit() if N < 5: f("NO") elif S[0] == "d": w = 1 elif S[0] == "e": w = -1 else: f("NO") i = 0 while True: if w > 0: if S[i]+S[i+1]+S[i+2]+S[i+3]+S[i+4] == "dream": i += 5 if i == N: f("YES") elif S[i] == "d": pass elif S[i] == "e": if i+1 <= N-1: if S[i+1] == "r": if i+1 == N-1: f("YES") elif S[i+2] == "a": w *= -1 elif S[i+2] == "e": i += 2 w *= -1 elif S[i+2] == "d": i += 2 else: f("NO") else: f("NO") else: f("NO") else: f("NO") else: f("NO") elif w < 0: if S[i]+S[i+1]+S[i+2]+S[i+3]+S[i+4] == "erase": i += 5 if i == N: if S[i] == "r": i += 1 if i == N: if S[i] == "d": w *= -1 elif S[i] == "e": pass else: f("NO") else: f("NO") if i+4 > N-1: f("NO")
s004823748
p03854
u165318982
1598553580
Python
Python (3.8.2)
py
Runtime Error
481
137924
286
A = input() A = A[::-1] divide = [i[::-1] for i in ["dream", "dreamer", "erase", "eraser"]] flag = 1 while flag and A: flag = 0 for word in divide: if A.startswith(word): A = A[len(word):] print(A) flag = 1 if len(A) == 0: print('YES') else: print('NO')
s526149185
p03854
u165318982
1598553561
Python
Python (3.8.2)
py
Runtime Error
482
137916
309
A = input() A = A[::-1] divide = [i[::-1] for i in ["dream", "dreamer", "erase", "eraser"]] print(A) print(divide) flag = 1 while flag and A: flag = 0 for word in divide: if A.startswith(word): A = A[len(word):] print(A) flag = 1 if len(A) == 0: print('YES') else: print('NO')
s166318187
p03854
u165318982
1598553519
Python
Python (3.8.2)
py
Runtime Error
483
137900
349
A = input() A = A[::-1] divide = [i[::-1] for i in ["dream", "dreamer", "erase", "eraser"]] flag = 1 while flag and A: flag = 0 for word in divide: if A.startswith(word): # 先頭が一致したら A = A[len(word):] # 該当文字分だけスライス print(A) flag = 1 if len(A) == 0: print('Yes') else: print('No')
s902401005
p03854
u771869879
1598490565
Python
Python (3.8.2)
py
Runtime Error
85
104056
303
S = input() text = ['dream','dreamer','erase','eraser'] def search(s): if len(s) == 0: return 1 flg = 0 for t in text: if len(s) < len(t): continue if s.find(t) == 0: flg |= search(s[len(t):]) return flg if search(S): print('YES') else: print('NO')
s642228322
p03854
u771869879
1598490358
Python
Python (3.8.2)
py
Runtime Error
88
104112
264
S = input() text = ['dream','dreamer','erase','eraser'] def search(s): if len(s) == 0: return 1 flg = 0 for t in text: if s.find(t) == 0: flg |= search(s[len(t):]) return flg if search(S): print('YES') else: print('NO')
s037531791
p03854
u607680583
1598411813
Python
Python (3.8.2)
py
Runtime Error
1509
139500
373
s = list(input()) a = list("dream") b = list("dreamer") c = list("erase") d = list("eraser") flag = 0 while(flag == 0): print(s) if s[-7:] == b: del s[-7:] elif s[-6:] == d: del s[-6:] elif s[-5:] == a or s[-5:] == c: del s[-5:] elif s == []: print("YES") flag = 1 else: print("NO") flag = 1
s266331570
p03854
u223663729
1598313471
Python
Python (3.8.2)
py
Runtime Error
32
12600
375
# dfs C = ['dream', 'dreamer', 'erase', 'eraser'] S = input() L = len(S) def dfs(x): l = len(x) if l >= L: if S == x: return True else: return False match = S[l:l+7] for c in C: if match.find(c) == 0: if dfs(x+c): return True return False print('YES' if dfs('') else 'NO')
s713752880
p03854
u869790980
1598284692
Python
PyPy2 (7.3.0)
py
Runtime Error
323
85508
209
words = [w[::-1] for w in ['dream','dreamer', 'erase', 'eraser']] s = raw_input()[::-1] while(i < len(s)): for w in words: if w == s[:len(w)]: i += len(w) break print 'YES' if i == len(s) else 'NO'
s897939209
p03854
u463893436
1597949994
Python
Python (3.8.2)
py
Runtime Error
34
10276
181
import re s = input() s = re.sub("dreamer","",s) s = re.sub("dream","",s) s = re.sub("eraser","",s) s = re.sub("erase","",s) if int(s) == 0: print("YES") else: print("NO")
s310457190
p03854
u106778233
1597785201
Python
Python (3.8.2)
py
Runtime Error
49
9816
386
s = input() def search(l): if l>=len(s): return 1 a = b = c = d = 0 if s[l:l+5]=="dream": a = search(l+5) if s[l:l+5]=="erase": b = search(l+5) if s[l:l+6]=="eraser": c = search(l+6) if s[l:l+7]=="dreamer": d = search(l+7) return max(a,b,c,d) if search(0): print("YES") else: print("NO")
s604677328
p03854
u106778233
1597784799
Python
Python (3.8.2)
py
Runtime Error
31
9036
321
def search(l): if l>=len(s): return 1 if s[l:l+5]=="dream": search(l+5) if s[l:l+5]=="erase": search(l+5) if s[l:l+6]=="eraser": search(l+6) if s[l:l+7]=="dreamer": search(l+7) else: return 0 if search(0): print("YES") else: print("NO")
s332293698
p03854
u842170774
1597741086
Python
Python (3.8.2)
py
Runtime Error
111
104184
345
S=input()[::-1] def a(s): if s: if s[:5]=='maerd': return a(s[5:]) elif s[:5]=='esare': return a(s[5:]) elif s[:6]=='resare': return a(s[6:]) elif s[:7]=='remaerd': return a(s[7:]) else: return False else: return True print(a(S))
s587524116
p03854
u190866453
1597632660
Python
Python (3.8.2)
py
Runtime Error
28
9216
187
s = input() list = ["dream", "dreamer", "erase", "eraser"] for i in list: s = s.replace(i, "x") s.sort() if s[0] == s[-1] and s[-1] == "x": print("YES") else: print("NO")
s860541248
p03854
u068646483
1597601552
Python
PyPy3 (7.3.0)
py
Runtime Error
89
68724
356
S = input() strs = list(reversed(S)) rev_S = ''.join(strs) while True: if rev_S[:6] == 'resare' rev_S = rev_S[6:] continue elif rev_S[:7] == 'remaerd': rev_S = rev_S[7:] continue elif rev_S[:5] == 'esare' or rev_S[:5] == 'maerd': rev_S = rev_S[5:] continue else: break if rev_S == '': print('YES') else: print('NO')
s049336672
p03854
u267549387
1597516103
Python
Python (3.8.2)
py
Runtime Error
438
712384
501
#!/usr/bin/env python3 import sys PARTS = ["eraser", "erase", "dreamer", "dream"] def main(): sys.setrecursionlimit(10000) S = input() if judgeStr(S): print("YES") else: print("NO") def judgeStr(target: str) -> bool: for item in PARTS: if target.startswith(item): tempStr = target.replace(item, "", 1) if tempStr == "" or judgeStr(tempStr): return True return False if __name__ == "__main__": main()
s753063850
p03854
u267549387
1597515207
Python
Python (3.8.2)
py
Runtime Error
2214
360416
683
#!/usr/bin/env python3 import sys PARTS = ["eraser", "erase", "dreamer", "dream"] PARTS2 = [] def main(): global PARTS2 sys.setrecursionlimit(5000) S = input() for i in range(0, 4): for j in range(0, 4): PARTS2.append(PARTS[i] + PARTS[j]) PARTS2 = PARTS2 + PARTS if judgeStr(S): print("YES") else: print("NO") def judgeStr(target: str) -> bool: global PARTS2 for item in PARTS2: if target.startswith(item): tempStr = target.replace(item, "", 1) if tempStr == "" or judgeStr(tempStr): return True return False if __name__ == "__main__": main()
s172284836
p03854
u267549387
1597514783
Python
PyPy3 (7.3.0)
py
Runtime Error
2226
811052
479
import sys PARTS = ["eraser", "erase", "dreamer", "dream"] def main(): sys.setrecursionlimit(5000) S = input() if judgeStr(S): print("YES") else: print("NO") def judgeStr(target: str) -> bool: for item in PARTS: if target.startswith(item): tempStr = target.replace(item, "", 1) if tempStr == "" or judgeStr(tempStr): return True return False if __name__ == "__main__": main()
s776433812
p03854
u267549387
1597514687
Python
Python (3.8.2)
py
Runtime Error
286
430492
501
#!/usr/bin/env python3 import sys PARTS = ["eraser", "erase", "dreamer", "dream"] def main(): sys.setrecursionlimit(5000) S = input() if judgeStr(S): print("YES") else: print("NO") def judgeStr(target: str) -> bool: for item in PARTS: if target.startswith(item): tempStr = target.replace(item, "", 1) if tempStr == "" or judgeStr(tempStr): return True return False if __name__ == "__main__": main()
s166472021
p03854
u267549387
1597514496
Python
Python (3.8.2)
py
Runtime Error
81
104140
457
#!/usr/bin/env python3 PARTS = ["eraser", "erase", "dreamer", "dream"] def main(): S = input() if judgeStr(S): print("YES") else: print("NO") def judgeStr(target: str) -> bool: for item in PARTS: if target.startswith(item): tempStr = target.replace(item, "", 1) if tempStr == "" or judgeStr(tempStr): return True return False if __name__ == "__main__": main()
s911977351
p03854
u095094246
1597340835
Python
Python (3.8.2)
py
Runtime Error
33
12572
275
s=input() text=['dream','dreamer','erase','eraser'] def bfs(t): if t == s: return 1 if len(t) >= len(s): return 0 if t != s[:len(t)]: return 0 ans = 0 for tx in text: ans += bfs(t+tx) return ans if bfs('') > 0: print('YES') else: print('NO')
s465820812
p03854
u760961723
1597160323
Python
Python (3.8.2)
py
Runtime Error
1479
140056
428
S =input() ls_S = list(S) ans = "Yes" while len(ls_S) != 0: print(ls_S) if "".join(ls_S[len(ls_S)-5:]) == "dream": ls_S = ls_S[:len(ls_S)-5] elif "".join(ls_S[len(ls_S)-5:]) == "erase": ls_S = ls_S[:len(ls_S)-5] elif "".join(ls_S[len(ls_S)-7:]) == "dreamer": ls_S = ls_S[:len(ls_S)-7] elif "".join(ls_S[len(ls_S)-6:]) == "eraser": ls_S = ls_S[:len(ls_S)-6] else: ans = "No" break print(ans)
s364947799
p03854
u074220993
1597114672
Python
Python (3.8.2)
py
Runtime Error
26
9184
429
s = input() while 1: if len(S) == 0: print("YES") break if s[len(s)-5:] == "dream": s = s[:len(s)-5] continue elif s[len(s)-7:] == "dreamer": s = s[:len(s)-7] continue elif s[len(s)-5:] == "erase": s = s[:len(s)-5] continue elif s[len(s)-6:] == "eraser": s = s[:len(s)-6] continue else: print("NO") break
s352679399
p03854
u969708690
1597001569
Python
Python (3.8.2)
py
Runtime Error
210
262020
233
import sys sys.setrecursionlimit(10000) def saiki(T): if len(T)<=len(S): if T==S: print("YES") exit() return saiki(T+"dream"),saiki(T+"erase"),saiki(T+"dreamer"),saiki(T+"eraser") S=input() saiki("") print("NO")
s282358877
p03854
u044220565
1596916301
Python
Python (3.8.2)
py
Runtime Error
25
9192
968
# coding: utf-8 import sys #from operator import itemgetter sysread = sys.stdin.buffer.readline read = sys.stdin.buffer.read #from heapq import heappop, heappush #from collections import defaultdict sys.setrecursionlimit(10**7) #import math #from itertools import product, accumulate, combinations, product #import bisect #import numpy as np #from copy import deepcopy #from collections import deque INF = 1 << 50 def dfs(seq): if seq in ['dreamer', 'dream', 'erase', 'eraser']: return True if seq[:7] == 'dreamer': if dfs[5:] or dfs[7:]: return True else: return False elif seq[:5] == 'dream': return dfs(seq[5:]) elif seq[:6] == 'eraser': return dfs(seq[6:]) elif seq[:5] == 'erase': return dfs(seq[5:]) else: return False def run(): S = input() if dfs(S): print('YES') else: print('NO') if __name__ == "__main__": run()
s261887777
p03854
u350093546
1596883210
Python
PyPy3 (7.3.0)
py
Runtime Error
163
79388
380
s=input() t='' while s!='': if s[:5]=='dream': if s[5:10]=='erase': s=s[5:] continue elif s[5:7]=='er': s=s[7:] continue else: s=s[5:] continue elif s[:5]=='erase': if s[5]=='r': s=s[6:] continue else: s=s[5:] continue else: break if s=='': print('YES') else: print('NO')
s188553369
p03854
u350093546
1596882985
Python
PyPy3 (7.3.0)
py
Runtime Error
91
74532
310
s=input() t='' while s!='': if s[:5]=='dream': if s[5:10]=='erase': s=s[5:] continue elif s[5:7]='er': s=s[7:] continue elif s[:5]=='erase': if s[5]=='r': s=s[6:] else: s=s[5:] else: break if s=='': print('YES') else: print('NO')
s392568842
p03854
u345057610
1596598828
Python
Python (3.8.2)
py
Runtime Error
1727
139856
963
def h(temp): if temp[0] == "m": a = 0 elif temp[0] == "r": if temp[2] == "m": a = 1 else: a = 3 else: a = 2 return a def H(temp,y,a): c = 0 if a == 0 or a == 2: for j in range(5): if y[a][4-j] != temp[0]: return c temp.remove(temp[0]) c = 1 elif a == 3: for j in range(6): if y[a][5-j] != temp[0]: return c temp.remove(temp[0]) c = 1 else: for j in range(7): if y[a][6-j] != temp[0]: return c temp.remove(temp[0]) c = 1 return c s = input() y = ['dream','dreamer','erase','eraser'] temp = [] t = [] k = len(s) for i in range(k): temp.append(s[k-i-1]) c = 1 while len(temp) != 0 and c == 1: a = h(temp) c = H(temp,y,a) print(temp,a) if c == 1: print("YES") else : print("NO")
s398070615
p03854
u345057610
1596597181
Python
Python (3.8.2)
py
Runtime Error
49
9816
777
def h(temp): if temp[0] == "m": a = 0 elif temp[0] == "r": if temp[2] == "m": a = 1 else: a = 3 else: a = 2 return a def H(temp,y,a): c = 0 if a == 0 or a == 2: for j in range(5): if y[a][4-j] != temp[0]: return c temp.remove(temp[0]) c = 1 else: for j in range(7): if y[a][6-j] != temp[0]: break c = 1 return c,temp s = input() y = ['dream','dreamer','erase','eraser'] temp = [] t = [] k = len(s) for i in range(k): temp.append(s[k-i-1]) a = h(temp) c = 1 while len(temp) != 0 and c == 1: c = H(temp,y,a) a = h(temp) if c[0] == 1: print("YES") else : print("NO")
s143044206
p03854
u345057610
1596597093
Python
Python (3.8.2)
py
Runtime Error
49
9840
777
def h(temp): if temp[0] == "m": a = 0 elif temp[0] == "r": if temp[2] == "m": a = 1 else: a = 3 else: a = 2 return a def H(temp,y,a): c = 0 if a == 0 or a == 2: for j in range(5): if y[a][4-j] != temp[0]: return c temp.remove(temp[0]) c = 1 else: for j in range(7): if y[a][6-j] != temp[j]: break c = 1 return c,temp s = input() y = ['dream','dreamer','erase','eraser'] temp = [] t = [] k = len(s) for i in range(k): temp.append(s[k-i-1]) a = h(temp) c = 1 while len(temp) != 0 and c == 1: c = H(temp,y,a) a = h(temp) if c[0] == 1: print("YES") else : print("NO")
s573596775
p03854
u518414537
1596582592
Python
Python (3.8.2)
py
Runtime Error
49
9936
961
s = list(input()) frag = 0 i = 0 while i < len(s): if len(s) < 5: frag = 1 break if s[i] == "d" and s[i + 1] == "r" and s[i + 2] == "e" and s[i + 3] == "a" and s[i + 4] == "m": if i + 6 < len(s): if s[i + 5] == "e" and s[i + 6] == "r": if s[i + 7] == "a" and s[i + 8] == "s" and s[i + 9] == "e": i += 5 continue else: i += 7 continue if i + 6 < len(s): if s[i + 5] == "e" and s[i + 6] == "r": i += 7 continue i += 4 elif s[i] == "e" and s[i + 1] == "r" and s[i + 2] == "a" and s[i + 3] == "s" and s[i + 4] == "e": if i + 5 < len(s): if s[i + 5] == "r": i += 6 continue i += 4 else: frag = 1 break i += 1 if frag == 0: print("YES") else: print("NO")
s098784865
p03854
u518414537
1596579895
Python
Python (3.8.2)
py
Runtime Error
50
9904
859
s = list(input()) frag = 0 i = 0 while i < len(s): if len(s) < 5: frag = 1 break if s[i] == "d" and s[i + 1] == "r" and s[i + 2] == "e" and s[i + 3] == "a" and s[i + 4] == "m": if i + 9 < len(s): if s[i + 5] == "e" and s[i + 6] == "r" and s[i + 7] == "a" and s[i + 8] == "s" and s[i + 9] == "e": i += 5 continue if i + 6 < len(s): if s[i + 5] == "e" and s[i + 6] == "r": i += 7 continue i += 4 elif s[i] == "e" and s[i + 1] == "r" and s[i + 2] == "a" and s[i + 3] == "s" and s[i + 4] == "e": if i + 5 < len(s): if s[i + 5] == "r": i += 6 continue i += 4 else: frag = 1 break i += 1 if frag == 0: print("YES") else: print("NO")
s196371481
p03854
u518414537
1596579730
Python
Python (3.8.2)
py
Runtime Error
50
10076
860
s = list(input()) frag = 0 i = 0 while i < len(s): if len(s) == 0: frag = 1 break if s[i] == "d" and s[i + 1] == "r" and s[i + 2] == "e" and s[i + 3] == "a" and s[i + 4] == "m": if i + 9 < len(s): if s[i + 5] == "e" and s[i + 6] == "r" and s[i + 7] == "a" and s[i + 8] == "s" and s[i + 9] == "e": i += 5 continue if i + 6 < len(s): if s[i + 5] == "e" and s[i + 6] == "r": i += 7 continue i += 4 elif s[i] == "e" and s[i + 1] == "r" and s[i + 2] == "a" and s[i + 3] == "s" and s[i + 4] == "e": if i + 5 < len(s): if s[i + 5] == "r": i += 6 continue i += 4 else: frag = 1 break i += 1 if frag == 0: print("YES") else: print("NO")
s701251444
p03854
u518414537
1596579289
Python
Python (3.8.2)
py
Runtime Error
48
10000
809
s = list(input()) frag = 0 i = 0 while i < len(s): if s[i] == "d" and s[i + 1] == "r" and s[i + 2] == "e" and s[i + 3] == "a" and s[i + 4] == "m": if i + 9 < len(s): if s[i + 5] == "e" and s[i + 6] == "r" and s[i + 7] == "a" and s[i + 8] == "s" and s[i + 9] == "e": i += 5 continue if i + 6 < len(s): if s[i + 5] == "e" and s[i + 6] == "r": i += 7 continue i += 4 elif s[i] == "e" and s[i + 1] == "r" and s[i + 2] == "a" and s[i + 3] == "s" and s[i + 4] == "e": if i + 5 < len(s): if s[i + 5] == "r": i += 6 continue i += 4 else: frag = 1 break i += 1 if frag == 0: print("YES") else: print("NO")
s443510782
p03854
u518414537
1596579003
Python
Python (3.8.2)
py
Runtime Error
50
10016
798
s = list(input()) frag = 0 i = 0 if len(s) == 0: frag = 1 while i < len(s): if s[i] == "d" and s[i + 1] == "r" and s[i + 2] == "e" and s[i + 3] == "a" and s[i + 4] == "m": if i + 7 < len(s): if s[i + 5] == "e" and s[i + 6] == "r" and s[i + 7] == "a": i += 5 continue if i + 6 < len(s): if s[i + 5] == "e" and s[i + 6] == "r": i += 7 continue i += 4 elif s[i] == "e" and s[i + 1] == "r" and s[i + 2] == "a" and s[i + 3] == "s" and s[i + 4] == "e": if i + 5 < len(s): if s[i + 5] == "r": i += 6 continue i += 4 else: frag = 1 break i += 1 if frag == 0: print("YES") else: print("NO")
s660980404
p03854
u518414537
1596578773
Python
Python (3.8.2)
py
Runtime Error
46
9956
769
s = list(input()) frag = 0 i = 0 while i < len(s): if s[i] == "d" and s[i + 1] == "r" and s[i + 2] == "e" and s[i + 3] == "a" and s[i + 4] == "m": if i + 7 < len(s): if s[i + 5] == "e" and s[i + 6] == "r" and s[i + 7] == "a": i += 5 continue if i + 6 < len(s): if s[i + 5] == "e" and s[i + 6] == "r": i += 7 continue i += 4 elif s[i] == "e" and s[i + 1] == "r" and s[i + 2] == "a" and s[i + 3] == "s" and s[i + 4] == "e": if i + 5 < len(s): if s[i + 5] == "r": i += 6 continue i += 4 else: frag = 1 break i += 1 if frag == 0: print("YES") else: print("NO")
s590394196
p03854
u518414537
1596578680
Python
Python (3.8.2)
py
Runtime Error
47
10020
803
s = list(input()) frag = 0 i = 0 while i < len(s): if s[i] == "d" and s[i + 1] == "r" and s[i + 2] == "e" and s[i + 3] == "a" and s[i + 4] == "m": if i + 7 < len(s): if s[i + 5] == "e" and s[i + 6] == "r" and s[i + 7] == "a": i += 5 continue if i + 6 < len(s): if s[i + 5] == "e" and s[i + 6] == "r": i += 7 continue i += 4 elif s[i] == "e" and s[i + 1] == "r" and s[i + 2] == "a" and s[i + 3] == "s" and s[i + 4] == "e": if i + 5 < len(s): if s[i + 5] == "r": i += 5 else: i += 4 else: i += 4 else: frag = 1 break i += 1 if frag == 0: print("YES") else: print("NO")
s533864949
p03854
u518414537
1596578550
Python
Python (3.8.2)
py
Runtime Error
32
9964
837
s = list(input()) frag = 0 i = 0 while i < len(s): if s[i] == "d" and s[i + 1] == "r" and s[i + 2] == "e" and s[i + 3] == "a" and s[i + 4] == "m": if i + 7 < len(s): if s[i + 5] == "e" and s[i + 6] == "r" and s[i + 7] == "a": i += 4 continue if i + 6 < len(s): if s[i + 5] == "e" and s[i + 6] == "r": i += 6 else: i += 4 else: i += 4 elif s[i] == "e" and s[i + 1] == "r" and s[i + 2] == "a" and s[i + 3] == "s" and s[i + 4] == "e": if i + 5 < len(s): if s[i + 5] == "r": i += 5 else: i += 4 else: i += 4 else: frag = 1 break i += 1 if frag == 0: print("YES") else: print("NO")
s809976967
p03854
u374802266
1596503051
Python
Python (3.8.2)
py
Runtime Error
2217
14028
354
s=input() while s: if s[-5:]=='erase': for i in range(5): s.pop() elif s[-5:]=='dream': for i in range(5): s.pop() elif s[-6:]=='eraser': for i in range(6): s.pop() elif s[-7:]=='dreamer': for i in range(7): s.pop() else: print('NO') print('YES')
s059014017
p03854
u374802266
1596502579
Python
Python (3.8.2)
py
Runtime Error
52
12560
348
def test(t): if len(t)==len(s): print('YES') exit() if s[len(t):len(t)+5]=='dream': test(t+'dream') if s[len(t):len(t)+7]=='dreamer': test(t+'dreamer') if s[len(t):len(t)+5]=='erase': test(t+'erase') if s[len(t):len(t)+6]=='eraser': test(t+'eraser') s=input() test('') print('NO')
s467767506
p03854
u935685410
1596088017
Python
PyPy3 (7.3.0)
py
Runtime Error
94
68520
112
import re s = imput() if re.match("(dreamer|dream|eraser|erase)+dreamer",s): print("YES") else: print("NO")
s910153581
p03854
u692690314
1595615602
Python
Python (3.8.2)
py
Runtime Error
48
9760
504
s = input() s_reverse = ''.join(list(reversed(s))) t = '' while True: if s_reverse == t: print('YES') break n = len(t) if s_reverse[n] == 'm': t += ''.join(list(reversed('dream'))) elif s_reverse[n] == 'e': t += ''.join(list(reversed('erase'))) elif s_reverse[n:n+3] == 'rem': t += ''.join(list(reversed('dreamer'))) elif s_reverse[n:n+3] == 'res': t += ''.join(list(reversed('eraser'))) else: print('NO') break
s290284975
p03854
u985929170
1595573017
Python
Python (3.8.2)
py
Runtime Error
2372
139492
960
S = input() import re li = ['dream','dreamer','erase','eraser'] while len(list(S)) > 8: if S[0] == 'd': if S[0:5] == 'dream': if S[5:10] == 'erase': S = S[5:] print(S) elif S[5:10] == 'dream': S = S[5:] print(S) elif S[5:7] == 'er': if S[7:12] == 'dream': S = S[7:] print(S) elif S[7:12] == 'erase': S = S[7:] print(S) else:break else: if S[0:6] == 'eraser': S = S[6:] print(S) elif S[0:5] == 'erase': if S[5:10] == 'erase': S = S[5:] print(S) elif S[5:10] == 'dream': S = S[5:] print(S) else:break k = 0 for l in li: if S == l:k = 1 if k == 0:print('No') else:print('Yes')
s326365170
p03854
u199948227
1595451020
Python
Python (3.8.2)
py
Runtime Error
84
104052
484
WORDS = ['dream', 'dreamer', 'erase', 'eraser'] def main(s): for word in WORDS: if delete_word(s, word): print('YES') break else: print('NO') def delete_word(s, word): if s.endswith(word): s = s[:-len(word)] if len(s) == 0: return True for w in WORDS: if delete_word(s, w): return True else: return False if __name__ == "__main__": main(input())
s668313381
p03854
u199948227
1595447540
Python
Python (3.8.2)
py
Runtime Error
84
104044
503
def main(s): for word in ['dream', 'dreamer', 'erase', 'eraser']: if delete_word(s, word): print('YES') break else: print('NO') def delete_word(s, word): if s.startswith(word): s = s[len(word):] if len(s) == 0: return True for w in ['dream', 'dreamer', 'erase', 'eraser']: if delete_word(s, w): return True else: return False if __name__ == "__main__": main(input())
s248549206
p03854
u199948227
1595447087
Python
Python (3.8.2)
py
Runtime Error
85
103808
485
WORDS = ['dream', 'dreamer', 'erase', 'eraser'] def main(s): for word in WORDS: if delete_word(s, word): print('YES') break else: print('NO') def delete_word(s, word): if s.startswith(word): s = s[len(word):] if len(s) == 0: return True for w in WORDS: if delete_word(s, w): return True else: return False if __name__ == "__main__": main(input())
s924273223
p03854
u199948227
1595446848
Python
Python (3.8.2)
py
Runtime Error
87
103820
491
WORDS = ['dream', 'dreamer', 'erase', 'eraser'] def main(s): for word in WORDS: if delete_word(s, word): print('YES') break else: print('NO') def delete_word(s, word): if s.startswith(word): s = s[len(word):] if len(s) == 0: return True for word in WORDS: if delete_word(s, word): return True else: return False if __name__ == "__main__": main(input())
s436234003
p03854
u433697974
1595292771
Python
Python (3.8.2)
py
Runtime Error
104
104108
440
def hantei(S): if S == 'dream' or S == 'dreamer' or S == 'erase' or S == 'eraser': return 1 if S[:5] == 'dream': if S[:7] == 'dreamer': return hantei(S[5:]) | hantei(S[7:]) else: return hantei(S[5:]) if S[:5] == 'erase': if S[:6] == 'eraser': return hantei(S[5:]) | hantei(S[6:]) else: return hantei(S[5:]) else: return 0 S = input() if(hantei(S)): print('YES') else: print('NO')
s953994987
p03854
u433697974
1595292644
Python
Python (3.8.2)
py
Runtime Error
23
9012
496
import sys import resource sys.setrecursionlimit(100000) def hantei(S): if S == 'dream' or S == 'dreamer' or S == 'erase' or S == 'eraser': return 1 if S[:5] == 'dream' if S[:7] == 'dreamer' return hantei(S[5:]) | hantei(S[7:]) else: return hantei(S[5:]) if S[:5] == 'erase' if S[:6] == 'eraser' return hantei(S[5:]) | hantei(S[6:]) else: return hantei(S[5:]) else: return 0 S = input() if(hantei(S)): print('YES') else: print('NO')
s229258774
p03854
u433380437
1594961428
Python
PyPy3 (7.3.0)
py
Runtime Error
481
177272
369
s = input() def solve(query): while 1: for frag in ("erase", "eraser", "dream", "dreamer"): if query.endswith(frag): query = query[:-len(frag)] print(query) break else: print("NO") break if not query: print("YES") break solve(s)
s138362307
p03854
u845982808
1594689783
Python
Python (3.8.2)
py
Runtime Error
24
9068
102
S = input() if re.match("^(dream|dreamer|erase|eraser)+$", S): print("Yes") else: print("No")
s462134905
p03854
u845982808
1594689555
Python
Python (3.8.2)
py
Runtime Error
25
9160
102
S = input() if re.match("^(dream|dreamer|erase|eraser)+$", s): print("Yes") else: print("No")
s219608367
p03854
u845982808
1594689458
Python
Python (3.8.2)
py
Runtime Error
25
8988
110
import re s = input() if re.match("^(dream|dreamer|erase|eraser)+$, s): print("Yes") else: print("No")
s375256311
p03854
u786020649
1594627000
Python
Python (3.8.2)
py
Runtime Error
1764
140704
811
from collections import deque import sys def fnw(n,s): sm=deque([]) if n<=len(s): for _ in range(n): sm.append(s.popleft()) return ''.join(sm) def jfws(s): print(s) fws=fnw(5,s) # print(fws) if fws=='dream': fws=fnw(2,s) if fws=='er': if s: if s[0]=='a': s.extendleft(deque(reversed(list(fws)))) else: s.extendleft(deque(reversed(list(fws)))) return False elif fws=='erase': fws=fnw(1,s) if fws!='r' or '': s.appendleft(fws) return False else: return True def main(s): while s: if jfws(s): return 'NO' print(s) return 'YES' s=deque(sys.stdin.readline().strip()) print(main(s))
s684527027
p03854
u786020649
1594623150
Python
Python (3.8.2)
py
Runtime Error
68
9964
770
from collections import deque import sys def fnw(n,s): sm=deque([]) if n<=len(s): for _ in range(n): sm.append(s.popleft()) return ''.join(sm) def jfws(s): # print(s) fws=fnw(5,s) # print(fws) if fws=='dream': fws=fnw(2,s) if fws=='er': if s[0]=='a': s.extendleft(deque(reversed(list(fws)))) else: s.extendleft(deque(reversed(list(fws)))) return False elif fws=='erase': fws=fnw(1,s) if fws!='r': s.appendleft(fws) return False else: return True def main(s): while bool(s): if jfws(s): return 'NO' return 'YES' s=deque(sys.stdin.readline().strip()) print(main(s))
s166143473
p03854
u786020649
1594623082
Python
Python (3.8.2)
py
Runtime Error
1807
140700
768
from collections import deque import sys def fnw(n,s): sm=deque([]) if n<=len(s): for _ in range(n): sm.append(s.popleft()) return ''.join(sm) def jfws(s): print(s) fws=fnw(5,s) # print(fws) if fws=='dream': fws=fnw(2,s) if fws=='er': if s[0]=='a': s.extendleft(deque(reversed(list(fws)))) else: s.extendleft(deque(reversed(list(fws)))) return False elif fws=='erase': fws=fnw(1,s) if fws!='r': s.appendleft(fws) return False else: return True def main(s): while bool(s): if jfws(s): return 'NO' return 'YES' s=deque(sys.stdin.readline().strip()) print(main(s))
s668459223
p03854
u786020649
1594622541
Python
Python (3.8.2)
py
Runtime Error
65
10076
755
from collections import deque import sys def fnw(n,s): sm=deque([]) if n<=len(s): for _ in range(n): sm.append(s.popleft()) return ''.join(sm) def jfws(s): fws=fnw(5,s) # print(fws) if fws=='dream': fws=fnw(2,s) if fws=='er': if s[0]=='a': s.extendleft(deque(reversed(list(fws)))) else: s.extendleft(deque(reversed(list(fws)))) return False elif fws=='erase': fws=fnw(1,s) if fws!='r': s.appendleft(fws) return False else: return True def main(s): while s: if jfws(s): return 'NO' return 'YES' s=deque(sys.stdin.readline().strip(),10**5) print(main(s))
s671426725
p03854
u786020649
1594621936
Python
Python (3.8.2)
py
Runtime Error
66
10008
749
from collections import deque import sys def fnw(n,s): sm=deque([]) if n<=len(s): for _ in range(n): sm.append(s.popleft()) return ''.join(sm) def jfws(s): fws=fnw(5,s) # print(fws) if fws=='dream': fws=fnw(2,s) if fws=='er': if s[0]=='a': s.extendleft(deque(reversed(list(fws)))) else: s.extendleft(deque(reversed(list(fws)))) return False elif fws=='erase': fws=fnw(1,s) if fws!='r': s.appendleft(fws) return False else: return True def main(s): while s: if jfws(s): return 'NO' return 'YES' s=deque(sys.stdin.readline().strip()) print(main(s))
s693147848
p03854
u786020649
1594621857
Python
Python (3.8.2)
py
Runtime Error
70
10136
747
from collections import deque import sys def fnw(n,s): sm=deque([]) if n<=len(s): for _ in range(n): sm.append(s.popleft()) return ''.join(sm) def jfws(s): fws=fnw(5,s) print(fws) if fws=='dream': fws=fnw(2,s) if fws=='er': if s[0]=='a': s.extendleft(deque(reversed(list(fws)))) else: s.extendleft(deque(reversed(list(fws)))) return False elif fws=='erase': fws=fnw(1,s) if fws!='r': s.appendleft(fws) return False else: return True def main(s): while s: if jfws(s): return 'NO' return 'YES' s=deque(sys.stdin.readline().strip()) print(main(s))
s137075015
p03854
u786020649
1594621629
Python
Python (3.8.2)
py
Runtime Error
23
8932
784
from collections import deque import sys def fnw(n,s): sm=deque([]) if n<=len(s): for _ in range(n): sm.append(s.popleft()) return ''.join(sm) def jfws(s): fws=fnw(5,s) if fws=='dream': fws=fnw(2,s) if fws=='er': if s[0]=='a': s.extendleft(deque(reversed(list(fws)))) else: s.extendleft(deque(reversed(list(fws)))) return False elif fws=='erase': fws=fnw(1,s) if fws!='r': s.appendleft(fws) return False else: return True def main(s): while True: if not list(s): return 'Yes" if jfws(s): return 'NO' return 'Yes' s=deque(sys.stdin.readline().strip()) print(main(s))
s782296335
p03854
u786020649
1594621318
Python
Python (3.8.2)
py
Runtime Error
66
10028
767
from collections import deque import sys def fnw(n,s): sm=deque([]) if n<=len(s): for _ in range(n): sm.append(s.popleft()) return ''.join(sm) def jfws(s): fws=fnw(5,s) if fws=='dream': fws=fnw(2,s) if fws=='er': if s[0]=='a': s.extendleft(deque(reversed(list(fws)))) else: s.extendleft(deque(reversed(list(fws)))) return False elif fws=='erase': fws=fnw(1,s) if fws!='r': s.appendleft(fws) return False else: return True def main(s): while True: if jfws(s): return 'NO' if not bool(s): return 'Yes' s=deque(sys.stdin.readline().strip()) print(main(s))
s084845095
p03854
u786020649
1594621300
Python
Python (3.8.2)
py
Runtime Error
25
9204
470
import sys def eat(i,candies,counter): s=candies[i]+candies[i-1] nc=max(0,s-x) counter+=nc candies[i]-=nc return counter def main(n,x,candies): counter=0 if candies[0]>x: counter=candies[0]-x candies[0]=x for i in range(1,n): counter=eat(i,candies,counter) return counter n,x=map(int,sys.stdin.readline().strip().split()) candies=list(map(int,sys.stdin.readline().strip().split())) print(main(n,x,candies))
s328914618
p03854
u747703115
1594131470
Python
Python (3.8.2)
py
Runtime Error
21
9000
130
s = input()replace('dreamer', '').replace('eraser', '').replace('dream', '').replace('erase', ''). print('YES' if s=='' else 'NO')
s550810218
p03854
u294385082
1592661259
Python
Python (3.8.2)
py
Runtime Error
27
10696
573
from collections import deque s = input() q = deque(list(s)) while q: if len(q) >= 5: subs = q.popleft()+q.popleft()+q.popleft()+q.popleft()+q.popleft() if subs != 'erase' and subs != 'dream': print('NO') exit() if subs == 'erase' and len(q) != 0 and q[0] == 'r': q.popleft() if subs == 'dream' and len(q) == 2 and q[0]+q[1] == 'er': q.popleft() q.popleft() if subs == 'dream' and len(q) >= 3 and q[0]+q[1] == 'er' and q[2] != e: q.popleft() q.popleft() else: print('NO') exit() print('YES')
s434260713
p03854
u925478395
1591653911
Python
Python (3.4.3)
py
Runtime Error
17
2940
109
import rs li = input() if re.match("^(dream|dreamer|erase|eraser)+$", li): print('YSE') else: print('NO')
s451836784
p03854
u925478395
1591653861
Python
Python (3.4.3)
py
Runtime Error
17
2940
124
import rs li = input() flag = 'No' if re.match("^(dream|dreamer|erase|eraser)+$", li): flag = 'YES' print(flag)
s798922535
p03854
u925478395
1591653250
Python
Python (3.4.3)
py
Runtime Error
17
2940
159
li = list(input()) list = ['dream','dreamer','erase','eraser'] flag = 'No' for x in list: for y in list: if x + y = li: flag = 'YES' print(flag)
s894168671
p03854
u269340384
1591580046
Python
Python (3.4.3)
py
Runtime Error
17
2940
1368
#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 += 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 += 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 += 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 += eraser; if(count4) countall++; if(T == S){ cout << "YES" << endl; break; } if(countall == 4){ cout << "NO" << endl; break; } } return 0; }
s605646836
p03854
u951480280
1591560587
Python
Python (3.4.3)
py
Runtime Error
41
3828
611
from collections import deque s = input() n = len(s) deque = deque() deque.append(0) def str_plus(i): s1 = s[i] if s1 == "d": if s[i:i+5] == "dream": if s[i+5:i+7] == "er": return [i+5,i+7] else: return [i+5] if s1 == "e": if s[i:i+5] == "erase": if s[i+5] == "r": return [i+5,i+6] else: return [i+5] ans = "NO" while deque: i = deque.pop() if i == n: ans = "YES" break l = str_plus(i) if l != None: deque.extend(l) print(ans)
s653696730
p03854
u951480280
1591560123
Python
Python (3.4.3)
py
Runtime Error
43
3828
752
from collections import deque str_l = ["dream", "dreamer", "erase" ,"eraser"] s = input() n = len(s) deque = deque() deque.append(0) def str_plus(i): s1 = s[i] if s1 == "d": if s[i:i+5] == "dream": if s[i+5:i+7] == "er": return [i+5,i+7] else: return [i+5] else: return False if s1 == "e": if s[i:i+5] == "erase": if s[i+5] == "r": return [i+5,i+6] else: return [i+5] else: return False ans = "NO" while deque: i = deque.pop() if i == n: ans = "YES" break l = str_plus(i) if l != False and l != None: deque.extend(l) print(ans)
s880921861
p03854
u818542539
1591471482
Python
Python (3.4.3)
py
Runtime Error
87
9852
657
S = input() U = ['dreamer', 'dream', 'eraser', 'erase'] answer = 'NO' def possible(current): possible = [] for string in U: if S.startswith(current + string): possible.append(string) return possible def judge(current): if current == S: global answer answer = 'YES' return if answer == 'YES': return else: if possible(current) == []: return else: for candidate in possible(current): new = current + candidate if len(S) >= len(new): judge(current + candidate) judge('') print(answer)
s293435383
p03854
u818542539
1591471107
Python
Python (3.4.3)
py
Runtime Error
89
9864
715
S = input() T = '' U = ['dreamer', 'dream', 'eraser', 'erase'] answer = 'NO' def possible(current): possible = [] for string in U: if S.startswith(current + string): possible.append(string) return possible def judge(current): if current == S: global answer answer = 'YES' return if answer == 'YES' or len(S) < len(current): return else: if possible(current) == []: return else: for candidate in possible(current): new = current + candidate if len(S) >= len(new): judge(current + candidate) for string in U: judge(string) print(answer)
s371904477
p03854
u742129941
1591338894
Python
Python (3.4.3)
py
Runtime Error
78
4304
348
import sys def add_str(t="",wn=0,s=0): if t == st[s:s+wn] or t == "": if s+wn == len(st): print("YES") sys.exit() add_str("dream", 5, s+wn) add_str("dreamer", 7, s+wn) add_str("erase", 5, s+wn) add_str("eraser", 6, s+wn) else: return st=input() add_str() print("NO")
s034817666
p03854
u844895214
1590954185
Python
Python (3.4.3)
py
Runtime Error
104
7196
463
from sys import stdin def S(): return stdin.readline().rstrip() a = S() def f(t,a): if t == a: return True elif len(a)<len(t): return False else: strl = {0:'dream',1:'dreamer',2:'erase',3:'eraser'} for i in range(4): tmp = strl[i] if t+tmp in a[:len(t+tmp)]: if f(t+tmp,a): return True return False if f('',a): print('YES') else: print('NO')
s205098384
p03854
u363146889
1590921421
Python
PyPy3 (2.4.0)
py
Runtime Error
177
38340
707
# -*- coding: utf-8 -*- ## Library import sys from fractions import gcd import math from math import ceil,floor import collections ## input # n=int(input()) # A,B,C,D=map(int, input().split()) # string = input() # yoko = list(map(int, input().split())) # tate = [int(input()) for _ in range(N)] # N, M = map(int,input().split()) # P = [list(map(int,input().split())) for i in range(M)] S = input() ## Logic S = S[::-1] print(S) i = 0 while i < len(S): if [i:i+7]=="remaerd": i = i + 7 elif [i:i+6]=="resare": i = i + 6 elif [i:i+5]=="maerd": i = i + 5 elif [i:i+5]=="esare": i = i + 5 else: print("NO") sys.exit() print("YES")
s918961397
p03854
u045628053
1590711759
Python
Python (3.4.3)
py
Runtime Error
19
3188
178
import re output ="NO" s = re.sub('dreamer', '', s) s = re.sub('dream', '', s) s = re.sub('eraser', '', s) s = re.sub('erase', '', s) if s == "": output = "YES" print(output)
s367993315
p03854
u243312682
1590687949
Python
Python (3.4.3)
py
Runtime Error
24
4900
530
import re def main(): s = list(input()) sr = ''.join(list(reversed(s))) t = ['dream', 'dreamer', 'erase', 'eraser'] tr = list() for i in t: tr.append(''.join(list(reversed(i)))) while sr: flag = False for i in tr: if sr.startswith(i): sr = sr.replace(i ,'', 1) flag = True if not flag: print('NO') break if st == '': print('YES') break if __name__ == '__main__': main()
s126759192
p03854
u558981240
1590600941
Python
Python (3.4.3)
py
Runtime Error
2104
3188
512
s = input() dr = "dream" dre = "dreamer" er = "erase" era = "eraser" dr = dr[::-1] dre = dre[::-1] er = er[::-1] era = era[::-1] s = s[::-1] flag = True while True: if len(s) == 0: break elif s.startswith(dr): s.replace(dr, "", 1) elif s.startswith(dre): s.replace(dre, "", 1) elif s.startswith(er): s.repalce(er, "", 1) elif s.startswith(era): s.replace(era, "", 1) else: flag = False if flag: print("YES") else: print("NO")
s230825168
p03854
u558981240
1590600106
Python
Python (3.4.3)
py
Runtime Error
18
3188
511
s = input() dr = "dream" dre = "dreamer" er = "erase" era = "eraser" dr = dr[::-1] dre = dre[::-1] er = er[::-1] era = era[::-1] s = s[::-1] flag = True while True: if s.length == 0: break elif s.startswith(dr): s.replace(dr, "", 1) elif s.startswi(dre): s.replace(dre, "", 1) elif s.startswith(er): s.repalce(er, "", 1) elif s.startswith(era): s.replace(era, "", 1) else: flag = False if flag: print("YES") else: print("NO")
s091528486
p03854
u919025034
1590196622
Python
PyPy3 (2.4.0)
py
Runtime Error
179
38256
533
IN = iter(Input.split('\n')).__next__ def input(): return IN() #ここから先 S=input() T=[] l=-1 while l>=-len(S): if S[l]=="r": if l-2<-len(S): print("NO");break elif S[l-2]=="s": T+="eraser"[::-1] l-=6 else: T+="dreamer"[::-1] l-=7 elif S[l]=="e": T+="erase"[::-1] l-=5 elif S[l]=="m": T+="dream"[::-1] l-=5 else: print("NO");break if S=="".join(T[::-1]): print("YES")
s916947436
p03854
u851469594
1590036008
Python
Python (3.4.3)
py
Runtime Error
74
3188
508
S = input() while True: if len(S) == 0: print('YES') exit() if len(S) < 5: print('NO') exit() if S[:5] == 'dream': if len(S) > 6 and S[5:7] == 'er': if S[7] == 'a': S = S[5:] else : S = S[7:] else : S = S[5:] elif S[:5] == 'erase': if len(S) > 5 and S[5] == 'r': S = S[6:] else : S = S[5:] else : print('NO') exit()
s007977811
p03854
u851469594
1590035644
Python
Python (3.4.3)
py
Runtime Error
71
3188
484
S = input() i = 0 while True: if len(S) == 0: print('YES') exit() if len(S) < 5: print('NO') exit() if S[:5] == 'dream': if S[5:7] == 'er': if S[7] == 'a': S = S[5:] else : S = S[7:] else : S = S[5:] elif S[:5] == 'erase': if S[5] == 'r': S = S[6:] else : S = S[5:] else : print('NO') exit()
s174694088
p03854
u324197506
1589901042
Python
Python (3.4.3)
py
Runtime Error
31
3316
838
s = input() vocabs = ["dream","dreamer","erase","eraser"] cnt = 0 t = "" while cnt <= len(s) - 7: if s[cnt] == "d": if s[cnt+5] == "d": cnt += 5 t += vocabs[0] elif s[cnt+5] == "e": if s[cnt+7] == "a": cnt += 5 t += vocabs[0] else: cnt += 7 t += vocabs[1] else: break elif s[cnt] == "e": if s[cnt+5] == "r": cnt += 6 t += vocabs[3] else: cnt += 5 t += vocabs[2] else: break if s[cnt:] == vocabs[0]: t+= vocabs[0] elif s[cnt:] == vocabs[1]: t+= vocabs[1] elif s[cnt:] == vocabs[2]: t+= vocabs[2] elif s[cnt:] == vocabs[3]: t+= vocabs[3] if s == t: print("YES") else: print("NO")
s909708358
p03854
u000842852
1589821776
Python
Python (3.4.3)
py
Runtime Error
18
3064
387
スコード Copy Copy def main(): S = input() while len(S)>=5: if len(S)>=7 and S[-7:]=="dreamer": S = S[:-7] continue elif len(S)>=6 and S[-6:]=="eraser": S = S[:-6] continue elif S[-5:]=="dream" or S[-5:]=="erase": S = S[:-5] continue else: break if len(S)==0: print('Yes') else: print('No') main()
s379182398
p03854
u981449436
1589686224
Python
Python (3.4.3)
py
Runtime Error
251
156660
528
def dfs(string): can = ["dream", "dreamer", "erase", "eraser"] stack = [] stack.append("dream") stack.append("dreamer") stack.append("erase") stack.append("eraser") while stack: judge = stack.pop() if judge == string:break for temp in can: ans = judge + temp print(ans) if ans == string[:len(ans)]: stack.append(ans) return "YES" if judge == string else "NO" if __name__ == '__main__': s = input() print(dfs(s))
s638103531
p03854
u738622346
1589481692
Python
Python (3.4.3)
py
Runtime Error
18
2940
440
div = ["dream", "dreamer", "erase", "eraser"] rev = [] t = "" s_rev = s[::-1] for d in div: rev.append(d[::-1]) result = True i = 0 while i < len(s): can_divide = False for d in rev: if len(s_rev) - i >= len(d): if s_rev[i:i + len(d)] == d: can_divide = True i += len(d) break if not can_divide: result = False break print("YES" if result else "NO")
s764707244
p03854
u738622346
1589481584
Python
Python (3.4.3)
py
Runtime Error
18
3064
487
div = ["dream", "dreamer", "erase", "eraser"] rev = [] t = "" s_rev = s[::-1] for d in div: rev.append(d[::-1]) result = True i = 0 while i < len(s): can_divide = False for d in rev: print("rev:%d i:%d d:%d" % (len(s_rev), i, len(d))) if len(s_rev) - i > len(d) and s_rev[i:i + len(d)] == d: can_divide = True i += len(d) break if not can_divide: result = False break print("YES" if result else "NO")
s119262475
p03854
u738622346
1589481495
Python
Python (3.4.3)
py
Runtime Error
18
3064
488
div = ["dream", "dreamer", "erase", "eraser"] rev = [] t = "" s_rev = s[::-1] for d in div: rev.append(d[::-1]) result = True i = 0 while i < len(s): can_divide = False for d in rev: print("rev:%d i:%d d:%d" % (len(s_rev), i, len(d))) if len(s_rev) - i >= len(d) and s_rev[i:i + len(d)] == d: can_divide = True i += len(d) break if not can_divide: result = False break print("YES" if result else "NO")