Codeforces Round 227 (Div. 2)


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

Examples
Input
05:50
05:44
Output
00:06
Input
00:00
01:00
Output
23:00
Input
00:01
00:00
Output
00:01
----------------------------------------------------------------------------------------------------
B. George and Round
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 5
1 2 3
1 2 2 3 3
Output
0
Input
3 5
1 2 3
1 1 1 1 1
Output
2
Input
3 1
2 3 4
1
Output
3
----------------------------------------------------------------------------------------------------
C. George and Number
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
9555
Output
4
Input
10000000005
Output
2
Input
800101
Output
3
Input
45
Output
1
Input
1000000000000001223300003342220044555
Output
17
Input
19992000
Output
1
Input
310200
Output
2
----------------------------------------------------------------------------------------------------
D. George and Interesting Graph
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 7
1 1
2 2
3 1
1 3
3 2
2 3
3 3
Output
0
Input
3 6
1 1
2 2
3 1
3 2
2 3
3 3
Output
1
Input
3 1
2 2
Output
6
----------------------------------------------------------------------------------------------------
E. George and Cards
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 2
2 1 3
1 3
Output
1
Input
10 5
1 2 3 4 5 6 7 8 9 10
2 4 6 8 10
Output
30
----------------------------------------------------------------------------------------------------
