Codeforces Round 492 (Div. 2) [Thanks, uDebug!]


A. Hit the Lottery
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
125
Output
3
Input
43
Output
5
Input
1000000000
Output
10000000
----------------------------------------------------------------------------------------------------
B. World Cup
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
2 3 2 0
Output
3
Input
2
10 10
Output
1
Input
6
5 2 6 5 7 4
Output
6
----------------------------------------------------------------------------------------------------
C. Tesla
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 5
1 2 0 4
1 2 0 4
5 0 0 3
0 5 0 3
Output
6
1 1 1
2 1 2
4 1 4
3 4 4
5 3 2
5 4 2
Input
1 2
1
2
1
2
Output
-1
Input
1 2
1
1
2
2
Output
2
1 1 1
2 4 1
----------------------------------------------------------------------------------------------------
D. Suit and Tie
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
1 1 2 3 3 2 4 4
Output
2
Input
3
1 1 2 2 3 3
Output
0
Input
3
3 1 2 3 1 2
Output
3
----------------------------------------------------------------------------------------------------
E. Leaving the Bar
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
999999 0
0 999999
999999 0
Output
1 1 -1 
Input
1
-824590 246031
Output
1 
Input
8
-67761 603277
640586 -396671
46147 -122580
569609 -2112
400 914208
131792 309779
-850150 -486293
5272 721899
Output
1 1 1 1 1 1 1 -1 
----------------------------------------------------------------------------------------------------
F. Game
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 2
0 1 2 3
2 5
0 4
Output
1.500000
2.250000
3.250000
Input
1 0
2 3
Output
2.500000
Input
2 0
1 1 1 1
Output
1.000000
----------------------------------------------------------------------------------------------------
