Codeforces Round 239 (Div. 1)


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

Examples
Input
1 1
Output
NO
Input
5 5
Output
YES
2 1
5 5
-2 4
Input
5 10
Output
YES
-10 4
-2 -2
1 2
----------------------------------------------------------------------------------------------------
B. Long Path
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
1 2
Output
4
Input
4
1 1 2 3
Output
20
Input
5
1 1 1 1 1
Output
62
----------------------------------------------------------------------------------------------------
C. Curious Array
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 1
0 0 0 0 0
1 5 0
Output
1 1 1 1 1
Input
10 2
1 2 3 4 5 0 0 0 0 0
1 6 1
6 10 2
Output
2 4 6 8 10 7 3 6 10 15
----------------------------------------------------------------------------------------------------
D. Largest Submatrix 3
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 3
1 3 1
4 5 6
2 6 1
Output
6
Input
3 4
5 2 3 1
3 3 5 3
4 4 4 5
Output
4
Input
2 6
1 2 3 4 5 6
8 6 7 8 9 1
Output
8
----------------------------------------------------------------------------------------------------
E. k-d-sequence
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

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