#K57402. Unique Pair Finder
Unique Pair Finder
Unique Pair Finder
You are given a list of integers and a target sum T. Your task is to find all unique pairs (a, b) such that:
\(a + b = T\)
Note that pairs where both numbers are identical (i.e. \(a = b\)) are not considered, even if there are two or more occurrences of that number in the list. Each valid pair should be printed in ascending order (i.e. the smaller number first) and each pair should be unique. If no valid pairs exist, output "No pairs found".
Example:
Input: 6 10 1 5 3 7 4 6</p>Output: 3 7 4 6
inputFormat
The input is given in two parts via standard input (stdin):
- The first line contains two integers: N (the number of elements) and T (the target sum).
- The second line contains N space-separated integers.
outputFormat
If one or more valid pairs exist, output each pair on a separate line with the two numbers separated by a space, in ascending order. The pairs themselves should be ordered in increasing order (first by the first element and then by the second element). If no pairs are found, output the line "No pairs found".
## sample6 10
1 5 3 7 4 6
3 7
4 6
</p>