VK Cup 2017 - Qualification 2


A. New Password
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 3
Output
java
Input
6 6
Output
python
Input
5 2
Output
phphp
----------------------------------------------------------------------------------------------------
B. Maximize Sum of Digits
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
100
Output
99
Input
48
Output
48
Input
521
Output
499
----------------------------------------------------------------------------------------------------
C. Online Courses In BSU
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6 2
5 3
0
0
0
2 2 1
1 4
1 5
Output
5
1 2 3 4 5 
Input
9 3
3 9 5
0
0
3 9 4 5
0
0
1 8
1 6
1 2
2 1 2
Output
6
1 2 9 4 5 3 
Input
3 3
1 2 3
1 2
1 3
1 1
Output
-1
----------------------------------------------------------------------------------------------------
D. Draw Brackets!
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
8
[[][]][]
Output
+-        -++- -+
|+- -++- -+||   |
||   ||   |||   |
|+- -++- -+||   |
+-        -++- -+
Input
6
[[[]]]
Output
+-     -+
|+-   -+|
||+- -+||
|||   |||
||+- -+||
|+-   -+|
+-     -+
Input
6
[[][]]
Output
+-        -+
|+- -++- -+|
||   ||   ||
|+- -++- -+|
+-        -+
Input
2
[]
Output
+- -+
|   |
+- -+
Input
4
[][]
Output
+- -++- -+
|   ||   |
+- -++- -+
----------------------------------------------------------------------------------------------------
