Codeforces Round 701 (Div. 2)


A. Add and Divide
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6
9 2
1337 1
1 1
50000000 4
991026972 997
1234 5678
Output
4
9
2
12
3
1
----------------------------------------------------------------------------------------------------
B. Replace and Keep Sorted
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

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

Examples
Input
9
3 4
2 100
4 3
50 3
12 4
69 420
12345 6789
123456 789
12345678 9
Output
1
0
2
3
5
141
53384
160909
36
----------------------------------------------------------------------------------------------------
D. Multiples and Power Differences
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 2
1 2
2 3
Output
1 2
2 3
Input
2 3
16 16 16
16 16 16
Output
16 32 48
32 48 64
Input
2 2
3 11
12 8
Output
327 583
408 664
----------------------------------------------------------------------------------------------------
E. Move and Swap
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
14
1 1 1 2 3 4 4 5 5 6 7 8 8
2 3 7 7 6 9 5 9 7 3 6 6 5
6
1 2 2 3 4
32 78 69 5 41
15
1 15 1 10 4 9 11 2 4 1 8 6 10 11
62 13 12 43 39 65 42 86 25 38 19 19 43 62
15
11 2 7 6 9 8 10 1 1 1 5 3 15 2
50 19 30 35 9 45 13 24 8 44 16 26 10 40
Output
14
45
163
123
----------------------------------------------------------------------------------------------------
F. Copy or Prefix Sum
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
3
1 -1 1
4
1 2 3 4
10
2 -1 1 -2 2 3 -5 0 2 -1
4
0 0 0 1
Output
3
8
223
1
----------------------------------------------------------------------------------------------------
