#C7197. Count Special Days

    ID: 51041 Type: Default 1000ms 256MiB

Count Special Days

Count Special Days

You are given several test cases. In each test case, there are D days, and an integer K. For each day, you are provided with the number of posts and the number of likes each post received. A day is considered special if there exists at least one post with exactly K likes. In formal notation, a day is special if for the set of likes \(\{l_1, l_2, \dots, l_P\}\) for that day, it holds that \(K \in \{l_1, l_2, \dots, l_P\}\).

Your task is to count the number of special days for each test case.

inputFormat

The input is read from stdin and has the following format:

T
D1 K1
P1 l1,1 l1,2 ... l1,P1
P2 l2,1 l2,2 ... l2,P2
...
PD1 lD1,1 ... lD1,PD1
... (the same format for each test case)

Here, the first line contains a single integer T denoting the number of test cases. For each test case:

  • The first line contains two integers D and K, where D is the number of days and K is the exact number of likes required for a day to be special.
  • Each of the following D lines starts with an integer P that indicates the number of posts on that day, followed by P integers representing the likes count for each post.

outputFormat

For each test case, output a single integer on a new line that indicates the number of special days.

The output should be written to stdout.

## sample
2
3 50
2 10 50
3 50 50 30
1 100
3 20
0
1 20
3 10 25 10
2

1

</p>