#K82842. Unique Pair Sum
Unique Pair Sum
Unique Pair Sum
Given a list of integers and a target integer \(T\), your task is to find all unique pairs of integers that sum up to \(T\). Each pair should be output as two integers in ascending order, and the overall list of pairs must be sorted based on the first element of each pair.
Note: Each input is provided via standard input and the output should be printed to standard output. If no valid pairs exist, print nothing.
inputFormat
The input is given in the following format via standard input:
n num1 num2 ... num_n T
where:
n
is an integer that represents the number of elements in the list.num1 num2 ... num_n
is a list ofn
space-separated integers.T
is the target sum.
outputFormat
For each unique pair found (a, b) such that \(a + b = T\), output a line with the two integers separated by a space. The integers in each pair should be in ascending order and the pairs themselves should be sorted in ascending order based on their first element. If no pairs exist, output nothing.
## sample9
2 4 3 5 6 -2 7 3 -3
5
-2 7
2 3
</p>