K Smallest Pair Sums
You are given two arrays a (of length n) and b (of length m), each sorted in non-decreasing order.
Consider all n·m index pairs (i, j) with 1 ≤ i ≤ n and 1 ≤ j ≤ m, and the value a_i + b_j of each pair. Print the k smallest of these values in non-decreasing order. Different index pairs count separately, even if their sums (or their elements) are equal.
Input
The first line contains three integers n, m and k (1 ≤ n, m ≤ 10^5, 1 ≤ k ≤ min(n·m, 2·10^5)).
The second line contains n integers a_1, a_2, …, a_n (−10^9 ≤ a_i ≤ 10^9, a_1 ≤ a_2 ≤ … ≤ a_n).
The third line contains m integers b_1, b_2, …, b_m (−10^9 ≤ b_j ≤ 10^9, b_1 ≤ b_2 ≤ … ≤ b_m).
Output
Print k integers on one line, separated by spaces: the k smallest pair sums in non-decreasing order.
Notes
In the first example the nine pair sums are 3, 5, 7, 9, 11, 13, 13, 15, 17, and the five smallest are printed.
In the second example a = [1, 1, 2] and b = [1, 2, 3]. The sum 2 comes from two different pairs, (1, 1) and (2, 1), so it appears twice; the sum 3 comes from three pairs and appears three times.