Codeforces Beta Round 94 (Div. 1 Only)


A. Statues
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
.......A
........
........
........
........
........
........
M.......
Output
WIN
Input
.......A
........
........
........
........
........
SS......
M.......
Output
LOSE
Input
.......A
........
........
........
........
.S......
S.......
MS......
Output
LOSE
----------------------------------------------------------------------------------------------------
B. String
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
aa
2
Output
a
Input
abc
5
Output
bc
Input
abab
7
Output
b
----------------------------------------------------------------------------------------------------
C. Games with Rectangle
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 3 1
Output
1
Input
4 4 1
Output
9
Input
6 7 2
Output
75
----------------------------------------------------------------------------------------------------
D. Numbers
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
1 2 3 2
Output
YES
Input
6
1 1 2 2 2 3
Output
YES
Input
6
2 4 1 1 2 2
Output
NO
----------------------------------------------------------------------------------------------------
E. Birthday
time limit per test: 4 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1 1
0 0 1
Output
2
Input
3 1
0 0 1
3 0 1
6 0 1
Output
6
Input
1 3
0 0 1
Output
7
----------------------------------------------------------------------------------------------------
