#C11493. Unique Pairs Sum Finder
Unique Pairs Sum Finder
Unique Pairs Sum Finder
Given a list of integers and a target integer \(m\), your task is to find all unique pairs of integers from the list such that the sum of each pair is exactly \(m\). Each pair \((a, b)\) must satisfy \(a \leq b\), and the final list of pairs should be sorted in lexicographical order.
If no such pair exists, output nothing.
inputFormat
The input is given via standard input and has the following format:
- The first line contains an integer \(n\), representing the number of elements in the list.
- The second line contains \(n\) space-separated integers.
- The third line contains a single integer \(m\), the target sum.
outputFormat
For each valid pair that sums to \(m\), print a line with two space-separated integers, where the pair is in ascending order. The pairs must be printed in lexicographical order. If no pairs exist, output nothing.
## sample5
1 2 3 4 5
5
1 4
2 3
</p>