Codeforces Round 645 (Div. 2)


A. Park Lighting
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
1 1
1 3
2 2
3 3
5 3
Output
1
2
2
5
8
----------------------------------------------------------------------------------------------------
B. Maria Breaks the Self-isolation
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
5
1 1 2 2 1
6
2 3 4 5 6 7
6
1 5 4 5 1 9
5
1 2 3 5 6
Output
6
1
6
4
----------------------------------------------------------------------------------------------------
C. Celex Update
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
1 1 2 2
1 2 2 4
179 1 179 100000
5 7 5 7
Output
2
3
1
1
----------------------------------------------------------------------------------------------------
D. The Best Vacation
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 2
1 3 1
Output
5
Input
3 6
3 3 3
Output
12
Input
5 6
4 2 3 1 3
Output
15
----------------------------------------------------------------------------------------------------
E. Are You Fired?
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
2 -1
2
Output
2
Input
5
2 2 -8
2
Output
-1
Input
6
-2 -2 6
-1
Output
4
----------------------------------------------------------------------------------------------------
F. Tasty Cookie
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
5 7
5 7
Output
SMALL
0
Input
2
1 1
300000 1
Output
BIG
299999
Input
2
10 1
13 14
Output
SMALL
6
RPPPRP
Input
3
1 2 1
2 1 2
Output
IMPOSSIBLE
----------------------------------------------------------------------------------------------------
