#C3619. Count Unique Pairs with Given Sum
Count Unique Pairs with Given Sum
Count Unique Pairs with Given Sum
You are given a list of integers and a target integer (k). Your task is to count the number of unique pairs ((a, b)) in the list such that (a + b = k). A pair is considered unique if the set ({a, b}) is distinct, meaning that ((a, b)) is treated the same as ((b, a)). For example, given the list ([1, 2, 3, 4, 5]) and (k = 5), the valid pairs are ((1, 4)) and ((2, 3)), so the answer is 2.
inputFormat
The input is read from standard input. The first line contains two integers (n) and (k), where (n) is the number of elements in the list and (k) is the target sum. The second line contains (n) space-separated integers representing the elements of the list.
outputFormat
Output a single integer to standard output representing the count of unique pairs whose sum is exactly (k).## sample
5 5
1 2 3 4 5
2