#C14457. Sum Pair Finder
Sum Pair Finder
Sum Pair Finder
You are given a list of integers and a target integer \(T\). Your task is to find all unique pairs of numbers \((a, b)\) from the list such that \(a + b = T\). Each pair must be printed in ascending order (i.e. \(a \leq b\)) and the overall list of pairs should be sorted: first by the first element, then by the second.
Note: Each number in the list may be used at most once in each pair. If there are multiple occurrences of the same number, duplicate pairs should be avoided in the output.
Input: Read input from standard input (stdin). The first line contains two integers \(n\) and \(T\), where \(n\) is the number of integers in the list and \(T\) is the target sum. The second line contains \(n\) integers separated by spaces.
Output: Print each unique pair that sums to \(T\) on a separate line in the format "a b". If no such pair exists, output nothing.
Example:
Input: 5 6 1 2 3 4 3</p>Output: 2 4 3 3
inputFormat
The first line of input contains two integers: \(n\) (the number of elements) and \(T\) (the target sum). The second line contains \(n\) space-separated integers representing the list.
outputFormat
Output each unique pair \(a\) and \(b\) such that \(a + b = T\) on a separate line in the format: "a b". The pairs must be sorted in ascending order. If there are no valid pairs, do not output anything.
## sample5 6
1 2 3 4 3
2 4
3 3
</p>