import Aoc import Data.List.Split parseFile :: [String] -> [(Int, Int, Int)] parseFile = map $ triplet . map read . splitOn "x" part1 :: [(Int, Int, Int)] -> Int part1 = sum . map wrapping where wrapping (l, w, h) = let areas = [l*w, l*h, w*h] in 2*sum areas + minimum areas part2 :: [(Int, Int, Int)] -> Int part2 = sum . map wrapping where wrapping (l, w, h) = 2*minimum [l+w, l+h, w+h] + l*w*h main :: IO () main = aocMain parseFile part1 part2