#!/bin/bash
set -eu -o pipefail
curl -fsS https://adventofcode.com/2024/day/"$1" | awk '/<pre><code>/ {sub("<pre><code>", ""); CODE=1; IDX+=1} /<\/code>/ {CODE=0} CODE {print > sprintf("sample%d.in", IDX)}'