시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
2 초 128 MB 403 331 306 85.000%

문제

꿍은 우주여행을 하고 싶어져서 우주여행을 계획하기 시작했다. 몇가지를 고려해본 결과 우주여행에는 우주선의 연료와 목적지까지의 도착시간이 가장 큰 영향을 미치는것으로 파악됐다. 꿍은 엄청난 부자여서 우주선이 여러대가 있는데 각각의 우주선마다 최고속도와 연료소비율이 조금씩 다르다.

모든 우주선이 최고속도에 즉시 도달한다고 할 때 꿍이 가고싶어하는 곳까지 여행할 수 있는 우주선은 총 몇대인지 여러분이 대신 구해줘라.

입력

입력은 테스트케이스의 개수 T (1 ≤ T ≤ 50)로 시작한다.

각 테스트케이스는 공백으로 구분되는, 우주선의 개수 N (1 ≤ N ≤ 100)과 목적지 까지의 거리 D (1 ≤ D ≤ 106), 두 개의 정수로 시작한다. 다음 N줄에는 각각 공백으로 구분되는, 우주선의 최고속도 vi (1 ≤ vi ≤ 1000)와 우주선의 연료양 fi (1 ≤ fi ≤ 1000)와 우주선의 연료소비율 ci (1 ≤ ci ≤ 1000), 세개의 정수가 주어진다.

출력

각 테스트케이스에 대해 목적지까지 갈 수 있는 우주선의 개수를 구하여라.

이 때, 정수의 나눗셈에 조심하라!

예제 입력 1

2
3 100
52 75 10
88 13 44
56 9 5
2 920368
950 950 1
943 976 1

예제 출력 1

2
1
W3sicHJvYmxlbV9pZCI6Ijk1MDEiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWFmY2RcdWM3NTggXHVjNmIwXHVjOGZjXHVjNWVjXHVkNTg5IiwiZGVzY3JpcHRpb24iOiI8cD5cdWFmY2RcdWM3NDAgXHVjNmIwXHVjOGZjXHVjNWVjXHVkNTg5XHVjNzQ0IFx1ZDU1OFx1YWNlMCBcdWMyZjZcdWM1YjRcdWM4MzhcdWMxMWMgXHVjNmIwXHVjOGZjXHVjNWVjXHVkNTg5XHVjNzQ0IFx1YWNjNFx1ZDY4ZFx1ZDU1OFx1YWUzMCBcd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