Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

S=input()[::-1]
T=""
L=["dream","dreamer","erase","eraser"] 
for s in S:
    T=T+s
    if T[::-1] in L:
        T=""
print("YES" if T=="" else "NO")

### FIXED CODE ###

S=input()[::-1]
T=""
L=["dream","dreamer","erase","eraser"] 
for s in S:
    T=s+T
    if T in L:
        T=""
    elif len(T)>6:
        break
print("YES" if T=="" else "NO")
### BUGGY CODE ###

def solve():
    from bisect import bisect_left, bisect_right

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

    As.sort()
    negAs = [-A for A in As[::-1]]
    A2s = [A*A for A in As]
    A2s.sort()

    def isOK(x):
        num = 0
        for A in As:
            if A > 0:
                i = bisect_right(As, x//A)
                num += i
            elif A == 0:
                if x >= 0:
                    num += N
            else:
                i = bisect_right(negAs, x//(-A))
                num += i
        i = bisect_right(A2s, x)
        num -= i
        num //= 2
        return num >= K

    ng, ok = -(10**18)-1, 10**18+1
    while abs(ok-ng) > 1:
        mid = (ng+ok) // 2
        if isOK(mid):
            ok = mid
        else:
            ng = mid

    print(ok)


solve()


### FIXED CODE ###

def solve():
    from bisect import bisect_left, bisect_right

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

    As.sort()
    negAs = [-A for A in As[::-1]]
    A2s = [A*A for A in As]
    A2s.sort()

    pstvBs = []
    numB0= 0
    ngtvBs = []
    for A in As:
        if A > 0:
            pstvBs.append(A)
        elif A == 0:
            numB0 += 1
        else:
            ngtvBs.append(A)

    def isOK(x):
        if x >= 0:
            dire = 1
        else:
            dire = -1
        num = 0
        # 正
        iA = 0
        for B in pstvBs[::-dire]:
            key = x//B
            while iA < N and As[iA] <= key:
                iA += 1
            num += iA
        # ゼロ
        if x >= 0:
            num += N*numB0
        # 負
        iA = 0
        for B in ngtvBs[::dire]:
            key = x//(-B)
            while iA < N and negAs[iA] <= key:
                iA += 1
            num += iA
        i = bisect_right(A2s, x)
        num -= i
        num //= 2
        return num >= K

    ng, ok = -(10**18)-1, 10**18+1
    while abs(ok-ng) > 1:
        mid = (ng+ok) // 2
        if isOK(mid):
            ok = mid
        else:
            ng = mid

    print(ok)


solve()
### BUGGY CODE ###

import numpy as np
n, k = map(int, input().split())
P = list(map(int, input().split()))

ans2 = list()
for i in range(n - (k-1)):
    ans2.append(P[i:i+k])
ans = 0
ans5 = list()

for i in ans2:
    ans = 0
    for j in i:
        for k in range(1, j + 1):
            ans += k / j
    ans5.append(ans)
print(max(ans5))

### FIXED CODE ###

from itertools import accumulate

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

# 期待値の前計算
expP = [(P[i]+1)/2 for i in range(n)]

# 累積和の計算
acc = [0]+ list(accumulate(expP)) # 0を忘れずに

# 隣接する K 項の和の計算
ans = 0
for i in range(n-k+1):
  ans = max(ans,acc[i+k]-acc[i])
print(ans)
### BUGGY CODE ###

n = int(input())
a = list(map(int, input().split()))
i = 0
while 1:
    if i >= len(a):
        break
    if a[i] != i+1:
        a.remove(a[i])
    else:
        i += 1
if len(a) == 0:
    print(-1)
else:
    print(n-len(a))

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
i = 0
j = 0
c = 0
while 1:
    if j >= len(a):
        break
    if a[j] != i+1:
        j += 1
        c += 1
    else:
        j += 1
        i += 1
if len(a) == c:
    print(-1)
else:
    print(c)
### BUGGY CODE ###

n=int(input())
comb=[]
ans=[]


for k in range(1, n+1):
    flag=False
    for x in range(1, k+1):
        if 6*x**2 >n:
            continue
        else:
            for y in range(x, k+1):
                for z in range(y, k+1):
                    if (x+y+z)**2 - x*y-y*z-z*x==k:
                        comb.append((x,y,z))
                        flag=True
                        break
    
    if flag:
        pass
    else:
        comb.append((0, 0, 0))


l=len(comb)

for s in range(l):
    if comb[s][0]==comb[s][1]==comb[s][2]==0:
        ans.append(0)
    elif comb[s][0]==comb[s][1]==comb[s][2]!=0:
        ans.append(1)
    elif comb[s][0]!=comb[s][1] and comb[s][1]!=comb[s][2] and comb[s][2]!=comb[s][0]:
        ans.append(6)
    else:
        ans.append(3)

for i in range(l):
    print(ans[i])

### FIXED CODE ###

n=int(input())
cnt=[0]*(n+1)

for x in range(1, 101):
    for y in range(1, 101):
        for z in range(1, 101):
            tmp=x*x + y*y + z*z + x*y + y*z + z*x
            if tmp <=n:
                cnt[tmp]+=1


for i in range(1, n+1):
    print(cnt[i])
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10**6+32)
from functools import lru_cache
mod=10**9+7
input=sys.stdin.buffer.readline
n,m=map(int,input().split())
s=list(map(int,input().split()))
t=list(map(int,input().split()))
#dp=[ [0 for _ in range(m)] for _ in range(n)]
@lru_cache(None)
def solve(i,j):
    if i==0 and j==0:
        if s[i]==t[j]:
            return 1
        else:
            return 0
    if i<0 or j<0:
        return 0
    ret=0
    ret=solve(i-1,j)+solve(i,j-1)-solve(i-1,j-1)
    ret%=mod
    if s[i]==t[j]:
        ret+=1+solve(i-1,j-1)
    return ret%mod
print((solve(n-1,m-1)+1)%mod)



### FIXED CODE ###

import sys
mod=10**9+7
input=sys.stdin.buffer.readline
n,m=map(int,input().split())
s=list(map(int,input().split()))
t=list(map(int,input().split()))
dp=[ [0 for _ in range(m)] for _ in range(n)]
for i in range(0,n):
    for j in range(0,m):
        ret=0
        if i-1>=0:
            ret+=dp[i-1][j]
        if j-1>=0:
            ret+=dp[i][j-1]
        if i-1>=0 and j-1>=0:
            ret-=dp[i-1][j-1]
        if s[i]==t[j]:
            ret+=1
            if i-1>=0 and j-1>=0:
                ret+=dp[i-1][j-1]
        if ret>=mod:
            ret%=mod
        if ret<0:
            ret+=mod
        dp[i][j]=ret
print((dp[n-1][m-1]+1))
### BUGGY CODE ###

N,K=map(int,input().split())
def wa(N,K):
    a=0
    for i in range(0,K):
        a=a+N-i
    c=0
    for i in range (0,K):
        c=c+i
    return a-c+1
d=0
for i in range(K,N+1):
  d=d+wa(N,i)
print((d+1)%(10**9+7))

### FIXED CODE ###

N,K=map(int,input().split())
def wa(N,K):
    return K*(N+1-K)+1
d=0
for i in range(K,N+2):
  d=d+wa(N,i)
print((d)%(10**9+7))
### BUGGY CODE ###

# coding:utf-8

import sys
import math
import time
import numpy as np
import collections
from collections import deque
import queue
import copy

# 最大公約数
def gcd(m,n):
  x = max(m,n)
  y = min(m,n)
  if x%y == 0:
    return y
  else:
    while x%y != 0:
      z = x%y
      x = y
      y = z
    else:
      return z

# 幅優先探索(BFS)でスタート座標(x, y)からの最大距離返す
def bfs(SS, x, y, H, W):#入力(座標系(迷路), x, y, xの端, yの端)
  x_next = [0, 0, -1, 1]
  y_next = [1, -1, 0, 0]
  tempx = x
  tempy = y
  mlength = 0
  q = deque()
  xytuple = (x, y, 0)
  q.append(xytuple)


  while q:
    xytuple = q.popleft()
    SS[xytuple[0]][xytuple[1]] = "x" #探索した場所は探索できないようにする
    for i in range(4): #このforで上下左右を調べてる
      tempx = xytuple[0] + x_next[i]
      tempy = xytuple[1] + y_next[i]
      #print(tempx, tempy, xytuple[2])
      #print(S)
      if(0 <= tempx and tempx < H and 0 <= tempy and tempy < W and SS[tempx][tempy] == "."):
        temptuple = (tempx, tempy, xytuple[2]+1)
        SS[temptuple[0]][temptuple[1]] = "x" #探索した場所は探索できないようにする
        mlength = max(mlength, xytuple[2] +1)
        q.append(temptuple)
      #print(q)
  return mlength


#X = str(input()).split()
N = int(input())
P = str(input()).split()
PP = []
# S = [[0 for i in range(W)] for j in range(H)]
val = 1

for i in range(N):
  PP.append(int(P[i]))

for i in range(N):
  #print(max(PP[:i+1]))
  #print(PP[i])
  if(i==0):
    i=0
  elif(min(PP[:i])>=PP[i]):
    val += 1

print(val)



### FIXED CODE ###

# coding:utf-8

import sys
import math
import time
import numpy as np
import collections
from collections import deque
import queue
import copy

# 最大公約数
def gcd(m,n):
  x = max(m,n)
  y = min(m,n)
  if x%y == 0:
    return y
  else:
    while x%y != 0:
      z = x%y
      x = y
      y = z
    else:
      return z

# 幅優先探索(BFS)でスタート座標(x, y)からの最大距離返す
def bfs(SS, x, y, H, W):#入力(座標系(迷路), x, y, xの端, yの端)
  x_next = [0, 0, -1, 1]
  y_next = [1, -1, 0, 0]
  tempx = x
  tempy = y
  mlength = 0
  q = deque()
  xytuple = (x, y, 0)
  q.append(xytuple)


  while q:
    xytuple = q.popleft()
    SS[xytuple[0]][xytuple[1]] = "x" #探索した場所は探索できないようにする
    for i in range(4): #このforで上下左右を調べてる
      tempx = xytuple[0] + x_next[i]
      tempy = xytuple[1] + y_next[i]
      #print(tempx, tempy, xytuple[2])
      #print(S)
      if(0 <= tempx and tempx < H and 0 <= tempy and tempy < W and SS[tempx][tempy] == "."):
        temptuple = (tempx, tempy, xytuple[2]+1)
        SS[temptuple[0]][temptuple[1]] = "x" #探索した場所は探索できないようにする
        mlength = max(mlength, xytuple[2] +1)
        q.append(temptuple)
      #print(q)
  return mlength


#X = str(input()).split()
N = int(input())
P = str(input()).split()
PP = []
# S = [[0 for i in range(W)] for j in range(H)]
val = 0

for i in range(N):
  PP.append(int(P[i]))

MIN = PP[0]

for i in range(N):
  #print(max(PP[:i+1]))
  #print(PP[i])
  MIN = min(MIN, PP[i])
  if(MIN>=PP[i]):
    val += 1

print(val)
### BUGGY CODE ###

n=int(input())
a=[int(x) for x in input().split()]
ma=max(a)
memo=[0]*ma

def gcd(a,b):#最大公約数
  while b!=0:
    a,b=b,a%b
  return a

for i in a:
  memo[i-1]+=1

pair=True
for i in range(2,ma+1):
  cnt=0
  for j in range(i,ma+1,i):
    if 0<memo[j-1]:
      cnt+=1
  if 1<cnt:
    pair=False


g=a[0]
for i in range(1,n):
  g=gcd(g,a[i])

if pair == False and g==1:
  print("setwise coprime")
elif pair == True and g==1:
  print("pairwise coprime")
else:
  print("not coprime")
    

### FIXED CODE ###

n=int(input())
a=[int(x) for x in input().split()]
ma=max(a)
memo=[0]*ma

def gcd(a,b):#最大公約数
  while b!=0:
    a,b=b,a%b
  return a

for i in a:
  memo[i-1]+=1

pair=True
for i in range(2,ma+1):
  cnt=0
  for j in range(i,ma+1,i):
    if 0<memo[j-1]:
      cnt+=1
  if 1<cnt:
    pair=False


g=a[0]
for i in range(1,n):
  g=gcd(g,a[i])

if pair == False and g==1:
  print("setwise coprime")
elif pair == True and g==1:
  print("pairwise coprime")
else:
  print("not coprime")
### BUGGY CODE ###

n=int(input())
S=list(map(int,input().split()))
q=int(input())
T=list(map(int,input().split()))
ans=0
for i in T:
    if i in S:
        ans += 1
print(ans)

### FIXED CODE ###

input()
a=set(input().split())
input()
b=set(input().split())

print(len(a&b))
### BUGGY CODE ###

H,W = map(int,input().split())
S = []
for i in range(H):
    S.append(list(input()))
L = [[] for _ in range(H)]
R = [[] for _ in range(H)]
D = [[] for _ in range(H)]
U = [[] for _ in range(H)]
for i in range(H):
    for j in range(W):
        if S[i][j] == '#':
            L[i].append(0)
        elif j == 0:
            L[i].append(1)
        else:
            L[i].append(L[i][-1] + 1)
for i in range(H):
    for j in range(-1,-W-1,-1):
        if S[i][j] == '#':
            R[i].insert(0,0)
        elif j == -1:
            R[i].append(1)
        else:
            R[i].insert(0,R[i][0] + 1)
for i in range(W):
    for j in range(H):
        if S[j][i] == '#':
            U[j].append(0)
        elif j == 0:
            U[j].append(1)
        else:
            U[j].append(U[j-1][-1] + 1)
for i in range(W):
    for j in range(-1,-H-1,-1):
        if S[j][i] == '#':
            D[j].append(0)
        elif j == -1:
            D[j].append(1)
        else:
            D[j].append(D[j+1][-1] + 1)
ans = 0
for i in range(H):
    for j in range(W):
        ans = max(ans,U[i][j]+D[i][j]+L[i][j]+R[i][j]-3)
print(ans)

### FIXED CODE ###

H,W = map(int,input().split())
S = []
for i in range(H):
    S.append(list(input()))
L = [[0 for _ in range(W)] for _ in range(H)]
R = [[0 for _ in range(W)] for _ in range(H)]
D = [[0 for _ in range(W)] for _ in range(H)]
U = [[0 for _ in range(W)] for _ in range(H)]
for i in range(H):
    for j in range(W):
        if S[i][j] == '#':
            continue
        elif j == 0:
            L[i][j] += 1
        else:
            L[i][j] += L[i][j-1] + 1
for i in range(H):
    for j in range(-1,-W-1,-1):
        if S[i][j] == '#':
            continue
        elif j == -1:
            R[i][j] += 1
        else:
            R[i][j] += R[i][j+1] + 1
for i in range(W):
    for j in range(H):
        if S[j][i] == '#':
            continue
        elif j == 0:
            U[j][i] += 1
        else:
            U[j][i] += U[j-1][i] + 1
for i in range(W):
    for j in range(-1,-H-1,-1):
        if S[j][i] == '#':
            continue
        elif j == -1:
            D[j][i] += 1
        else:
            D[j][i] += D[j+1][i] + 1
ans = 0
for i in range(H):
    for j in range(W):
        ans = max(ans,U[i][j]+D[i][j]+L[i][j]+R[i][j]-3)
print(ans)
### BUGGY CODE ###

L, R = map(int, input().split())

module = []
for i in range(L, R):
    for j in range(i+1, R+1):
       # print("({} * {}) % 2019:{}".format(i, j, (i * j) % 2019))
        module.append((i * j) % 2019)

print(min(module))


### FIXED CODE ###

L, R = map(int, input().split())

module = []
for i in range(L, R):
    for j in range(i+1, R+1):
        #print("({} * {}) mod 2019 = {}".format(i, j, (i * j) % 2019))
        if (i * j) % 2019 == 0:
            print("0")
            exit()
        else:
            module.append((i * j) % 2019)

if not module:
    print("0")
else:
    print(min(module))
### BUGGY CODE ###

N = int(input())
l = list(map(int,input().split()))
d = l.copy()

count = 0
i = 0
while len(d) != 0:
    if count == 0:
        a = 0
        count += 1
        for j in range(N-count):
            target = d[i] ^ d[j]
            if target in d :
                a += 1
                i = j
        if a >= 1 :
            i2 = target
            mae =d[i]
            d.pop(i)
        else:
            print('No')
            break
    
    elif 1 <= count <= N-3:
        a = 0
        count += 1
        for j in range(N-count):
            if target == mae ^ d[j] :
                a += 1
                i = j
        if a >= 1 :
            mae =d[i]
            d.pop(i)
        else:
            print('No')
            break
    
    elif count == N-2:
        a = 0
        count += 1
        if mae == target ^ l[0] :
            pass
        else:
            print('No')
            break    

    else:
        if l[0] == i2  ^   mae :
            print('Yes')
            break
        else:
            print('No')
            break 


### FIXED CODE ###

N = int(input())
a = list(map(int, input().split()))
a_unique = list(set(a))
a_unique.sort()

if len(a_unique) == 1 and a[0] == 0:
    ans = 'Yes'
elif len(a) % 3 == 0 :
    if len(a_unique) == 3:
        if bin(a_unique[0]) == bin(a_unique[1] ^ a_unique[2]) and bin(a_unique[1]) == bin(a_unique[0] ^ a_unique[2]) and bin(a_unique[2]) == bin(a_unique[1] ^ a_unique[0]) and a.count(a_unique[1]) == N//3 and a.count(a_unique[0]) == N//3 :
            ans = 'Yes'
        else:
            ans = 'No'
    elif len(a_unique) == 2:
        if a_unique[0] == 0 and a.count(a_unique[1]) == N//3 * 2:
            ans = 'Yes'
        else:
            ans = 'No'
    else:
        ans = 'No'
else:
    ans = 'No'

print(ans)
### BUGGY CODE ###

N,M =map(int,input().split())
A = [0] + list(map(int,input().split()))
for i in range(N):
  A[i+1] = (A[i]+A[i+1])%M
ans = 0
for a in set(A):
  n = A.count(a)
  ans += int(n*(n-1)/2)
print(ans)

### FIXED CODE ###

import collections
N,M =map(int,input().split())
A = [0] + list(map(int,input().split()))
for i in range(N):
  A[i+1] = (A[i]+A[i+1])%M
ans = 0
c = collections.Counter(A)
for a in set(A):
  n = c[a]
  ans += int(n*(n-1)/2)
print(ans)
### BUGGY CODE ###

import itertools

n, y = map(int, input().split())

t = (1000, 5000, 10000)
l = list(itertools.combinations_with_replacement(t, n))

for i in range(len(l)):
    if sum(l[i]) == y:
        print(l[i].count(10000), l[i].count(5000), l[i].count(1000))
        exit()
        
print('-1 -1 -1')

### FIXED CODE ###

n, y = map(int, input().split())

for i in range(n+1):
    for j in range(n-i+1):
        if 10000*i + 5000*j + 1000*(n-i-j) == y:
            print(i, j, n-i-j)
            exit()

print("-1 -1 -1")
### BUGGY CODE ###

S = input()

count = 0
for index, value in enumerate(S):
    if value == 'W':
        count += S[0:index].count('B')

print(count)


### FIXED CODE ###

S = input()

count = 0
pre_index = 0
pre_count = 0
for index, value in enumerate(S):
    if value == 'W':
        n = S[pre_index:index].count('B')
        count += n + pre_count
        pre_count = n + pre_count
        pre_index = index

print(count)
### BUGGY CODE ###

n,k=map(int,input().split())
a=list(map(int,input().split()))
b=[1]
for i in range(k):b[0]*=a[i]
for i in range(k,n):
  b.append(b[-1]*a[i]//a[i-k])
for i in range(len(b)-1):
  if b[i]<b[i+1]:print('Yes')
  else:print('No')

### FIXED CODE ###

n,k=map(int,input().split())
a=list(map(int,input().split()))
for i in range(k,n):
  if a[i-k]<a[i]:print('Yes')
  else:print('No')
### BUGGY CODE ###

S = input()  #文字
Q = int(input())  #数字
X = [0] * Q
R = 1
for i in range(Q):
    X[i] = list(input().split() ) #文字、複数行複数列
    if X[i][0] == "1":
        R *= - 1
    else:
        T = int(X[i][1])
        if T * R == 1 or T * R == -2:
            S = X[i][2] + S
        else:
            S = S + X[i][2]                

print(S[::R])

### FIXED CODE ###

s = input()
q = int(input())
cou = 1
frt = ""
bck = ""
for i in range(q):
    t = list(input().split())
    #logging.debug(t)#
    if t[0] == "1":
        cou *= -1
    else:
        if (t[1] == "1" and cou == 1)or(t[1] == "2" and cou == -1):
            frt = t[2] + frt
        else:
            bck = bck + t[2]
#    logging.debug("s {},cou {}".format(s,cou))

s = frt + s + bck
#logging.debug(s)#
if cou == 1:
    print(''.join(s))
else:
    print(''.join(s[::-1]))
### BUGGY CODE ###

N,M=map(int, input().split())
L=[ [] for _ in range(N)]
Y=[]
X=[]
for _ in range(M):
    a,b =map(int, input().split())
    L[a-1].append(b)
    X.append({a:b})
for _ in range(N) :
    Y.append(sorted(L[_]))
for i in range(M) :
    for k,v in X[i].items():
        z='%06d' % (Y[k-1].index(v)+1)
        Z='%06d' % k
        print(Z+z)


### FIXED CODE ###

N,M = map(int,input().split())
L = []
for i in range(M):
    l = list(map(int,input().split()))+[i]
    L.append(l)
cnt = 0
tmp = []
M = sorted(L,key = lambda x: (x[0],x[1]))
for x in M:
    if tmp == x[0]:
        x.append(cnt+1)
        cnt += 1
    else:
        tmp = x[0]
        cnt = 0
        x.append(cnt)
M = sorted(L,key = lambda x:x[2])
#print(M)
for x in M:
    st = str(x[0]).zfill(6)
    st += str(x[3]+1).zfill(6)
    print(st)
### BUGGY CODE ###

n, k = map(int, input().split())
s = input() # str

zero_lens = []
one_lens = []
flag_zero_before = 'None'
zeros = 0
ones = 0

for i in range(n):
    if s[i] == '0':
        if flag_zero_before == False:
            one_lens.append(ones)
            ones = 0
        zeros += 1
        flag_zero_before = True
    if s[i] == '1':
        if flag_zero_before and zeros != 0:
            zero_lens.append(zeros)
            zeros = 0
        ones += 1
        flag_zero_before = False

if s[-1] == '0':
    zero_lens.append(zeros)
if s[-1] == '1':
    one_lens.append(ones)

k = min(k, len(zero_lens))

counters = []
if s[0] == '1':
    for i in range(len(zero_lens) - k + 1):
        if i + k == len(one_lens):
            counter = sum(zero_lens[i: i+k]) + sum(one_lens[i: i+k])
        else:
            counter = sum(zero_lens[i: i+k]) + sum(one_lens[i: i+k+1])
        counters.append(counter)
elif s[0] == '0':
    for i in range(len(zero_lens) - k + 1):
        if i == 0:
            counter = sum(zero_lens[i: i+k]) + sum(one_lens[i: i+k])
        elif i + k > len(one_lens):
            counter = sum(zero_lens[i: i+k]) + sum(one_lens[i-1: i+k-1])
        else:
            counter = sum(zero_lens[i: i+k]) + sum(one_lens[i-1: i+k])
        counters.append(counter)

print(max(counters))


### FIXED CODE ###

n, k = map(int, input().split())
s = input()

counts = []
tmp = []
for i in range(len(s)):
    if tmp == []:
        tmp = [s[i], 1]
    else:
        if tmp[0] == s[i]:
            tmp[1] += 1
        else:
            counts.append(tmp)
            tmp = [s[i], 1]
if tmp:
    counts.append(tmp)

zero_ints = 0
for char, count in counts:
    if char == '0':
        zero_ints += 1

if counts[0][0] == '0':
    left = 0
else:
    left = 1
right = left - 2

used = 0
l = 0
for char, count in counts:
    if char == '0':
        if used < k:
            used += 1
            right += 2
        else:
            break
    l += count

ans = l
for i in range(zero_ints):
    l = l - counts[left][1]
    if left - 1 >= 0:
        l-= counts[left - 1][1]
    if right + 2 < len(counts):
        l += counts[right + 2][1]
    if right + 3 < len(counts):
        l += counts[right + 3][1]
    ans = max(ans, l)
    left += 2
    right += 2
    # print(left, right, l)
print(ans)
### BUGGY CODE ###

def main():
    N, K = map(int, input().split())
    answer = 1
    while True:
        if K ** answer <= N < K ** (answer + 1):
            break
        else:
            answer += 1
    print(answer + 1)


if __name__ == '__main__':
    main()



### FIXED CODE ###

from math import log, ceil


def main():
    N, K = map(int, input().split())
    answer = log(N, K)
    if answer.is_integer():
        print(int(answer) + 1)
    else:
        print(ceil(answer))


if __name__ == '__main__':
    main()
### BUGGY CODE ###

N = int(input())
H = [int(i) for i in input().split()]
can_move_nums = [0] * N
start = 0

for now in range(N-1):
    if H[now+1] <= H[now]:
        for j in range(start, now+1):
            can_move_nums[j] += 1
    else:
        start = now
        
print(max(can_move_nums)) 

### FIXED CODE ###

N = int(input())
H = [int(i) for i in input().split()]
H = H[::-1]
can_move_nums = [0] * N
start = 0

for i in range(1, N):
    if H[i] >= H[i-1]:
        can_move_nums[i] = can_move_nums[i-1]+1        
        
print(max(can_move_nums))
### BUGGY CODE ###

def main():
    INF = 2**60
    N, M = map(int, input().split())
    XYZ = [list(map(int, input().split())) for _ in range(N)]

    sgn = [[1,1,1], [1,1,-1],[1,-1,1],[1,-1,-1],[-1,1,1],[-1,1,-1],[-1,-1,1],[-1,-1,-1]]
    ans = -INF 
    for a, b, c in sgn:
        dp = [-INF]*(M+1)
        dp[0] = 0
        for i in range(N):
            for j in range(M-1, -1, -1):
                if dp[j] == -INF: continue
                dp[j+1] = max(dp[j+1], dp[j]+a * XYZ[i][0] + b * XYZ[i][1] + c * XYZ[i][2])
        ans = max(ans, dp[M])
    print(ans)

main()


### FIXED CODE ###

import sys

def main():
    INF = -2**60
    N, M = map(int, sys.stdin.buffer.readline().split())
    XYZ = [list(map(int, sys.stdin.buffer.readline().split())) for _ in range(N)]

    sgn = [[1,1,1], [1,1,-1],[1,-1,1],[1,-1,-1],[-1,1,1],[-1,1,-1],[-1,-1,1],[-1,-1,-1]]
    ans = INF 
    for a, b, c in sgn:
        dp = [INF]*(M+1)
        dp[0] = 0
        for x, y, z in XYZ:
            for j in range(M-1, -1, -1):
                if dp[j] == INF: continue
                s = dp[j]+ a*x + b*y + c*z
                if s > dp[j+1]:
                    dp[j+1] = s
        if dp[M] > ans:
            ans = dp[M]
    print(ans)

main()