! Copyright (C) 2022 Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. USING: kernel math.parser math.statistics sequences splitting ; IN: 2022-aoc1 : parse-aoc1 ( string -- seq ) string-lines { "" } split [ [ string>number ] map-sum ] map ; : aoc1-1 ( string -- n ) parse-aoc1 minmax nip ; : aoc1-2 ( string -- n ) parse-aoc1 { 0 1 2 } kth-largests sum ;