#C6190. Find All Pairs With Given Sum
Find All Pairs With Given Sum
Find All Pairs With Given Sum
You are given an array of n unique integers and a target sum \(k\). Your task is to find all pairs \( (a, b) \) such that \( a + b = k \) and \( a < b \). Each pair should be printed on a separate line with the smaller number first. If there are multiple pairs, they must be listed in lexicographical order.
Note: The input is read from standard input and the results are output to standard output.
Example:
Input: 5 1 2 3 4 5 5</p>Output: 1 4 2 3
inputFormat
The first line contains an integer n representing the number of elements in the array.
The second line contains n space-separated integers which are all unique.
The third line contains the target integer k.
outputFormat
For each pair of elements that sum up to \( k \), output the two numbers in one line separated by a space. The pairs must be printed in lexicographical order.
## sample5
1 2 3 4 5
5
1 4
2 3
</p>