(ns aoc2025 (:require [clojure.string :as str])) (defn get-input [day] (slurp (str "2025/day" day "-input.txt"))) (def day1-input-test "L68 L30 R48 L5 R60 L55 L1 L99 R14 L82") (defn day1-get-sequence [input] (map (fn [line] [(if (= "R" (str (first line))) #'+ #'-) (Integer/parseInt (str/join (rest line)))]) (str/split-lines input))) (defn day1-p1 [input] (let [sequence (day1-get-sequence input)] (loop [s sequence curr 50 zero-count 0] (if (not (seq s)) zero-count (let [[f amount] (first s) new-dial-pos (mod (f curr amount) 100)] (recur (rest s) new-dial-pos (if (zero? new-dial-pos) (inc zero-count) zero-count))))))) (defn day1-p2 [input] (let [sequence (day1-get-sequence input)] (loop [s sequence curr 50 zero-count 0] (if (not (seq s)) zero-count (let [[f amount] (first s) new-dial-pos (mod (f curr amount) 100) spins (if (and (neg? (f amount)) (not (zero? curr))) (quot (+ (- 100 curr) amount) 100) (quot (+ curr amount) 100))] (recur (rest s) new-dial-pos (+ zero-count spins))))))) (comment (day1-p1 day1-input-test) (day1-p1 (get-input 1)) (day1-p2 day1-input-test) (day1-p2 (get-input 1)) :-)