Advent of Code 2025
at main 672 B view raw
1module Day12 where 2 3parse :: String -> [(Int,Int,[Int])] 4parse = map parseLine . drop 30 . lines 5 where parseLine line = 6 let w = words line 7 (size,counts) = (head w, map read $ tail w) 8 cols = read $ take 2 size 9 rows = read $ take 2 $ drop 3 size 10 in (cols, rows, counts) 11 12part1 :: String -> String 13part1 input = 14 let regions = parse input 15 slack (cols, rows, counts) = cols * rows - 7 * (counts !! 0) - 7 * (counts !! 1) - 7 * (counts !! 2) - 5 * (counts !! 3) - 7 * (counts !! 4) - 6 * (counts !! 5) 16 in show $ length $ filter (> 0) $ map slack regions 17 18part2 :: String -> String 19part2 _ = "You win!"