Codeforces Round 452 (Div. 2)


A. Splitting in Teams
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
1 1 2 1
Output
1
Input
2
2 2
Output
0
Input
7
2 2 2 1 1 1 1
Output
3
Input
3
1 1 1
Output
1
----------------------------------------------------------------------------------------------------
B. Months and Years
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
31 31 30 31
Output
Yes
Input
2
30 30
Output
No
Input
5
29 31 30 31 30
Output
Yes
Input
3
31 28 30
Output
No
Input
3
31 31 28
Output
Yes
----------------------------------------------------------------------------------------------------
C. Dividing the numbers
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
Output
0
2 1 4 
Input
2
Output
1
1 1 
----------------------------------------------------------------------------------------------------
D. Shovel Sale
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
7
Output
3
Input
14
Output
9
Input
50
Output
1
----------------------------------------------------------------------------------------------------
E. Segments Removal
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
2 5 5 2
Output
2
Input
5
6 3 4 1 5
Output
5
Input
8
4 4 4 2 2 100 100 100
Output
3
Input
6
10 10 50 10 50 50
Output
4
----------------------------------------------------------------------------------------------------
F. Letters Removing
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 2
abac
1 3 a
2 2 c
Output
b
Input
3 2
A0z
1 3 0
1 1 z
Output
Az
Input
10 4
agtFrgF4aF
2 5 g
4 9 F
1 5 4
1 7 a
Output
tFrg4
Input
9 5
aAAaBBccD
1 4 a
5 6 c
2 3 B
4 4 D
2 3 A
Output
AB
----------------------------------------------------------------------------------------------------
