Codeforces Round 284 (Div. 2)


A. Watching a movie
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 3
5 6
10 12
Output
6
Input
1 1
1 100000
Output
100000
----------------------------------------------------------------------------------------------------
B. Lecture
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 3
codeforces codesecrof
contest round
letter message
codeforces contest letter contest
Output
codeforces round letter round
Input
5 3
joll wuqrd
euzf un
hbnyiyc rsoqqveh
hbnyiyc joll joll euzf joll
Output
hbnyiyc joll joll un joll
----------------------------------------------------------------------------------------------------
C. Crazy Town
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1 1
-1 -1
2
0 1 0
1 0 0
Output
2
Input
1 1
-1 -1
3
1 0 0
0 1 0
1 1 -3
Output
2
----------------------------------------------------------------------------------------------------
D. Name That Tune
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 2
50 2
10 1
Output
1.500000000
Input
2 2
0 2
100 2
Output
1.000000000
Input
3 3
50 3
50 2
25 2
Output
1.687500000
Input
2 2
0 2
0 2
Output
1.000000000
----------------------------------------------------------------------------------------------------
E. Array and Operations
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 2
8 3 8
1 2
2 3
Output
0
Input
3 2
8 12 8
1 2
2 3
Output
2
----------------------------------------------------------------------------------------------------
