Codeforces Round 349 (Div. 1)


A. Reberland Linguistics
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
abacabaca
Output
3
aca
ba
ca
Input
abaca
Output
0
----------------------------------------------------------------------------------------------------
B. World Tour
time limit per test: 5 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
8 9
1 2
2 3
3 4
4 1
4 5
5 6
6 7
7 8
8 5
Output
2 1 8 7
----------------------------------------------------------------------------------------------------
C. Codeword
time limit per test: 6 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
a
2 2
1 bc
2 5
Output
51
162626
----------------------------------------------------------------------------------------------------
D. Chain Reaction
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
1 1
1 -1
-1 1
-1 -1
1 1
2 2
4 4
6 6
Output
0
1 1
1 -1
-1 1
-1 -1
-1
----------------------------------------------------------------------------------------------------
E. Forensic Examination
time limit per test: 6 seconds
memory limit per test: 768 megabytes
input: standard input
output: standard output

Examples
Input
suffixtree
3
suffixtreesareawesome
cartesiantreeisworsethansegmenttree
nyeeheeheee
2
1 2 1 10
1 3 9 10
Output
1 1
3 4
----------------------------------------------------------------------------------------------------
