Codeforces Round 187 (Div. 1)


A. Sereja and Contest
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 0
5 3 4 1 2
Output
2
3
4
Input
10 -10
5 5 1 7 5 1 2 4 9 2
Output
2
4
5
7
8
9
----------------------------------------------------------------------------------------------------
B. Sereja and Periods
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
10 3
abab
bab
Output
3
----------------------------------------------------------------------------------------------------
C. Sereja and Subsequences
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1
42
Output
42
Input
3
1 2 2
Output
13
Input
5
1 2 3 4 5
Output
719
----------------------------------------------------------------------------------------------------
D. Sereja and Straight Lines
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
0 0
2 0
0 2
2 2
Output
0.000000000000000
Input
4
1 0
0 1
2 1
1 2
Output
1.000000000000000
----------------------------------------------------------------------------------------------------
E. Sereja and Squares
time limit per test: 4 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
a???
Output
50
Input
4
abc?
Output
0
Input
6
abc???
Output
1
----------------------------------------------------------------------------------------------------
