Codeforces Round 674 (Div. 3)


A. Floor Number
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
7 3
1 5
22 5
987 13
Output
3
1
5
77
----------------------------------------------------------------------------------------------------
B. Symmetric Matrix
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6
3 4
1 2
5 6
5 7
7 4
8 9
9 8
2 5
1 1
1 1
2 2
2 2
1 100
10 10
10 10
1 2
4 5
8 4
2 2
1 1
1 1
1 2
3 4
1 2
1 1
1 1
Output
YES
NO
YES
NO
YES
YES
----------------------------------------------------------------------------------------------------
C. Increase and Copy
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
1
5
42
1337
1000000000
Output
0
3
11
72
63244
----------------------------------------------------------------------------------------------------
D. Non-zero Segments
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
1 -5 3 2
Output
1
Input
5
4 -2 3 -9 2
Output
0
Input
9
-1 1 -1 1 -1 1 1 -1 -1
Output
6
Input
8
16 -5 -11 -15 10 5 4 -4
Output
3
----------------------------------------------------------------------------------------------------
E. Rock, Paper, Scissors
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
0 1 1
1 1 0
Output
0 1
Input
15
5 5 5
5 5 5
Output
0 15
Input
3
0 0 3
3 0 0
Output
3 3
Input
686
479 178 29
11 145 530
Output
22 334
Input
319
10 53 256
182 103 34
Output
119 226
----------------------------------------------------------------------------------------------------
F. Number of Subsequences
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6
ac?b?c
Output
24
Input
7
???????
Output
2835
Input
9
cccbbbaaa
Output
0
Input
5
a???c
Output
46
----------------------------------------------------------------------------------------------------
