Codeforces Round 822 (Div. 2)


A. Select Three Sticks
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
3
1 2 3
4
7 3 7 3
5
3 4 2 1 1
8
3 1 4 1 5 9 2 6
Output
2
4
1
1
----------------------------------------------------------------------------------------------------
B. Bright, Nice, Brilliant
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
1
2
3
Output
1 
1 
1 1 
1 
1 1 
1 0 1 
----------------------------------------------------------------------------------------------------
C. Removing Smallest Multiples
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6
6
111111
7
1101001
4
0000
4
0010
8
10010101
15
110011100101100
Output
0
11
4
4
17
60
----------------------------------------------------------------------------------------------------
D. Slime Escape
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6
7 4
-1 -2 -3 6 -2 -3 -1
3 1
232 -500 -700
7 4
-1 -2 -4 6 -2 -4 -1
8 4
-100 10 -7 6 -2 -3 6 -10
8 2
-999 0 -2 3 4 5 6 7
7 3
7 3 3 4 2 1 1
Output
YES
YES
NO
YES
NO
YES
----------------------------------------------------------------------------------------------------
E. Rectangular Congruence
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
0 0
Output
0 1 
0 0
Input
3
1 1 1
Output
1 2 2
1 1 0
1 0 1
Input
5
1 4 1 2 4
Output
1 0 1 3 4
1 4 3 1 0
2 4 1 0 2
1 2 2 2 2
2 2 0 1 4
----------------------------------------------------------------------------------------------------
F. Zeros and Ones
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6
1 1
5 10
34 211
73 34
19124639 56348772
12073412269 96221437021
Output
1
6
95
20
28208137
48102976088
----------------------------------------------------------------------------------------------------
