Kotlin Heroes: Practice 1


A. Dice Rolling
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
2
13
37
100
Output
1
3
8
27
----------------------------------------------------------------------------------------------------
B. New Year and the Christmas Ornament
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
8 13 9
Output
24
Input
13 3 6
Output
9
----------------------------------------------------------------------------------------------------
C. Letters Rearranging
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
aa
abacaba
xdd
Output
-1
abaacba
xdd
----------------------------------------------------------------------------------------------------
D. Got Any Grapes?
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

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

Examples
Input
6
aabddc
Output
Yes
Input
3
abc
Output
No
Input
3
jjj
Output
Yes
----------------------------------------------------------------------------------------------------
F. Division and Union
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

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