Codeforces Round 196 (Div. 1)


A. Quiz
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 3 2
Output
3
Input
5 4 2
Output
6
----------------------------------------------------------------------------------------------------
B. Book of Evil
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6 2 3
1 2
1 5
2 3
3 4
4 5
5 6
Output
3
----------------------------------------------------------------------------------------------------
C. Divisor Tree
time limit per test: 0.5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
6 10
Output
7
Input
4
6 72 8 4
Output
12
Input
1
7
Output
1
----------------------------------------------------------------------------------------------------
D. GCD Table
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
100 100 5
5 2 1 2 1
Output
YES
Input
100 8 5
5 2 1 2 1
Output
NO
Input
100 100 7
1 2 3 4 5 6 7
Output
NO
----------------------------------------------------------------------------------------------------
E. Optimize!
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 2 10
5 3
1 8 5 5 7
Output
2
----------------------------------------------------------------------------------------------------
