Codeforces Round 442 (Div. 2)


A. Alex and broken contest
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
Alex_and_broken_contest
Output
NO
Input
NikitaAndString
Output
YES
Input
Danil_and_Olya
Output
NO
----------------------------------------------------------------------------------------------------
B. Nikita and string
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
abba
Output
4
Input
bab
Output
2
----------------------------------------------------------------------------------------------------
C. Slava and tanks
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
Output
3
2 1 2 
Input
3
Output
4
2 1 3 2 
----------------------------------------------------------------------------------------------------
D. Olya and Energy Drinks
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 4 4
....
###.
....
1 1 3 1
Output
3
Input
3 4 1
....
###.
....
1 1 3 1
Output
8
Input
2 2 1
.#
#.
1 1 2 2
Output
-1
----------------------------------------------------------------------------------------------------
E. Danil and a Part-time Job
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
1 1 1
1 0 0 1
9
get 1
get 2
get 3
get 4
pow 1
get 1
get 2
get 3
get 4
Output
2
0
0
1
2
1
1
0
----------------------------------------------------------------------------------------------------
F. Ann and Books
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 1
1 1 1 2
1 1 1 1
4
1 2
1 3
1 4
3 4
Output
2
3
4
1
Input
4 0
1 2 1 2
0 0 0 0
1
1 4
Output
10
----------------------------------------------------------------------------------------------------
