diff options
Diffstat (limited to '2024/1.hs')
-rw-r--r-- | 2024/1.hs | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -9,5 +9,5 @@ main = do . map (\l -> let [x,y] = words l in (read @Int x, read y)) . lines <$> getContents print $ sum (zipWith (\x y -> abs (x - y)) a b) - let hist = Map.fromListWith (+) (map (,1 :: Int) b) + let hist = Map.fromAscListWith (+) (map (,1 :: Int) b) print $ sum [n * Map.findWithDefault 0 n hist | n <- a] |