Square - MarisaOJ: Marisa Online Judge

Square

Time limit: 1000 ms
Memory limit: 256 MB
Given $n$ points on a two-dimensional coordinate system. Find a square with side length $k$ and sides parallel to the x-axis or y-axis such that it contains the maximum number of points. ### Input - The first line contains two integers $n$ and $k$. - The next $n$ lines each contain two integers $(x, y)$, representing a point at coordinates $(x, y)$. ### Output - Print an integer representing the maximum number of points in a square with side length $R$. ### Constraints - $1 \leq n \leq 10^5$. - $1 \leq x, y \leq 10^5$. ### Example Input: ``` 4 2 1 1 1 4 3 2 4 3 ``` Output: ``` 2 ```