#C4687. Count Harmonious Wizard Pairs
Count Harmonious Wizard Pairs
Count Harmonious Wizard Pairs
In the magical world of Taco, wizards are paired up to form harmonious teams. A harmonious pair is defined as two wizards with distinct power levels whose sum equals a given magical number \(k\). Each wizard can be used at most once.
You are given an integer \(n\) representing the number of wizards, an integer \(k\) the magical number, and a list of \(n\) integers representing the power levels of the wizards. Your task is to determine the number of distinct harmonious pairs.
Note: A pair is considered harmonious only if the two wizards have different power levels (i.e. if one wizard's power is \(a\), its partner must have power \(k-a\) with \(a \neq k-a\)).
inputFormat
The input consists of two lines.
The first line contains two space-separated integers \(n\) and \(k\).
The second line contains \(n\) space-separated integers representing the power levels of the wizards.
outputFormat
Output a single integer, the number of harmonious pairs.
## sample5 7
1 2 3 4 6
2
</p>