From 2dad8cf5d59e07637ad45c4200966816b76dcd67 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Tue, 1 Dec 2026 17:04:23 +0000 Subject: 2026: 1 --- 2026/.gitignore | 16 ++++++++++++++++ 2026/1.hs | 10 ++++++++++ 2026/Makefile | 1 + 2026/get_input.sh | 3 +++ 4 files changed, 30 insertions(+) create mode 100644 2026/.gitignore create mode 100644 2026/1.hs create mode 120000 2026/Makefile create mode 100755 2026/get_input.sh (limited to '2026') diff --git a/2026/.gitignore b/2026/.gitignore new file mode 100644 index 0000000..dc0f47d --- /dev/null +++ b/2026/.gitignore @@ -0,0 +1,16 @@ +aoc-cookie.txt +*.o +*.hi +*.in +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 diff --git a/2026/1.hs b/2026/1.hs new file mode 100644 index 0000000..e36246b --- /dev/null +++ b/2026/1.hs @@ -0,0 +1,10 @@ +{-# OPTIONS -Wno-x-partial #-} +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 diff --git a/2026/Makefile b/2026/Makefile new file mode 120000 index 0000000..17e64eb --- /dev/null +++ b/2026/Makefile @@ -0,0 +1 @@ +../2024/Makefile \ No newline at end of file diff --git a/2026/get_input.sh b/2026/get_input.sh new file mode 100755 index 0000000..5f396b0 --- /dev/null +++ b/2026/get_input.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +set -eu +curl -H "Cookie: session=$(cat aoc-cookie.txt)" https://adventofcode.com/2026/day/"$1"/input >"$1".in -- cgit v1.3.1