//> using dep org.scala-lang.modules::scala-parser-combinators::2.3.0 package aoc import scala.util.parsing.combinator._ def iterate[T](get: => T | Null) = Iterator.continually(get).takeWhile(_ != null).map(_.nn) def lines = iterate(scala.io.StdIn.readLine()) class CommonParser extends RegexParsers: val num = """(0|[1-9]\d*)""".r ^^ { _.toInt } val long = """(0|[1-9]\d*)""".r ^^ { _.toLong } object CommonParser extends CommonParser