#C6942. Taco Pairs Finder

    ID: 50758 Type: Default 1000ms 256MiB

Taco Pairs Finder

Taco Pairs Finder

You are given a list of integers and a target integer. Your task is to find all unique pairs \((a, b)\) in the list such that \(a + b = \text{target}\) and \(a \le b\). The resulting pairs must be printed in lexicographical order.

If no such pairs exist, output "No pairs found".

Each pair should be printed on a new line in the format (a, b).

inputFormat

The input is given via standard input (stdin) and consists of three parts:

  1. The first line contains an integer (n), the number of elements in the list.
  2. The second line contains (n) space-separated integers representing the list of numbers.
  3. The third line contains an integer representing the target sum.

outputFormat

Output the unique pairs ((a, b)) satisfying (a + b = \text{target}) and (a \le b) in lexicographical order, each on a separate line in the format (a, b). If there are no such pairs, output "No pairs found".## sample

5
1 2 3 4 5
5
(1, 4)

(2, 3)

</p>