#C11293. Unique Pair Sum Finder
Unique Pair Sum Finder
Unique Pair Sum Finder
You are given an array of integers and an integer \(k\). Your task is to find and print all unique pairs of elements in the array that sum up to \(k\). Each pair should be displayed in the format \((a, b)\) where \(a \le b\). The pairs should be ordered in ascending order by the first element and, if equal, by the second element.
Note: Even if there are duplicate elements in the input, each unique pair (by value) should be printed only once.
Constraints:
- \(1 \le n \le 10^5\) where \(n\) is the number of elements in the array.
- Each element is between \(0\) and \(10^9\).
- \(0 \le k \le 10^9\).
Example:
Input: 5 7 1 2 3 4 5</p>Output: (2, 5) (3, 4)
inputFormat
The first line contains two integers \(n\) and \(k\) separated by a space, where \(n\) is the number of elements in the array and \(k\) is the target sum.
The second line contains \(n\) space-separated integers, the elements of the array.
outputFormat
Print each unique pair of numbers that add up to \(k\) on a new line in the format \((a, b)\), where \(a \leq b\). The pairs should be sorted in ascending order of the first element, and if equal, by the second.
If no such pair exists, output nothing.
## sample5 7
1 2 3 4 5
(2, 5)
(3, 4)
</p>