Codeforces Round 441 (Div. 2, by Moscow Team Olympiad)


A. Trip For Meal
time limit per test: 1 second
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
3
2
3
1
Output
3
Input
1
2
3
5
Output
0
----------------------------------------------------------------------------------------------------
B. Divisiblity of Differences
time limit per test: 1 second
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
3 2 3
1 8 4
Output
Yes
1 4 
Input
3 3 3
1 8 4
Output
No
Input
4 3 5
2 7 7 7
Output
Yes
2 7 7 
----------------------------------------------------------------------------------------------------
C. Classroom Watch
time limit per test: 1 second
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
21
Output
1
15
Input
20
Output
0
----------------------------------------------------------------------------------------------------
D. Sorting the Coins
time limit per test: 1 second
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
4
1 3 4 2
Output
1 2 3 2 1
Input
8
6 8 3 4 7 2 1 5
Output
1 2 2 3 4 3 4 5 1
----------------------------------------------------------------------------------------------------
E. National Property
time limit per test: 1 second
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
4 3
1 2
1 1
3 1 3 2
2 1 1
Output
Yes
2
2 3 
Input
6 5
2 1 2
2 1 2
3 1 2 3
2 1 5
2 4 4
2 4 4
Output
Yes
0
Input
4 3
4 3 2 2 1
3 1 1 3
3 2 3 3
2 3 1
Output
No
----------------------------------------------------------------------------------------------------
F. High Cry
time limit per test: 1 second
memory limit per test: 512 megabytes
input: standard input
output: standard output

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