Codeforces Round 736 (Div. 2)


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

Examples
Input
2
17
5
Output
3 5
2 4
----------------------------------------------------------------------------------------------------
B. Gregor and the Pawn Game
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
3
000
111
4
1111
1111
3
010
010
5
11001
00000
Output
3
4
0
0
----------------------------------------------------------------------------------------------------
C. Web of Lies
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 3
2 1
1 3
3 4
4
3
1 2 3
2 3 1
3
Output
2
1
Input
4 3
2 3
3 4
4 1
1
3
Output
1
----------------------------------------------------------------------------------------------------
D. Integers Have Friends
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
5
1 5 2 4 6
4
8 2 5 10
2
1000 2000
8
465 55 3 54 234 12 45 78
Output
3
3
2
6
----------------------------------------------------------------------------------------------------
E. The Three Little Pigs
time limit per test: 1 second
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
2 3
1
5
6
Output
9
6
1
Input
5 4
2
4
6
8
Output
225
2001
6014
6939
----------------------------------------------------------------------------------------------------
F1. Gregor and the Odd Cows (Easy)
time limit per test: 6 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
0 0
2 0
0 4
Output
1
Input
5
0 0
2 16
30 14
4 6
2 10
Output
3
----------------------------------------------------------------------------------------------------
F2. Gregor and the Odd Cows (Hard)
time limit per test: 6 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
0 0
2 0
0 4
Output
1
Input
4
1 8
0 6
5 2
5 6
Output
1
Input
10
170 59
129 54
5 98
129 37
58 193
154 58
24 3
13 138
136 144
174 150
Output
29
----------------------------------------------------------------------------------------------------
