Educational Codeforces Round 146 (Rated for Div. 2)


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

Examples
Input
4
5 3
6 1
7 4
8 8
Output
YES
YES
NO
YES
----------------------------------------------------------------------------------------------------
B. Long Legs
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
1 1
1 6
8 4
Output
2
5
6
----------------------------------------------------------------------------------------------------
C. Search in Parallel
time limit per test: 2 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

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

Examples
Input
5
4 2
6 3 13 7
1 2 1 2
3 2
100 101 102
100 99 98
5 0
1 12 4 4 3
12 1 3 3 4
2 50
1000 10
1000000000 1
3 5
1 19 11
49 4 72
Output
2
3
0
1
2
----------------------------------------------------------------------------------------------------
E. Chain Chips
time limit per test: 3 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
10
12 6 12 15 20 8 17 12 15
8
4 10
7 3
6 14
9 9
2 10
3 5
4 11
7 11
Output
126
108
120
108
112
98
98
114
----------------------------------------------------------------------------------------------------
F. Communication Towers
time limit per test: 4 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

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