Codeforces Beta Round 63 (Div. 2)


A. Young Physicist
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
4 1 7
-2 4 -1
1 -5 -3
Output
NO
Input
3
3 -1 7
-5 2 -4
2 -1 -3
Output
YES
----------------------------------------------------------------------------------------------------
B. Bets
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 4
1 4 20 5
1 3 21 10
3 3 4 30
3 4 4 20
Output
60
Input
8 4
1 5 24 10
2 4 6 15
4 6 30 50
6 7 4 20
Output
105
----------------------------------------------------------------------------------------------------
C. Game
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 3 2 5
desolator
refresher
perseverance
vanguard: desolator 1, refresher 1
maelstorm: perseverance 2
1 desolator
2 perseverance
1 refresher
2 desolator
2 perseverance
Output
1
vanguard 1
2
desolator 1
maelstorm 1
----------------------------------------------------------------------------------------------------
D. Dot
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
0 0 2 3
1 1
1 2
Output
Anton
Input
0 0 2 4
1 1
1 2
Output
Dasha
----------------------------------------------------------------------------------------------------
E. Subsegments
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 3
1
2
2
3
3
Output
1
3
2
Input
6 4
3
3
3
4
4
2
Output
4
Nothing
3
----------------------------------------------------------------------------------------------------
