Codeforces Round 356 (Div. 1)


A. Bear and Prime 100
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
yes
no
yes
Output
2
80
5
composite
Input
no
yes
no
no
no
Output
58
59
78
78
2
prime
----------------------------------------------------------------------------------------------------
B. Bear and Tower of Cubes
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
48
Output
9 42
Input
6
Output
6 6
----------------------------------------------------------------------------------------------------
C. Bear and Square Grid
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 2
..XXX
XX.XX
X.XXX
X...X
XXXX.
Output
10
Input
5 3
.....
.XXX.
.XXX.
.XXX.
.....
Output
25
----------------------------------------------------------------------------------------------------
D. Bear and Chase
time limit per test: 7 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 3
1 2
1 3
2 3
Output
0.833333333333
Input
5 4
1 2
3 1
5 1
1 4
Output
1.000000000000
Input
4 4
1 2
1 3
2 3
1 4
Output
0.916666666667
Input
5 5
1 2
2 3
3 4
4 5
1 5
Output
0.900000000000
----------------------------------------------------------------------------------------------------
E. Bear and Bad Powers of 42
time limit per test: 5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6 12
40 1700 7 1672 4 1722
3 2 4 42
1 2
1 3
3 2 6 50
1 2
1 4
1 6
2 3 4 41
3 1 5 1
1 1
1 3
1 5
Output
1742
49
1842
1814
1822
43
44
107
----------------------------------------------------------------------------------------------------
