Codeforces Round 806 (Div. 4)


A. YES or YES?
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
10
YES
yES
yes
Yes
YeS
Noo
orZ
yEz
Yas
XES
Output
YES
YES
YES
YES
YES
NO
NO
NO
NO
NO
----------------------------------------------------------------------------------------------------
B. ICPC Balloons
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6
3
ABA
1
A
3
ORZ
5
BAAAA
4
BKPT
10
CODEFORCES
Output
5
2
6
7
8
17
----------------------------------------------------------------------------------------------------
C. Cypher
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
3
9 3 1
3 DDD
4 UDUU
2 DU
2
0 9
9 DDDDDDDDD
9 UUUUUUUUU
5
0 5 9 8 3
10 UUUUUUUUUU
3 UUD
8 UUDUUDDD
10 UUDUUDUDDU
4 UUUU
Output
2 1 1 
9 0 
0 4 9 6 9 
----------------------------------------------------------------------------------------------------
D. Double Strings
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
5
abab
ab
abc
abacb
c
3
x
xx
xxx
8
codeforc
es
codes
cod
forc
forces
e
code
Output
10100
011
10100101
----------------------------------------------------------------------------------------------------
E. Mirror Grid
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
3
010
110
010
1
0
5
11100
11011
01011
10011
11000
5
01000
10101
01010
00010
01001
5
11001
00000
11111
10110
01111
Output
1
0
9
7
6
----------------------------------------------------------------------------------------------------
F. Yet Another Problem About Pairs Satisfying an Inequality
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
8
1 1 2 3 8 2 1 4
2
1 2
10
0 2 1 6 3 4 1 2 8 3
2
1 1000000000
3
0 1000000000 2
Output
3
0
10
0
1
----------------------------------------------------------------------------------------------------
G. Good Key, Bad Key
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
4 5
10 10 3 1
1 2
1
3 12
10 10 29
12 51
5 74 89 45 18 69 67 67 11 96 23 59
2 57
85 60
Output
11
0
13
60
58
----------------------------------------------------------------------------------------------------
