Educational Codeforces Round 21


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

Examples
Input
4
Output
1
Input
201
Output
99
Input
4000
Output
1000
----------------------------------------------------------------------------------------------------
B. Average Sleep Time
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 2
3 4 7
Output
9.0000000000
Input
1 1
10
Output
10.0000000000
Input
8 2
1 2 4 100000 123 456 789 1
Output
28964.2857142857
----------------------------------------------------------------------------------------------------
C. Tea Party
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 10
8 7
Output
6 4 
Input
4 4
1 1 1 1
Output
1 1 1 1 
Input
3 10
9 8 10
Output
-1
----------------------------------------------------------------------------------------------------
D. Array Division
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
1 3 2
Output
YES
Input
5
1 2 3 4 5
Output
NO
Input
5
2 2 3 4 5
Output
YES
----------------------------------------------------------------------------------------------------
E. Selling Souvenirs
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1 1
2 1
Output
0
Input
2 2
1 3
2 2
Output
3
Input
4 3
3 10
2 7
2 8
1 1
Output
10
----------------------------------------------------------------------------------------------------
F. Card Game
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 8
5 5 1
1 5 4
4 6 3
1 12 4
3 12 1
Output
4
Input
3 7
4 4 1
5 8 2
5 3 3
Output
2
----------------------------------------------------------------------------------------------------
G. Anthem of Berland
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
winlose???winl???w??
win
Output
5
Input
glo?yto?e??an?
or
Output
3
Input
??c?????
abcab
Output
2
----------------------------------------------------------------------------------------------------
