Harryxun/stf_run huggingface dataset:
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

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

blue = K
red = N-K

for i in range(1, blue+1):
    ans = cmb(blue-1, i-1) * cmb(red+1, i)
    print(ans%(10**9+7))


### FIXED CODE ###

from math import factorial

def cmb(n,k):
    if n < k or n < 0 or k < 0:
        return 0
    return factorial(n)//(factorial(k)*factorial(n-k))

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

for i in range(1, K+1):
    ans = cmb(K-1, i-1) * cmb(N-K+1, i)
    print(ans%(10**9+7))
n1 = input()
n = list(n1)
ans = 0
for i in n1:
  ans += 1
if n%ans ==0:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

n=int(input())
n_=[int(i) for i in str(n)]
s=sum(n_)
if n%s==0:
    print('Yes')
else:
    print('No')
#!/usr/bin/env python3.4
# -*- coding: utf-8 -*-

# abc126_d

from collections import namedtuple

DistFrom = namedtuple('DistFrom', ['f', 'dist'])

def main():
    # Input
    n, = [int(s) for s in input().split()]
    fs = [[int(s) for s in input().split()] for _ in range(n-1)]
    # Get ans
    gs = [None] * n
    for i in range(n):
        gs[i] = list()
    for x, y, d in fs:
        x -= 1
        y -= 1
        d = d%2
        gs[x].append(DistFrom(y, d))
        gs[y].append(DistFrom(x, d))
    distlist = [None] * n
    def dfs(cur, dist):
        if distlist[cur] != None:
            return
        distlist[cur] = dist
        for i, d in gs[cur]:
            dfs(i, dist^d)
    dfs(0, 0)
    # Output
    for i in range(n):
        print(distlist[i])

if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
 
sys.setrecursionlimit(10**5)

n = int(input())
p = [list() for _ in range(n)]
for i in range(n-1):
    u, v, w = [int(s) for s in input().split()]
    u -= 1
    v -= 1
    w %= 2
    p[u].append((v, w))
    p[v].append((u, w))

costs = [-1 for _ in range(n)]

def dfs(cur, dist):
    if costs[cur] != -1:
        return
    costs[cur] = dist
    for v, d in p[cur]:
        dfs(v, dist^d)
dfs(0, 0)

for i in range(n):
    print(costs[i])
h w = int(input())
if h*w == 0:
  print(h*w/2)
 else:
  print(h*w//2+1)

### FIXED CODE ###

H,W=map(int, input().split())

if H == 1 or W == 1:
    print(1)
elif H * W % 2 == 0:
    print(int(H * W / 2))
elif H * W % 2 != 0:
    print(int(H * W // 2 + 1))
def coffee():
    if len(S) == 6 and S[2]==S[3] and S[4]==S[5]:
        return 'Yes'

coffee()

### FIXED CODE ###

S = input()

if len(S) == 6 and S[2]==S[3] and S[4]==S[5]: print('Yes')
else: print('No')
h = int(input())
w = int(input())
n = int(input())

if h < w:
    if n % w == 0:
        print(n % w)
    else:
        print(n % w + 1)
if n % h == 0:
        print(n % h)
    else:
        print(n % h + 1)

### FIXED CODE ###

h = int(input())
w = int(input())
n = int(input())

if h < w:
    if n % w == 0:
        print(n // w)
    else:
        print(n // w + 1)
else:
    if n % h == 0: 
        print(n // h)
    else:
        print(n // h + 1)
abc166b
k=int(input())
s=input()
if len(s)<=k:
 print(s)
else:
 ss=s[:k]
 print(ss+'...')


### FIXED CODE ###

#abc168b
k=int(input())
s=input()
if len(s)<=k:
 print(s)
else:
 ss=s[:k]
 print(ss+'...')
n=int(input())
p=[int(i) for i in input().split()]
ans=0
for x in range(1,n-1):
    a=p[x-1]
    b=p[x]
    c=p[x+1]
    if a<b<c or c<b<a:
        ans+=1
print(ans)

### FIXED CODE ###

S = sorted(input())
if len(set(S)) == 2 and S[0] == S[1] and S[1] != S[2] and S[2] == S[3]:
	print("Yes")
else:
	print("No")
def lcm(a, b):
    ax = a
    bx = b
    c = 0
    if a<b:
        ax, bx = (bx, ax)
    while True:
        if ax%bx == 0:
            gcd = bx
            break
        else:
            c = bx
            bx = ax%bx
            ax = c
    return a*b // gcd

n = int(input())
Mx = int(input())
lst = [Mx]
lst2 = []
for i in range(n-1):
    a = int(input())
    if Mx%a != 0:
        lst.append(a)
        lst.sort()
        if Mx<a:
            Mx = a

while True:
    lst2.append(lcm(lst[0], lst[1]))
    lst.pop(0)
    lst.pop(0)
    lst2.extend(lst)
    if len(lst2)==1:
        print(lst2[0])
        break
    lst.clear()
        
    lst.append(lcm(lst2[0], lst2[1]))
    lst2.pop(0)
    lst2.pop(0)
    lst.extend(lst2)
    if len(lst)==1:
        print(lst[0])
        break
    lst2.clear()

### FIXED CODE ###

def lcm(a, b):
    ax = a
    bx = b
    if a<b:
        ax, bx = (bx, ax)
    while True:
        if ax%bx == 0:
            gcd = bx
            break
        else:
            c = bx
            bx = ax%bx
            ax = c
    return a*b // gcd

n = int(input())
lst = []
lst2 = []
for i in range(n):
    a = int(input())
    lst.append(a)

while True:    
    if n==1:
        print(lst[0])
        break
    lst2.append(lcm(lst[0], lst[1]))
    lst.pop(0)
    lst.pop(0)
    lst2.extend(lst)
    if len(lst2)==1:
        print(lst2[0])
        break
    lst.clear()
        
    lst.append(lcm(lst2[0], lst2[1]))
    lst2.pop(0)
    lst2.pop(0)
    lst.extend(lst2)
    if len(lst)==1:
        print(lst[0])
        break
    lst2.clear()
def solve():
  count = [0] * 4
  for i in range(3):
    A, B = map(int, input().split())
    count[A - 1] += 1
    count[B - 1] += 1

  time = [0] * 2
  for c in count:
    if c == 0: continue
    time[c - 1] += 1

  return 'YES' if time[0] == 2 and time[1] == 2 else 'NO'

print(solve())


### FIXED CODE ###

def solve():
  count = [0] * 4
  for i in range(3):
    A, B = map(int, input().split())
    count[A - 1] += 1
    count[B - 1] += 1

  time = [0] * 2
  for c in count:
    if c != 1 and c != 2: continue
    time[c - 1] += 1

  return 'YES' if time[0] == 2 and time[1] == 2 else 'NO'

print(solve())
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**9)

def main():
    S = input()
    N = len(S)

    # S = [int(s) if s!="?" else -1 for s in S ]
    dp = [[0] * 13 for _ in range(N+1)]

    s = S[0]
    if s == "?":
        for j in range(10):
            dp[0][j] += 1
    else:
        dp[0][int(s)%13] += 1
    for i in range(1,N):
        s = S[i]
        if s == "?":
            X = range(10)
        else:
            X = [int(s)]

        for j in range(0,13):
            ten_j = j*10
            for x in X:
                k = (ten_j+x)%13
                dp[i][k] += dp[i-1][j]
                # print(i,j,k)

    # print(dp)
    print(dp[-2][5] % (10**9+7))



if __name__ == "__main__":
  main()

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**9)

def main():
    S = input()
    N = len(S)
    MOD = 10**9+7

    # S = [int(s) if s!="?" else -1 for s in S ]
    dp = [[0] * 13 for _ in range(N+1)]

    s = S[0]
    if s == "?":
        for j in range(10):
            dp[0][j] += 1
    else:
        dp[0][int(s)%13] += 1
    for i in range(1,N):
        s = S[i]
        if s == "?":
            for j in range(0,13):
                for x in range(10):
                    k = (j*10+x)%13
                    dp[i][k] += dp[i-1][j]
                    dp[i][k] %= MOD
        else:
            for j in range(0,13):
                k = (j*10+int(s))%13
                dp[i][k] += dp[i-1][j]
                dp[i][k] %= MOD


    print(dp[N-1][5])


if __name__ == "__main__":
  main()
n = int(input())
ns = list(map(int, input().split()))
ans = 0
from collections import Counter
c = Counter(ns)
dubbles = set([key for key, value in c.items() if value >= 2])
ns = sorted(set(ns))
a = [True] * n
for i in range(n):
    if not a[i]:
        continue
    for j in range(i + 1, n):
        if not a[j]:
            continue
        if ns[j] % ns[i] == 0:
            a[j] = False
print(sum(a))



### FIXED CODE ###

from collections import Counter
n = int(input())
ns = list(map(int, input().split()))
c = Counter(ns)
ans = 0

l = [True] * (max(ns)+1)
for i in sorted(set(ns)):
    if l[i]:
        j = i*2
        while j < len(l):
            l[j] = False
            j += i

a = set([key for key, value in c.items() if value == 1])
for i in a:
    if l[i]:
        ans += 1
print(ans)
h,w = map(int,input().split())
HW = [list(map(int,input().split())) for _ in range(h)]
sharp = HW.count('#')
min_root = h + w - 1
if sharp == min_root:
  print('Possible')
else:
  print('Impossible')

### FIXED CODE ###

def main():
  H, W = list(map(int, input().split()))

  count = 0

  for i in range(H):
    row = input()
    for j in range(W):
      if(row[j] == '#'):
        count += 1

  print("Possible" if W + H - 1 == count else "Impossible")

if __name__ == "__main__":
  main()
N, M = map(int, input().split())
a = [int(input()) for i in range(M)]
inf = 10**9+7

#動的計画法問題
dp = [0] * (N+1)
dp[0] = 1
if 1 not in a:
  dp[1] = 1
else:
  dp[1] = 0

    for i in range(2,N+1):
      if i in a:
        continue
      dp[i] = dp[i-1] + dp[i-2]
      dp[i] %= inf

print(dp[N]) 

### FIXED CODE ###

N, M = map(int, input().split())
a = set([int(input()) for _ in range(M)])
INF = 1000000007

dp = [0] * (N + 1)
dp[0] = 1
if 1 not in a:
	dp[1] = 1
else:
	dp[1] = 0
for i in range(2, N + 1):
	if i in a:
		continue
	dp[i] = dp[i - 1] + dp[i - 2]
	dp[i] %= INF

print(dp[N])
input_lines = input().split(" ")
n = int(input_lines[0])
m = int(input_lines[1])

if n == 1 and m == 1:
  	return 1
  
if n == 1 or m == 1:
	if n == 1:
		return m - 2
	else:
		return n - 2

return (m-2)*(n-2) 

### FIXED CODE ###

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

count = 0
if m > 1 and n > 1:
  count = (m - 2)*(n - 2)
elif m == 1 and n > 1:
  count = n - 2
elif m > 1 and n == 1:
  count = m - 2
elif m == 1 and n == 1:
  count = 1
 
print(count)
N = int(input())
A = []
for i in range(N):
  A.append(int(input()))
for i in range(N):
  a = A
  del a[i]
  print(max(a))

### FIXED CODE ###

N = int(input())
A = []
for i in range(N):
  A.append(int(input()))
a = sorted(A)
max = a[-1]
if max == a[-2]:
  for i in range(N):
    print(max)
else:
  n = A.index(max)
  for i in range(N):
    if i == n:
      print(a[-2])
      continue
    print(max)
#!/usr/bin/env python3
import sys
from collections import deque

def get_digits(i):
    last_digit = int(str(i)[-1])
    if last_digit in list(range(1,9)):
        return [last_digit-1, last_digit, last_digit+1]
    elif last_digit == 0:
        return [last_digit, last_digit+1]
    elif last_digit == 9:
        return [last_digit-1, last_digit]

def solve(K: int):
    deq1 = deque()
    deq2 = deque()
    lunlun_list = []

    for i in range(1,10):
        deq1.append(i)
        lunlun_list.append(i)

    while  len(lunlun_list) <= 10 ** 5:
        num = deq1.popleft()
        digits = get_digits(num)
        for new_digit in digits:
            new_num = int(str(num)+str(new_digit))
            lunlun_list.append(new_num)
            deq2.append(new_num)

        if len(deq1) == 0:
            deq1 = deq2.copy()
            deq2 = deque()

    print(lunlun_list[K-1])


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    K = int(next(tokens))  # type: int
    solve(K)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys
from collections import deque
from copy import copy

def get_digits(i):
    last_digit = int(str(i)[-1])
    if last_digit in list(range(1,9)):
        return [last_digit-1, last_digit, last_digit+1]
    elif last_digit == 0:
        return [last_digit, last_digit+1]
    elif last_digit == 9:
        return [last_digit-1, last_digit]

def solve(K: int):
    deq1 = deque()
    deq2 = deque()
    lunlun_list = []

    for i in range(1,10):
        deq1.append(i)
        lunlun_list.append(i)

    while  len(lunlun_list) <= 10 ** 5:
        num = deq1.popleft()
        digits = get_digits(num)
        for new_digit in digits:
            new_num = int(str(num)+str(new_digit))
            lunlun_list.append(new_num)
            deq2.append(new_num)

        if len(deq1) == 0:
            deq1 = copy(deq2)
            deq2 = deque()

    print(lunlun_list[K-1])


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    K = int(next(tokens))  # type: int
    solve(K)

if __name__ == '__main__':
    main()
from math import factorial

def dist(x1, y1, x2, y2):
    return ((x1 - x2)**2 + (y1 - y2)**2)**0.5

N = int(input())
x, y = [map(int, input().split()) for _ in range(N)]

ans = 0

for i in range(N-1):
    for j in range(i+1, N):
        ans += dist(x[i], y[i], x[j], y[j]) * 2

ans /= factorial(N)

print(ans)


### FIXED CODE ###

def dist(x1, y1, x2, y2):
    return ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5

N = int(input())
x, y = [0] * N, [0] * N
for i in range(N):
    x[i], y[i] = map(int, input().split())
ans = 0

for i in range(N - 1):
    for j in range(i + 1, N):
        ans += dist(x[i], y[i], x[j], y[j])

ans = ans * 2 / N

print(ans)
import math

N = int(input())
A = []
B = []
F = []

for i in range(1,int(math.sqrt(N)),1):
    if (N%i)== 0:
        A.append(N/i)
        B.append(i)
for i in range(len(A)):
    count_A = int(math.log10(A[i])+1)
    count_B = int(math.log10(B[i])+1)
    if count_A >= count_B:
        F.append(count_A)
    else:
        F.append(count_B)
print(min(F))


### FIXED CODE ###

import math

N = int(input())
A = []
B = []
F = []

for i in range(1,int(math.sqrt(N))+1,1):
    if (N%i)== 0:
        A.append(N/i)
        B.append(i)
for i in range(len(A)):
    count_A = int(math.log10(A[i])+1)
    count_B = int(math.log10(B[i])+1)
    if count_A >= count_B:
        F.append(count_A)
    else:
        F.append(count_B)
print(min(F))
x = int(input())
n = 0
for i in range(100):
    d[0][i] = i**5
    d[i][0] = i**5
    if i**5 == x:
        n = i
if n !=0:
    print(n,0)
else:
    for i in range(1,100):
        for j in range(1,100):
            d[i][j] = d[0][j]+d[i][0]
            if d[i][j] > x:
                n = i
                break
            elif d[i][j] == x:
                print(i,-j)
                n = i
                break
        if n == i:
            break

### FIXED CODE ###

x = int(input())
d = [[0 for i in range(500)] for j in range(500)]
e = [[0 for i in range(500)] for j in range(500)]
f = [[0 for i in range(500)] for j in range(500)]
for i in range(500):
    d[0][i] = i**5
    d[i][0] = i**5
for i in range(1,500):
    for j in range(1,500):
        d[i][j] = d[0][j]-d[i][0]
        e[i][j] = d[0][j]+d[i][0]
for m in range(500):
    if x in d[m]:
        print(d[m].index(x),m)
        break
    elif x in e[m]:
        print(e[m].index(x),-m)
        break
from collections import Counter

arr_b = []
N = int(input())
for i in range(N):
    arr_b.append(str(input()))
arr_r = []
N = int(input())
for i in range(N):
    arr_r.append(str(input()))

c_b = Counter(arr_b)
c_r = Counter(arr_r)

res = 0
for k_b in c_b.keys():
    if k_b in c_r:
        if res < c_b[k_b] - c_r[k_r]:
            res = c_b[k_b] - c_r[k_r]

print(res)

### FIXED CODE ###

from collections import Counter

arr_b = []
N = int(input())
for i in range(N):
    arr_b.append(str(input()))
arr_r = []
N = int(input())
for i in range(N):
    arr_r.append(str(input()))

c_b = Counter(arr_b)
c_r = Counter(arr_r)

res = 0
for k_b in c_b.keys():
    if k_b in c_r :
        if res < c_b[k_b] - c_r[k_b]:
            res = c_b[k_b] - c_r[k_b]
    else:
        if res < c_b[k_b]:
            res = c_b[k_b]

print(res)
N, K, X, Y = map(int, input().split())

a = N * X

b = K * X + (N - K) * Y

if N <= K:
    print(a)
else:
    print(b)

### FIXED CODE ###

N = int(input())    # 宿泊数
K = int(input())    # 単価が切り替わる泊数
X = int(input())    # 単価a
Y = int(input())    # 単価b


if N <= K:
    a = N * X
else:
    a = K * X + Y * (N - K)

print(a)
import sys

i = 0

while x != 0:
  x = sys.stdin.readline()
  i += 1

  print Case,
  print "%d: %d", %(i,x)
  

### FIXED CODE ###

i = 0
d = 0

while d == 0:
    x = input()
    if x != 0:
        i += 1
        print("Case %d: %d" %(i, x))
    else:
        d = 1
1 x,y,z=list(map(int,input().split()))
  2 print(x*y/2)  

### FIXED CODE ###

x,y,z=list(map(int,input().split()))                              
print(int(x*y/2))
N,K=map(int, inpu().split())
if N % K = 0:
 print(0)
else:
 print(1)

### FIXED CODE ###

N,K=map(int, input().split())
if N % K == 0:
 print(0)
else:
 print(1)
A = map(int,input().split())
sort(A)
print(0.5*A[0]*A[1])

### FIXED CODE ###

A = list(map(int,input().split()))
print(A[0]*A[1]//2)
#B
import numpy as np
import sys
n = int(input())
A = np.array(list(map(int,input().split())))
ans = 1
flag = True
for i in A:
    if flag:
	    ans *= i
		if ans > 10**18:
    		ans = -1
            flag = False
	else:
		if i == 0:
          ans = 0
print(ans)


### FIXED CODE ###

import numpy as np
N = int(input())
A = list(map(int,input().split()))
A.sort()
ans = 1

for i in A:
    ans *= i
    if ans > 10**18:
        ans = -1
        print(ans)
        break
else:
    print(ans)
S=input()
A=S[0]+S[1]+S[2]+S[3]
if int(S[5])!=0 and int(S[6]>5):
    print('TBD')
else:
    if int(A)<=2019:
        print('Heisei')
    else:
        print('TBD')

### FIXED CODE ###

S=input()
S=S.split('/')
A=S[0]
if int(S[1])>=5:
    print('TBD')
else:
    if int(A)<=2019:
        print('Heisei')
    else:
        print('TBD')
N = int(input())
A = list(map(int, input().split()))

if abs(A[0]) < abs(A[-1]):
    A = A[::-1]
B = list(map(abs, A))
tmp = A[0] // abs(A[0])
for i in range(1, N):
    if A[i] == 0:
        tmp = 0
        continue
    if tmp < 0:
        tmp = tmp*(A[i] // abs(A[i]))
    else:
        tmp = A[i] // abs(A[i])

if tmp < 0:
    print(sum(B) - 2 * B[-1])
else:
    print(sum(B))


### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
count = 0
A.sort(key=lambda x: abs(x))
for x in A:
    if x < 0:
        count += 1
A = [abs(x) for x in A]
ans = 0
if count % 2 == 0:
    ans = sum(A)
else:
    ans = sum(A[1:]) - A[0]

print(ans)
N,A,B,C,D=map(int,input().split())
for i in range(0,N-1):
    l.append(range(i*C-(N-i)*D,i*D-(N-i)*C+1))

for _ in l:
    if B-A in _:
        print("YES")
        break
else:
    print("NO")

### FIXED CODE ###

N,A,B,C,D=map(int,input().split())
N=N-1
l=[]
for i in range(0,N+1):
    l.append(range(i*C-(N-i)*D,i*D-(N-i)*C+1))

for _ in l:
    if B-A in _:
        print("YES")
        break
else:
    print("NO")
x = map(int,input().split(' '))
print(x[0]*x[1] + ' ' + 2*(x[0]+x[1]))

### FIXED CODE ###

x = map(int,raw_input().split(' '))
print(str(x[0]*x[1]) + ' ' + str(2*(x[0]+x[1])))
from functools import lru_cache
n = int(input())
arr = [int(i) for i in input().strip().split()]

@lru_cache(None)
def cal(i):
    if i>=n-1:
        return 0
    else:
        if i==n-2:
            return cal(i+1)+abs(arr[i]-arr[i+1])

        return min(cal(i+1)+abs(arr[i]-arr[i+1]),cal(i+2)+abs(arr[i]-arr[i+2]))

print(cal(0))

### FIXED CODE ###


from functools import lru_cache
import sys
sys.setrecursionlimit(10**9)
n = int(input())
arr = [int(i) for i in input().strip().split()]

@lru_cache(None)
def cal(i):
    if i>=n-1:
        return 0
    else:
        if i==n-2:
            return cal(i+1)+abs(arr[i]-arr[i+1])

        return min(cal(i+1)+abs(arr[i]-arr[i+1]),cal(i+2)+abs(arr[i]-arr[i+2]))

print(cal(0))
n,y = map(int,input().split())
for i in range(n+1):
  for j in range(n-i+1):
    if y == 10000*i+5000*j+1000*(n-i-j) :
      print(i,l,n-i-j)
      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 i * 10000 + j * 5000 + (n - i - j) * 1000 == y:
            print(i, j, n - i - j)
            exit()
print("-1 -1 -1")
N,M= list(map(int, input().split()))
P = [list(map(int,input().split())) for i in range(M)]
Q = list(map(list, set(map(tuple, P))))
C = []
S = []
n = N -1
sum1 = 0

for s in range(len(Q)):
    C.append(Q[s][0])
for t in range(len(Q)):
    S.append(Q[t][1])
D = list(set(C))
unko = C.index(1)
if len(D) <len(S):
    print("-1")
else:
    for u in range(len(Q)):
        sum1 = sum1 + Q[u][1]*(10 ** (N - Q[u][0]))
    if sum1 > (10 ** n):
        print(sum1)
    elif Q[unko][1] == 0:
        print(sum1 + 10 ** N)
    else:
        print(sum1 + 10 ** n)

### FIXED CODE ###

N,M= list(map(int, input().split()))
P = [list(map(int,input().split())) for i in range(M)]
Q = list(map(list, set(map(tuple, P))))
C = []
S = []
n = N -1
sum1 = 0
 
for s in range(len(Q)):
    C.append(Q[s][0])
for t in range(len(Q)):
    S.append(Q[t][1])
D = list(set(C))
if len(D) <len(S) :
    print("-1")
else:
    if N == 1 and M == 1 and Q[0][1] == 0:
        print("0")
    elif N == 1 and M == 0:
                print("0")
    else:
        for u in range(len(Q)):
            sum1 = sum1 + Q[u][1]*(10 ** (N - Q[u][0]))
        if sum1 >= (10 ** n):
            print(sum1)
        else:
            if D.count(1) >= 1:
                unko = C.index(1)
                if Q[unko][1] == 0:
                    print("-1")
                else:
                    print(sum1 + 10 ** n)
            else:
                print(sum1 + 10 ** n)
str1=input()
ct=0
for i in range(0,3):
  if(str1[i]=='S')
  ct+=1
if(ct==0):
  print(3)
if(ct==3):
  print(0)
if(ct==2):
  print(1)
if(ct==1):
  if(str1[1]=='S'):
    print(1)
  else:
    print(2)

### FIXED CODE ###

str1=input()
ct=0
for i in range(0,3):
    if(str1[i]=='S'):
        ct+=1
if(ct==0):
    print(3)
if(ct==3):
    print(0)
if(ct==2):
    print(1)
if(ct==1):
    if(str1[1]=='S'):
        print(1)
    else:
        print(2)
n, k =map(int, input().split())
data = []
for i in range(k):
    data.append(list(map(int, input().split())))
for i in range(0, 10**n):
    a = str(i)
    tmp = True
    if(len(a) != n):tmp = False
    for i in data:
        data1 = i[0]
        data2 = i[1]
        #print(data1, data2)
        if(a[data1-1] != str(data2)):
            tmp=False
    if(tmp):print(a);exit()
if(n==1):print(0)
else:print(-1)

### FIXED CODE ###

a,b=map(int,input().split())
c2=10**a
if(a==1):c1=0
else:c1=c2//10
v = [-1]*b
for i in range(b):
  n,m=map(int,input().split())
  v[i] = [n,m]
#print(v) 

for i in range(c1,c2):
  p =str(i)
  t=True
  for j in v:
    
    if(int(p[j[0]-1]) != j[1]):
      t=False
      break
  
  if(t):print(i);exit()
  
print(-1)
import itertools
import math
N = int(input())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
L = list(map(list,list(itertools.permutations(list(i for i in range(1,N+1)),N))))
a = L.index(P)
b = L.index(Q)
print(abs(a-b))

### FIXED CODE ###

from itertools import permutations 

N = int(input())
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))

perm = list(permutations(range(1, N+1), N))
print(abs(perm.index(P) - perm.index(Q)))
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())
f=fractions.gcd(a,b)
f2=a*b//f
print(f2)
R, C, K = map(int, input().split(" "))
board = [ [0]*(C+1) for _ in range(R+1) ]
for _ in range(K) :
    i, j, v = map(int, input().split(" "))
    board[i][j] = v

score = [ [ [0]*4 for _ in range(C+1) ] for _ in range(R+1) ] 

for i in range(1, R+1) :
    for j in range(1, C+1) : 
        if board[i][j] == 0 :
            for k in range(4) :
                score[i][j][k] = score[i][j-1][k]    
        else :
            for k in range(3):
                score[i][j][k+1] = score[i][j-1][k] + board[i][j]
        
        descent = max(score[i-1][j])
        score[i][j][1] = max(descent + board[i][j], score[i][j-1][1], score[i][j-1][0]+board[i][j])
        score[i][j][0] = max(descent, score[i][j-1][0])



print(max(score[-1][-1]))


### FIXED CODE ###

s = input()
prev = "R"
res = 0
a = 0
for c in s :
    if c=="R" :
        a+=1
    else :
        a = 0
    res = max(res, a)
print(res)