QOJ.ac

QOJ

時間限制: 1 s 記憶體限制: 512 MB 總分: 100

#3629. Phenomenal Lantern

统计

In the small village of Cugovec Biškupečki, there are $n$ residents, each living in their own house. Unfortunately, super-fast internet has not yet reached this part of the country, mainly because no household is supplied with electricity. Consequently, the residents of Cugovec Biškupečki do not spend their free time solving algorithmic problems on popular websites; instead, they devise algorithms using only paper and pencil. Naturally, they find the winter period most difficult, as it gets dark quickly, forcing them to solve problems in their heads because they can no longer see what they have written on paper.

However, this winter they decided to put an end to their problem. One resident exclaimed that they possess a candle, but cannot light it. Another resident replied that they possess a lighter, a third one announced they possess a lantern, and a fourth one found a long pole just this morning. A phenomenal plan was soon hatched: when it gets dark, they will place the lit candle inside the lantern, which will be mounted on the pole, which in turn will be driven into the ground. All that remains is to determine the location where they will place the pole.

Using methods of mathematics and computation, the residents concluded that the lantern will illuminate a circular area of radius $r$. They also collectively agreed that they would place the pole somewhere along the street that runs through Cugovec Biškupečki, in such a way that the light illuminates the maximum number of houses. Naturally, they then placed the problem into a coordinate system where they aligned the street with the $x$-axis and determined the coordinates of each house.

Can you determine how many houses will be illuminated after the residents place the lantern?

Note: A house is illuminated if it is located on the edge of or inside the circle of radius $r$ centered at the lantern. The optimal position of the lantern does not necessarily have to be at integer coordinates.

Input

The first line contains the natural numbers $n$ ($1 \le n \le 100\,000$) and $r$ ($1 \le r \le 10^9$).

In the $i$-th of the following $n$ lines, there are two integers $x_i$ and $y_i$ ($0 \le |x_i|, |y_i| \le 10^9$) representing the coordinates of the house where the $i$-th resident lives. The positions of all houses are distinct.

Output

In a single line, print the required number from the problem statement.

Examples

Input 1

4 3
1 2
-2 3
-1 -2
3 3

Output 1

2

Input 2

9 2
1 1
-3 0
-3 -2
-2 1
1 -2
3 3
-2 4
-1 1
-2 -2

Output 2

4

Figure 1. Visualization of Example 1, showing the lantern position and illuminated houses.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.