r/adventofcode • u/daggerdragon • Dec 09 '25
SOLUTION MEGATHREAD -❄️- 2025 Day 9 Solutions -❄️-
THE USUAL REMINDERS
All of our rules, FAQs, resources, etc. are in our community wiki.
If you see content in the subreddit or megathreads that violates one of our rules, either inform the user (politely and gently!) or use the report button on the post/comment and the mods will take care of it.
AoC Community Fun 2025: Red(dit) One
Submissions megathread is unlocked!
8 DAYS remaining until the submissions deadline on December 17 at 18:00 EST!
Featured Subreddits: /r/iiiiiiitttttttttttt, /r/itsaunixsystem, /r/astrologymemes
"It's all humbug, I tell you, humbug!"
— Ebenezer Scrooge, A Christmas Carol (1951)
Today's challenge is to create an AoC-themed meme. You know what to do.
If you need inspiration, have a look at the Hall of Fame in our community wiki as well as the highly upvoted posts in /r/adventofcode with the
Meme/Funnyflair.Memes containing musical instruments will likely be nuked from orbit.
REMINDERS:
If you post your submission outside this megathread, make sure to follow the posting rules for memes!
If your meme contains AI-generated artwork of any kind, follow the posting rules for AI art
Keep your contributions SFW and professional—stay away from the more risqué memes and absolutely no naughty language is allowed.
Request from the mods: When you include an entry alongside your solution, please label it with [Red(dit) One] so we can find it easily!
--- Day 9: Movie Theater ---
Post your code solution in this megathread.
Read the full posting rules in our community wiki before you post!
State which language(s) your solution uses with
[LANGUAGE: xyz]Format code blocks using the four-spaces Markdown syntax!
Quick link to Topaz's
pasteif you need it for longer code blocks. What is Topaz'spastetool?
1
u/flwyd Dec 09 '25
[LANGUAGE: SQL] [LANGUAGE: PostgreSQL] (on GitHub)
My theme this year: glue languages you might already have installed. I didn’t actually have PostgreSQL and PostGIS installed, but it’s definitely something I want to have hanging around. (Arguably using PostGIS breaks my “only use the language’s standard library” constraint, but one could imagine a SQL system with spatial queries in the core language.) I also implemented part 1 in
bcand attempted part 2 inImageMagickwhich worked for the example but choked on the 10 gigapixel image. I’ll post about that later. I considered using S2 geometry, but the onlyR2(planar Cartesian) shape it supports is a rectangle, not a polygon. I briefly considered converting the input’s integer points to spherical coordinates near null island and usingS2Polygoncontainment, but didn’t really want to use a “real” language this year, and double math might have a slightly-wrong result.Aside from the data loading, the following SQL code should work in other spatial databases that support the OGC simple feature access functions. I initially did this by having sed and zsh generate polygon literals, but cleaned it up to do self-joins with a
pointstable. TheST_Expand(box, 0.5, 0.5)is because AoC shapes live in a quantized grid where points with area, so a box from (1,1) to (2, 2) has area 4, not 1, while the spatial functions assume a continuous space where endpoints have no area. To run this at the command line with database$DBNAME, runpsql $DBNAME -q -c "$(cat day9.sql)" < input.example.txt. The sillycatin there is because psql’s-fjust treats the script as part of stdin, so theCOPYstatement runs into the rest of the query.