Codeforces Round 928 (Div. 4)


A. Vlad and the Best of Five
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
8
ABABB
ABABA
BBBAB
AAAAA
BBBBB
BABAA
AAAAB
BAAAA
Output
B
A
B
A
B
A
A
A
----------------------------------------------------------------------------------------------------
B. Vlad and Shapes
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6
3
000
011
011
4
0000
0000
0100
1110
2
11
11
5
00111
00010
00000
00000
00000
10
0000000000
0000000000
0000000000
0000000000
0000000000
1111111110
0111111100
0011111000
0001110000
0000100000
3
111
111
111
Output
SQUARE
TRIANGLE
SQUARE
TRIANGLE
TRIANGLE
SQUARE
----------------------------------------------------------------------------------------------------
C. Vlad and a Sum of Sum of Digits
time limit per test: 0.5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
7
12
1
2
3
1434
2024
200000
Output
51
1
3
6
18465
28170
4600002
----------------------------------------------------------------------------------------------------
D. Vlad and Division
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
9
4
1 4 3 4
2
0 2147483647
5
476319172 261956880 2136179468 1671164475 1885526767
3
1335890506 811593141 1128223362
4
688873446 627404104 1520079543 1458610201
4
61545621 2085938026 1269342732 1430258575
4
0 0 2147483647 2147483647
3
0 0 2147483647
8
1858058912 289424735 1858058912 2024818580 1858058912 289424735 122665067 289424735
Output
4
1
3
2
2
3
2
2
4
----------------------------------------------------------------------------------------------------
E. Vlad and an Odd Ordering
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
11
7 1
7 2
7 3
7 4
7 5
7 6
7 7
1 1
34 14
84 19
1000000000 1000000000
Output
1
3
5
7
2
6
4
1
27
37
536870912
----------------------------------------------------------------------------------------------------
F. Vlad and Avoiding X
time limit per test: 4 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
WWWWWWW
WWWWBBB
WWWWWBW
WWBBBBB
WWWBWWW
WWBBBWW
WWWWWWW
WWWWWWW
WWWWWWW
WBBBBBW
WBBBBBW
WBBBBBW
WWWWWWW
WWWWWWW
WWWWWWW
WWWWWWW
WWWWWWW
WWWWWWW
WWWWWWW
WWWWWWW
WWWWWWW
WBBBBBW
BBBBBBB
BBBBBBB
WWWWWWW
BBBBBBB
BBBBBBB
BBBBBBB
Output
1
2
0
5
----------------------------------------------------------------------------------------------------
G. Vlad and Trouble at MIT
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
3
1 1
CSP
4
1 2 2
PCSS
4
1 2 2
PPSS
Output
1
1
2
----------------------------------------------------------------------------------------------------
