Codeforces Round 189 (Div. 1)


A. 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
----------------------------------------------------------------------------------------------------
B. 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
----------------------------------------------------------------------------------------------------
C. 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
----------------------------------------------------------------------------------------------------
D. Have You Ever Heard About the Word?
time limit per test: 6 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
abccabc
Output
abc
Input
aaaabaaab
Output
ab
Input
birdbirdbirdistheword
Output
birdistheword
----------------------------------------------------------------------------------------------------
E. Ping-Pong
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
----------------------------------------------------------------------------------------------------
