Harryxun/stf_run huggingface dataset:
N, K = map(int, input().split())
h = list(map(int, input().split()))

dp = [0] + [1000000000] * (N-1)

for i in range(N-1):
	for j in range(1, min(K+1, N-i)):
      if dp[i] + abs(h[i+j] - h[i]) < dp[i+j]:
		dp[i+j] = dp[i] + abs(h[i+j] - h[i])			

print(dp[-1])

### FIXED CODE ###

import numpy as np
N, K = map(int, input().split())
h = np.array(list(map(int, input().split())))

dp = np.array([0] * N)
#candi = np.array([0] * N)

for i in range(1, N):
	j = max(0, i-K)
	#print()
	#candi[j:i] = dp[j:i] + np.abs(h[i] - h[j:i])
	dp[i] = (dp[j:i] + np.abs(h[i] - h[j:i])).min()
	#print('j,i=',j,i)
	#print('dp[j:i]=',dp[j:i])
	#print('np.abs(h[i] - h[j:i]) = ', np.abs(h[i] - h[j:i]) )		
	#print('candi[j:i]=',candi[j:i])
	#dp[i] = candi[j:i].min()
	#print('dp=',dp)
				
print(dp[-1])
import sys
a, b = sys.stdin.readline().split()
a = int(a)
b = int(b)
if a > b:
  print "a>b"
elif a < b:
  print "a<b"
else
  print "a==b"

### FIXED CODE ###

import sys
a, b = sys.stdin.readline().split()
a = int(a)
b = int(b)
if a > b:
  print "a > b"
elif a < b:
  print "a < b"
else:
  print "a == b"
N = int(input())
P = [int(input()) for _ in range(N)]

POINT = [False] * (10 ** 4 + 10)
POINT[0] = True
LP = len(POINT)

for p in POINT:
  for i in range(LP):
    POINT[i+p] = POINT[i] | POINT[i+p]
  
ans = 0
for i in range(LP):
  if POINT[i]:
    ans = max(i,ans)
    
print(ans)

### FIXED CODE ###

N = int(input())
P = [int(input()) for _ in range(N)]

POINT = [False] * (10 ** 4 + 101)
POINT[0] = True
LP = len(POINT)

for p in P:
  for i in range(10**4,-1,-1):
    POINT[i+p] = POINT[i] | POINT[i+p]
  
ans = 0
for i in range(LP):
  if POINT[i] and i % 10 != 0:
    ans = max(i,ans)
    
print(ans)
n=int(input())
A=list(map(int,input().split()))
for i in range(n):
  for j in range(i+1,n):
    ans.append(A[i]*A[j])
print(sum(ans))

### FIXED CODE ###

n=int(input())
A=list(map(int,input().split()))
ans=[]
for i in range(n):
    for j in range(i+1,n):
        ans.append(A[i]*A[j])
print(sum(ans))
h, w = map(int, input().split())
ls = [list(map(int, input().split())) for _ in range(h)]
ls = [[bool(a % 2) for a in l] for l in ls]

res = []
started = False
steps = []
for i in range(h):
    odd = i % 2
    for j in range(w):
        if odd:
            j = w - j - 1
        if started:
            steps.append((i, j))
        if ls[i][j]:
            if not started:
                steps = [(i, j)]
                started = True
            else:
                for s, t in zip(steps, steps[1:]):
                    res.append((*s, *t))
                started = False

print(len(res))
for row in res:
    row = map(lambda x: x + 1, row)
    print(*row)

### FIXED CODE ###

h, w = map(int, input().split())
ls = [list(map(int, input().split())) for _ in range(h)]
ls = [[bool(a % 2) for a in l] for l in ls]

res = []
started = False
steps = []
for i in range(h):
    odd = i % 2
    for j in range(w):
        if odd:
            j = w - j - 1
        if started:
            steps.append((i, j))
        if ls[i][j]:
            if not started:
                steps = [(i, j)]
                started = True
            else:
                for s, t in zip(steps, steps[1:]):
                    res.append((s[0], s[1], t[0], t[1]))
                started = False

print(len(res))
for row in res:
    row = map(lambda x: x + 1, row)
    print(*row)
N, X = map(int, input().split())

a = [1]  # 厚さ
p = [1]  # パティの数
for i in range(N):
    a.append(2*a[-1] + 3)
    p.append(2*p[-1] + 1)


def f(n: int, x: int) -> int:
    """レベルnバーガーの下からx枚のパティの数
    """
    if x == 1:
        return 0 if n > 0 else 1
    elif x <= 1+a[n-1]:
        return f(n-1, x-1)
    elif x == 2 + a[n-1]:
        return p[n-1] + 1
    elif x <= 2*a[n-1] + 2:
        return p[n-1] + 1 + f(n-1, x - (2+a[n-1]))
    elif x == 2*a[n-1] + 3:
        return p[n]
    else:
        raise ValueError(f"xがレベルnバーガーの厚さより大きい, x={x}, n={n}")


if __name__ == "__main__":
    ans = f(N, X)
    print(ans)


### FIXED CODE ###

N,X = map(int, input().split())

a,p = [1],[1]
for i in range(N):
    a.append(a[i]*2+3)
    p.append(p[i]*2+1)

def f(n,x):
    if n==0:
        return 1 if x>=1 else 0
    if x==1:
        return 0
    elif x<=1+a[n-1]:
        return f(n-1, x-1)
    else:
        return p[n-1]+1+f(n-1, x-2-a[n-1])
    
print(f(N,X))
a=int(input())
b=int(input())
ans="Even" if int(a * b % 2) == 0 else "Odd"
print(ans)


### FIXED CODE ###

a,b=map(int,input().split())
ans="Even" if (a * b % 2) == 0 else "Odd"
print(ans)
argv = sys.argv
a = int(input())


b = int(input())

t = int(input()) + 0.5 - a

r = 0

while t > 0:
    r += b
    t -= a

print(r)


### FIXED CODE ###

args = input()
args = args.split(' ')

a = int(args[0])
b = int(args[1])
t = int(args[2]) + 0.5 - a

r = 0

while t > 0:
    r += b
    t -= a

print(r)
a,b=input().split()
print(min(a*int(b),b*(int(a))) 


### FIXED CODE ###

a, b = input().split()
 
print(min(a*int(b), b*int(a) ) )
t=int(input())

if v>w:
  c=(b-a)/(v-w)
  if t>=c:
    print('YES')
  else:
    print('NO')
else:
  print('NO')

### FIXED CODE ###

a,v=map(int,input().split())
b,w=map(int,input().split())
t=int(input())
gap=abs(a-b) 
if v>w:
  c=gap/(v-w)
  if t>=c:
    print('YES')
  else:
    print('NO')
else:
  print('NO')
a,b=map(int, input().split())
x = list(map(int, input().split()))
x.sort()
p=0
q=0
y=0
for i in x:
    if p == 1 and q == 1:break
    if i == b:
        y=1
    if i%2==0:
        p=1
    else:
        q=1
if b<=x[-1] or y==1:
    if (b%2==0 and(p*q ==0)):
        m="POSSIBLE"
    elif p==1 and q==1:m="POSSIBLE"
    elif y==1:m="POSSIBLE"
else:m="IMPOSSIBLE" 
print(m)

### FIXED CODE ###

N,K= map(int, input().split())
x = list(map(int, input().split()))
x = list(set(x))
x.sort()
t = max(x)
y = x[0]
s = [1000000000000]
o=0
if x[0] == K:o=1
for i in range(1,len(x)):
    s.append(x[i]-x[i-1])
    if x[i] == K:o = 1
s.sort()
m = min(y,s[0])
if (t>= K and K%m==0) or o==1:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
s = input()

if int(s) < 2019:
    print(0)
else:
    count = sum(int(s[j:i+j]) % 2019 == 0 for i in range(4, len(s)) for j in range(len(s) - i + 1))
print(count)

### FIXED CODE ###

import numpy as np

s = input()[::-1]
length = len(s)
a = np.zeros(length, dtype=int)
d = np.zeros(length, dtype=int)
ans = np.zeros(2019, dtype=int)
x = 10

a[0] = int(s[0])
d[0] = a[0]
ans[d[0]] += 1

for i in range(1, length):
    a[i] = int(s[i]) * x % 2019
    d[i] = (d[i-1] + a[i]) % 2019
    ans[d[i]] += 1
    x = x * 10 % 2019

ans_c = ans[np.nonzero(ans)]

print(int(sum([ans_c[i] * (ans_c[i]-1) for i in range(ans_c.shape[0])]) / 2) + ans[0])
from bitarray import bitarray
n,T=[int(i) for i in input().split()]
t=[int(i) for i in input().split()]

ans=0
for i in range(n-1):
    start=t[i]
    end=start+T
    if(end>t[i+1]):
        ans+=t[i+1]-t[i]
    else:
        ans+=T
ans+=T
print(ans)

### FIXED CODE ###

n, T = map(int, input().split())
t = list(map(int, input().split()))
 
ans = 0
for i in range(1, n):
    ans += min(t[i] - t[i-1], T)
print(ans + T)
a,b,c=input().split()
d=list[a,b,c]
for i in range(2):
    if d.count(d[i])!=1:
        del d[i]
print(len(d))


### FIXED CODE ###

a,b,c=input().split()
d=[a,b,c]
for i in range(2):
    if d.count(d[i])!=1:
        del d[i]
print(len(d))
a,b,c = input()

print(c,a,b)

### FIXED CODE ###

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

print(c,a,b)
O,K = input().split()
I = O*int(k)
U = K*int(O)
print(sorted([I,U])[0])

### FIXED CODE ###

N, M = input().split()
a = N*int(M)
b = M*int(N)
print(sorted([a,b])[0])
n,k=map(int,input().split())

import math
ans=0
for m in range(1,n+1):
    if m>=k:
        l=0
    else:
        l=math.ceil( math.log2(k/m) )
    ans+=(0.50)**l /n
print(ans)

### FIXED CODE ###

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

import math
ans=0
for m in range(1,n+1):
    if m>=k:
        l=0
    else:
        l=math.ceil( math.log(k/m,2) )
    ans+=(0.50)**l /n
print(ans)
N, K = map(int, input().split())
A = list(map(int, input().split()))
 
B = []
Vector = [0]*N
j = 0
 
for i in range (0,K+1):
	if Vector[A[j]] == 1:
		Value = B.index(A[j])
		C = B[B.index(A[j])::]
		break
	else:
		B.append(A[j])
		Vector[A[j]] = 1
		j = A[j]-1

if A[0] ==1:
	print(1)
elif len(B) == K:
	print(B[-1])
else:
	print(C[(K-Value-1)%len(C)])

### FIXED CODE ###

N, K = map(int, input().split())
A = list(map(int, input().split()))
 
B = []
Vector = [0]*N
j = 0
 
for i in range (0,K):
	if Vector[A[j]-1] == 1:
		Value = B.index(A[j])
		C = B[B.index(A[j])::]
		break
	else:
		B.append(A[j])
		Vector[A[j]-1] = 1
		j = A[j]-1

if A[0] ==1:
	print(1)
elif len(B) == K:
	print(B[-1])
else:
	print(C[(K-Value-1)%len(C)])
n = int(input())
xyh = [tuple(map(int, input().split())) for i in range(n)]


for cx in range(101):
    for cy in range(101):
        height = set(hi + abs(xi-cx) + abs(yi-cy) for xi, yi, hi in xyh if hi > 0)
      
        if len(height) == 1:
            H = max(height)
            if all(set(hi=max(H - abs(xi-cx) - abs(yi-cy), 0)) for xi, yi, hi in xyh if hi == 0):
                print(cx, cy, H)
                exit()

### FIXED CODE ###

n = int(input())
xyh = [tuple(map(int, input().split())) for i in range(n)]

for cx in range(101):
    for cy in range(101):
        height = set(hi + abs(xi-cx) + abs(yi-cy) for xi, yi, hi in xyh if hi > 0)
        if len(height) == 1:
            H = max(height)
            if all(set(hi==max(H - abs(xi-cx) - abs(yi-cy), 0) for xi, yi, hi in xyh if hi == 0)):
                print(cx, cy, H)
                exit()
l = raw_input().split(' ')
string = l[0]
# string = string[0]
# num = int(string[1])
# num = input()
# num = int(num)
num = int(l[1])
# print(string)
if num == 0:
    print(string)
else:
    out=string[0]
    for i in [i for i in range(len(string))]:
        if i != 0:
            if i%num == 0:
                out=out+string[i]
    print(out)


### FIXED CODE ###

l = input().split()
if int(l[0])+int(l[1])==15:
    print('+')
elif int(l[0])*int(l[1]) ==15:
    print('*')
else:
    print('x')
import gcd from math
def main(): #startline-------------------------------------------
    k = int(input())
    ans = 0
    for i in range(1,k+1):
        for j in range(1,k+1):
            for l in range(1,k+1):
                ans += gcd(gcd(i,j),l)

    print(ans)
if __name__ == "__main__":
    main() #endline===============================================

### FIXED CODE ###

from math import gcd
def main(): #startline-------------------------------------------
    k = int(input())
    ans = 0
    for i in range(1,k+1):
        for j in range(1,k+1):
            for l in range(1,k+1):
                ans += gcd(gcd(i,j),l)

    print(ans)
if __name__ == "__main__":
    main() #endline===============================================
In [93]: s, w  = map(int,input().split()) 
    ...: if s <= w: 
    ...:     print("unsafe") 
    ...: else : 
    ...:     print("safe") 

### FIXED CODE ###

s, w  = map(int,input().split())
if s <= w:
    print("unsafe")
else :
    print("safe")
x,y=map(int,input().split())
for i in range(x+1):
    if 2*i+4*(x-i)==y:
        print("Yes")
print('No')

### FIXED CODE ###

n = list(map(int, input().split()))
result = 0
for i in range(len(n)):
  if n[i] == 0:
    print(i+1)
A ,B = [int(x) for x in input().split()]
C = [(int(x)+1)/2 for x in input().split()]
ans = 0
count = 0
D = [0]*A
sum = 0
for i in range(A):
    sum += C[i]
    D[i] = sum
    if i >= B:
        dif = sum - D[i-B]
        if dif > ans:
            ans = dif
    
if A==B:
    ans=sum[A-1]
    
print(ans)




### FIXED CODE ###

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

total = 0
ans = 0
for i,a in enumerate(P):
    total += (a+1)/2
    if i >= k:
        total -= (P[i-k]+1)/2
    if i >= k-1:
        ans = max(total,ans)
    
print(ans)
if K <= A + B:
  print(K)
else:
  print(A * 2 + B - K)

### FIXED CODE ###

import math
A, B, C, K = list(map(int, input().split()))
if K <= A:
  print(K)
if A < K <= A + B:
  print(A)
if A + B < K <= A + B + C:
  print(A * 2 + B - K)
n=int(input())
d=[int(input())-1for i in range(n)]
s=set(0)
ans=0
b=0
while 1>0:
  if d[b] in s:
    ans=-1
    break
  b=d[b]
  s.add(b)
  ans+=1
  if b==1:
    break
print(ans)

### FIXED CODE ###

n=int(input())
d=[int(input())-1for i in range(n)]
s=set()
s.add(0)
ans=0
b=0
while 1>0:
  if d[b] in s:
    ans=-1
    break
  b=d[b]
  s.add(b)
  ans+=1
  if b==1:
    break
print(ans)
N = int(input())
X = int(input(),2)

def pcrem(n,cnt):
  if (n==0):
    print(cnt)
    return 0
  pc = bin(n).count("1")
  pcrem(n%pc,cnt+1)

for i in range(N):
  f = X^(1<<N-i-1)
  pcrem(f,0)


### FIXED CODE ###

import math
N = int(input())
ans_list = [0 for i in range(N)]
index = int(math.sqrt(N))

for x in range(1,index):
  for y in range(1,index):
    for z in range(1,index):
      n = x**2 + y**2 + z**2 + x*y + y*z + z*x 
      if (n <= N):
        ans_list[n-1] += 1
for i in range(N):
  print(ans_list[i])
n=int(input())
a=list(map(int,input().split()))
sa=set(a)
ma=max(a)
a2=[0]*ma
for ii in a:
  a2[ii-1]+=1

def func(a2):
  r=0
  for jj in range(len(a2)):
     r+= a2[jj]*(jj+1)
  return r

r=func(a2)
q=int(input())
for ii in range(q):
  b,c=map(int,input().split())
  r+=(c-b)*a2[b-1]
  a2[c-1]+=a2[b-1]
  a2[b-1]=0
  print(r)


### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
ma=10**5
a2=[0]*ma
for ii in a:
  a2[ii-1]+=1

def func(a2):
  r=0
  for jj in range(len(a2)):
     r+= a2[jj]*(jj+1)
  return r

r=func(a2)
q=int(input())
for ii in range(q):
  b,c=map(int,input().split())
  r+=(c-b)*a2[b-1]
  a2[c-1]+=a2[b-1]
  a2[b-1]=0
  print(r)
from collections import deque
import sys
h,w=map(int,input().split())
field=[list(input()) for _ in range(h)]
count=0
queue=deque([[0,0,0]])
for i in range(h):
    for j in range(w):
        if field[i][j]=='.':
            count+=1
def bfs(x,y,k):
    if (not 0<=x<h) or (not 0<=y<w):
        return
    if field[x][y]=='#':
        return
    queue.append([x,y,k+1])
#    print(queue)
#    print(field)
while True:
    x,y,k=queue.popleft()
    if x==h-1 and y==w-1:
        print(count-k-1)
        sys.exit()
    field[x][y]='#'
    bfs(x+1,y,k)
    bfs(x-1,y,k)
    bfs(x,y-1,k)
    bfs(x,y+1,k)
print(-1)

### FIXED CODE ###

from collections import deque
h,w=map(int,input().split())
field=[list(input()) for _ in range(h)]
cost=[[float('inf')]*w for _ in range(h)]
cost[0][0]=1
queue=deque([[0,0]])
count=0
for i in range(h):
    for j in range(w):
        if field[i][j]=='.':
            count+=1
def bfs():
    while queue:
        x,y=queue.popleft()
        for dx,dy in [[1,0],[-1,0],[0,1],[0,-1]]:
            if 0<=x+dx<h and 0<=y+dy<w:
                if field[x+dx][y+dy]=='.' and cost[x+dx][y+dy]==float('inf'):
                    cost[x+dx][y+dy]=cost[x][y]+1
                    queue.append([x+dx,y+dy])
bfs()
#print(cost)
if cost[-1][-1]<float('inf'):
    print(count-cost[-1][-1])
else:
    print(-1)
from bisect import bisect_right
s = input().strip()
t = input().strip()
A = sorted(list(set(list(s))))
B = sorted(list(set(list(t))))
D = {}
for i in range(len(s)):
    a = s[i]
    if a not in D:
        D[a] = []
    D[a].append(i+1)
cur = 0
for i in range(len(B)):
    flag = 0
    while cur<len(A):
        if A[cur]<B[i]:
            cur += 1
        elif A[cur]==B[i]:
            break
        else:
            flag = 1
            break
    if flag==1:break
if flag==1:
    print(-1)
else:
    C = []
    cur = -1
    for i in range(len(t)):
        b = t[i]
        ind = bisect_right(D[b],cur)%len(D[b])
        C.append(D[b][ind])
        cur = D[b][ind]
    cnt = 0
    for j in range(1,len(C)):
        if C[j]<=C[j-1]:
            cnt += 1
    print(len(s)*cnt+C[-1])

### FIXED CODE ###

from bisect import bisect_right
s = input().strip()
t = input().strip()
D = {}
for i in range(len(s)):
    a = s[i]
    if a not in D:
        D[a] = []
    D[a].append(i+1)
A = sorted(list(set(list(s))))
A.append(chr(123))
B = sorted(list(set(list(t))))
cur = 0
flag = 0
for i in range(len(B)):
    while True:
        if A[cur]<B[i]:
            cur += 1
        elif A[cur]==B[i]:
            break
        else:
            flag = 1
            break
    if flag==1:break
if flag==1:
    print(-1)
else:
    C = []
    cur = -1
    for i in range(len(t)):
        b = t[i]
        ind = bisect_right(D[b],cur)%len(D[b])
        C.append(D[b][ind])
        cur = D[b][ind]
    cnt = 0
    for j in range(1,len(C)):
        if C[j]<=C[j-1]:
            cnt += 1
    print(len(s)*cnt+C[-1])
import heapq
import sys

class rode():
    def __init__(self,x,y):
        self.x = x
        self.y = y
    def __lt__(self, other):
        return self.y < other.y
    def __gt__(self, other):
        return other > self
    def __le__(self, other):
        return not(other > self)
    def __ge__(self, other):
        return not(self > other)

n,m = map(int,input().split())
da = [[i-1,0] for i in range(n)]
da[0] = []
for i in range(m):
    l,r,c = map(int,input().split())
    da[l-1].append([r-1,c])
for i in range(1,n):
    da[i].append([i-1,0])
pq=[]
ju = [False for i in range(n)]
ju[0] = True
for i in da[0]:
    heapq.heappush(pq, rode(i[0],i[1]))
while(len(pq)):
    now = heapq.heappop(pq)
    if now.x == n-1:
        print(now.y)
        sys.exit()
    if ju[now.x]:
        continue
    ju[now.x] = True
    for i in da[now.x]:
        if ju[i[0]]:
            continue
        heapq.heappush(pq,rode(i[0],now.y+i[1]))
print(-1)

### FIXED CODE ###

import heapq
import numpy as np
import sys

n,m = map(int,input().split())
da = [[] for i in range(n)]
for i in range(1,n):
    da[i].append([i-1,0])
for i in range(m):
    l,r,c = map(int,input().split())
    da[l-1].append([r-1,c])
pq=[]
ju = np.zeros(n,dtype=bool)
ju[0] = True
for i in da[0]:
    heapq.heappush(pq, [i[1],i[0]])
while(len(pq)):
    now = heapq.heappop(pq)
    if now[1] == n-1:
        print(now[0])
        sys.exit()
    if ju[now[1]]:
        continue
    ju[now[1]] = True
    for i in da[now[1]]:
        if ju[i[0]]:
            continue
        heapq.heappush(pq,[now[0]+i[1],i[0]])
print(-1)
N=int(input())
T=[int(x) for x in input().split()]
M=int(input())
P=[]
X=[]
for i in range(M):
    p1,x1=(int(d) for d in input().split())
    P.append(p1)
    X.append(x1)
sum1=0
for i in range(N):
    sum1+=T[i]
for i in range(M):
    temp=sum1
    temp=temp-T[P[i]-1]+X[i]
    print(temp)

### FIXED CODE ###

A,op,B=(x for x in input().split())
A1=int(A)
B1=int(B)
if(op=="+"):
    print(A1+B1)
else:
    print(A1-B1)
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x) ; y = self.find(y)
        if x == y:
            return
        if self.parents[x] > self.parents[y]:
            x, y = y, x
        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def same(self, x, y):
        return self.find(x) == self.find(y)
    
N,M=map(int,input().split())
uf=UnionFind(N)
for i in range(M):
    a,b=map(int,input().split(' '))
    uf.union(a,b)

ans=sum([1 for i in uf.parents if i==-1])
print(ans)

### FIXED CODE ###

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x) ; y = self.find(y)
        if x == y:
            return
        if self.parents[x] > self.parents[y]:
            x, y = y, x
        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def same(self, x, y):
        return self.find(x) == self.find(y)
    
N,M=map(int,input().split())
uf=UnionFind(N)
for i in range(M):
    a,b=map(int,input().split(' '))
    uf.union(a-1,b-1)

ans=sum([1 for i in uf.parents if i<0])-1
print(ans)
import math
A, B = map(int, input().split())


def lcm(x, y):
    return x * y // math.gcd(x, y)


print(lcm(A, B))


### FIXED CODE ###

import fractions
A, B = map(int, input().split())


def lcm(x, y):
    return x * y // fractions.gcd(x, y)


print(lcm(A, B))
for r in S:
  if rrr in S:
    return(3)
  elif rr in S:
    return(2)
  elif: r in S:
    return(1)
  else:
    return(0)
        
    

### FIXED CODE ###

s= input()

if 'RRR' in s:
    print(3)
    

elif 'RR' in s:
    print(2)
    
elif 'R' in s:
    print(1)
else:
    print(0)
def g(x, y, z):
  return x * x + y * y + z * z + x * y + y * z + z * x
  
def f(n):
  if(n < 6):
    return 0
  
  sum = 0
  lim = math.floor(math.sqrt(n)) + 1
  for x in range(1, lim, 1):
    for y in range(1, lim, 1):
      for z in range(1, lim, 1):
        a = g(x, y, z)
        if a > n:
          break
        if a == n:
          sum += 1
  return sum

for i in range(n + 1):
  print(f(i))

### FIXED CODE ###

import math

def f(x, y, z):
  return(x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x)

n = int(input())
fs = [0] * n

lim = math.floor(math.sqrt(n))
rng = range(1, lim)

for x in rng:
  for y in rng:
    for z in rng:
      v = f(x, y, z)
      if v <= n:
      	fs[v - 1] += 1
      
for i in range(n):
  print(fs[i])
import itertools
import math
import string
import collections
from collections import Counter
from collections import deque
import sys
sys.setrecursionlimit(2*10**5)
INF = 2**60


def readints():
    return list(map(int, input().split()))


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


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]
N = input()
if N[0] == N[3]:
    print('Yes')
else:
    print('No')


### FIXED CODE ###

N = input()
if N[0] == N[2]:
    print('Yes')
else:
    print('No')
N = input()
A = list(map(int, input().split()))
i = 0
while i < N:
    num = 0
    for i in len(A):
        if A[i] == i + 1:
            num += 1
    print(num)    



### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
ans = [0] * N
for i in range(N - 1):
    ans[A[i] - 1] += 1
for i in range(N):
    print(ans[i])
import math

a=int(input())

L = 2*math.pi*a
s = a*a*math.pi

print("%.6f"%(L),"%.6f"%(s))

### FIXED CODE ###

(a,b)=[int(i) for i in input().split()]

print(int(a/b),int(a%b),"%.8f"%(a/b))
S = input()

print (S//3600,":",S%3600//60,":",S%60,sep="")

### FIXED CODE ###

S = int(input())

print (S//3600,":",S%3600//60,":",S%60,sep="")
N, K = map(int, input().split())
S = [str(_) for _ in input().split()]

if (S[K] == 'A'):
  S[K] = 'a'
elif (S[K] == 'B'):
  S[K] = 'b'
else:
  S[K] = 'c'
    
printf(S)


### FIXED CODE ###

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

if (S[K-1] == 'A'):
  S[K-1] = 'a'
elif (S[K-1] == 'B'):
  S[K-1] = 'b'
elif (S[K-1] == 'C'):
  S[K-1] = 'c'
  
ans = ''.join(S)
    
print(ans)
N, K = map(int, input().split())
d = list(map(int, input().split()))
a = []
for i in range(10):
    if d.count(i) == 0:
        a.append(i)
ans = []
def dfs(s):
    if int(s) >= N or len(s) > len(str(N)):
        return s
    for i in a:
        S = dfs(s + str(i))
        if int(S) >= N:
            ans.append(int(S))
    return s
    
dfs('0')
print(min(ans))

### FIXED CODE ###

N, K = map(int, input().split())
d = list(map(int, input().split()))
a = []
for i in range(10):
    if d.count(i) == 0:
        a.append(i)
ans = []
def dfs(s):
    if int(s) >= N or len(s) > 6:
        return s
    for i in a:
        S = dfs(s + str(i))
        if int(S) >= N:
            ans.append(int(S))
    return s
    
dfs('0')
print(min(ans))
from fractions import gcd

N=int(input())
T0=int(input())
for i in range(1,N):
    T=int(input())
    g=gcd(T0,T)
    ans=T0*(T)//g
    T0=ans
print(ans)

### FIXED CODE ###

import fractions

N=int(input())
T0=int(input())

if N==1:
  print(T0)
  exit()

for i in range(1,N):
    T=int(input())
    g=fractions.gcd(T0,T)
    ans=T0*T//g
    T0=ans
print(ans)