{"trustable":false,"prependHtml":"\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\" type\u003d\"text/javascript\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cscript type\u003d\u0027text/x-mathjax-config\u0027\u003eMathJax.Hub.Config({tex2jax: { inlineMath: [[\u0027$\u0027,\u0027$\u0027]] } }); \u003c/script\u003e\n\u003cscript type\u003d\u0027text/javascript\u0027 src\u003d\u0027https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\u0027\u003e\u003c/script\u003e\n\u003cscript type\u003d\u0027text/javascript\u0027\u003esetTimeout(function(){MathJax.Hub.Queue([\u0027Typeset\u0027, MathJax.Hub, \u0027left_view\u0027]);}, 2000);\u003c/script\u003e\n\u003cdiv class\u003d\"panel_content\"\u003e\n One day, Dudu, the most clever boy, heard of ACM/ICPC, which is a very interesting game. He wants to take part in the game. But as we all know, you can\u0027t get good result without teammates. \n \u003cbr\u003eSo, he needs to select two classmates as his teammates. \n \u003cbr\u003eIn this game, the IQ is very important, if you have low IQ you will WanTuo. Dudu\u0027s IQ is a given number k. We use an integer v[i] to represent the IQ of the ith classmate. \n \u003cbr\u003eThe sum of new two teammates\u0027 IQ must more than Dudu\u0027s IQ. \n \u003cbr\u003eFor some reason, Dudu don\u0027t want the two teammates comes from the same class. \n \u003cbr\u003eNow, give you the status of classes, can you tell Dudu how many ways there are. \n\u003c/div\u003e\nPS:给n个集合,求从两个不同集合里面各取一个数使得它们的和大于给定数的方案数。"}},{"title":"Input","value":{"format":"HTML","content":"There is a number T shows there are T test cases below. ($T \\leq 20$) \n\u003cbr\u003eFor each test case , the first line contains two integers, n and k, which means the number of class and the IQ of Dudu. n ( $0 \\leq n \\leq 1000$ ), k( $0 \\leq k \u0026lt; 2^{31}$ ). \n\u003cbr\u003eThen, there are n classes below, for each class, the first line contains an integer m, which means the number of the classmates in this class, and for next m lines, each line contains an integer v[i], which means there is a person whose iq is v[i] in this class. m( $0 \\leq m \\leq 100$ ), v[i]( $0 \\leq v[i] \u0026lt; 2^{31}$ )"}},{"title":"Output","value":{"format":"HTML","content":"For each test case, output a single integer."}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cpre\u003e1\n3 1\n1 2\n1 2\n2 1 1\u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cpre\u003e5\u003c/pre\u003e"}}]}