Codeforces Beta Round 91 (Div. 1 Only)


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

Examples
Input
2 7
Output
33
Input
7 7
Output
7
----------------------------------------------------------------------------------------------------
B. Lucky Transformation
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
7 4
4727447
Output
4427477
Input
4 2
4478
Output
4478
----------------------------------------------------------------------------------------------------
C. Lucky Permutation
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
7 4
Output
1
Input
4 7
Output
1
----------------------------------------------------------------------------------------------------
D. Lucky Segments
time limit per test: 4 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 7
1 4
6 9
4 7
3 5
Output
1
Input
2 7
40 45
47 74
Output
2
----------------------------------------------------------------------------------------------------
E. Lucky Array
time limit per test: 4 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 6
2 3 4
count 1 3
count 1 2
add 1 3 2
count 1 3
add 2 3 3
count 1 3
Output
1
0
1
1
Input
4 5
4 4 4 4
count 1 4
add 1 4 3
count 1 4
add 2 3 40
count 1 4
Output
4
4
4
----------------------------------------------------------------------------------------------------
