Codeforces Round 291 (Div. 2)


A. Chewbaсca and Number
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
27
Output
22
Input
4545
Output
4444
----------------------------------------------------------------------------------------------------
B. Han Solo and Lazer Gun
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 0 0
1 1
2 2
2 0
-1 -1
Output
2
Input
2 1 2
1 1
1 0
Output
1
----------------------------------------------------------------------------------------------------
C. Watto and Mechanism
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 3
aaaaa
acacaca
aabaa
ccacacc
caaac
Output
YES
NO
NO
----------------------------------------------------------------------------------------------------
D. R2D2 and Droid Army
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 2 4
4 0
1 2
2 1
0 2
1 3
Output
2 2
Input
3 2 4
1 2
1 3
2 2
Output
1 3
----------------------------------------------------------------------------------------------------
E. Darth Vader and Tree
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 3
1 2 3
Output
8
----------------------------------------------------------------------------------------------------
