Day 07 part 1
type
Entry = ref object
parent: Entry
size: Natural
var
answer: Natural
cwd = Entry()
for l in "input.txt".lines:
var
size: int
item: string
if l.scanf("$$ cd $+", item):
if item == "..":
if cwd.size < 100000: answer.inc cwd.size
cwd.parent.size.inc cwd.size
cwd = cwd.parent
else:
cwd = Entry(parent: cwd)
elif l.scanf("$i $w", size, item): cwd.size.inc size
Answer is: 1583951