Codeforces Round 640 (Div. 4)


A. Sum of Round Numbers
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
5009
7
9876
10000
10
Output
2
5000 9
1
7 
4
800 70 6 9000 
1
10000 
1
10 
----------------------------------------------------------------------------------------------------
B. Same Parity Summands
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
8
10 3
100 4
8 7
97 2
8 8
3 10
5 3
1000000000 9
Output
YES
4 2 4
YES
55 5 5 35
NO
NO
YES
1 1 1 1 1 1 1 1
NO
YES
3 1 1
YES
111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111120
----------------------------------------------------------------------------------------------------
C. K-th Not Divisible by n
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6
3 7
4 12
2 1000000000
7 97
1000000000 1000000000
2 1
Output
10
15
1999999999
113
1000000001
1
----------------------------------------------------------------------------------------------------
D. Alice, Bob and Candies
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
7
11
3 1 4 1 5 9 2 6 5 3 5
1
1000
3
1 1 1
13
1 2 3 4 5 6 7 8 9 10 11 12 13
2
2 1
6
1 1 1 1 1 1
7
1 1 1 1 1 1 1
Output
6 23 21
1 1000 0
2 1 2
6 45 46
2 2 1
3 4 2
4 4 3
----------------------------------------------------------------------------------------------------
E. Special Elements
time limit per test: 1 second
memory limit per test: 64 megabytes
input: standard input
output: standard output

Examples
Input
5
9
3 1 4 1 5 9 2 6 5
3
1 1 2
5
1 1 1 1 1
8
8 7 6 5 4 3 2 1
1
1
Output
5
1
0
4
0
----------------------------------------------------------------------------------------------------
F. Binary String Reconstruction
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
7
1 3 5
1 1 1
3 9 3
0 1 0
3 1 2
0 0 3
2 0 0
Output
1110011110
0011
0110001100101011
10
0000111
1111
000
----------------------------------------------------------------------------------------------------
G. Special Permutation
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6
10
2
4
6
7
13
Output
9 6 10 8 4 7 3 1 5 2 
-1
3 1 4 2 
5 3 6 2 4 1 
5 1 3 6 2 4 7 
13 9 7 11 8 4 1 3 5 2 6 10 12 
----------------------------------------------------------------------------------------------------
