Codeforces Round 437 (Div. 2, based on MemSQL Start[c]UP 3.0 - Round 2)


A. Between the Offices
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
FSSF
Output
NO
Input
2
SF
Output
YES
Input
10
FFFFFFFFFF
Output
NO
Input
10
SSFFSFFSFF
Output
YES
----------------------------------------------------------------------------------------------------
B. Save the problem!
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
18
Output
30 4
1 5 10 25
Input
3
Output
20 2
5 2
Input
314
Output
183 4
6 5 2 139
----------------------------------------------------------------------------------------------------
C. Ordering Pizza
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 12
3 5 7
4 6 7
5 9 5
Output
84
Input
6 10
7 4 7
5 8 8
12 5 8
6 11 6
3 3 7
5 9 6
Output
314
----------------------------------------------------------------------------------------------------
D. Gotta Go Fast
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1 8
2 8 81
Output
3.14
Input
2 30
20 30 80
3 9 85
Output
31.4
Input
4 319
63 79 89
79 97 91
75 87 88
75 90 83
Output
314.159265358
----------------------------------------------------------------------------------------------------
E. Buy Low Sell High
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
9
10 5 4 7 9 12 6 2 10
Output
20
Input
20
3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4
Output
41
----------------------------------------------------------------------------------------------------
F. Hex Dyslexia
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
f1e
Output
NO
Input
0f1e
Output
00f1
Input
12d2c
Output
00314
----------------------------------------------------------------------------------------------------
