aoc2025/brechtje/1/1-2.py

21 lines
479 B
Python

input = open("input.txt", "r").read().splitlines()
pos = 50
password = 0
for line in input:
if line.startswith('L'):
for _ in range(int(line[1:])):
pos -= 1
if pos == -1:
pos = 99
elif pos == 0:
password += 1
elif line.startswith('R'):
for _ in range(int(line[1:])):
pos += 1
if pos == 100:
pos = 0
password += 1
print(password)