Codeforces Round 113 (Div. 2)


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

Examples
Input
7 2
4 10
4 10
4 10
3 20
2 1
2 1
1 10
Output
3
Input
5 4
3 1
3 1
5 3
3 1
3 1
Output
4
----------------------------------------------------------------------------------------------------
B. Polygons
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

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

Examples
Input
3 10
10 20 30
Output
1
Input
3 4
1 2 3
Output
4
----------------------------------------------------------------------------------------------------
D. Shoe Store
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
10 1
30 2
20 3
2
20 1
20 2
Output
30
2
2 3
1 1
Input
3
10 4
20 5
30 6
2
70 4
50 5
Output
50
2
2 3
1 2
----------------------------------------------------------------------------------------------------
E. Tetrahedron
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
Output
3
Input
4
Output
21
----------------------------------------------------------------------------------------------------
