CodeCraft-19 and Codeforces Round 537 (Div. 2)


A. Superhero Transformation
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
a
u
Output
Yes
Input
abc
ukm
Output
Yes
Input
akm
ua
Output
No
----------------------------------------------------------------------------------------------------
B. Average Superhero Gang Power
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 4 6
4 7
Output
11.00000000000000000000
Input
4 2 6
1 3 2 3
Output
5.00000000000000000000
----------------------------------------------------------------------------------------------------
C. Creative Snap
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 2 1 2
1 3
Output
6
Input
3 2 1 2
1 7
Output
8
----------------------------------------------------------------------------------------------------
D. Destroy the Colony
time limit per test: 2 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
abba
2
1 4
1 2
Output
2
0
Input
AAaa
2
1 2
1 3
Output
2
0
Input
abcd
1
1 3
Output
8
----------------------------------------------------------------------------------------------------
E. Tree
time limit per test: 1.5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

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