Codeforces Round 544 (Div. 3)


A. Middle of the Contest
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
10:00
11:00
Output
10:30
Input
11:10
11:12
Output
11:11
Input
01:02
03:02
Output
02:02
----------------------------------------------------------------------------------------------------
B. Preparation for International Women's Day
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
7 2
1 2 2 3 2 4 10
Output
6
Input
8 2
1 2 2 3 2 4 6 10
Output
8
Input
7 3
1 2 2 3 2 4 5
Output
4
----------------------------------------------------------------------------------------------------
C. Balanced Team
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6
1 10 17 12 15 2
Output
3
Input
10
1337 1337 1337 1337 1337 1337 1337 1337 1337 1337
Output
10
Input
6
1 1000 10000 10 100 1000000000
Output
1
----------------------------------------------------------------------------------------------------
D. Zero Quantity Maximization
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
1 2 3 4 5
2 4 7 11 3
Output
2
Input
3
13 37 39
1 2 3
Output
2
Input
4
0 0 0 0
1 2 3 4
Output
0
Input
3
1 2 -1
-6 -12 6
Output
3
----------------------------------------------------------------------------------------------------
E. K Balanced Teams
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 2
1 2 15 15 15
Output
5
Input
6 1
36 4 1 25 9 16
Output
2
Input
4 4
1 10 100 1000
Output
4
----------------------------------------------------------------------------------------------------
F1. Spanning Tree with Maximum Degree
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 5
1 2
2 3
3 5
4 3
1 5
Output
3 5
2 1
3 2
3 4
Input
4 6
1 2
1 3
1 4
2 3
2 4
3 4
Output
4 1
1 2
1 3
Input
8 9
1 2
2 3
2 5
1 6
3 4
6 5
4 5
2 7
5 8
Output
3 2
2 5
8 5
6 1
2 7
1 2
3 4
----------------------------------------------------------------------------------------------------
F2. Spanning Tree with One Fixed Degree
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 5 1
1 2
1 3
1 4
2 3
3 4
Output
YES
2 1
2 3
3 4
Input
4 5 3
1 2
1 3
1 4
2 3
3 4
Output
YES
1 2
1 3
4 1
Input
4 4 3
1 2
1 4
2 3
3 4
Output
NO
----------------------------------------------------------------------------------------------------
