Codeforces Round 683 (Div. 2, by Meet IT)


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

Examples
Input
2
2
3
Output
1
2
5
3 3 3 1 2
----------------------------------------------------------------------------------------------------
B. Numbers Box
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
2 2
-1 1
1 1
3 4
0 -1 -2 -3
-1 -2 -3 -4
-2 -3 -4 -5
Output
2
30
----------------------------------------------------------------------------------------------------
C. Knapsack
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
1 3
3
6 2
19 8 19 69 9 4
7 12
1 1 1 17 1 1 1
Output
1
1
-1
6
1 2 3 5 6 7
----------------------------------------------------------------------------------------------------
D. Catching Cheaters
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 5
abba
babab
Output
5
Input
8 10
bbbbabab
bbbabaaaaa
Output
12
Input
7 7
uiibwws
qhtkxcn
Output
0
----------------------------------------------------------------------------------------------------
E. Xor Tree
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
0 1 5 2 6
Output
1
Input
7
6 9 8 7 3 5 2
Output
2
----------------------------------------------------------------------------------------------------
F1. Frequency Problem (Easy Version)
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
7
1 1 2 2 3 3 3
Output
6
Input
10
1 1 1 5 4 1 3 1 2 2
Output
7
Input
1
1
Output
0
----------------------------------------------------------------------------------------------------
F2. Frequency Problem (Hard Version)
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
7
1 1 2 2 3 3 3
Output
6
Input
10
1 1 1 5 4 1 3 1 2 2
Output
7
Input
1
1
Output
0
----------------------------------------------------------------------------------------------------
