Codeforces Beta Round 42 (Div. 2)


A. Football
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1
ABC
Output
ABC
Input
5
A
ABA
ABA
A
A
Output
A
----------------------------------------------------------------------------------------------------
B. Letter
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
Instead of dogging Your footsteps it disappears but you dont notice anything
where is your dog
Output
NO
Input
Instead of dogging Your footsteps it disappears but you dont notice anything
Your dog is upstears
Output
YES
Input
Instead of dogging your footsteps it disappears but you dont notice anything
Your dog is upstears
Output
NO
Input
abcdefg hijk
k j i h g f e d c b a
Output
YES
----------------------------------------------------------------------------------------------------
C. Lucky Tickets
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
123 123 99
Output
1
Input
6
1 1 1 23 10 3
Output
1
----------------------------------------------------------------------------------------------------
D. Journey
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 2
Output
0
1 1
1 2
2 2
2 1
1 1
Input
3 3
Output
1
3 3 1 1
1 1
1 2
1 3
2 3
2 2
2 1
3 1
3 2
3 3
1 1
----------------------------------------------------------------------------------------------------
E. Race
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 33
2 5 1 2 14
1 3 11
Output
1
Input
2 33
2 1 3 10 3
1 11 3
Output
0
Input
5 33
2 1 3 3 10
1 11 3
2 5 3 3 6
2 3 1 10 3
2 6 3 3 5
Output
2
----------------------------------------------------------------------------------------------------
