#K996. Count Unique Pairs

    ID: 39145 Type: Default 1000ms 256MiB

Count Unique Pairs

Count Unique Pairs

Given a list of integers and a target sum \(T\), determine the number of unique pairs \((a,b)\) such that \(a + b = T\). A pair is considered unique if the numbers are not counted more than once (i.e., \((a,b)\) is the same as \((b,a)\)).

For example, when the list is [1, 5, 7, -1, 5] and \(T = 6\), the unique pairs are \((1, 5)\) and \((7, -1)\), so the answer is 2.

inputFormat

The input consists of two lines. The first line contains two space-separated integers \(n\) and \(T\), where \(n\) is the number of integers in the list and \(T\) is the target sum. The second line contains \(n\) space-separated integers.

outputFormat

Output a single integer representing the number of unique pairs that sum up to \(T\).

## sample
5 6
1 5 7 -1 5
2

</p>