Codeforces Round 220 (Div. 2)


A. Inna and Pink Pony
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 7 1 3 2 2
Output
2
Input
5 5 2 3 1 1
Output
Poor Inna and pony!
----------------------------------------------------------------------------------------------------
B. Inna and Nine
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
369727
Output
2
Input
123456789987654321
Output
1
Input
1
Output
1
----------------------------------------------------------------------------------------------------
C. Inna and Dima
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1 2
DI
Output
Poor Dima!
Input
2 2
MA
ID
Output
Poor Inna!
Input
5 5
DIMAD
DIMAI
DIMAM
DDMAA
AAMID
Output
4
----------------------------------------------------------------------------------------------------
D. Inna and Sequence
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
10 3
1 3 6
-1
1
1
0
0
-1
0
1
-1
1
Output
011
Input
2 1
1
1
-1
Output
Poor stack!
----------------------------------------------------------------------------------------------------
E. Inna and Babies
time limit per test: 6 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 2
2 2
5 5
3 7
5 1
Output
3
Input
3 2
2 2
3 2
6 2
4 2
5 2
Output
1
----------------------------------------------------------------------------------------------------
