Codeforces Beta Round 14 (Div. 2)


A. Letter
time limit per test: 1 second
memory limit per test: 64 megabytes
input: standard input
output: standard output

Examples
Input
6 7
.......
..***..
..*....
..***..
..*....
..***..
Output
***
*..
***
*..
***
Input
3 3
***
*.*
***
Output
***
*.*
***
----------------------------------------------------------------------------------------------------
B. Young Photographer
time limit per test: 2 seconds
memory limit per test: 64 megabytes
input: standard input
output: standard output

Examples
Input
3 3
0 7
14 2
4 6
Output
1
----------------------------------------------------------------------------------------------------
C. Four Segments
time limit per test: 2 seconds
memory limit per test: 64 megabytes
input: standard input
output: standard output

Examples
Input
1 1 6 1
1 0 6 0
6 0 6 1
1 1 1 0
Output
YES
Input
0 0 0 3
2 0 0 0
2 2 2 0
0 2 2 2
Output
NO
----------------------------------------------------------------------------------------------------
D. Two Paths
time limit per test: 2 seconds
memory limit per test: 64 megabytes
input: standard input
output: standard output

Examples
Input
4
1 2
2 3
3 4
Output
1
Input
7
1 2
1 3
1 4
1 5
1 6
1 7
Output
0
Input
6
1 2
2 3
2 4
5 4
6 4
Output
4
----------------------------------------------------------------------------------------------------
E. Camels
time limit per test: 2 seconds
memory limit per test: 64 megabytes
input: standard input
output: standard output

Examples
Input
6 1
Output
6
Input
4 2
Output
0
----------------------------------------------------------------------------------------------------
