Codeforces Beta Round 60


A. Harry Potter and Three Spells
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
100 200 250 150 200 250
Output
Ron
Input
100 50 50 200 200 100
Output
Hermione
Input
100 10 200 20 300 30
Output
Hermione
Input
0 0 0 0 0 0
Output
Hermione
Input
1 1 0 1 1 1
Output
Ron
Input
1 0 1 2 1 2
Output
Hermione
Input
100 1 100 1 0 1
Output
Ron
----------------------------------------------------------------------------------------------------
B. Harry Potter and the History of Magic
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
1875
1936
1721
Output
1835
1836
1921
Input
4
9999
2000
3000
3011
Output
1999
2000
2000
2011
Input
3
1999
5055
2000
Output
No solution
----------------------------------------------------------------------------------------------------
C. Harry Potter and the Golden Snitch
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
0 0 0
0 10 0
10 10 0
10 0 0
0 0 0
1 1
5 5 25
Output
YES
25.5000000000
10.0000000000 4.5000000000 0.0000000000
Input
4
0 0 0
0 10 0
10 10 0
10 0 0
0 0 0
1 1
5 5 50
Output
NO
Input
1
1 2 3
4 5 6
20 10
1 2 3
Output
YES
0.0000000000
1.0000000000 2.0000000000 3.0000000000
----------------------------------------------------------------------------------------------------
D. Harry Potter and the Sorting Hat
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
11
G????SS???H
Output
Gryffindor
Ravenclaw
Input
2
H?
Output
Gryffindor
Ravenclaw
Slytherin
----------------------------------------------------------------------------------------------------
E. Harry Potter and Moving Staircases
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6 4
1 2
1 3
2 3
4 5
Output
YES
2
3 1 2 3
2 3 5
3 5 4 5
4 5 6
3 6 5 3
Input
4 1
1 2
Output
NO
Input
5 5
1 2
1 3
3 4
3 5
4 5
Output
YES
0
6 1 2 1 3 4 5
----------------------------------------------------------------------------------------------------
