Harryxun/stf_run huggingface dataset:
def isSquare(x):
  return x == round(x**(1/2))**2

N = int(input())
l = (x if isSquare(x) else -1 for x in range(1,N+1))
print(max(l))

### FIXED CODE ###

S = "".join(reversed(input()))
T = "".join(input())

if S == T:
  print("YES")
else:
  print("NO")
N = int(input())

L = [0]
l = 0
for i in range(1,100) :
    l += i
    L.append(l)
ans = []
while N > 0 :
    for i in range(len(L))  :
        #print(L[i],N,L[i+1])
        if (L[i]+1 <= N <= L[i+1]) :
            ans.append(i+1)
            N -= i+1
            break
    
print(*ans,sep="\n")


### FIXED CODE ###

import sys
import bisect

sys.setrecursionlimit(10**9)

N = int(input())

L = [0]
l = 0
for i in range(1,10**6) :
    l += i
    L.append(l+1)
ans = []
while N > 0 :
    tmp = bisect.bisect(L,N)
    
    ans.append(tmp)
    N -= tmp
    
print(*ans,sep="\n")
s=set(sep(input()))
a='abcdefghijklmnopqrstuvwxyz'
b=set()
for i in range(26):
    b.append(str(a[i]))
if s==b:
    print('None')
else:
    print(b-s)


### FIXED CODE ###

s=set(list(input()))
a=set(list('abcdefghijklmnopqrstuvwxyz'))

if s==a:
    print('None')
else:
    b=sorted(list(a-s))
    print(str(b[0]))
a,b=map(int,input().split())
lista=[]
import fractions
gcd=fractions.gcd(a,b)

for i in range(2,gcd+1):
    if a% i == 0 and b % i == 0: 
        lista.append(i)
        
listb=[]
for i in range(len(lista)):   
    if pow(2, lista[i]-1, lista[i]) == 1:
            listb.append(lista[i])
print(listb)   

if lista[1]=2:   
print(len(listb)+2)

else:
    print(len(listb)+1)


### FIXED CODE ###

a,b=map(int,input().split())
lista=[]
import fractions
import math
gcd=fractions.gcd(a,b)

for i in range(1,int(gcd**0.5)+1): 
    if gcd% i == 0: 
        lista.append(i)
        if i!=int(gcd/i):
            lista.append(int(gcd/i))

#print(lista)
lista=lista[1:]
lista.sort()
listb=[]
for i in range(len(lista)):
    flag = True
    for j in range(len(listb)):
        if lista[i]%listb[j]==0:
            flag = False    
    if flag==True:
        listb.append(lista[i])

print(len(listb)+1)
A, B, C = map(int,input().split())
if A == B == C:
    print('No')
elif B == C:
    print('Yes')
elif A == C:
    print('Yes')
elif A == B:
    print('Yes')
else:
    print('No'

### FIXED CODE ###

A, B, C = map(int,input().split())
if A ==B and B == C:
    print('No')
elif B == C:
    print('Yes')
elif A == C:
    print('Yes')
elif A == B:
    print('Yes')
else:
    print('No')
edges = [map(int, input().split()) for _ in range(3)]

flattened = [i for sub in edges for i in sub]
cont = sorted([flattened.count(i) for i in range(4)])
ans = 'YES' if cont = [1,1,2,2] else 'NO'

### FIXED CODE ###

edges = [map(int, input().split()) for _ in range(3)]

flattened = [i for sub in edges for i in sub]
cont = sorted([flattened.count(i) for i in range(1, 5)])
ans = 'YES' if cont == [1,1,2,2] else 'NO'
print(ans)
seq_a = []
seq_b = []
seq_n = int(input())
for i in range(seq_n):
    num_a,num_b=map(int,input().split())
    seq_a.append(num_a)
    seq_b.append(num_b)
x = 0
for i in range(seq_n - 1, -1 ,-1):
    elem_a , elem_b = seq_a[i],seq_b[i]
    y = (elem_a + x)% elem_b
    if y != 0: x += (m-y)
print(x)

### FIXED CODE ###

a=[]
b=[]
n=int(input())
for i in range(n):
    j,k=map(int,input().split())
    a.append(j)
    b.append(k)
x=0
for i in range(n-1,-1,-1):
    n,m=a[i],b[i]
    y=(n+x)%m
    if y!=0:x+=m-y
print(x)
N,A = (int(i) for i in input().split()) 
i = 0
while(N >=500):
    N//=500
if(N <=A):
    print("Yes")
else:
    print("No")

### FIXED CODE ###

N=int(input())
A=int(input())
tmp = N
while(N >=500):
    tmp = N%500
    N//=500
if(tmp <=A):
    print("Yes")
else:
    print("No")
from sys import stdin


def main():
    n = int(stdin.readline())
    a = map(int, stdin.readline().split())
    r = [0] * 12
    for ai in a:
        r[int(ai / 400)] += 1
    min = 0
    for i in range(8):
        if r[i] > 0:
            min += 1
    max = min
    for i in range(8, 12):
        max += r[i]
    print(min, max)


if __name__ == "__main__":
    main()


### FIXED CODE ###

from sys import stdin


def main():
    n = int(stdin.readline())
    a = map(int, stdin.readline().split())
    r = [0] * 13
    for ai in a:
        r[int(ai / 400)] += 1
    min = 0
    for i in range(8):
        if r[i] > 0:
            min += 1
    max = min
    for i in range(8, 13):
        max += r[i]
    if min == 0:
        min = 1
    print(min, max)


if __name__ == "__main__":
    main()
a,b,c=map(int,input().split())
print(max(int(str(a)+str(b))+c,int(str(a)+str(c))+b,int(str(b)+str(c))+a,int(str(b)+str(a)+c,int(str(c)+str(a)+b,int(str(c)+str(b)+a))


### FIXED CODE ###

a=list(map(int,input().split()))
a_=sorted(a,reverse=True)
print(int(str(a_[0])+str(a_[1]))+a_[2])
N=int(input())
H=list(map(int,input().split()))
cnt=1
if H[1]>=H[0]:
    cnt+=1
for j in range(2,N):
    if H[j]>=H[j-1] and H[j]>=H[0] and H[j]>=H[1]:
        cnt+=1
print(cnt)

### FIXED CODE ###

N=int(input())
H=list(map(int,input().split()))
cnt=1
for j in range(1,N):
    if max(H[0:j+1])==H[j]:
        cnt+=1
print(cnt)
n, x = map(int, input().split())
p = set(map(int, input().split()))

ans = 0
for i in range(1, 102):
  if i in p:
    continue
  if i < x:
    ans = i
  elif x - ans > i - x:
  	ans = i
    break
print(ans)

### FIXED CODE ###

x, n = map(int, input().split())
p = set(map(int, input().split()))

ans = 0
diff = x
for i in range(1, 102):
  if i in p:
    continue
  tmp = abs(i - x)
  if tmp < diff:
    diff = tmp
    ans = i
print(ans)
from collections import defaultdict


def resolve():
    n = int(input())
    v = list(map(int, input().split()))
    d_o = defaultdict(int)
    d_e = defaultdict(int)
    for i in range(n):
        if i % 2:
            d_o[v[i]] += 1
        else:
            d_e[v[i]] += 1
    de = sorted(d_e.items(), key=lambda x: x[1])
    do = sorted(d_o.items(), key=lambda x: x[1])
    if de == do:
        p = max(de[0][1], do[0][1])
        print(n - p)
    if de[0] != do[0]:
        print(n - de[0][1] - do[0][1])
    else:
        p = max(de[0][1] + do[1][1], de[1][1] + do[0][1])
        print(n - p)


if __name__ == "__main__":
    resolve()


### FIXED CODE ###

from collections import defaultdict


def resolve():
    n = int(input())
    v = list(map(int, input().split()))
    d_o = defaultdict(int)
    d_e = defaultdict(int)
    for i in range(n):
        if i % 2:
            d_o[v[i]] += 1
        else:
            d_e[v[i]] += 1
    d_e[0] = 0
    d_o[0] = 0
    de = sorted(d_e.items(), key=lambda x: -x[1])
    do = sorted(d_o.items(), key=lambda x: -x[1])
    if de[0][0] != do[0][0]:
        print(n - de[0][1] - do[0][1])
    else:
        p01 = de[0][1] + do[1][1]
        p10 = de[1][1] + do[0][1]
        print(n - max(p01, p10))


if __name__ == "__main__":
    resolve()
from collections import defaultdict
import itertools


def analyze(string):
  s_count = defaultdict(int)
  for s in string:
    s_count[s] += 1
  return s_count

def count_up(s_count):
  strings = list(s_count.keys())
  ans = 0
  for num in range(1, len(strings) + 1):
    for s_list in itertools.product(strings, num):
      a = 1
      for s in s_list:
        a *= s_count[s]
      ans += a
  print(ans)
  
N, string = input().split('\n')
N = int(N)

s_count = analyze(string)
count_up(s_count)

### FIXED CODE ###

from collections import defaultdict
import itertools
from functools import reduce


def analyze(string):
  s_count = defaultdict(int)
  for s in string:
    s_count[s] += 1
  counts = tuple(s_count.values())
  return counts

N = int(input())
string = input()

def search(N, string):
    memo = {}
    def count(counts, num_set):
        if (counts, num_set) in memo:
            return memo[(counts, num_set)]

        if num_set == 1:
            ans = sum(counts)
        elif num_set == 2:
            num_sum = sum(counts)
            ans = 0
            for i in range(len(counts)):
                num_sum -= counts[i]
                ans += counts[i] * num_sum
        else:
            ans = 0
            for i in range(len(counts) - 1):
                ans += counts[i] * count(counts[i + 1:], num_set - 1)

        memo[(counts, num_set)] = ans
        return ans

    counts = analyze(string)
    ans = 0
    for i in range(1, len(counts) + 1):
        ans += count(counts, i)
    print(ans % (10**9 + 7))

search(N, string)
A = list(map(int, input().split()))
N = A[0]
D = A[1:N*2+1]
D1 = []
D2 = []
for i in range(N):
    D1.append(D[2 * i])
    D2.append(D[2 * i + 1])
ans = "No"
for i in range(N - 2):
    if D1[i] == D[i]:
         if D[i + 1] == D[i + 1]:
            if D[i + 2] == D[i + 2]:
                ans = "Yes"
                break
print(ans)

### FIXED CODE ###

N = int(input())
D = [input().split() for _ in range(N)]
ans = "No"
for i in range(N - 2):
    if D[i][0] == D[i][1]:
         if D[i + 1][0] == D[i + 1][1]:
            if D[i + 2][0] == D[i + 2][1]:
                ans = "Yes"
                break
print(ans)
import sys

n = int(input())
t = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]

if t[n-1]!=a[0]:
    print(0)
    sys.exit()

m =[]
for i in range(n):
    mx = min(t[i],a[i])
    mn = 1
    if i == 0:
        mn = t[i]
    elif i == n-1:
        mn = a[i]
    else :
        if t[i]!=t[i-1]:
            mn=t[i]
        if a[i]!=a[i+1]:
            mn=a[i]
    m.append([mx,min(mx,mn)])

ans = 1
for i in range(n):
    ans = (ans * (m[i][0]-m[i][1]+1))%(10**9+7)
print(ans)


### FIXED CODE ###

s = input()
c = s.find('C')
f = s.rfind('F')

if  c != -1 and f != -1 and (c < f):
    print('Yes')
else:
    print('No')
A = int(input())
B = int(input())
if(A<=5):
  print(0)
else:
  if(A<13):
    V = B/2
    print(V)
  else:
    print(B)

### FIXED CODE ###

A,B = map(int,input().split())
if(A<=5):
  print(0)
else:
  if(A<13):
    V = B//2
    print(V)
  else:
    print(B)
N,M=map(int,input().split())
sc=[list(map(int,input().split())) for i in range(M)]
s=[sc[i][0] for i in range(M)]
c=[sc[i][1] for i in range(M)]
sc.sort()
sets=list(set(s))
setc=list(set(c))
if len(sets)!=len(setc):
    ans=-1
if len(setc)==1 and setc[0]==0:
    ans=0
elif sc[0][0]==1 and sc[0][1]==0:
    ans=-1
else:
    if len(sets)==3:
        ans=sc[0][1]*100+sc[1][1]*10+sc[2][1]
    elif len(sets)==2:
        if len(sc)==3:
            sc=[sc[0],sc[2]]
        if sc[0][0]==1:
            if sc[1][0]==2:
                ans=sc[0][1]*100+sc[1][1]*10
            if sc[1][0]==3:
                ans=sc[0][1]*100+sc[1][1]
        if sc[0][0]==2:
            ans=100+sc[0][0]*10+sc[0][1]
    elif len(sets)==1:
        if sc[0][0]==1:
            ans=sc[0][1]*100
        if sc[0][0]==2:
            ans=100+sc[0][1]*10
        if sc[0][0]==3:
            ans=100+sc[0][1]
if len(str(ans))==N:
    print(ans)
else:
    print(-1)

### FIXED CODE ###

N,M=map(int,input().split())
sc=[list(map(int,input().split())) for i in range(M)]
s=[sc[i][0] for i in range(M)]
c=[sc[i][1] for i in range(M)]

for i in range(1000):
    if len(str(i)) == N:
        for j in range(M):
            if str(i)[s[j]-1] != str(c[j]):
                break
        else:
            print(i)
            break
else:
    print(-1)
N = int(input())
A_list = list(map(int, input().split()))
M = 2*10**5+1
cnt = [0 for _ in range(M)]

for i in A_list:
    if cnt[i] != 0:
        cnt[i] = 2
        continue
    for j in range(i, M, i): cnt[j] += 1

ans = 0
for k in A_list:
    if cnt[k] == 1: ans += 1
print(ans)


### FIXED CODE ###

N = int(input())
A_list = list(map(int, input().split()))
M = 10**6+1
cnt = [0 for _ in range(M)]

for i in A_list:
    if cnt[i] != 0:
        cnt[i] = 2
        continue
    for j in range(i, M, i): cnt[j] += 1

ans = 0
for k in A_list:
    if cnt[k] == 1: ans += 1
print(ans)
#d
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
B = [0] * Q
C = [0] * Q
for i in range(Q):
    B[i], C[i] = map(int, input().split())
D = [0] * (10**5)
ans=sum(A)
for i in A:
    D[i]+=1
for x in range(Q):
    D[C[x]]+=D[B[x]]
    ans+=D[B[x]]*(C[x]-B[x])
    print(ans)
    D[B[x]]=0

### FIXED CODE ###

#d
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
B = [0] * Q
C = [0] * Q
for i in range(Q):
    B[i], C[i] = map(int, input().split())
D = [0] * (10**5+1)
ans=sum(A)
for i in A:
    D[i]+=1
for x in range(Q):
    ans+=D[B[x]]*int(C[x]-B[x])
    print(ans)
    D[C[x]]+=D[B[x]]
    D[B[x]]=0
from collections import Counter

n = int(input())
a = list(map(int, input().split()))

new = [key for key, val in Counter(a).most_common() if val == 1]
dp = [0] * 100010

for i in new:
    for j in range(0, 100010, i):
        dp[j] += 1

ans = 0
for i in new:
    if dp[i] == 1:
        ans += 1
print(ans)


### FIXED CODE ###

from collections import Counter

n = int(input())
a = list(map(int, input().split()))

# new = [key for key, val in Counter(a).most_common() if val == 1]
prime = [1] * 1000010

for i in set(a):
    # if prime[i]:
    for j in range(i + i, 1000001, i):
        prime[j] = 0

c = Counter(a)
ans = 0
for i in a:
    if prime[i] and c[i] == 1:
        ans += 1
print(ans)
a,b,c,=map(int,input().split())

if a<b<c:
    print(Yes)
else:
    print(No)

### FIXED CODE ###

a,b,c,=map(int,input().split())

if a<b<c:
    print('Yes')
else:
    print('No')
N,M = map(int,input().split())
a=[]
for i in range(N):
  x = input().split()
  y = int(x[0])
  z = x[1:y+1]
  w = list(map(int,z))
  a.append(w)
  
b = []
for l in range(1:M+1):
  for j in range(N-1):
    if ((l in a[j]) and (l in a[j+1])):
      b.append(l)
    else:
      b = b

cnt=0
for k in range(1:M+1):
  n = b.count(k)
  if n==N-1:
    cnt +=1
  else:
    cnt = cnt
print(cnt)
    
  
    
    
       
    


### FIXED CODE ###

N,M = map(int,input().split())
a=[]
for i in range(N):
  x = input().split()
  z = x[1:]
  a += list(map(int,z))
cnt=0
for k in range(1,M+1):
  n = a.count(k)
  if n==N:
    cnt +=1
  else:
    cnt = cnt
print(cnt)
import sys
import numpy as np


def main(stdin):
    N, K, Q = stdin[:3]
    ans = np.full(N + 1, K - Q, dtype=np.int64)
    for i in stdin[3:]:
        ans[i] += 1
    ans = np.where(ans > 0, 'Yes', 'No')
    print(*ans[1:], sep='\n')


if sys.argv[-1] == 'ONLINE_JUDGE':
    import numba
    from numba.pycc import CC
    cc = CC('my_module')
    cc.export('main', '(i8[:],)')(main)
    # b1: bool, i4: int32, i8: int64, double: f8, [:], [:, :]
    cc.compile()
else:
    from my_module import main
    stdin = np.array([int(_) for _ in open(0).read().split()])
    main(stdin)


### FIXED CODE ###

N, K, Q = [int(_) for _ in input().split()]
A = [int(input()) for _ in range(Q)]
s = [K - Q] * (N + 1)
for a in A:
    s[a] += 1
for i in range(1, N + 1):
    if s[i] > 0:
        print('Yes')
    else:
        print('No')
x,y,z = list(map(int,input().split()))
 
def swap(a,b):
    tmp = a
    a = b
    b = tmp
    return (a,b)
 
x,y = swap(x,y)
x, z = swap(x, z)
print(x,y,z)

### FIXED CODE ###

x,y,z = list(map(int,input().split()))
 
def swap(a,b):
    tmp = a
    a = b
    b = tmp
    return (a,b)
 
x,y = swap(x,y)
x, z = swap(x, z)
print(x,y,z)
from bisect import bisect_left,bisect,bisect_right
import sys

icase=1
if icase==0:
    n=int(input())
    a=list(map(int,input().split()))

a.sort()
ii=bisect(a,0)

if ii==n:
    if ii%2==0:
        asum=-sum(a)
    else:    
        asum=-sum(a[0:ii-1])+a[ii-1]
    print(asum)
    sys.exit()

if ii%2==0:
    asum=-sum(a[0:ii])+sum(a[ii:])
else:
    if -a[ii-1]<a[ii]:
        d=a[ii-1]+a[ii]
    else:
        d=-a[ii-1]-a[ii]
    asum=-sum(a[0:ii-1])+d+sum(a[ii+1:])

print(asum)

### FIXED CODE ###

from bisect import bisect_left,bisect,bisect_right
import sys

icase=0
if icase==0:
    n=int(input())
    a=list(map(int,input().split()))

a.sort()
ii=bisect(a,0)

if ii==n:
    if ii%2==0:
        asum=-sum(a)
    else:    
        asum=-sum(a[0:ii-1])+a[ii-1]
    print(asum)
    sys.exit()

if ii%2==0:
    asum=-sum(a[0:ii])+sum(a[ii:])
else:
    if -a[ii-1]<a[ii]:
        d=a[ii-1]+a[ii]
    else:
        d=-a[ii-1]-a[ii]
    asum=-sum(a[0:ii-1])+d+sum(a[ii+1:])

print(asum)
from scipy.misc import comb
 
N = int(input())
s = {}
for _ in range(N):
    b = list(input())
    b.sort()
    c = ''.join(b)
    if not b in s:
        s[b] = 1
    else:
        s[b] += 1
 
a = [comb(v, 2, exact=True) for v in s.values()]
print(sum(a))

### FIXED CODE ###

import itertools
from math import factorial
from scipy.misc import comb

N = int(input())
s = {}
for _ in range(N):
    b = list(input())
    b.sort()
    c = ''.join(b)
    if not c in s:
        s[c] = 1
    else:
        s[c] += 1

a = [comb(v, 2, exact=True) for v in s.values()]
print(sum(a))
# 整数の入力
N = int(input())

print((10 ** N - 2* 9 **N + 8 ** N)) % (10 ** 9 + 7)

### FIXED CODE ###

# 整数の入力
N = int(input())
 
print((10 ** N - 2* 9 ** N + 8 ** N) % (10 ** 9 + 7))
#n idカード　m ゲート
n,m = map(int, input().split())
maxlist = []
minlist = []

for i in range(m):
	#l　ゲートの下限　r ゲートの上限
	l , r = list(map(int, input().split()))
	minlist.append(l)
	if r > 0:
		maxlist.append(r)

minid = max(minlist)
maxid = min(maxlist)
okgate = maxid - minid + 1

if okegate >= 0:
	print(okgate)
else:
	print(0)

### FIXED CODE ###

#n idカード　m ゲート
n,m = map(int, input().split())
maxlist = []
minlist = []

for i in range(m):
	#l　ゲートの下限　r ゲートの上限
	l , r = list(map(int, input().split()))
	minlist.append(l)
	if r > 0:
		maxlist.append(r)

minid = max(minlist)
maxid = min(maxlist)
okgate = maxid - minid + 1

if okgate >= 0:
	print(okgate)
else:
	print(0)
n,k=map(int,input().split())
p=list(map(int,input().split()))

sort(p)
for i range k:
    s+=a[i]

print(s)

### FIXED CODE ###

n,k=map(int,input().split())
p=list(map(int,input().split()))
s=0
p.sort()
for i in range(k):
    s+=p[i]

print(s)
n = list(input())
for i in range(3):
    if n[i] == '1':
        n[i] = '9'
    else:
        n[i] = '1'
print(int(n[0]+n[1]+n[2]))

### FIXED CODE ###

n = list(raw_input())
for i in range(3):
    if n[i] == '1':
        n[i] = '9'
    else:
        n[i] = '1'
print(int(n[0]+n[1]+n[2]))
A = input().split()
count = 0
for a in range(3):
    if A[a] == 'R':
      count++
      
if count == 2 A[1] == 'S':
      count = 1
print(count)

### FIXED CODE ###

A = input()
count = 0
for a in range(3):
    if A[a] == 'R':
      count+=1
      
if count == 2 and A[1] == 'S':
      count = 1
print(count)
#E
n,m,k = list(map(int,input().split()))
fac = [1,1]
finv = [1,1]
inv = [1,1]
MOD = 998244353
for i in range(2,n):
    fac[i].append(fac[i-1]*i%MOD)
    inv[i].append(MOD-inv[MOD%i]*(MOD//i)%MOD)
    finv[i].append(finv[i-1]*inv[i]%MOD)
def comb(n,k):
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD
ans = 0
for i in range(k+1):
#     print(comb(n-1,i),m*(m-1)**(n-i-1))
    ans += (comb(n-1,i)*(m*(m-1)**(n-i-1)%MOD))%MOD
    ans %= MOD
print(ans)

### FIXED CODE ###

#E
n,m,k = list(map(int,input().split()))
fac = [1]*n
finv = [1]*n
inv = [1]*n
MOD = 998244353
for i in range(2,n):
    fac[i] = fac[i-1]*i%MOD
    inv[i] = MOD-inv[MOD%i]*(MOD//i)%MOD
    finv[i] = finv[i-1]*inv[i]%MOD
def comb(n,k):
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD

ans = 0
for i in range(k+1):
#     print(comb(n-1,i),m*(m-1)**(n-i-1))
    ans += comb(n-1,i)*m*pow(m-1,n-i-1,MOD)%MOD
    ans %= MOD
print(ans)
N = int(input())
l = list(map(int,input().split()))
count = 1
max = l[0]
for i in l:
  if max <= l[i]:
   	count += 1
    max = l[i]
print(count)

### FIXED CODE ###

n = int(input())
l = list(map(int,input().split()))
max = l[0]
count = 0
for i in range(n):
  if l[i] >= max:
    count += 1
    max = l[i]
    
print(count)
S = input()
#print(len(S))
dire = ['dream','dreamer','erase','eraser']
flag = 0
i=0
j=0

while True:

    tmp = dire[j]
    ind = i

    if ind + len(dire[j]) <=len(S)+1:
        #print(j)
        for k in range(len(dire[j])):
            if S[ind] != tmp[k]:
                flag =0
                j += 1
                break
            else:
                ind = ind + 1
                if k==len(dire[j])-1:
                    i = i + len(dire[j])
                    flag = 1
                    old = len(dire[j])
                    old_j  = j
                    j=0
    else:
        j+=1
        if j==4:
            i=i-old
            j=old_j+1

    if   j >= 4 and flag == 0 and i != 0:
        i = i - old
        j = old_j+1

    if i >= len(S)-1:
        print('YES')
        break
    elif i <= 0 and j >= 3 and flag == 0:
        print('NO')
        break


### FIXED CODE ###

S = input()
S_r = S[::-1]
dire = ['dream','dreamer','erase','eraser']
dire_r = [0]*4
for i in range(4):
    tmp = dire[i]
    dire_r[i] = tmp[::-1]
ind = 0

excep = 0

while ind  <len(S_r):
    if excep == 1:
        break
    flag2= 0
    for j in range(4):
        if flag2 ==0:
            case = 0
            for k in range(len(dire_r[j])):
                tmp = dire_r[j]

                if ind + k < len(S_r) and case == 0:
                #    print(j)
            #        print('S:'+S_r[ind+k])
            #        print('dire:'+tmp[k])
                    if S_r[ind+k] != tmp[k]:
                        flag = 0
                        case = 1
                        if j == 3:
                            excep = 1

                    elif k== len(dire_r[j])  -1:
                        ind = ind + len(dire_r[j])
                        flag = 1
                        case = 1
                        flag2 = 1


if flag == 1:
    print('YES')
else:
    print('NO')
n=int(input())
a=list(map(int,input().split()))

list=[0]*(10**9+1)

for i in range(n):
    list[a[i]]+=1

one=0
two=0

for i in range(10**9+1):
    if one==0 and list[i]>1:
        one=i
    elif list[i]>1:
        two=one
        one=i

print(one*two)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))

dict={}

for i in range(n):
    if not a[i] in dict:
        dict[a[i]]=0
    dict[a[i]]+=1


a=sorted(dict.items(), key=lambda x:x[0])
one=0
two=0
for i in range(len(a)):
    if a[i][1]>3:
            one=a[i][0]
            two=one

    elif a[i][1]>1:
        two=one
        one=a[i][0]
    
print(one*two)
S = input()
Slist = list(S)
L = len(S)
if S[0] == 'A' and 'C' in S[1:L-1] and Slist.count('C') == 1:
    Slist.remove('A', 'C')
    flag = True
    for s in Slist:
        if s.isupper():
            flag = False
    if flag:
        print('AC')
        exit()
print('WA')


### FIXED CODE ###

S = input()
Slist = list(S)
L = len(S)
if S[0] == 'A' and 'C' in S[2:L-1] and Slist.count('C') == 1:
    Slist.remove('A')
    Slist.remove('C') 
    flag = True
    for s in Slist:
        if s.isupper():
            flag = False
    if flag:
        print('AC')
        exit()
print('WA')
n = int(input())
x = list(map(str, input().split()))
sx = sorted(x)

max_mid = sx[int(n/2)]
min_mid = sx[int(n/2-1)]

for i in x:
    if i <= min_mid:    # 左半分から取られてる時
        print(max_mid)
    else:               # 右半分から取られてる時
        print(min_mid)


### FIXED CODE ###

a, b , x = map(int, input().split())

if x >= a and x <= a+b:
    print("YES")
else:
    print("NO")
import sys
input = sys.stdin.readline

S=input().strip()

from collections import deque
Q=deque(S)

ANS=0

count=0
while len(Q)>0 and Q[0]==">":
    count+=1
    Q.popleft()

ANS+=count*(count+1)//2
count=0

while len(Q)>0 and Q[-1]=="<":
    count+=1
    Q.pop()

ANS+=count*(count+1)//2


count=1
LIST=[]

for i in range(1,len(Q)):
    if Q[i]==Q[i-1]:
        count+=1
    else:
        LIST.append(count)
        count=1

LIST.append(count)

for i in range(0,len(LIST),2):
    s,t=sorted((LIST[i],LIST[i+1]))

    ANS+=t*(t+1)//2+s*(s-1)//2

print(ANS)


### FIXED CODE ###

import sys
input = sys.stdin.readline

S=input().strip()

from collections import deque
Q=deque(S)

ANS=0

count=0
while len(Q)>0 and Q[0]==">":
    count+=1
    Q.popleft()

ANS+=count*(count+1)//2
count=0

while len(Q)>0 and Q[-1]=="<":
    count+=1
    Q.pop()

ANS+=count*(count+1)//2

if Q==deque():
    print(ANS)
    sys.exit()

Q=list(Q)

count=1
LIST=[]

for i in range(1,len(Q)):
    if Q[i]==Q[i-1]:
        count+=1
    else:
        LIST.append(count)
        count=1

LIST.append(count)

for i in range(0,len(LIST),2):
    s,t=sorted((LIST[i],LIST[i+1]))

    ANS+=t*(t+1)//2+s*(s-1)//2

print(ANS)