Codeforces Round 419 (Div. 2)


A. Karen and Morning
time limit per test: 2 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
05:39
Output
11
Input
13:31
Output
0
Input
23:59
Output
1
----------------------------------------------------------------------------------------------------
B. Karen and Coffee
time limit per test: 2.5 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
3 2 4
91 94
92 97
97 99
92 94
93 97
95 96
90 100
Output
3
3
0
4
Input
2 1 1
1 1
200000 200000
90 100
Output
0
----------------------------------------------------------------------------------------------------
C. Karen and Game
time limit per test: 2 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
3 5
2 2 2 3 2
0 0 0 1 0
1 1 1 2 1
Output
4
row 1
row 1
col 4
row 3
Input
3 3
0 0 0
0 1 0
0 0 0
Output
-1
Input
3 3
1 1 1
1 1 1
1 1 1
Output
3
row 1
row 2
row 3
----------------------------------------------------------------------------------------------------
D. Karen and Test
time limit per test: 2 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
5
3 6 9 12 15
Output
36
Input
4
3 7 5 2
Output
1000000006
----------------------------------------------------------------------------------------------------
E. Karen and Supermarket
time limit per test: 2 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
6 16
10 9
10 5 1
12 2 1
20 18 3
10 2 3
2 1 5
Output
4
Input
5 10
3 1
3 1 1
3 1 2
3 1 3
3 1 4
Output
5
----------------------------------------------------------------------------------------------------
