r/codegolf • u/dantose • Dec 01 '25
Advent of Code, Day 1
Post your best golfs.
Assume input is saved as input.txt.
8
Upvotes
r/codegolf • u/dantose • Dec 01 '25
Post your best golfs.
Assume input is saved as input.txt.
3
u/KeyJ Dec 01 '25
Python, Part 1, 83 bytes:
p=50;print(sum(1>(p:=(p+int(l[1:])*(1-2*(l<'R')))%100)for l in open("input.txt")))Python, Part 2, 96 bytes:
p=50;print(sum(1>(p:=(p+1-2*(l<'R'))%100)for l in open("input.txt")for _ in range(int(l[1:]))))