Codeforces Beta Round 86 (Div. 1 Only)


A. Grammar Lessons
time limit per test: 5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
petr
Output
YES
Input
etis atis animatis etis atis amatis
Output
NO
Input
nataliala kataliala vetra feinites
Output
YES
----------------------------------------------------------------------------------------------------
B. Petr#
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
round
ro
ou
Output
1
Input
codeforces
code
forca
Output
0
Input
abababab
a
b
Output
4
Input
aba
ab
ba
Output
1
----------------------------------------------------------------------------------------------------
C. Double Happiness
time limit per test: 3 seconds
memory limit per test: 128 megabytes
input: standard input
output: standard output

Examples
Input
3 5
Output
1
Input
6 66
Output
7
----------------------------------------------------------------------------------------------------
D. Museum
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 1 1 2
1 2
0.5
0.5
Output
0.5000000000 0.5000000000 
Input
4 4 1 2
1 2
2 3
3 4
4 1
0.5
0.5
0.5
0.5
Output
0.3333333333 0.3333333333 0.1666666667 0.1666666667 
----------------------------------------------------------------------------------------------------
E. Sleeping
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 5 2
4 4
2 1
Output
3
Input
24 60 1
0 0
23 59
Output
1439
Input
24 60 3
23 59
23 59
Output
0
----------------------------------------------------------------------------------------------------
