MemSQL Start[c]UP 3.0 - Round 1


A. Declined Finalists
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
25
2 3 4 5 6 7 8 9 10 11 12 14 15 16 17 18 19 20 21 22 23 24 25 26 28
Output
3
Input
5
16 23 8 15 4
Output
0
Input
3
14 15 92
Output
67
----------------------------------------------------------------------------------------------------
B. Lazy Security Guard
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
Output
8
Input
11
Output
14
Input
22
Output
20
----------------------------------------------------------------------------------------------------
C. Pie Rules
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
141 592 653
Output
653 733
Input
5
10 21 10 21 10
Output
31 41
----------------------------------------------------------------------------------------------------
D. Third Month Insanity
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
0 40 100 100
60 0 40 40
0 60 0 45
0 60 55 0
Output
1.75
Input
3
0 0 100 0 100 0 0 0
100 0 100 0 0 0 100 100
0 0 0 100 100 0 0 0
100 100 0 0 0 0 100 100
0 100 0 100 0 0 100 0
100 100 100 100 100 0 0 0
100 0 100 0 0 100 0 0
100 0 100 0 100 100 100 0
Output
12
Input
2
0 21 41 26
79 0 97 33
59 3 0 91
74 67 9 0
Output
3.141592
----------------------------------------------------------------------------------------------------
E. Desk Disorder
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
1 5
5 2
3 7
7 3
Output
6
Input
5
1 10
2 10
3 10
4 10
5 5
Output
5
----------------------------------------------------------------------------------------------------
F. Ordering T-Shirts
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 200
100 250 100
Output
200
Input
4 160
88 69 62 29 58 52 44
Output
314
----------------------------------------------------------------------------------------------------
G. Circle of Numbers
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
30
000100000100000110000000001100
Output
YES
Input
6
314159
Output
NO
----------------------------------------------------------------------------------------------------
