Educational Codeforces Round 16


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

Examples
Input
e4
Output
8
----------------------------------------------------------------------------------------------------
B. Optimal Point on a Line
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
1 2 3 4
Output
2
----------------------------------------------------------------------------------------------------
C. Magic Odd Square
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1
Output
1
Input
3
Output
2 1 4
3 5 7
6 9 8
----------------------------------------------------------------------------------------------------
D. Two Arithmetic Progressions
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 0 3 3 5 21
Output
3
Input
2 4 3 0 6 17
Output
2
----------------------------------------------------------------------------------------------------
E. Generate a String
time limit per test: 2 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
8 1 1
Output
4
Input
8 1 10
Output
8
----------------------------------------------------------------------------------------------------
F. String Set Queries
time limit per test: 3 seconds
memory limit per test: 768 megabytes
input: standard input
output: standard output

Examples
Input
5
1 abc
3 abcabc
2 abc
1 aba
3 abababc
Output
2
2
Input
10
1 abc
1 bcd
1 abcd
3 abcd
2 abcd
3 abcd
2 bcd
3 abcd
2 abc
3 abcd
Output
3
2
1
0
----------------------------------------------------------------------------------------------------
