#include <cstdio>
#include <cstring>
using namespace std;
int main()
{
    long long T, n, d;
    scanf("%lld", &T);
    while (T--)
    {
        scanf("%lld%lld", &n, &d);
        long long ans = 0;
        for (long long i = 0, v, f, c; i < n; i++)
        {
            scanf("%lld%lld%lld", &v, &f, &c);
            if (v * f >= d * c) ans++;
        }
        printf("%lld\n", ans);
    }
    return 0;
}