Codeforces Round 389 (Div. 2, Rated, Based on Technocup 2017 - Elimination Round 3)


A. Santa Claus and a Place in a Class
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 3 9
Output
2 2 L
Input
4 3 24
Output
4 3 R
Input
2 4 4
Output
1 2 R
----------------------------------------------------------------------------------------------------
B. Santa Claus and Keyboard Check
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
helloworld
ehoolwlroz
Output
3
h e
l o
d z
Input
hastalavistababy
hastalavistababy
Output
0
Input
merrychristmas
christmasmerry
Output
-1
----------------------------------------------------------------------------------------------------
C. Santa Claus and Robot
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
RURD
Output
2
Input
6
RRULDD
Output
2
Input
26
RRRULURURUULULLLDLDDRDRDLD
Output
7
Input
3
RLL
Output
2
Input
4
LRLR
Output
4
----------------------------------------------------------------------------------------------------
D. Santa Claus and a Palindrome
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
7 3
abb 2
aaa -3
bba -1
zyz -4
abb 5
aaa 7
xyx 4
Output
12
Input
3 1
a 1
a 2
a 3
Output
6
Input
2 5
abcde 10000
abcde 10000
Output
0
----------------------------------------------------------------------------------------------------
E. Santa Claus and Tangerines
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 2
5 9 3
Output
5
Input
2 4
12 14
Output
6
Input
2 3
1 1
Output
-1
----------------------------------------------------------------------------------------------------
F. Santa Clauses and a Soccer Championship
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6 2
1 2
1 3
2 4
2 5
3 6
2 5 4 6
Output
1
2
5 4 2
6 2 2
----------------------------------------------------------------------------------------------------
