#!/usr/bin/env python depth = 0 dist = 0 with open("day2.txt") as data: for line in data: match line.split(): case ["forward", x]: dist += int(x) case ["up", x]: depth -= int(x) case ["down", x]: depth += int(x) print(depth * dist) depth = 0 dist = 0 aim = 0 with open("day2.txt") as data: for line in data: match line.split(): case ["forward", x]: dist += int(x) depth += aim * int(x) case ["up", x]: aim -= int(x) case ["down", x]: aim += int(x) print(depth * dist)