StyleInCode

RSS

 

Day 9 - Advent of Code 2025

9 December 2025

Working solutions for the day 9 puzzles.

Part One

""" day_09_01.py """

# usage: python3 day_09_01.py < input

import sys


def area(tile1, tile2):
    """ area of rectangle with given corners """
    (x1, y1), (x2, y2) = tile1, tile2
    return (abs(x1 - x2) + 1) * (abs(y1 - y2) + 1)


with sys.stdin as infile:
    tiles = [tuple(map(int, line.split(','))) for line in infile]

areas = [area(t1, t2) for i, t1 in enumerate(tiles[:-1])
         for t2 in tiles[i + 1:]]

print(max(areas))

Part Two

""" working solution not yet available """


Categories

Links