defmodule Main do
  def main do
    [_n, d] = IO.gets("")
             |> String.trim()
             |> String.split()
             |> Enum.map(&String.to_integer/1)

    max = System.schedulers_online() * 2

    input()
    |> Task.async_stream(fn [x, y] -> dist(x, y) |> calc(d) end, max_concurrency: max)
    |> Enum.reduce(0, fn {:ok, num}, acc -> num + acc end)
    |> IO.puts()
  end

  def input do
    IO.read(:all)
    |> String.split()
    |> Stream.map(&String.to_integer/1)
    |> Stream.chunk_every(2)
  end

  defguard eval(dist, d) when dist <= d

  def dist(x, y) do
    :math.sqrt(x*x+y*y)
  end

  def calc(dist, d) when eval(dist, d), do: 1
  def calc(_, _), do: 0
end
