P3298 [SDOI2013] Springs
Description
As a proud member of the Jinan Springs History Research Group, Mingming has collected, for $N$ different years, the flow index of different spring zones. This index is a non-negative integer less than $2^{30}$. In year $i$, the flow indices of the six spring zones are $A_{i,1} \sim A_{i,6}$.
Now Mingming wants to know how many pairs of different years $i$ and $j$ ($i < j$) have exactly $K$ spring zones whose flow indices are equal in those two years.
Input Format
The first line contains two integers $N, K$.
The next $N$ lines each contain $6$ integers $A_{i,1} \sim A_{i,6}$.
Output Format
Output a single integer on one line, representing the answer.
Explanation/Hint
Constraints: $1 \le N \le 10^5$,$0 \le A_{i,j} \le 2^{30}$,且保证 $K$ 在 $[0,1,2,3,4,5,6]$ 中均匀随机选取。
Translated by ChatGPT 5