#K63732. Unique Pair Sum Finder
Unique Pair Sum Finder
Unique Pair Sum Finder
You are given a list of integers and a target integer \(T\). Your task is to find all unique pairs \((a, b)\) (with \(a \leq b\)) such that:
\(a + b = T\)
Each valid pair should appear only once in the output, and the order of pairs is determined by the order in which they are first encountered when scanning the list from left to right. If no pairs exist, output nothing.
Note: The input is read from standard input (stdin) and the output should be printed to standard output (stdout). Each pair is printed on its own line with the two numbers separated by a space.
Example:
Input: 7 2 4 3 5 7 8 -1 7</p>Output: 2 5 3 4 -1 8
inputFormat
The input consists of three parts:
- An integer \(n\) representing the number of elements in the list.
- A line containing \(n\) space-separated integers.
- An integer \(T\) which is the target sum.
This input is provided via standard input (stdin).
outputFormat
For each unique pair of integers \((a, b)\) such that \(a + b = T\) and \(a \leq b\), output a line with the two integers separated by a space. The output should be printed to standard output (stdout). If no such pair exists, output nothing.
## sample7
2 4 3 5 7 8 -1
7
2 5
3 4
-1 8
</p>