defmodule Main do def main do IO.read(:line) |> String.trim() |> String.split() |> Enum.map(&String.to_integer/1) |> solve |> IO.puts() end def solve([x, y]) do if {x, y} in locations(), do: "YES", else: "NO" end def locations do locations1 = [{0, 0}] |> search_rec([]) locations2 = locations1 |> search_rec([]) locations3 = locations2 |> search_rec([]) [locations1, locations2, locations3] |> Enum.concat() |> Enum.uniq() end def search_rec([], result) do result end def search_rec([{x, y} | t], result) do t |> search_rec( result |> Enum.concat([ {x - 2, y - 1}, {x - 2, y + 1}, {x - 1, y - 2}, {x - 1, y + 2}, {x + 1, y - 2}, {x + 1, y + 2}, {x + 2, y - 1}, {x + 2, y + 1} ]) ) end end