Forethought Future Cup - Elimination Round


A. Love "A"
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
xaxxxxa
Output
3
Input
aaabaa
Output
6
----------------------------------------------------------------------------------------------------
B. Hate "A"
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
aaaaa
Output
aaaaa
Input
aacaababc
Output
:(
Input
ababacacbbcc
Output
ababacac
Input
baba
Output
:(
----------------------------------------------------------------------------------------------------
C. Tree Diameter
time limit per test: 4 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
5
9
6
10
9
10
2
99
Output
1 4 1 2 3 4 5
1 4 2 3 4 5 1
1 4 3 4 5 1 2
1 4 4 5 1 2 3
1 4 5 1 2 3 4
-1 10
1 1 1 2
-1 99
----------------------------------------------------------------------------------------------------
D. Frog Jumping
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
7 5 3
Output
19
Input
1000000000 1 2019
Output
500000001500000001
Input
100 100000 1
Output
101
Input
6 4 5
Output
10
----------------------------------------------------------------------------------------------------
E. Hot is Cold
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
11 3
-5 -4 -3 -2 -1 0 1 2 3 4 5
> 2
> -4
< 5
Output
5 4 -3 -2 -1 0 1 2 -3 4 5
Input
5 5
0 1 -2 -1 2
< -2
< -1
< 0
< 1
< 2
Output
0 -1 2 -1 2
----------------------------------------------------------------------------------------------------
F. Leaf Partition
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
1 1 1 1
Output
12
Input
10
1 2 3 4 5 6 7 8 9
Output
1
----------------------------------------------------------------------------------------------------
G. Zoning Restrictions
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 3 3
1 1 1 1000
2 2 3 1000
3 3 2 1000
Output
14
Input
4 10 2
2 3 8 76
3 4 7 39
Output
289
----------------------------------------------------------------------------------------------------
H. Satanic Panic
time limit per test: 4 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
0 0
0 2
2 0
2 2
1 3
Output
1
Input
5
0 0
4 0
0 4
4 4
2 3
Output
0
Input
10
841746 527518
595261 331297
-946901 129987
670374 -140388
-684770 309555
-302589 415564
-387435 613331
-624940 -95922
945847 -199224
24636 -565799
Output
85
----------------------------------------------------------------------------------------------------
