Codeforces Round 189 (Div. 2)


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

Examples
Input
114114
Output
YES
Input
1111
Output
YES
Input
441231
Output
NO
----------------------------------------------------------------------------------------------------
B. Ping-Pong (Easy Version)
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
1 1 5
1 5 11
2 1 2
1 2 9
2 1 2
Output
NO
YES
----------------------------------------------------------------------------------------------------
C. Malek Dance Club
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
11
Output
6
Input
01
Output
2
Input
1
Output
1
----------------------------------------------------------------------------------------------------
D. Psychos in a Line
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
10
10 9 7 8 6 5 3 4 2 1
Output
2
Input
6
1 2 3 4 5 6
Output
0
----------------------------------------------------------------------------------------------------
E. Kalila and Dimna in the Logging Industry
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
1 2 3 4 5
5 4 3 2 0
Output
25
Input
6
1 2 3 10 20 30
6 5 4 3 2 0
Output
138
----------------------------------------------------------------------------------------------------
