summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--2024/1.hs2
1 files changed, 1 insertions, 1 deletions
diff --git a/2024/1.hs b/2024/1.hs
index c3871d6..3301ceb 100644
--- a/2024/1.hs
+++ b/2024/1.hs
@@ -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]