import streams, sequtils, sets, options, deques, input_helpers, day1 const WINDOW = 25 proc part1*(s: Stream): int = var rollingWindow = initDeque[int](WINDOW) for i in s.asInts: echo i if rollingWindow.len < WINDOW: rollingWindow.addFirst(i) continue else: let maybe = toSeq(rollingWindow).findComplement(i) if maybe.isSome: rollingWindow.addFirst(i) rollingWindow.popLast else: return i proc part2*(s: Stream): int = let n = s.part1 s.setPosition 0 let nums = toSeq(s.asInts) for i in 0.. n: continue sum += nums[j]