Codeforces Round 129 (Div. 1)


A. Little Elephant and Interval
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 47
Output
12
Input
47 1024
Output
98
----------------------------------------------------------------------------------------------------
B. Little Elephant and Cards
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
4 7
4 7
7 4
Output
0
Input
5
4 7
7 4
2 11
9 7
1 1
Output
2
----------------------------------------------------------------------------------------------------
C. Little Elephant and Furik and Rubik
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
AB
BA
Output
0.400000000
Input
3
AAB
CAA
Output
0.642857143
----------------------------------------------------------------------------------------------------
D. Little Elephant and Retro Strings
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 2
XXX
Output
0
Input
4 2
XXXX
Output
1
Input
10 2
XXBXXWXXXX
Output
166
----------------------------------------------------------------------------------------------------
E. Little Elephant and Strings
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 1
abc
a
ab
Output
6 1 3 
Input
7 4
rubik
furik
abab
baba
aaabbbababa
abababababa
zero
Output
1 0 9 9 21 30 0 
----------------------------------------------------------------------------------------------------
