Codeforces Round 205 (Div. 2)


A. Domino
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
4 2
6 4
Output
0
Input
1
2 3
Output
-1
Input
3
1 4
2 3
4 4
Output
1
----------------------------------------------------------------------------------------------------
B. Two Heaps
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1
10 99
Output
1
2 1 
Input
2
13 24 13 45
Output
4
1 2 2 1 
----------------------------------------------------------------------------------------------------
C. Find Maximum
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
3 8
10
Output
3
Input
5
17 0 10 2 1
11010
Output
27
----------------------------------------------------------------------------------------------------
D. Queue
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
MFM
Output
1
Input
MMFF
Output
3
Input
FFMMM
Output
0
----------------------------------------------------------------------------------------------------
E. Antichain
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
001
Output
1
Input
110010
Output
3
----------------------------------------------------------------------------------------------------
