Codeforces Beta Round 67 (Div. 2)


A. Life Without Zeros
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
101
102
Output
YES
Input
105
106
Output
NO
----------------------------------------------------------------------------------------------------
B. Facetook Priority Wall
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
ahmed
3
ahmed posted on fatma's wall
fatma commented on ahmed's post
mona likes ahmed's post
Output
fatma
mona
Input
aba
1
likes likes posted's post
Output
likes
posted
----------------------------------------------------------------------------------------------------
C. Modified GCD
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
9 27
3
1 5
10 11
9 11
Output
3
-1
9
----------------------------------------------------------------------------------------------------
D. Big Maximum Sum
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 4
3 1 6 -2
2 3 3
2 -5 1
2 3 1 3
Output
9
Input
6 1
4 0 8 -3 -10
8 3 -2 -5 10 8 -9 -5 -4
1 0
1 -3
3 -8 5 6
2 9 6
1
Output
8
----------------------------------------------------------------------------------------------------
E. Ship's Shortest Path
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1 7 6 7
4
4 2 4 12 3 12 3 2
Output
6.000000000
Input
-1 0 2 0
4
0 0 1 0 1 1 0 1
Output
3.000000000
----------------------------------------------------------------------------------------------------
