Codeforces Round 678 (Div. 2)


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

Examples
Input
2
3 8
2 5 1
4 4
0 1 2 3
Output
YES
NO
----------------------------------------------------------------------------------------------------
B. Prime Square
time limit per test: 1.5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
4
2
Output
4 6 8 1
4 9 9 9
4 10 10 65
1 4 4 4
1 1
1 1
----------------------------------------------------------------------------------------------------
C. Binary Search
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 1 2
Output
6
Input
123 42 24
Output
824071958
----------------------------------------------------------------------------------------------------
D. Bandit in a City
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
1 1
3 1 2
Output
3
Input
3
1 1
3 1 3
Output
4
----------------------------------------------------------------------------------------------------
E. Complicated Computations
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
1 3 2
Output
3
Input
5
1 4 3 1 2
Output
6
----------------------------------------------------------------------------------------------------
F. Sum Over Subsets
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
1 1
2 1
Output
9
Input
4
1 1
2 1
3 1
6 1
Output
1207
Input
1
1 5
Output
560
----------------------------------------------------------------------------------------------------
