#P3298. [SDOI2013] 泉

[SDOI2013] 泉

Description

As a proud member of the Jinan Springs History Research Group, Mingming has collected, for NN different years, the flow index of different spring zones. This index is a non-negative integer less than 2302^{30}. In year ii, the flow indices of the six spring zones are Ai,1Ai,6A_{i,1} \sim A_{i,6}.

Now Mingming wants to know how many pairs of different years ii and jj (i<ji < j) have exactly KK spring zones whose flow indices are equal in those two years.

Input Format

The first line contains two integers N,KN, K.

The next NN lines each contain 66 integers Ai,1Ai,6A_{i,1} \sim A_{i,6}.

Output Format

Output a single integer on one line, representing the answer.

3 3
1 2 3 4 5 6
1 2 3 0 0 0
0 0 0 4 5 6
2

Hint

Constraints: 1N1051 \le N \le 10^50Ai,j2300 \le A_{i,j} \le 2^{30},且保证 KK[0,1,2,3,4,5,6][0,1,2,3,4,5,6] 中均匀随机选取。

Translated by ChatGPT 5