Codeforces Round 941 (Div. 1)


A. Everything Nim
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
7
5
3 3 3 3 3
2
1 7
7
1 3 9 7 4 2 100
3
1 2 3
6
2 1 3 4 2 4
8
5 7 2 9 6 3 3 2
1
1000000000
Output
Alice
Bob
Alice
Alice
Bob
Alice
Alice
----------------------------------------------------------------------------------------------------
B. Missing Subsequence Sum
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
2 2
6 1
8 8
9 3
10 7
Output
1
1
5
2 3 4 5 6
7
1 1 1 1 1 1 1
4
7 1 4 1
4
1 2 8 3
----------------------------------------------------------------------------------------------------
C. Folding Strip
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6
6
101101
1
0
12
110110110011
5
01110
4
1111
2
01
Output
3
1
3
3
1
2
----------------------------------------------------------------------------------------------------
D. Missing Subarray Sum
time limit per test: 5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
7
3
1 2 3 4 1
4
18 2 11 9 7 11 7 2 9
4
5 10 5 16 3 3 13 8 8
4
8 10 4 6 4 20 14 14 6
5
1 2 3 4 5 4 3 2 1 1 2 3 2 1
5
1 1 2 2 2 3 3 3 3 4 5 5 6 8
3
500000000 1000000000 500000000 500000000 1000000000
Output
1 2 1 
7 2 2 7 
3 5 5 3 
6 4 4 6 
1 1 1 1 1 
2 1 2 1 2 
500000000 500000000 500000000 
----------------------------------------------------------------------------------------------------
E. Connected Cubes
time limit per test: 4 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 4 3
3 2 3 1
1 1 1 1
1 3 3 2
Output
13
1 1 2 3
1 3 2 3
2 1 2 3
2 2 2 3
2 3 2 3
3 3 2 3
1 2 2 2
1 2 3 2
1 3 3 2
1 4 3 2
2 4 3 2
3 4 3 2
3 4 2 2
Input
2 2 2
2 1
1 2
Output
9
1 3 1 1
2 3 1 1
3 1 1 1
3 2 1 1
3 3 1 1
1 1 2 2
1 2 2 2
2 1 2 2
2 2 2 2
----------------------------------------------------------------------------------------------------
F. Conference
time limit per test: 4 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
3
1 2
3 4
5 6
Output
6
2
0
Input
5
1 3
1 3
1 3
1 3
1 3
Output
3
2
1
0
0
----------------------------------------------------------------------------------------------------
