#!/usr/bin/env python # https://adventofcode.com/2025/day/1 f = open("day01input.txt", "r") a = f.readlines() b = list(map(str.strip, a)) c = list(map(lambda x: -int(x[1:]) if x[0] == "L" else int(x[1:]), b)) def part1(data: list[str], pos: int = 50, clicks: int = 100) -> int: total = pos zeroes = 0 for i in data: total = (total + i) % clicks if total == 0: zeroes += 1 return zeroes def part2(data: list[str], pos: int = 50, clicks: int = 100) -> int: total = pos zeroes = 0 for i in data: if i >= 0: m, total = divmod((total + i), clicks) zeroes += m else: newtotal = (total + i) % clicks if total == 0: zeroes += -(i // clicks) - 1 elif -i > total: zeroes += -((total + i) // clicks) if newtotal == 0: zeroes += 1 elif -i == total: zeroes += 1 total = newtotal return zeroes print(f"Solution to part 1: {part1(c)}") print(f"Solution to part 2: {part2(c)}")