everybody codes 2025
i enjoyed everybody code a lot!
good problems and easter eggs, what’s not to like?
what’s important for me in these code events:
- realize early what can and cannot work
- have fun
- read other people code
- re-read your solutions
- see your innefficiencies
it’s very important to read other’s code. you already figured out the “what” by solving the problem, so you’re more efficient on the “how”.
so here is my review of some shared python code:
yldraw
i found the very useful tqdm library. get a loading bar for your loops!
i also see that cmp_to_key was not needed for day 5
and a simple lambda sort would have worked.
i brute forced day 6 (sorry). it’s nice he figured out the “wrap”.
nice recursion on day 7. let’s do a quick set cheatsheet:
| Code | Means |
|---|---|
| a |= b | a = a.union(b) |
| a &= b | a = a.intersection(b) |
| a -= b | a = a.difference(b) |
| a ^= b | a = a.symmetric_difference(b) |
yes for day 8, you don’t need to store every strike. this “max update” pattern, i should use it more often.
ok he stopped around where i stopped. i won’t check after day 11 anyway.
danagle
he “washed” his code, meaning he cleaned it and added any “efficient” tricks (like a modulo trick you don’t see in your first pass but understand afterwards).
but it’s a bit too washed. almost golfed.
he uses numba to speed up his loops. interesting.
nice use of Counter.most_common().
string padding on day 6, why not.
i wondered if someone used cycle.
oh itertools pairwise, nice!
oh and a trie?! ok… a prefix tree. useful for autocomplete, spell check and ip routing. even better is a radix tree, ok ok.
oh so that’s how you profile python code. might be useful for my dod posts.
oh and now a fenwick tree, watch out we’ve got a badass over there. hmmm ok i don’t think i’ll ever use that.
day 9 he uses a trie again. and so he doesn’t do bfs like i did. man i need to level up my trees.
ok, i learned about nonlocal in imbricated functions.
i don’t think i should use it.
i still can’t figure out what went wrong in day 10. day 11, i also tried that and it didn’t work. oh well.
nice, he made visualizations!
using PIL.Image.fromarray() is tight.
alex11br
oh shit. numpy arrays,
functools.reduce,
we’ve got a madman.
yeah, no, bad code.
r01f
nothing fancy.
i really like his:
trees = [
{a[0], b[0], c[0]}
for a, b, c in permutations(lines, 3)
if b > c and is_child(a[1], b[1], c[1])
]
quite effective.
elandor
yuck.
if you want to see what i did, here’s my code.
now, let’s do the same for aoc!