Harryxun/stf_run huggingface dataset:
from math import factorial
N,K=map(int, input().split()) 

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

for i in range(1, K+1):
    print((combinations_count(N-K+1, i) * combinations_count(K-i+(i-1), i-1))%(10**9+7))

### FIXED CODE ###

import math
n,k=map(int,input().split()) 

def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

mod_num = 10 ** 9 + 7
for i in range(1, k+1):
    if i > n - k + 1:
        print(0)
    else:
        print(comb(n-k+1, i) * comb(k-i+(i-1), i-1) % mod_num)
a,b,c=input().sprit(",")
print(a,b,c)

### FIXED CODE ###

a, b, c = input().split(",")
print(a, b, c)
s=input()
a=int(s[:2])
b=int(s[2:])

if a>=13 and b>=1 and b<=12:
  print("YYMM")
elif a==0 and b>=1 and b<=12:
  print("YYMM")  
elif a>=1 and a<=12 and b>=13:
  print("MMYY")
elif a>=1 and a<=12 and b==0:
  print("MMYY")
elif a>=1 and a<=12 b>=1 and b<=12:
  print("AMBIGUOUS")
else:
  print("NA")


### FIXED CODE ###

s=input()
a=int(s[0]+s[1])
b=int(s[2]+s[3])

if a>=13 and b>=1 and b<=12:
  print("YYMM")
elif a==0 and b>=1 and b<=12:
  print("YYMM")  
elif a>=1 and a<=12 and b>=13:
  print("MMYY")
elif a>=1 and a<=12 and b==0:
  print("MMYY")
elif a>=1 and a<=12 and b>=1 and b<=12:
  print("AMBIGUOUS")
else:
  print("NA")
N = int(input())

if N == 1:
  print('Hello World')

else:
  A = int(imput())
  B = int(imput())
  print(A + B)

### FIXED CODE ###

N = int(input())

if N == 1:
    print("Hello World")
else:
    A = int(input())
    B = int(input())
    print(A + B)
s=input()
if s=='RRR':
    print(3)
elif s=='RRS':
    print(2)
elif s=='RSR':
    print(1)
elif s=='SRR':
    pront(2)
elif s=='SSR':
    print(1)
elif s=='SRS':
    print(1)
elif s=='RSS':
    print(1)
elif s=='SSS':
    print(0)
    


### FIXED CODE ###

s=input()

if 'RRR' in s:
    print(3)
elif 'RR' in s:
    print(2)
elif 'SSS' in s:
    print(0)
else :
    print(1)
A,B,C = map(int,input())
print(min(B//A,C))

### FIXED CODE ###

A,B,C = map(int,input().split())
print(min(B//A,C))
inf = float('inf')
def main():
    n, k = map(int, input().rstrip().split())
    h = list(map(int, input().rstrip().split()))
    dp = [inf for i in range(n)]
    dp[0] = 0
    for i in range(n):
        for j in range(i+1, i+k+1):
            if j<n:
                cost = abs(h[i] - h[j])
                dp[j] = min(dp[j], dp[i] + cost)
    print(dp[n-1])

if __name__ == "__main__":
    main()


### FIXED CODE ###

inf = float('inf')
def main():
    n = int(input().rstrip())
    h = list(map(int, input().rstrip().split()))
    dp = [inf for i in range(n)]
    dp[0]=0
    for i in range(n):
        for j in [i+1, i+2]:
            if j<n:
                dp[j] = min(dp[j], dp[i]+ abs(h[i] - h[j]))
    print(dp[n-1])

if __name__ == "__main__":
    main()
from fractions import gcd
a, b = map(int, input().split())
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
print(lcm(a, b))

### FIXED CODE ###

from fractions import gcd
a, b = map(int, input().split())
def lcm(x, y):
    return (x * y) // gcd(x, y)
print(lcm(a, b))
def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n //= i
      table.append(i)
    i += 1
  if n > 1:
    table.append(n)
  return table

N = int(input())
if N = 1:
    print(1)
else:
    table = prime_decomposition(N)
    digN = len(str(N))
    digMaxEle = len(str(table[-1]))
    if digN / 2  < digMaxEle:
        print(digMaxEle)
    else:
        print(digN//2 + digN%2)


### FIXED CODE ###

N = int(input())

def count_digit(N):
    return(len(str(N)))

ans = count_digit(N)

A = 1
while (A * A <= N):
    if N%A != 0: pass
    else:
        B = N//A
        curDig = max(count_digit(A), count_digit(B))
    ans = min(ans, curDig)
    A += 1
print(ans)
import sys
n,m,k = list(map(int,input().split()))

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

if k < a[0] and k < b[0]:
    print(0)
    sys.exit()

count = [[0 for i in range(n + 1)] for j in range(m + 1)]

answer = 0
for i in range(n+2):
    for j in range(m):
        if j != 0:
            count[i][j] = count[i][j-1] + a[j-1]
        if count[i][j] > k:
            break
        if answer < i + j and count[i][j] <= k:
            answer = i + j
    if i == n + 1:
        break
    count[i+1][0] = count[i][0] + b[i]
    if count[i+1][j] > k:
        break 

print(answer)


### FIXED CODE ###

n,m,k = list(map(int,input().split()))

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

asum = [0]
bsum = [0]

for i in range(n):
    asum.append(asum[i] + a[i])
for i in range(m):
    bsum.append(bsum[i] + b[i])

best = m
answer = 0
for i in range(n+1):
    j = best
    while 1:
        if bsum[j] <= (k - asum[i]):
            best = j
            if answer < i + j:
                answer = i + j
            break
        j -= 1
        if j < 0:
            break

print(answer)
N, K = map(int, input().split())
S = input()
new_S = []
count_S = []

cur_c = S[0]
cur_count = 0

new_S.append(cur_c)
for c in S:
    if c == cur_c:
        cur_count += 1
    else:
        new_S.append(c)
        count_S.append(cur_count)
        cur_count = 1
        cur_c = c
count_S.append(cur_count)        

new_count = []
st_ix = 0
if S[0] == '0':
    cur_sum = sum(count_S[:2*K])
    st_ix = 1
    new_count.append(cur_sum)
else:
    cur_sum = sum(count_S[:2*K+1])
    new_count.append(cur_sum)

en_ix = st_ix + 2*K + 1
cur_sum = sum(count_S[st_ix:en_ix])
new_count.append(cur_sum)

while en_ix < len(count_S):
    # shift st_ix
    st_ix = st_ix + 2
    en_ix = en_ix + 2
    cur_sum -= (count_S[st_ix-2] + count_S[st_ix-1])
    cur_sum += (count_S[max(en_ix-2, len(count_S)]
                        + count_S[max(en_ix-1, len(count_S)])
    new_count.append(cur_sum)

print(max(new_count))


### FIXED CODE ###

N, K = map(int, input().split())
S = input()
new_S = []
count_S = []

cur_c = S[0]
cur_count = 0

new_S.append(cur_c)
for c in S:
    if c == cur_c:
        cur_count += 1
    else:
        new_S.append(c)
        count_S.append(cur_count)
        cur_count = 1
        cur_c = c
count_S.append(cur_count)        

new_count = []
st_ix = 0
if S[0] == '0':
    cur_sum = sum(count_S[:2*K])
    st_ix = 1
    new_count.append(cur_sum)
else:
    cur_sum = sum(count_S[:2*K+1])
    new_count.append(cur_sum)

en_ix = st_ix + 2*K + 1
cur_sum = sum(count_S[st_ix:en_ix])
new_count.append(cur_sum)

while en_ix < len(count_S):
    # shift st_ix
    st_ix = st_ix + 2
    en_ix = en_ix + 2
    if en_ix >= len(count_S):
        new_count.append(sum(count_S[st_ix:]))
    else:
        cur_sum -= (count_S[st_ix-2] + count_S[st_ix-1])
        cur_sum += (count_S[en_ix-2]
                        + count_S[en_ix-1])
    new_count.append(cur_sum)

print(max(new_count))
while True:
	a,b  = map(int, input().split())
	if a,b = 0,0: break
	if a > b: a,b = b,a
	print(f"{a} {b}")


### FIXED CODE ###


while True:
	a,b  = map(int, input().split())
	if a == 0 and b == 0: break
	if a > b: a,b = b,a
	print(f"{a} {b}")
H, W = map(int, input().split())
import sys
input = sys.stdin.readline
def sc(s):
    b = None
    nc = 0
    kk = [0]*len(s)
    for i, c in enumerate(s):
        if c == ".":
            if c == b:
                nc += 1
            else:
                si = i
        else:
            if b == ".":
                for j in range(si, i):
                    kk[j] = i - si
            nc = 0
        b = c
    return kk
d = []
d2 = []
d3 = [[0]*W for _ in range(H)]
for h in range(H):
    s = input().strip() + "#"
    d.append(s)
    d2.append(sc(s))

r = 0
for i in range(H):
    for j in range(W):
        r = max(r, d2[i][j] + d3[j][i]-1)
print(r)


### FIXED CODE ###

H, W = map(int, input().split())
import sys
input = sys.stdin.readline
def sc(s):
    b = None
    nc = 0
    kk = [0]*len(s)
    for i, c in enumerate(s):
        if c == ".":
            if c == b:
                nc += 1
            else:
                si = i
        else:
            if b == ".":
                for j in range(si, i):
                    kk[j] = i - si
            nc = 0
        b = c
    return kk
d = []
d2 = []
d3 = []
for h in range(H):
    s = input().strip()
    d.append(s)
    d2.append(sc(s+"#"))

d = list(zip(*d))
for s in d:
    d3.append(sc("".join(s)+"#"))
r = 0
for i in range(H):
    for j in range(W):
        r = max(r, d2[i][j] + d3[j][i]-1)
print(r)
import bisect
import copy
import heapq
import statistics
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
sys.setrecursionlimit(500000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n,x=map(int,input().split())
if x==1 or x==2*n-1:
    print("No")
    exit()
print("Yes")
if n==2:
    for i in range(n+1):
        print(i+1)
elif x==2:
    cnt=4
    for i in range(2*n-1):
        if i==n-2:
            lst[i]=x+1
        elif i==n-1:
            lst[i]=x
        elif i==n:
            lst[i]=x-1
        else:
            lst[i]=x+2
        print(cnt)
        cnt+=1
else:
    lst=[0]*(2*n-1)
    cnt=1
    for i in range(2*n-1):
        if i<n-2 or n+1<i:
            if cnt<x-2 or x+1<cnt:
                lst[i]=cnt
            else:
                cnt=x+2
                lst[i]=cnt
            cnt+=1
        else:
            if i==n-2:
                lst[i]=x-1
            elif i==n-1:
                lst[i]=x
            elif i==n:
                lst[i]=x+1
            else:
                lst[i]=x-2
    for i in range(2*n-1):
        print(lst[i])

### FIXED CODE ###

import bisect
import copy
import heapq
import statistics
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
sys.setrecursionlimit(500000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n,x=map(int,input().split())
if x==1 or x==2*n-1:
    print("No")
    exit()
print("Yes")
if n==2:
    for i in range(n+1):
        print(i+1)
elif x==2:
    cnt=5
    for i in range(2*n-1):
        if i<n-2 or n+1<i:
            print(cnt)
            cnt+=1
        else:
            if i==n-2:
                print(x+1)
            elif i==n-1:
                print(x)
            elif i==n:
                print(x-1)
            else:
                print(x+2)
else:
    lst=[0]*(2*n-1)
    cnt=1
    for i in range(2*n-1):
        if i<n-2 or n+1<i:
            if cnt<x-2 or x+1<cnt:
                lst[i]=cnt
            else:
                cnt=x+2
                lst[i]=cnt
            cnt+=1
        else:
            if i==n-2:
                lst[i]=x-1
            elif i==n-1:
                lst[i]=x
            elif i==n:
                lst[i]=x+1
            else:
                lst[i]=x-2
    for i in range(2*n-1):
        print(lst[i])
import copy
N, K = map(int, input().split())
dic = {}
ans = []
uniq = []
etc = []
def calc_ans(ans):
    x = 0
    tmp = 0
    for i in range(K):
      tmp += ans[i][0]
      x += ans[i][1]
    return tmp + (x * x)

for i in range(N):
    l = list(map(int, input().split()))
    if dic.get(l[0]):
        dic[l[0]].append(l[1])
    else:
        dic[l[0]] = [l[1]]
if N <= K:
    ans = 0
    for i in dic.keys():
        ans += sum(dic[i])
    ans += len(dic.keys()) * len(dic.keys())
    print(ans)
    exit()
for t in dic.keys():
    dic[t].sort(reverse=True)
    uniq.append((dic[t][0], t))
uniq.sort(reverse=True)
for i in range(K):
  ans.append((uniq[i][0], 1))
  for n in dic[uniq[i][1]][1:]:
      if n <= uniq[K-1][0]:
          break
      etc.append((n, 0))
etc.sort(reverse=True)
ans_res = calc_ans(ans)
for n in etc:
    tmp = copy.copy(ans)
    tmp[-1] = n
    tmp_res = calc_ans(tmp)
    if ans_res > tmp_res:
        print(ans_res)
        exit()
    else:
        ans = tmp
        ans_res = tmp_res
print(ans_res)

### FIXED CODE ###

N,K = map(int,input().split())
td = [[int(i) for i in input().split()] for _ in range(N)]
td.sort(key=lambda x:x[1],reverse=True)
ans = 0
ls = set()
dl = []
for i in range(K):
    ans += td[i][1]
    if not td[i][0] in ls:
        ls.add(td[i][0])
    else:
        dl.append(td[i][1])
ans = ans + len(ls)**2
res = ans
for i in range(K,N):
    if not dl:
        break
    if td[i][0] in ls:
        continue
    ans += len(ls)*2+1
    ans += td[i][1]
    ans -= dl[-1]
    del dl[-1]
    res = max(res,ans)
    ls.add(td[i][0])
print(res)
n,q=map(int,input().split())
s=list(str(input()))
l=[]
r=[]
ans=0
x=[]
for i in range(q):
  x1,y1=[int(i) for i in input().split()]
  x.append(x1)
  y.append(y1)
  
for j in range(0,q):
  for k in range(l[j],r[j]):
    if s[k]=="A" and s[k+1]=="C":
      ans+=1
    else:
      ans+=0
  x.append(ans)
  ans=0
  
for m in range(0,q):
  print(x[m])
      
      
      
  
  
  
  


### FIXED CODE ###

n,q=map(int,input().split())
s=list(str(input()))
l=[]
r=[]
ans=0
x=[0]
for i in range(q):
  l1,r1=map(int,input().split())
  l.append(l1)
  r.append(r1)

for j in range(0,n-1):
  if s[j]=="A" and s[j+1]=="C":
    ans+=1
    x.append(ans)
  else:
    x.append(ans)

for k in range(0,q):
  print(x[r[k]-1]-x[l[k]-1])
def calc():
    X = int(input())
    A = 1
    B = 1
    if X == 0:
        return A,B
    if X == 2:
        B = -1
        return A,B
    else:
        l_bound = int(X**0.2)
        h_bound = l_bound * 2
        for i in range(l_bound,h_bound):
            for j in range(0,i):
                if i ** 5 - j ** 5 == X:
                    A = i
                    B = j
                    return A,B
                if i ** 5 + j ** 5 == X:
                    A = i
                    B = -j
                    return A,B 
def resolve():
    A,B = calc()  
    print(str(A) + " " + str(B))
resolve()

### FIXED CODE ###

def calc(X):
    A = 1
    B = 1
    if X == 0:
        return A,B
    else:
        l_bound = 1
        h_bound = 200
        for i in range(l_bound,h_bound):
            for j in range(0,i+1):
                if i ** 5 - j ** 5 == X:
                    A = i
                    B = j
                    return A,B
                if i ** 5 + j ** 5 == X:
                    A = i
                    B = -j
                    return A,B
def resolve():
    X = int(input())
    A,B = calc(X)  
    print(str(A) + " " + str(B))
resolve()
S = datetime(input())

if S <= 2019/04/30 :
	print("Heisei")
else :
	print("TBD")


### FIXED CODE ###

s = input()

if s <= "2019/04/30":
    print("Heisei")
else:
    print("TBD")
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

L = [A, B, C, D, E]
S = []
for l in L:
    if l % 10 != 0:
        S.append(l % 10)
min_s = min(S)

s = 0
flag = True
for l in L:
    if flag and min_s == l % 10:
        s += l
        flag = False
    elif 0 == l % 10:
        s += l
    else:
        s += 10 * (l // 10) + 10
print(s)

### FIXED CODE ###

A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

L = [A, B, C, D, E]
S = [10]
for l in L:
    if l % 10 != 0:
        S.append(l % 10)
min_s = min(S)

s = 0
flag = True
for l in L:
    if flag and min_s == l % 10:
        s += l
        flag = False
    elif 0 == l % 10:
        s += l
    else:
        s += 10 * (l // 10) + 10
print(s)
memo = {2:1}
def cmb2(n):
  if n in memo:
    return memo[n]
  memo[n] = cmb2(n-1) + n - 1
  return memo[n]
n = int(input())
ans = 0
sum = 0
ansdic = {}
for i in range(n):
  s = input()
  slist = [i for i in s]
  slist.sort()
  smoji = ','.join(slist)
  if smoji in ansdic:
    ansdic[smoji] += 1
  else:
    ansdic[smoji] = 1
for i in ansdic:
  if ansdic[i] > 1:
    sum += cmb2(ansdic[i])
print(sum)


### FIXED CODE ###

def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result
n = int(input())
ans = 0
sum = 0
ansdic = {}
for i in range(n):
  s = input()
  slist = [i for i in s]
  slist.sort()
  smoji = ','.join(slist)
  if smoji in ansdic:
    ansdic[smoji] += 1
  else:
    ansdic[smoji] = 1
for i in ansdic:
  if ansdic[i] > 1:
    sum += cmb(ansdic[i],2)
print(sum)
n=int(input())
b=list(map(int,input().split()))

x=b[1]

i=0
while n-1>i:
  if b[i]<=b[i+1]:
    x+=b[i]
    i+=1
  else:
    x+=b[i+1]
    i+=1
    
print(x)

### FIXED CODE ###

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

x=b[0]+b[n-2]

i=1
while n-1>i:
  if b[i-1]<=b[i]:
    x+=b[i-1]
    i+=1
  else:
    x+=b[i]
    i+=1
    
print(x)
import numpy as np

listS = []

N, K  = map(int, input().split())
A = list(map(int,input().split()))

for i in range(0,N-K+1):
    listS.append(np.prod(A[i:K+i]))
    
for j in range(len(listS)-1):
    if listS[j] < listS[j+1]:
        print("Yes")
    else:
        print("No")

### FIXED CODE ###

N, K  = map(int, input().split())
A = list(map(int,input().split()))

for i in range(0,N-K):
    if A[i] < A[i+K]:
        print("Yes")
    else:
        print("No")
n = int(input())
ls = list(map(int,input().split()))
a = min(ls)
b = max(ls)
c = len(ls)
s = 0
def sub(p,q):
    return p-q
ans = []
aaa = [0]*(len(ls))
for i in range(a,b+1):
    new = [i]*(c)
    ans = map(sub,ls,new)
    ans = list(map(str,ans))
    s = ans.count("-1") + ans.count("1") + ans.count("0")
    aaa[i] = s
print(max(aaa))

### FIXED CODE ###

n = int(input())
ls = list(map(int,input().split()))
di = [0]*(max(ls)+3)
for i in ls:
    di[i] += 1
    di[i+1] += 1
    di[i+2] += 1
print(max(di))
a,b,c=map(int,input())
print(a if b-c ==0 else b if a-c ==0 else c)

### FIXED CODE ###

a,b,c=map(int,input().split())
print(a if b-c ==0 else b if a-c ==0 else c)
n, m = map(int, input().split())

ac = [0]*n
wa = [0]*n

for i in range(m):
  p, s = input().split()

  if s == 'WA' and ac[int(p)-1] == 0:
    wa[int(p)-1] += 1
  elif s == 'AC' and ac[int(p)-1] == 0:
    ac[int(p)-1] += 1

print('%d %d' % (sum(ac), sum([wa[k] for k in [i for i,j in enumerete(ac) if j != 0]])))

### FIXED CODE ###

N, M = map(int, input().split())
 
ac, wa = [0]*N, [0]*N
 
for i in range(M):
    p, s = input().split()
    if s == 'WA' and ac[int(p)-1] == 0:
            wa[int(p)-1] += 1
    elif s == 'AC' and ac[int(p)-1] == 0:
            ac[int(p)-1] += 1
print('%d %d' % (sum(ac), sum([wa[k] for k in [i for i, j in enumerate(ac) if j != 0]])))
def main(S):
    charlist = list(S)
    out = 0
    for c in charlist:
        if(c=='+'): 
            out = out + 1
        else:  
            out = out - 1
    print(out)
S = raw_input()
main(S)


### FIXED CODE ###

def main(S):
    charlist = list(S)
    out = 0
    for c in charlist:
        if(c=='+'): 
            out = out + 1
        else:  
            out = out - 1
    print(out)
S = input()
main(S)
n = int(input())
x = list(range(n))
y = list(range(n))
h = list(range(n))

for i in range(n):
  x[i], y[i], h[i] = map(int, input().split())

flag=0
i = 0
while(flag==0 and i < 101):
  j = 0
  while(flag==0 and j < 101):
    for k in range(n):
      if k == 0:
        ans_h = abs(i-x[k])+abs(j-y[k])+h[k]
      elif abs(i-x[k])+abs(j-y[k])+h[k] != ans_h:
        break
      elif k == n-1:
        ans_x = i
        ans_y = j
        flag=1
        break
    j+=1
  i+=1

print(ans_x, ans_y, ans_h)

### FIXED CODE ###

n = int(input())
x = list(range(n))
y = list(range(n))
h = list(range(n))

for i in range(n):
  x[i], y[i], h[i] = map(int, input().split())
  if h[i] != 0:
    X = x[i]
    Y = y[i]
    H = h[i]

flag=0
i = 0
while(flag==0 and i < 101):
  j = 0
  while(flag==0 and j < 101):
    ans_h = abs(i-X)+abs(j-Y)+H
    for k in range(n):
      h_ = max(ans_h-abs(i-x[k])-abs(j-y[k]), 0)
      if h_ != h[k]:
        break
      if k == n-1:
        ans_x = i
        ans_y = j
        flag=1
        break
    j+=1
  i+=1

print(ans_x, ans_y, ans_h)
n, y = map(int, input().split(' '))
yy = y / 1000
d = yy - n
a = (4 * d - n - 3 * yy) / 5
b = (8 * yy - 9 * d + n) / 5
if a>= 0 and b >= 0 and c >= 0:
	print(a, b, c)
else:
	print('-1 -1 -1')

### FIXED CODE ###

n, y = [int(x) for x in input().split(' ')]
q, mod = divmod(y, 10000)

if n * 10000 > y and y > (n-1)* 10000 + 5000:
	print('-1 -1 -1')
else:
	if q == n and mod == 0:
		print('{} 0 0'.format(q))
	else:
		for a in range(q+1):
			b = int((y - 1000 * n - 9000 * a) / 4000)
			c = int((5000 * n - y + 5000 * a) / 4000)
			if a + b + c == n and a >= 0 and b >= 0 and c >= 0 and 10000 * a + 5000 * b + 1000 * c == y:
				print('{} {} {}'.format(a, b, c))
				break
		else:
			print('-1 -1 -1')
ins = input()


def foo(s):
    last = s[-1:]
    # is empty
    if not s:
        return "YES"
    else:
        n = 0
        if last == 'r' and s[-6:] == 'eraser':
            n = -6
        elif last == 'r' and s[-7:] == 'dreamer':
            n = -7
        elif (last == 'e' and s[-5:] == 'erase') or (last == 'm' and s[-5:] == 'dream'):
            n = -5

        if n == 0:
            return "NO"
        else:
            return foo(s[:n])


print(foo(ins))


### FIXED CODE ###

s = input()


while len(s) > 0:
    if s[-6:] == 'eraser':
        s=s[:-6]
    elif s[-7:] == 'dreamer':
        s=s[:-7]
    elif s[-5:] == 'erase' or s[-5:] == 'dream':
        s=s[:-5]
    else:
        print('NO')
        exit(0)
print('YES')
n,x=map(int,input().split())
ln=map(int,input().split())
print(n+(x-sum(ln))//min(ln))

### FIXED CODE ###

n,x=map(int,input().split())
ln=[int(input()) for i in range(n)]
print(n+(x-sum(ln))//min(ln))
# -*- coding: utf-8 -*-
s = input()
K = int(input())


def substring(s, K):
    substrings = []
    length = len(s)
    for i in range(length):
        for j in range(K+1):
            if i + j >= length:
                break
            substrings.append(s[i:i + j])
    unique_substrings = list(set(substrings))
    unique_substrings.sort()
    return substrings[K]


print(substring(s, K))


### FIXED CODE ###

# -*- coding: utf-8 -*-
s = input()
K = int(input())


def substring(s, K):
    substrings = []
    length = len(s)
    for i in range(length):
        for j in range(1, K+1):
            if i + j > length:
                break
            substrings.append(s[i:i + j])
    unique_substrings = list(set(substrings))
    unique_substrings.sort()
    return unique_substrings[K - 1]


print(substring(s, K))
n = int(input())
a = list(map(int, input().split()))
c = Counter(a)
ans = 0
for num, cnt in c.items():
    if cnt>=num:
        ans += cnt - num
    else:
        ans += cnt
print(ans)


### FIXED CODE ###

from collections import Counter
from collections import deque

n = int(input())
a = list(map(int, input().split()))
c = Counter(a)
c = c.most_common()
ans = 0
for num, cnt in c:
    if cnt>=num:
        ans += cnt - num
    else:
        ans += cnt
print(ans)
a, b, c = map(int, raw_input().split())
num = [a, b, c]
num.sort
for i in num
   print i

### FIXED CODE ###

a, b, c = map(int, raw_input().split())
num = [a, b, c]
num.sort()
print num[0], num[1], num[2]
N =　int(input())
a = []
for i in range(N):
    a.append(input())
    
    

for i in range(N):
    v = a[i]
    j = i-1
    while j>=0 and a[j]>v:
        a[j+1] = a[j]
        j = j-1
        a[j+1] = v
    print(a)


### FIXED CODE ###

N = int(input())
a = input().split()
b = [int(n) for n in a]


for i in range(N):
    v = b[i]
    j = i-1
    while j>=0 and b[j]>v:
        b[j+1] = b[j]
        j = j-1
        b[j+1] = v
    print(" ".join([str(n) for n in b]))
[A, B, C, D] = list(map(int, input().split()))
X = A / D
Y = C / B
if (X - Y) > 1:
    print('Yes')
else:
    if Y > X:
        print('No')
    else:
        print('Yes')

### FIXED CODE ###

[S, W] = list(map(int, input().split()))
if W >= S:
    print('unsafe')
else:
    print('safe')