Codeforces Beta Round 23


A. You're Given a String...
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
abcd
Output
0
Input
ababa
Output
3
Input
zzz
Output
2
----------------------------------------------------------------------------------------------------
B. Party
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1
3
Output
1
----------------------------------------------------------------------------------------------------
C. Oranges and Apples
time limit per test: 1.5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
2
10 15
5 7
20 18
1
0 0
Output
YES
1 3
YES
1
----------------------------------------------------------------------------------------------------
D. Tetragon
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
1 1 2 2 3 3
0 1 1 0 2 2
9 3 7 9 9 8
Output
NO
YES
3.5 1.5 0.5 2.5 -0.5 -0.5 2.5 0.5
NO
----------------------------------------------------------------------------------------------------
E. Tree
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
1 2
2 3
3 4
4 5
Output
6
Input
8
1 2
1 3
2 4
2 5
3 6
3 7
6 8
Output
18
Input
3
1 2
1 3
Output
3
----------------------------------------------------------------------------------------------------
