Looksery Cup 2015


A. Face Detection
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 4
xxxx
xfax
xcex
xxxx
Output
1
Input
4 2
xx
cf
ae
xx
Output
1
Input
2 3
fac
cef
Output
2
Input
1 4
face
Output
0
----------------------------------------------------------------------------------------------------
B. Looksery Party
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
101
010
001
0 1 2
Output
1
1 
Input
1
1
1
Output
0
Input
4
1111
0101
1110
0001
1 0 1 0
Output
4
1 2 3 4 
----------------------------------------------------------------------------------------------------
C. The Game Of Parity
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 1
1 2 1
Output
Stannis
Input
3 1
2 2 1
Output
Daenerys
Input
6 3
5 20 12 7 14 101
Output
Stannis
----------------------------------------------------------------------------------------------------
D. Haar Features
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6 8
BBBBBBBB
BBBBBBBB
BBBBBBBB
WWWWWWWW
WWWWWWWW
WWWWWWWW
Output
2
Input
3 3
WBW
BWW
WWW
Output
4
Input
3 6
WWBBWW
WWBBWW
WWBBWW
Output
3
Input
4 4
BBBB
BBBB
BBBB
BBBW
Output
4
----------------------------------------------------------------------------------------------------
E. Sasha Circle
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 2
-1 0
1 0
0 -1
0 1
Output
NO
Input
4 4
1 0
0 1
-1 0
0 -1
1 1
-1 1
-1 -1
1 -1
Output
YES
----------------------------------------------------------------------------------------------------
F. Yura and Developers
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 3
1 2 3 4
Output
3
Input
4 2
4 4 7 4
Output
6
----------------------------------------------------------------------------------------------------
G. Happy Line
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
11 8
Output
9 10 
Input
5
10 9 7 10 6
Output
:(
Input
3
12 3 3
Output
4 4 10 
----------------------------------------------------------------------------------------------------
H. Degenerate Matrix
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1 2
3 4
Output
0.2000000000
Input
1 0
0 1
Output
0.5000000000
----------------------------------------------------------------------------------------------------
