Codeforces Round 268 (Div. 1)


A. 24 Game
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1
Output
NO
Input
8
Output
YES
8 * 7 = 56
6 * 5 = 30
3 - 4 = -1
1 - 2 = -1
30 - -1 = 31
56 - 31 = 25
25 + -1 = 24
----------------------------------------------------------------------------------------------------
B. Two Sets
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 5 9
2 3 4 5
Output
YES
0 0 1 1
Input
3 3 4
1 2 4
Output
NO
----------------------------------------------------------------------------------------------------
C. Hack it!
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
46
Output
1 10
Input
126444381000032
Output
2333333 2333333333333
----------------------------------------------------------------------------------------------------
D. Tree
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
1 2 3
Output
6
2 1
Input
5
1 2 2
1 3 3
2 4 4
2 5 5
Output
32
2 1 4 5 3
----------------------------------------------------------------------------------------------------
E. Permanent
time limit per test: 2 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
3 1
1 1 2
Output
8
Input
10 10
3 3 367056794
6 2 124561273
1 3 46718146
6 9 415916869
10 5 985968336
3 1 526792265
1 4 386357058
10 4 349304187
2 7 102032499
3 6 502679075
Output
233333333
----------------------------------------------------------------------------------------------------
