Codeforces Round 123 (Div. 2)


A. Let's Watch Football
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 1 1
Output
3
Input
10 3 2
Output
5
Input
13 12 1
Output
1
----------------------------------------------------------------------------------------------------
B. After Training
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 3
Output
2
1
3
2
Input
3 1
Output
1
1
1
----------------------------------------------------------------------------------------------------
C. Try and Catch
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
8
try
    try
        throw ( AE ) 
    catch ( BE, "BE in line 3")
    try
    catch(AE, "AE in line 5") 
catch(AE,"AE somewhere")
Output
AE somewhere
Input
8
try
    try
        throw ( AE ) 
    catch ( AE, "AE in line 3")
    try
    catch(BE, "BE in line 5") 
catch(AE,"AE somewhere")
Output
AE in line 3
Input
8
try
    try
        throw ( CE ) 
    catch ( BE, "BE in line 3")
    try
    catch(AE, "AE in line 5") 
catch(AE,"AE somewhere")
Output
Unhandled Exception
----------------------------------------------------------------------------------------------------
D. Analyzing Polyline
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1
1 0
Output
1
Input
3
1 0
0 2
-1 1
Output
2
Input
3
-2 -4
1 7
-5 1
Output
3
----------------------------------------------------------------------------------------------------
E. Building Forest
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6
0
0
1 2 1
2 1 5 2 2
1 1 2
1 3 4
Output
30
Input
5
0
1 1 5
0
0
2 3 1 4 3
Output
9
----------------------------------------------------------------------------------------------------
