Codeforces Round 365 (Div. 2)


A. Mishka and Game
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
3 5
2 1
4 2
Output
Mishka
Input
2
6 1
1 6
Output
Friendship is magic!^^
Input
3
1 5
3 3
2 2
Output
Chris
----------------------------------------------------------------------------------------------------
B. Mishka and trip
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 1
2 3 1 2
3
Output
17
Input
5 2
3 5 2 2 4
1 4
Output
71
----------------------------------------------------------------------------------------------------
C. Chris and Road
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 5 1 2
1 2
3 1
4 3
3 4
1 4
Output
5.0000000000
----------------------------------------------------------------------------------------------------
D. Mishka and Interesting sum
time limit per test: 3.5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
3 7 8
1
1 3
Output
0
Input
7
1 2 1 3 3 2 3
5
4 7
4 5
1 3
1 7
1 5
Output
0
3
1
3
2
----------------------------------------------------------------------------------------------------
E. Mishka and Divisors
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

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