Day 7: No Space Left On Device

Day 7 involves parsing terminal output to build a directory structure and calculate directory sizes.

Problem Overview

You're trying to free up space on your device by analyzing the file system. Given a terminal output showing the commands you executed and their results, you need to:

  1. Build a directory tree from the commands and output
  2. Calculate the total size of each directory (including subdirectories)
  3. Find directories smaller than a certain size
  4. Find the smallest directory that, when deleted, would free enough space

This problem tests your ability to parse structured text, build a tree data structure, and perform size calculations on it.