Codeforces Round 485 (Div. 2)


A. Infinity Gauntlet
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
red
purple
yellow
orange
Output
2
Space
Time
Input
0
Output
6
Time
Mind
Soul
Power
Reality
Space
----------------------------------------------------------------------------------------------------
B. High School: Become Human
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 8
Output
>
Input
10 3
Output
<
Input
6 6
Output
=
----------------------------------------------------------------------------------------------------
C. Three displays
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
2 4 5 4 10
40 30 20 10 40
Output
90
Input
3
100 101 100
2 4 5
Output
-1
Input
10
1 2 3 4 5 6 7 8 9 10
10 13 11 14 15 12 13 13 18 13
Output
33
----------------------------------------------------------------------------------------------------
D. Fair
time limit per test: 2 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
5 5 4 3
1 2 4 3 2
1 2
2 3
3 4
4 1
4 5
Output
2 2 2 2 3 
Input
7 6 3 2
1 2 3 3 2 2 1
1 2
2 3
3 4
2 5
5 6
6 7
Output
1 1 1 2 2 1 1 
----------------------------------------------------------------------------------------------------
E. Petr and Permutations
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
2 4 5 1 3
Output
Petr
----------------------------------------------------------------------------------------------------
F. AND Graph
time limit per test: 4 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 3
1 2 3
Output
2
Input
5 5
5 19 10 20 12
Output
2
----------------------------------------------------------------------------------------------------
