diff options
Diffstat (limited to '2026')
| -rw-r--r-- | 2026/1.hs | 3 | ||||
| -rwxr-xr-x | 2026/1.sh | 4 |
2 files changed, 5 insertions, 2 deletions
@@ -3,8 +3,7 @@ module Main where import Control.Arrow import Control.Monad (join) -import Data.Bifunctor (bimap) import Data.List (group, sort) main :: IO () -main = runKleisli (const () ^<< join (***) (Kleisli print)) . join bimap (product . map snd . take 3) . (reverse &&& id) . sort . map (length &&& head) . group . sort . map (read @Int) . words =<< getContents +main = runKleisli (const () ^<< join (***) (Kleisli print <<^ product . map snd . take 3)) . (reverse &&& id) . sort . map (length &&& head) . group . sort . map (read @Int) . words =<< getContents diff --git a/2026/1.sh b/2026/1.sh new file mode 100755 index 0000000..8434e7c --- /dev/null +++ b/2026/1.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +input=$(sort -n | uniq -c | sort -n) +tac <<<"$input" | head -3 | awk '{print $2}' | xargs | tr \ \* | bc +head -3 <<<"$input" | awk '{print $2}' | xargs | tr \ \* | bc |
