Codeforces Round 197 (Div. 2)


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

Examples
Input
3+2+1
Output
1+2+3
Input
1+1+3+1+3
Output
1+1+1+3+3
Input
2
Output
2
----------------------------------------------------------------------------------------------------
B. Xenia and Ringroad
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 3
3 2 3
Output
6
Input
4 3
2 3 3
Output
2
----------------------------------------------------------------------------------------------------
C. Xenia and Weights
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
0000000101
3
Output
YES
8 10 8
Input
1000000000
2
Output
NO
----------------------------------------------------------------------------------------------------
D. Xenia and Bit Operations
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 4
1 6 3 5
1 4
3 4
1 2
1 2
Output
1
3
3
3
----------------------------------------------------------------------------------------------------
E. Three Swaps
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

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