Codeforces Beta Round 73 (Div. 1 Only)


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

Examples
Input
3 7
Output
Dasha
Input
5 3
Output
Masha
Input
2 3
Output
Equal
----------------------------------------------------------------------------------------------------
B. Vasya and Types
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
typedef void* ptv
typeof ptv
typedef &&ptv node
typeof node
typeof &ptv
Output
void*
errtype
void
Input
17
typedef void* b
typedef b* c
typeof b
typeof c
typedef &b b
typeof b
typeof c
typedef &&b* c
typeof c
typedef &b* c
typeof c
typedef &void b
typeof b
typedef b******* c
typeof c
typedef &&b* c
typeof c
Output
void*
void**
void
void**
errtype
void
errtype
errtype
errtype
----------------------------------------------------------------------------------------------------
C. Interesting Game
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
Output
2
Input
6
Output
-1
Input
100
Output
8
----------------------------------------------------------------------------------------------------
D. Beautiful Road
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
2 1 5
Output
2 1
1 
Input
6
1 2 1
1 3 5
3 4 2
3 5 3
3 6 4
Output
16 1
2 
----------------------------------------------------------------------------------------------------
E. Mogohu-Rea Idol
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
0 0
1 0
1 1
4
8 8
5 5
6 4
8 4
3
-1 -1
-3 -1
-2 -2
5
0 0
2 1
7 1
1 1
5 3
Output
NO
YES
NO
YES
NO
----------------------------------------------------------------------------------------------------
