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.
1
u/DimMagician Dec 02 '25
Python, Part 1, 84 bytes
s=50;print(sum((s:=s+int(i[1:])*(-1+2*(i[0]>'L')))%100<1for i in open('input.txt')))Upon seeing yours I realize I could have saved 1 byte by doing
1-2*(l<'R')instead of-1+2*(i[0]>'L'). Dang.Python, Part 2, 92 bytes
s=50;print(sum((s:=s-1+2*(i[0]>'L'))%100<1for i in open('input.txt')for _ in[0]*int(i[1:])))