Codeforces Round 557 (Div. 2) [based on Forethought Future Cup - Final Round]


A. Zoning Restrictions Again
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 3 3
1 1 1
2 2 3
3 3 2
Output
14
Input
4 10 2
2 3 8
3 4 7
Output
262
----------------------------------------------------------------------------------------------------
B. Double Matrix
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 2
2 10
11 5
9 4
3 12
Output
Possible
Input
2 3
2 4 5
4 5 6
3 6 7
8 10 11
Output
Possible
Input
3 2
1 3
2 4
5 10
3 1
3 6
4 8
Output
Impossible
----------------------------------------------------------------------------------------------------
C. Hide and Seek
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 3
5 1 4
Output
9
Input
4 8
1 2 3 4 4 3 2 1
Output
0
Input
100000 1
42
Output
299997
----------------------------------------------------------------------------------------------------
D. Chladni Figure
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
12 6
1 3
3 7
5 7
7 11
9 11
11 3
Output
Yes
Input
9 6
4 5
5 6
7 8
8 9
1 2
2 3
Output
Yes
Input
10 3
1 2
3 2
7 2
Output
No
Input
10 2
1 6
2 7
Output
Yes
----------------------------------------------------------------------------------------------------
E. Thanos Nim
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
8 8
Output
Bob
Input
4
3 1 4 1
Output
Alice
----------------------------------------------------------------------------------------------------
F. Palindrome XOR
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
10110
Output
3
Input
1?0???10
Output
44
Input
1?????????????????????????????????????
Output
519569202
Input
1
Output
0
----------------------------------------------------------------------------------------------------
