Codeforces Round 839 (Div. 3)


A. A+B?
time limit per test: 2 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
4
4+2
0+0
3+7
8+9
Output
6
0
10
17
----------------------------------------------------------------------------------------------------
B. Matrix Rotation
time limit per test: 2 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
6
1 3
5 7
8 10
3 4
8 10
4 3
6 1
9 2
7 5
4 2
1 2
4 3
Output
YES
YES
NO
YES
YES
NO
----------------------------------------------------------------------------------------------------
C. Different Differences
time limit per test: 2 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
7
5 9
4 12
3 3
3 4
4 4
4 6
8 11
Output
1 3 4 7 8
2 4 7 12
1 2 3
1 3 4
1 2 3 4
2 4 5 6
1 2 3 5 6 7 8 11
----------------------------------------------------------------------------------------------------
D. Absolute Sorting
time limit per test: 2 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
8
5
5 3 3 3 5
4
5 3 4 5
8
1 2 3 4 5 6 7 8
6
10 5 4 3 2 1
3
3 3 1
3
42 43 42
2
100000000 99999999
6
29613295 52036613 75100585 78027446 81409090 73215
Output
4
-1
0
42
2
-1
100000000
40741153
----------------------------------------------------------------------------------------------------
E. Permutation Game
time limit per test: 4 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
4
1 2 4 3
3
2 3 1
5
3 4 5 2 1
6
1 5 6 3 2 4
Output
First
Tie
Second
Tie
----------------------------------------------------------------------------------------------------
F. Copy of a Copy of a Copy
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 3 1
010
111
010
010
101
010
Output
2
2
1 2 2
2 1
Input
4 5 3
00000
01000
11100
01000
00000
01000
10100
01000
00000
01010
10100
01000
00000
01000
10100
01000
Output
3
5
1 2 4
2 2
2 4
1 3 2
2 1
Input
5 3 0
110
010
001
011
001
Output
1
0
----------------------------------------------------------------------------------------------------
G. Gaining Rating
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
7 2 10
3 1 9 2 5 20 8
7 1 10
3 1 9 2 5 20 8
5 10 12
100 1 200 11 300
Output
20
-1
2
----------------------------------------------------------------------------------------------------
