Two Platforms SOLUTION
There are n focuses on a plane. The I-th point has organizes (xi,yi). You have two level stages, both of length k. Every stage can be put anyplace on a plane yet it ought to be put evenly (on a similar y-facilitate) and have number outskirts. In the event that the left outskirt of the stage is (x,y) at that point the correct fringe is (x+k,y) and all focuses between fringes (counting fringes) have a place with the stage.
Note that stages can share regular focuses (cover) and it isn’t important to put the two stages on a similar y-facilitate.
At the point when you place the two stages on a plane, all focuses begin tumbling down diminishing their y-arrange. On the off chance that a point slams into some stage at some second, the point stops and is spared. Focuses which never slam into any stage are lost.
Your undertaking is to locate the most extreme number of focuses you can spare in the event that you place the two stages ideally.
You need to answer t free experiments.
For better seeing, if it’s not too much trouble read the Note area underneath to see an image for the main experiment.
The principal line of the info contains one whole number t (1≤t≤2⋅104) — the quantity of experiments. At that point t experiments follow.
The principal line of the experiment contains two whole numbers n and k (1≤n≤2⋅105; 1≤k≤109) — the quantity of focuses and the length of every stage, individually. The second line of the experiment contains n numbers x1,x2,… ,xn (1≤xi≤109), where xi is x-facilitate of the I-th point. The third line of the information contains n numbers y1,y2,… ,yn (1≤yi≤109), where yi is y-arrange of the I-th point. All focuses are unmistakable (there is no pair 1≤i<j≤n with the end goal that xi=xj and yi=yj).
It is ensured that the whole of n doesn’t surpass 2⋅105 (∑n≤2⋅105).
For each experiment, print the appropriate response: the greatest number of focuses you can spare on the off chance that you place the two stages ideally.
1 5 2 3 1 5 4
1 3 6 7 2 5 4
10 7 5 15 8
20 199 192 219 1904
15 19 8 17 20 10 9 2 10 19
12 13 6 17 1 14 7 9 19 3
The image relating to the principal experiment of the model:
Blue spots speak to the focuses, red portions speak to the stages. One of the potential ways is to put the principal stage between focuses (1,−1) and (2,−1) and the second one between focuses (4,3) and (5,3). Vectors speak to how the focuses will tumble down. As should be obvious, the main point we can’t spare is the point (3,7) so it tumbles down limitlessly and will be lost. It tends to be demonstrated that we can’t accomplish better answer here. Likewise note that the point (5,3) doesn’t fall at all since it is now on the stage.