Codeforces Round 267 (Div. 2)


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

Examples
Input
3
1 1
2 2
3 3
Output
0
Input
3
1 10
0 10
10 10
Output
2
----------------------------------------------------------------------------------------------------
B. Fedor and New Game
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

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

Examples
Input
5 2 1
1 2 3 4 5
Output
9
Input
7 1 3
2 10 7 18 5 33 0
Output
61
----------------------------------------------------------------------------------------------------
D. Fedor and Essay
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
AbRb r Zz
4
xR abRb
aA xr
zz Z
xr y
Output
2 6
Input
2
RuruRu fedya
1
ruruRU fedor
Output
1 10
----------------------------------------------------------------------------------------------------
E. Alex and Complicated Task
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
3 5 3 5
Output
4
3 5 3 5
Input
10
35 1 2 1 2 35 100 200 100 200
Output
8
1 2 1 2 100 200 100 200
----------------------------------------------------------------------------------------------------
