Drag the spheres back to your area!
Gold spheres are worth three points!
Sphere Mongers is a four player minigame in Super Mario Party, and
you can view how the game is actually played
here. The game area has a lot of spheres
on the ground. Each player flies in a UFO with a magnet, and the goal is
to get as many spheres as possible. There are two types of spheres: the
regular ones (silver ones) which are worth one point and gold ones which
are worth three points. At any time, a player can lower their magnet to
attract some spheres. In particular, all spheres within a certain radius

At any time, a player may want to know, given the current status of the game (all the spheres and their position), what is the maximum points one can get in one catch. Your task is to write a program to answer this question. Note that the player can be at any position, not just integral coordinates.
Input Specification
The first line of the input contains two integers,
The next
Output Specification
The output only contains 1 integer, which is the maximum number of points one can get by one catch.
Sample Input
5 2
1 1 0
1 5 1
3 3 0
3 7 0
10 10 1
Sample Output
5
Explanation for Sample Output
In the best solution, the player can stay at position
Scoring
For 60% of the test cases,
There are 20 test cases, 6 points each.
Comments