Codeforces Round 235 (Div. 2)


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

Examples
Input
3 2
-1 1 2
Output
1
Input
2 3
-2 -2
Output
2
----------------------------------------------------------------------------------------------------
B. Sereja and Contests
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 2
2 1
2 2
Output
0 0
Input
9 3
1 2 3
2 8
1 4 5
Output
2 3
Input
10 0
Output
5 9
----------------------------------------------------------------------------------------------------
C. Team
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1 2
Output
101
Input
4 8
Output
110110110101
Input
4 10
Output
11011011011011
Input
1 5
Output
-1
----------------------------------------------------------------------------------------------------
D. Roman and Numbers
time limit per test: 4 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
104 2
Output
3
Input
223 4
Output
1
Input
7067678 8
Output
47
----------------------------------------------------------------------------------------------------
E. Olympic Games
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1 1
1 2 100
Output
6
----------------------------------------------------------------------------------------------------
