#C7956. Unique Pair Sum Finder

    ID: 51884 Type: Default 1000ms 256MiB

Unique Pair Sum Finder

Unique Pair Sum Finder

Your task is to find all unique pairs of integers in a given array that sum up to a specified target value. Each pair must be sorted in ascending order, and the overall list of pairs should also be sorted. If no such pair exists, print No pairs.

Formally, given an array \(\textbf{arr}\) and a target integer \(T\), find every pair \((a, b)\) such that \(a + b = T\) and \(a \le b\). Duplicate pairs should be omitted.

inputFormat

The first line of input contains an integer \(t\), the number of test cases. Each test case consists of two lines:

  1. The first line contains two space-separated integers \(n\) and \(T\), where \(n\) is the number of elements in the array and \(T\) is the target sum.
  2. The second line contains \(n\) space-separated integers representing the elements of the array.

outputFormat

For each test case, output a single line. If at least one valid pair is found, print the sorted list of unique pairs in the format: [(a, b), (c, d), ...]. If no valid pair exists, print No pairs.

## sample
4
6 9
2 7 11 15 -1 8
4 10
1 5 3 7
4 8
1 2 3 4
4 10
1 5 5 7
[(2, 7)]

[(3, 7)] No pairs [(5, 5)]

</p>