Advent of Code 2026
It's that time of the year again, come get your share of the fun here! Day 1 was the easiest yet, quite similar to the classic McIlroy flex.
So for any UNIX greybeard, a few dozen seconds and a POSIX environment suffice:
sort input.txt | uniq -c | sort -n | tail -n3 | awk '{print $2}' | paste -sd\* - | bc sort input.txt | uniq -c | sort -n | head -n3 | awk '{print $2}' | paste -sd\* - | bc
Then a little later in my more verbose main language (Common Lisp):
(let* ((input (mapcar #'parse-integer (uiop:read-file-lines #P"input.txt"))) (tally (sort (hash-table-alist (tally input)) #'< :key #'cdr))) (format t "~@{~A~%~}" (reduce #'* tally :start (- (length tally) 3) :key #'car) (reduce #'* tally :end 3 :key #'car)))
As usual, the code is available on my sr.ht.
This year, my only ambition will be to switch from the baroque iterate to Štar and my own collection macros.