Harryxun/stf_run huggingface dataset:
import sys
input = sys.stdin.readline
from collections import Counter


def read():
    N, K = map(int, input().strip().split())
    G = [[] for i in range(N+1)]
    for i in range(N-1):
        a, b = map(int, input().strip().split())
        G[a-1].append(b-1)
        G[b-1].append(a-1)
    return N, K, G


def permute_init(n, MOD):
    factorial = [1 for i in range(n+1)]
    for i in range(1, n+1):
        factorial[i] = factorial[i-1] * i
        factorial[i] %= MOD
    return factorial


def permute(n, r, factorial, MOD):
    """nPr = n! / (n-r)!"""
    if n < 0 or r < 0 or n < r:
        return 0
    return factorial[n] * pow(factorial[n-r], MOD-2, MOD) % MOD


def solve(N, K, G, MOD=10**9+7):
    factorial = permute_init(K, MOD)

    visited = [False for i in range(N)]
    
    def dfs(a=0):
        f = 1
        if a == 0:
            f = permute(K-1, len(G[a]), factorial, MOD)
        else:
            f = permute(K-2, len(G[a])-1, factorial, MOD)
        for b in G[a]:
            if not visited[b]:
                visited[b] = True
                f *= dfs(b)
                f %= MOD
        return f
    
    visited[0] = True
    ans = K * dfs(0) % MOD

    return ans


if __name__ == '__main__':
    inputs = read()
    print("%s" % solve(*inputs))


### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(100000)


def read():
    N, K = map(int, input().strip().split())
    G = [[] for i in range(N+1)]
    for i in range(N-1):
        a, b = map(int, input().strip().split())
        G[a-1].append(b-1)
        G[b-1].append(a-1)
    return N, K, G


def permute_init(n, MOD):
    factorial = [1 for i in range(n+1)]
    for i in range(1, n+1):
        factorial[i] = factorial[i-1] * i
        factorial[i] %= MOD
    return factorial


def permute(n, r, factorial, MOD):
    """nPr = n! / (n-r)!"""
    if n < 0 or r < 0 or n < r:
        return 0
    return factorial[n] * pow(factorial[n-r], MOD-2, MOD) % MOD


def solve(N, K, G, MOD=10**9+7):
    factorial = permute_init(K, MOD)

    visited = [False for i in range(N)]
    
    def dfs(a=0):
        f = 1
        if a == 0:
            f = permute(K-1, len(G[a]), factorial, MOD)
        else:
            f = permute(K-2, len(G[a])-1, factorial, MOD)
        for b in G[a]:
            if not visited[b]:
                visited[b] = True
                f *= dfs(b)
                f %= MOD
        return f
    
    visited[0] = True
    ans = K * dfs(0) % MOD

    return ans


if __name__ == '__main__':
    inputs = read()
    print("%s" % solve(*inputs))
N, X = map(int, input().split())
L = list(map(int, input().split()))

s = 0
i = 1

while s <= X:
    s += L[i-1]
    i += 1

print(i-1)   

### FIXED CODE ###

N, X = map(int, input().split())
L = list(map(int, input().split()))
pref_sum = [0]*(N+1)
ans = 0

for i in range(N):
    pref_sum[i+1] = L[i]+pref_sum[i]



for s in pref_sum:
    if s <= X:
        ans += 1     
print(ans)
n=int(input())
a=list(map(int,input().split()))
cnt=0
for i in range(n):
  while a-1:
    if a%2==0:
      a=a//2
      cnt+=1
    else:break
      
print(cnt)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
cnt=0
for i in range(n):
  k=0
  while 1:
    if a[i]%2==0:
      a[i]=a[i]//2
      k+=1
    else:break
  cnt+=k    
print(cnt)
from sys import stdin

li = list(map(int,stdin.readline().rstrip.split()))

if li[1] > li[2]:
    print(li[0]*li[1])
else:
    print(li[0]*li[2])
    

### FIXED CODE ###

from sys import stdin
li = list(map(int,stdin.readline().rstrip().split()))
if li[1]*li[0] > li[2]:
    print(li[2])
else:
    print(li[0]*li[1])
N = int(input())
C = [-1]

prev = -1
for _ in range(N):
    c = int(input())
    if c == prev:
        continue
    else:
        C.append(c)
        prev = c

MOD = 10**9+7
n = len(C)
dp = [0]*(n+2)
last = [-1]*(N+N)
dp[0] = 1
for i in range(1, n+1):
    if last[C[i]] == -1:
        last[C[i]] = i
        dp[i] = dp[i-1]
    else:
        dp[i] = dp[i-1]+dp[last[C[i]]]
        dp[i] %= MOD
        last[C[i]] = i
print(max(dp))


### FIXED CODE ###

N = int(input())
C = [-1]

for _ in range(N):
    c = int(input())
    if c == C[-1]:
        continue
    else:
        C.append(c)

MOD = 10**9+7
dp = 1
prev = [0]*(max(C)+1)

for c in C[1:]:
    dp = (dp+prev[c]) % MOD
    prev[c] = dp
print(dp)
# -*- coding: utf-8 -*-
#グローバル変数
pn_list = {2:0,3:0}

def next_pn():
    npn = list(pn_list.keys())[-1] + 2
    pn_flg = 0
    while pn_flg == 0:
        for i in pn_list.keys():
            if npn % i > 0:
                pn_flg += 1
        if pn_flg == len(pn_list.keys()):
            break # 素数が見つかったらbreak
        else:
            npn += 2
            pn_flg = 0
    pn_list[npn] = 0
    return npn

def check_a(n,a):
    res = "ok"
    for i in range(n):
        if a[i] > 1:
            res = "notyet"
    return res

# 整数の入力
n = int(input())
s = input()
#n = 3
#s ="1000000 999999 999998"
a = [int(x) for x in s.split()]
aa = [int(x) for x in s.split()]

#素数作成
sqr_max_a = int((1.0 * 10**6) ** 0.5) + 1
pn = 0
while pn < sqr_max_a:
    pn = next_pn()

# a を素因数分解する
for i in pn_list.keys():
    wareta = 1
    while wareta == 1:
        wareta = 0
        for j in range(len(a)):
            if a[j] % i == 0:
                a[j] = a[j] / i
                wareta = 1
        if wareta == 1:
            pn_list[i] += 1
    if check_a(n,a) == "ok":
        break

lcm = 1.0
for i in pn_list.keys():
    lcm = lcm * (i ** pn_list[i])

min_bsum = 0.0
for i in aa:
    min_bsum += lcm / i

print(int(min_bsum % (10**9+7)))

### FIXED CODE ###

# -*- coding: utf-8 -*-
#グローバル変数
pn_list = [2,3]

def next_pn(pn):
    npn = pn + 2
    pn_flg = 0
    while pn_flg == 0:
        for i in pn_list:
            if npn % i == 0:
                break
            if (i ** 2) > npn:
                pn_flg = 1
                break
        if pn_flg == 1:
            break # 素数が見つかったらbreak
        else:
            npn += 2
    pn_list.append(npn)
    return npn

# 整数の入力
n = int(input())
s = input()
a = [int(x) for x in s.split()]
aa = [int(x) for x in s.split()]

#素数作成
sqr_max_a = int((1.0 * 10**6) ** 0.5) + 1
#sqr_max_a = int(1.0 * 10**6)
pn = 3
while pn < sqr_max_a:
    pn = next_pn(pn)

# a を素因数分解する
lcm = int(1)
for i in pn_list:
    wareta = 1
    while wareta == 1:
        wareta = 0
        for j in range(n):
            if a[j] % i == 0:
                a[j] = a[j] // i
                wareta = 1
        if wareta == 1:
            lcm = lcm * i
pn_lcm = []
for i in a:
    if i > 1:
        if i not in pn_lcm:
            pn_lcm.append(i)
            lcm = lcm * i

min_bsum = int(0)
for i in aa:
    min_bsum = min_bsum + lcm // i

print(min_bsum % (10**9+7))
def insertionSort( nums, n, g ):
	cnt = 0
	for i in range( g, n):
		v = nums[i]
		j = i - g
		while ( 0 <= j ) and ( v < nums[j] ):
			nums[ j+g ] = nums[j]
			j -= g
			cnt += 1
		nums[ j+g ] = v
	return cnt
		
def shellSort( nums, n ):
	cnt = 0
	g = []
	v = 1
	while v <= n:
		g.append( v )
		v = 3*v+1     
	g.reverse( )
	m = len( g )
	print( m )
	print( " ".join( map( str, g ) ) )	
	for i in range( m ):
		cnt += insertionSort( nums, n, g[i] )
	print( cnt )
 
n = int( input( ) )
nums = []
for i in range( n ):
	nums.append( int( input( ) ) )

shellSort( nums, n )
for v in nums:
	print( v )

### FIXED CODE ###

import sys
 
def insertionSort( nums, n, g ):
    cnt = 0
    i = g
    while i < n:
        v = nums[i]
        j = i - g
        while 0 <= j and v < nums[j]:
            nums[ j+g ] = nums[j]
            j -= g
            cnt += 1
        nums[ j+g ] = v
        i += 1
    return cnt
         
def shellSort( nums, n ):
    g = []
    val = 1
    while val <= n:
        g.append( val )
        val = 3*val+1
     
    g.reverse( )
    m = len( g )
    print( m )
    print( " ".join( map( str, g ) ) )
    cnt = 0
    for i in range( m ):
        cnt += insertionSort( nums, n, g[i] )
    print( cnt )
     
n = int( sys.stdin.readline( ) )
nums = []
for i in range( n ):
    nums.append( int( sys.stdin.readline( ) ) )
 
shellSort( nums, n )
print( "\n".join( map( str, nums ) ) )
N, A, B = [int(input()) for i in range(3)]
count = 0

for n in range(1:N+1):
  d = str(n)
  x = list(map(int, d))
  y = sum(x)
  
  if A <= y <= B:
    count += 1

print(count)

### FIXED CODE ###

N, A, B = map(int, input().split())
count = 0

for n in range(1,N+1):
  d = str(n)
  x = list(map(int, d))
  y = sum(x)
  
  if A <= y <= B:
    count += n

print(count)
li = list(map(int,input().split()))
li1 = []
for i in range(len(list)):
  li1.append(li[i]+li[i+1])
  li1.append(li[i]*li[i+1])
  li1.append(li[i]-li[i+1])
print(max(li1))


### FIXED CODE ###

li = list(map(int,input().split()))
li1 = [li[0] + li[1], li[0] * li[1], li[0] - li[1]]
print(max(li1))
from math import floor
nk = input()
n, k = nk.split()
n = int(n)
k = int(k)

an = input()
an_list = an.split()
min = min(an_list)

min_ind = an_list.index(min) + 1
after = (n - min_ind) / (k-1)
before = (min_ind - 1) / (k-1)

res = 0

if min_ind < k or (n - min_ind) > (k-1):
    res = floor(n/(k-1)) 

else:
    if after.is_integer():
    res = res + after
    else:
    res = res + floor(after) + 1

    if before.is_integer():
    res = res + before
    else:
    res = res + floor(before) + 1


print(int(res))

### FIXED CODE ###

N, K = map(int,input().split())
A = list(map(int, input().split()))
if (N-1) % (K-1) == 0:
	print((N-1)//(K-1))
else:
  	print((N-1)//(K-1)+1)
N = int(input())
A = list(map(int, input().split()))

cnt =0

while True:
    if [i for i in A if i%2 == 1]:
        break
    A = [i/2 for i in A if i%2 ==0]
    cnt += 1
    
prnt(cnt)


### FIXED CODE ###

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

cnt =0

while True:
    if [i for i in A if i%2 == 1]:
        break
    A = [i/2 for i in A if i%2 ==0]
    cnt += 1

print(cnt)
import copy


def move(C, S):
    newC = copy.copy(C)
    for i, s in enumerate(S):
        if s == "L":
            newC[i - 1] += C[i]
        else:
            newC[i + 1] += C[i]
        newC[i] -= C[i]
        # print(C, newC)
    return newC


def main():
    S = input()
    N = len(S)
    C = [1] * N
    Cs = []
    Cs.append(C)
    init = 0
    cnt = 0
    while True:
        C = move(C, S)
        cnt += 1
        if C in Cs:
            init = Cs.index(C)
            cnt -= init
            Cs = Cs[init - 1:]
            break
        Cs.append(C)
    # print(init, cnt)
    # print(Cs)
    print(' '.join([str(c) for c in Cs[(10**100 - init) % cnt + 1]]))


if __name__ == "__main__":
    main()

### FIXED CODE ###

import copy


def move(C, S):
    newC = copy.copy(C)
    for i, s in enumerate(S):
        if s == "L":
            newC[i - 1] += C[i]
        else:
            newC[i + 1] += C[i]
        newC[i] -= C[i]
        # print(C, newC)
    return newC


def main():
    S = input()
    N = len(S)
    C = [0] * N

    odd_cnt, even_cnt = 0, 0
    for i, s in enumerate(S):
        if s == 'R':
            if (i + 1) % 2 == 0:
                even_cnt += 1
            else:
                odd_cnt += 1
        else:
            if (i + 1) % 2 == 0:
                C[i] += even_cnt
                C[i - 1] += odd_cnt
                odd_cnt, even_cnt = 0, 0
            else:
                C[i] += odd_cnt
                C[i - 1] += even_cnt
                odd_cnt, even_cnt = 0, 0
        # print(i, S, odd_cnt, even_cnt, C)

    C = list(reversed(C))
    odd_cnt, even_cnt = 0, 0
    for i, s in enumerate(reversed(S)):
        if s == 'L':
            if (i + 1) % 2 == 0:
                even_cnt += 1
            else:
                odd_cnt += 1
        else:
            if (i + 1) % 2 == 0:
                C[i] += even_cnt
                C[i - 1] += odd_cnt
                odd_cnt, even_cnt = 0, 0
            else:
                C[i] += odd_cnt
                C[i - 1] += even_cnt
                odd_cnt, even_cnt = 0, 0
        # print(i, ''.join(list(reversed(S))), odd_cnt, even_cnt,
        #       list(reversed(C)))

    C = reversed(C)
    print(' '.join([str(c) for c in C]))


if __name__ == "__main__":
    main()
s = int(input())
cnt = 0
for s1, s2 in zip(s, s[::-1]):
    if s1 != s2:
        cnt += 1
print(cnt // 2)

### FIXED CODE ###

s = input()
cnt = 0
for s1, s2 in zip(s, s[::-1]):
    if s1 != s2:
        cnt += 1
print(cnt // 2)
n = int(input())

if n < 1000:
    input("ABC")
else:
    input("ABD")


### FIXED CODE ###

n = int(input())

if n < 1000:
    print("ABC")
else:
    print("ABD")
A = 25 - int(input()) # 0,1,2,3
X = [0] * (10 ** 8 * (A*2+1))

### FIXED CODE ###

D = int(input())
if D == 25:
    print("Christmas")
elif D == 24:
    print("Christmas Eve")
elif D == 23:
    print("Christmas Eve Eve")
else:
    print("Christmas Eve Eve Eve")
# coding:utf-8

import sys
import math
from collections import defaultdict

INF = float('inf')
MOD = 10 ** 9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()


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


n, a, b = LI()
V = LI()
V.sort()
V.reverse()

cnt = defaultdict(int)
sum_v = 0
for i in range(a):
    sum_v += V[i]
    cnt[V[i]] += 1

# 大きい順にa個選ぶ場合，価値の平均値は最大となる
print(sum_v / a)

# a個選んだ中で一番価値の低いものがいくつ残っているか数える
min_v = V[i]
min_cnt = cnt[min_v]
for i in range(a, n):
    v = V[i]
    if v != min_v:
        break
    cnt[v] += 1

if cnt[min_v] == min_cnt:
    print(1)
    exit()
elif len(cnt.keys()) != 1:
    print(cnt[min_v])
    exit()
ans = 0
for i in range(b - a + 1):
    ans += comb(cnt[min_v], min_cnt + i)

print(ans)


### FIXED CODE ###

# coding:utf-8

import sys
import math
from collections import defaultdict

INF = float('inf')
MOD = 10 ** 9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()


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


n, a, b = LI()
V = LI()
V.sort()
V.reverse()

cnt = defaultdict(int)
sum_v = 0
for i in range(a):
    sum_v += V[i]
    cnt[V[i]] += 1

# 大きい順にa個選ぶ場合，価値の平均値は最大となる
print(sum_v / a)

# a個選んだ中で一番価値の低いものがいくつ残っているか数える
min_v = V[i]
min_cnt = cnt[min_v]
for i in range(a, n):
    v = V[i]
    if v != min_v:
        break
    cnt[v] += 1

if cnt[min_v] == min_cnt:
    print(1)
    exit()
elif len(cnt.keys()) != 1:
    print(comb(cnt[min_v], min_cnt))
    exit()
ans = 0
for i in range(b - a + 1):
    if cnt[min_v] < min_cnt + i:
        break
    ans += comb(cnt[min_v], min_cnt + i)

print(ans)
while True:
    s = input()
    if s == "":
        break
    joi = 0
    ioi = 0
    for i in range(len(s) - 2):
        x = s[i] + s[i + 1] + s[i + 2]
        if (x == "JOI"):
            joi += 1
        elif (x == "IOI"):
            ioi += 1
    print(joi)
    print(ioi)

### FIXED CODE ###

while True:
    try:
        s = input()
    except:
        break
    joi = 0
    ioi = 0
    for i in range(len(s) - 2):
        x = s[i] + s[i + 1] + s[i + 2]
        if x == "JOI":
            joi += 1
        if x == "IOI":
            ioi += 1
    print(joi)
    print(ioi)
S = input()
if S == Sunny:
  N = Cloudy
elif S == Cloudy:
  N = Rainy
elif S == Rainy:
  N = Sunny
  
print(N)


### FIXED CODE ###

S = input()
if S == 'Sunny':
  N = 'Cloudy'
elif S == 'Cloudy':
  N = 'Rainy'
elif S == 'Rainy':
  N = 'Sunny'
  
print(N)
import math
from fractions import *
a,b,c,d=map(int,input().split())

def lcm(a,b):
    return a * b // math.gcd(a, b)

def f(a,b,c):
    return (b - a + 1) // c + (1 if b % c <= a % c else 0)

if c != 1 and d != 1:
    if c != d:
        print ((b-a+1) - (b // c - ceil(a / c) + 1) - (b // d - ceil(a / d) + 1) + (b // lcm(c, d) - ceil(a / lcm(c, d)) + 1))
    else:
        print ((b - a + 1) - f(a, b, c))
else:
    print (0)

### FIXED CODE ###

from math import *
from fractions import *
a,b,c,d=map(int,input().split())

def lcm(a,b):
    return a * b // gcd(a, b)

def f(a,b,c):
    return (b - a + 1) // c + (1 if b % c <= a % c else 0)

if c != 1 and d != 1:
    print ((b-a+1) - (b // c - ceil(a / c) + 1) - (b // d - ceil(a / d) + 1) + (b // lcm(c, d) - ceil(a / lcm(c, d)) + 1))
else:
    print (0)
A,B,C,X,Y = map(int,input().split(' '))
MIN = float('inf')

for i in range(10**5):
  sum = C*2*i + max(0,X-i)*A + max(0,Y-i)*B
  MIN = min(MIN,sum)
print(MIN)
  
    

### FIXED CODE ###

S = input()

topping = S.count('o')

print(700 + int(topping)*100)
N,M,K = list(map(int,input().split()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))

i_a = 0
i_b = 0

total_time = 0

while True:
    if i_a == N and i_b == M:
        break
    else:
        if i_a == N:
            read_a = False:
        elif i_b ==M:
            read_a = True:
        elif A[i_a] <= B[i_b]:
            read_a = True
    
    if read_a:
        if A[i_a] <= K - total_time:
            total_time += A[i_a]
            i_a += 1
        else:
            break
    else:
        if B[i_b] <= K - total_time:
            total_time += B[i_b]
            i_b += 1
        else:
            break

print(int(i_a+i_b))

### FIXED CODE ###

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

a = [0]*(N+1)
b = [0]*(M+1)

for i in range(N):
    a[i+1] = a[i] + A[i]
for j in range(M):
    b[j+1] = b[j] + B[j]

n_b = M
best = 0

for n_a in range(N+1):
    if K < a[n_a]:
        break

    while  K < a[n_a] + b[n_b]:
        n_b -= 1

    best = max(n_a + n_b,best)

print(int(best))
N,M = map(int,input().split())
print("Yes" if N==M : "No")

### FIXED CODE ###

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

print("Yes" if N==M else "No")
import sys
from io import StringIO
import unittest
def resolve():
    S = input()
    a = 0
    for i in range(len(S) - 1):
        if (S[i] == S[i + 1]):
            a = 1
    if (a == 0):
        print("Good")
    else:
        print("Bad")
resoluve()

### FIXED CODE ###

import sys
from io import StringIO
import unittest
def resolve():
    S = input()
    a = 0
    for i in range(len(S) - 1):
        if (S[i] == S[i + 1]):
            a = 1
    if (a == 0):
        print("Good")
    else:
        print("Bad")
resolve()
n,d = map(int,input().split())
l = [list(map(int,input().split()))for _ in range(n)]
ans = 0
for i in raneh(n):
    for j in range(i+1,n):
        r = 0
        for k in range(d):
            r += (l[i][k]-l[j][k])**2
            r = r**0.5
            if r == int(r):
                ans += 1
print(ans)

### FIXED CODE ###

n,*l, = [list(map(int,s.split()))for s in open(0)]
cnt = 0
for i in range(len(l)-1):
    for j in range(i+1,len(l)):
        dist = 0
        for d in range(n[1]):
            dist += (l[i][d] - l[j][d])**2
        if (dist**(0.5))%1 ==0:
            cnt += 1
print(cnt)
N = int(input())
A = list(map(int, input().split()))

ans = 10**8 
sum_A = sum(A)
t = 0


for i in range(N-1):
  hoge = hoge + A[i]
  ans = min(ans,abs(sum_A - (hoge*2)))

print(ans)

### FIXED CODE ###

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

ans = float('inf')
sum_A = sum(A)
hoge = 0


for i in range(N-1):
  hoge = hoge + A[i]
  ans = min(ans,abs(sum_A - (hoge*2)))

print(ans)
#! /usr/bin/env python3
# -*- coding:utf-8 -*-

def generate_children(num_children, pl):
    children = ["0"]*num_children
    if num_children == 0: return []
    if num_children%2 == 0:
        children[pl-1] = str(int(num_children/2))
        children[pl] = str(int(num_children/2))
    else:
        if (num_children - pl)%2 == 0:
            children[pl-1] = str(int((num_children+1)/2))
            children[pl] = str(int((num_children-1)/2))
        else:
            children[pl-1] = str(int((num_children-1)/2))
            children[pl] = str(int((num_children+1)/2))
    return children


def gathering(s):
    children = []
    pr = 0
    pl = 0
    now = ""
    for i, x in enumerate(s):
        if i == len(s)-1:
            children.extend(generate_children(i+1-pr, pl-pr))
        if x == now: continue
        if x == 'L': pl = i
        if x == 'R':
            children.extend(generate_children(i-pr, pl-pr))
            pr = i
        now = x
    return ' '.join(children)

def main():
    s = int(input())
    print(gathering(s))

if __name__ == '__main__':
    main()


### FIXED CODE ###

#! /usr/bin/env python3
# -*- coding:utf-8 -*-

def generate_children(num_children, pl):
    children = ["0"]*num_children
    if num_children == 0: return []
    if num_children%2 == 0:
        children[pl-1] = str(int(num_children/2))
        children[pl] = str(int(num_children/2))
    else:
        if (num_children - pl)%2 == 0:
            children[pl-1] = str(int((num_children+1)/2))
            children[pl] = str(int((num_children-1)/2))
        else:
            children[pl-1] = str(int((num_children-1)/2))
            children[pl] = str(int((num_children+1)/2))
    return children


def gathering(s):
    children = []
    pr = 0
    pl = 0
    now = ""
    for i, x in enumerate(s):
        if x == now: continue
        if x == 'L': pl = i
        if x == 'R':
            children.extend(generate_children(i-pr, pl-pr))
            pr = i
        now = x
    children.extend(generate_children(len(s)-pr, pl-pr))
    return ' '.join(children)

def main():
    s = input()
    print(gathering(s))

if __name__ == '__main__':
    main()
input(S)
if S="SUN":
  print(7)
elif S="MON":
  print(6)
elif S="TUE":
  print(5)
elif S="WED":
  print(4)
elif S="THU":
  print(3)
elif S="FRI":
  print(2)
elif S="SAT":
  print(1)

### FIXED CODE ###

S=input()
if S=="SUN":
  print("7")
elif S=="MON":
  print("6")
elif S=="TUE":
  print("5")
elif S=="WED":
  print("4")
elif S=="THU":
  print("3")
elif S=="FRI":
  print("2")
elif S=="SAT":
  print("1")
from functools import reduce

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

end = max(a)
ansAry = []

b = min(a)
while(True):
    suma = []
    for i in range(0,len(a)):
        if b == a[i]:
            pass
        else:
            suma.append((a[i] - b)*(a[i] - b))
    ansAry.append(reduce(lambda x,y:x+y,suma))
    b += 1
    if b == end:
        break

print(min(ansAry))

### FIXED CODE ###

from functools import reduce

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

end = max(a)
ansAry = []

b = min(a)
while(True):
    suma = []
    for i in range(0,len(a)):
        if b == a[i]:
            pass
        else:
            suma.append((a[i] - b)*(a[i] - b))

    try:
        ansAry.append(reduce(lambda x,y:x+y,suma))
    except:pass

    if b == end:
        break
    b += 1

if len(ansAry) > 0:
    print(min(ansAry))
else:
    print(0)
n=int(input())
dict={}
for i in range(n):
    s=input()
    if s in dict_keys:
        dict[s]=1
    else:
        dict[s]+=1
items_sorted = sorted(dict.items(), key = lambda x : x[1])
value=items_sorted[0][0]
i=0
while(1):
    if items_sorted[i][0]==value:
        print(items_sorted[i][1])
    else:
        break

### FIXED CODE ###

import collections

N = int(input())
l = []
 
for _ in range(N):
    s = str(input())
    l.append(s)

c = collections.Counter(l)
c = c.most_common()
 
most_count = c[0][1]
c.sort()
 
for i in range(len(c)):
    if c[i][1] == most_count:
        print(c[i][0])