[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology


Thread archived.
You cannot reply anymore.


[Advertise on 4chan]


File: lotrdoom.jpg (80 KB, 750x932)
80 KB
80 KB JPG
Brink of Glory edition

>Advent of Code is an Advent calendar of small programming puzzles for a variety of skill sets and skill levels that can be solved in any programming language you like. People use them as a speed contest, interview prep, company training, university coursework, practice problems, or to challenge each other.
https://adventofcode.com/

/g/ leaderboard join code:
224303-2c132471
anonymous-only leaderboard:
383378-dd1e2041

Previous thread: >>107503906
>>
Fuck you Eric.
>>
another day of import solution, place your bets!

>Captcha: Eighty Ku Klux Klan
>8TKKK
>>
no I WILL NOT import solution
>>
Once I've imported on solution, nothing is stopping me importing more.
>>
How are you supposed to get this without knowing linear algebra
>>
>>107511353
there are days you wouldn't get if you didn't know bfs etc. considering linalg is like a core cs course it's fine to expect a degree of understanding
>>
>>107511370
nta, what is bfs? I'm not filtered yet
>>
>>107511379
it stands for booby first suck, it's the medical name for the phenomenon of newborns suckling for the first meal
>>
>>107511389
my mum didn't breastfeed me. my first titty suck was my high school girlfriend
>>
>>107511353
How would you get through this without a processor?
>>
>>107511379
Take part 1 for example.
If you try pressing all the buttons and then from from each result from that you try pressing all the buttons, that's a bfs.
You're trying every possible combination at each "level" as you go.
>>
someone should gaussian eliminate eric
>>
>>107511370
any idiot could derive bfs on his own
>>
>>107511398
>my mum didn't breastfeed me.
ouch
>>
>>107511504
dfs is easier to do on your own
>>
1 HOUR
>>
>>107511504
only an idiot could derive bfs
>>
File: 1738671624576085.png (489 KB, 1200x797)
489 KB
489 KB PNG
Good morning anon. Do you really have to play that silly puzzle game? Why don't you stay here in bed with me?
>>
>>107511570
the other anon was right, I cannot lose face on a mongolian basket weaving forum
>>
Upset
>>
File: sadcowboy.jpg (7 KB, 220x229)
7 KB
7 KB JPG
>2nd to last puzzle tonight
Damn. I'm gonna miss you guys. I look forward to these threads all year. It's the only time the actual, genuine programmers on /g/ congregate.
>>
>>107511370
bfs is kind of intuitive, you could come up with it without knowing it by name pretty easily, especially if the puzzle really funnels you into an easy bfs setup. i guess you could probably "inuit" this ILP shit if you're a math savant who never studies linear algebra
>>
>>107511614
seems about right
>>
It's gonna be a maze problem next, right? We haven't had one yet.
>>
>>107511570
sorry, babe, gotta let my broot run for a few hours while googling which library to import for the real solution
>>
>>107511629
If it wasn't for the filter deadline i was about to multithread my broot. But I can't do it in an hour as ive never done it before. But I'm just popping states off a stack so I don't see why not.

It solves 90% of the states in the input no problem in under a second, but 10% have some sort of property that avoids all my pruning and take over an hour.
>>
>>107511639
feels too late for that but maybe. does feels weird to not have had a pathfinding day yet
>>
>>107511639
don't manifest that evil. my template parser returns data line by line i cant be fucked to modify it
>>
>>107511639
A year with no pathfinding would be very unusual
>>
>>107511680
a year with 12 days would be very unusual
>>
>>107511685
unprecedented, to say the least
>>
Heh, Eric only included 23/157 cases where the button matrix is invertible, for which mx=b is trivial and only has one (obviously minimal) solution.
>>
>>107511570
Every morning, my wife asks me if I finished the day's puzzle.
>>
>>107511713
You are a lucky man.
>>
>>107511640
Levels of cope that shouldn't even be possible.
>>
I have track club tonight so I have to be finished in 2 hours ok eric?
>>
A broot I was toying with but never implemented. Is it sound?

>Approach joltage by spam clicking a set of buttons that span the entire voltage range, use a greedy algorithm that chooses the longest buttons, as they increase the joltage by the highest amount and are optimal (?)

>broot the rest of the joltage normally, with the smaller numbers akin to the test cases
>>
>>107511749
you live in hawaii or something?
>>
>>107511785
straya
>>
>>107511783
it sounds reasonable but i bet it wont work because erics a nigger
>>
>>107511813
yeah my thoughts as well.
>>
File: FM95-sdXsAkJY8p.jpg (353 KB, 1200x1200)
353 KB
353 KB JPG
Since there are only 12 days this year and I've been wanting to do this for the past 2 years, fuck it, I'm doing it now.

I like hanging out with you guys and I want there to be a /g/ project alongside AoC that happens in the summer. I'll start work on it in January or so. I'd be honored if you hopped on board.

https://obonofcode.com
>>
>>107511339
i knew one person who imported solution and he just couldn't stop
>>
>>107511824
ronald reagan smuggled solution into the competitive programmer community
>>
>>107511820
any QRD I can read without joining the trannycord. You have my attention, a website is father than anyone else has gotten on this project.
>>
>>107511820
not giving you my email
>>
>>107511713
every morning your wife wakes up in a cold sweat and asks if you finished your puzzle, dreading the inevitable chimpout if you did not
>>
>>107511713
>giving your wife the ick explaining that you had to import z3 after 6 hours
>>
>>107511820
>I want there to be a /g/ project alongside AoC that happens in the summer
retard, do it for day 13-25
huge gap in the market on christmas puzzles
>>
>>107511859
This. I am hoping we at least have 3 lined up. RIGHT anons?
>>
>>107511868
uh yeah i'll have one ready by then don't worry about it
*gulp*
>>
>>107511820
cute looking site
>>
if you asked eric how he intended people to solve the problem he'd shrug and tell you he imported solution when creating the inputs
>>
>>107511834
So far I'm literally just recruiting people to do it with. Just put the site online today, discord and mailing list still being built, and was thinking 20 or so puzzles during June or July. Same format as AoC.

>>107511841
Fortunately, I've also made a dicksword for zoom zooms.

>>107511859
As fun as that sounds, I haven't had the time to make puzzles these past 2 weeks.
>>
>>107511901
any reason why the frontpage is a sensory nightmare? I'm fine with stylized fonts in header etc but atleast make sensible choices for the body text
>>
>>107511901
I like the website I think it looks nice
>>
I hope this is a maze I can crank out in 30 minutes and go to bed. I'm exhausted
>>
>>107511901
>I haven't had the time to make puzzles these past 2 weeks.
so make puzzles for next december?
12 days is a recurring thing
>>
10 MINUTES
>>
>>107511910
I'm really bad at frontend dev.

>>107511919
Thank you!

>>107511928
Maybe I will, but I've always thought summer is a fun time for coding.
>>
File: xarbon.png (20 KB, 524x836)
20 KB
20 KB PNG
I gave up in the last moment and import solutioned. Eric-sama, forgive me...
>>
>>107511910
you fraid of some colors anon?
>>
Dropping tonight's music.
https://www.youtube.com/watch?v=SDNA934EEVk
>>
File: file.png (99 KB, 1200x1200)
99 KB
99 KB PNG
Well, Eric "Henry" Wastl...
>>
>>107511935
I mean even if the puzzles are kind of shit, I would like to try to keep /aocg/ on life support until the 25th, for traditions sake.

Plus erics puzzles have also been kind of shit. The bar is on the floor. Personally I was thinking of shitting out generic maze puzzle #431243214
>>
>day 11
>solve this boolean satisfiability problem
>there's 100000 variables and 10000 equations
>good luck!
>>
File: WALL_INCOMING.jpg (157 KB, 462x260)
157 KB
157 KB JPG
TONIGHT'S THE NIGHT

still not too late to be filtered
>>
File: file.png (47 KB, 1200x1200)
47 KB
47 KB PNG
This gold star is a tragedy.
>>
grok explain the お盆 of code
>>
File: showtime.jpg (46 KB, 640x480)
46 KB
46 KB JPG
www.youtube.com/watch?v=hjGZLnja1o8
>>
>>107511961
cancer music
>>
5 MINUTES
>>
>>107511949
>>107511958
nice
>>
File: mokou-showtime.jpg (130 KB, 440x518)
130 KB
130 KB JPG
>>
>>107511949
>>107511958
Holy based. I am shocked they havent cracked bitfs yet with the crazy bully shit they were working on.
>>
>>107511949
>>107511958
JUST IN TIME
THANK YOU DRAWNON
>>
>>107511958
kino
>>
>>107511951
i think we should limp along for 1-3 days then coordinate something for next year
a website with puzzle inputs, leaderboards, etc.
we need to hop in an irc like we tried last year but commit this time

>>107511949
behead eric wastl babies
>>
I
NEED
TO
SHIT
>>
>>107511980
That was my intent with Obon of Code, actually; I'm just sick of the only way to contact all of you being to hope you're still around in a thread next December.
>>
It's time for the reverse engineering problem.

step1: build an interpreter with these instructions.
step2: run the program again, but with a 1 in A register.
>>
>>107511987
HOLD THE LINE

>>107511988
we'll agree on a liberachat channel
>>
please something comfy
>>
HOLD THE FUCKING LINE

TILL THE LAST FUCKING ANON
>>
>>107511992
eric didn't put in enough effort for that this year
it's going to be some generic pathfinding or leetcode math problem
>>
COMFY OVERDRIVE: ACTIVATE
>>
FUCK
>>
the great filter
>>
>>107511998
AAAAAH I'M PISSING MY PANTS RN
>>
FUCK
>>
FUCK
>>
>>107511820
What the fuck is an obon?
>>
>>107512020
1. Obon; Bon Festival; Buddhist festival for honouring the spirits of one's ancestors, held in mid-August or in some regions, mid-July
>>
To recurse or not to recurse...
>>
eric you fucker did you put a loop in there
>>
Day   -Part 1-   -Part 2-
11 00:07:09 00:10:56

nice final two-part day eric
>>
>raped by a DAG award
>raped by segmentation fault award
>raped by hash map award
>>
>>107512078
how to get this time data
>>
>>107512090
https://adventofcode.com/2025/leaderboard/self
>>
>>107511998
I have fallen. Don't let my demise be for nothing...
>>
>part 2 taking forever
is there just a bigger space or does the input have loops?
>>
>part 2 answer is 15 digits
bruh
>>
File: xarbon.png (13 KB, 788x580)
13 KB
13 KB PNG
fuck I'm retarded, typed srv as the input instead and debugged for 10 minutes

Day   -Part 1-   -Part 2-
11 00:03:33 00:15:05
>>
Part 1
data = open("Day 11 input.txt", "r").read().strip().split("\n")
nodes = {}
for i in data:
name, out = i.split(": ")
nodes[name] = out.split()

cache = {}
def search(pos):
if pos in cache: return cache[pos]
if pos == "out": return 1
total = 0
for i in nodes[pos]:
total += search(i)
cache[pos] = total
return total

print search("you")

Part 2
data = open("Day 11 input.txt", "r").read().strip().split("\n")
nodes = {}
for i in data:
name, out = i.split(": ")
nodes[name] = out.split()

cache = {}
def search(pos, fft=False, dac=False):
state = (pos, fft, dac)
if state in cache: return cache[state]
if pos == "out":
if fft and dac:
return 1
else:
return 0
if pos == "fft": fft = True
if pos == "dac": dac = True
total = 0
for i in nodes[pos]:
total += search(i, fft, dac)
cache[state] = total
return total

print search("svr")

Today was indeed comfy.
>>
>>107512038
Chose recursion. No regrets.
>>
>
aaa: you hhh

>After dividing up the work, the Elves would like you to focus on the devices starting with the one next to you (an Elf hastily attaches a label which just says you)
for some reason I assumed this meant the starting point was aaa because "you" is next to it
>>
File: 2025_day11.png (71 KB, 1449x811)
71 KB
71 KB PNG
Surprisingly easy for the penultimate day.
>>
[src\day_11.rs:50:5] count_graph_paths("fft", "dac", &graph) = 18408243
[src\day_11.rs:51:5] count_graph_paths("dac", "fft", &graph) = 0

>the paths you find must all also visit both dac and fft (in any order)
>there's only one order
>>
File: pepe-the-frog-afraid.gif (101 KB, 640x640)
101 KB
101 KB GIF
>C cache implementation keeps segfaulting

what sort of beast is this
>>
>>107512170
my part 2 only has 1357 unique states
>>
This is taking a long time...
>>
>>107512192
interesting visual
>>
File: ehh.png (217 KB, 500x500)
217 KB
217 KB PNG
Lost time by not reading the instructions and trying to start part 2 from the (You) node.
>>
File: 11.png (961 KB, 5008x4882)
961 KB
961 KB PNG
boring
>>
>>107512100
BFS is not the play for pt2 if that's what you're doing, I'll avoid explaining why for now if you want the ah-hah moment
>>
File: 1736407636016890.png (58 KB, 657x580)
58 KB
58 KB PNG
>wake up in time for the puzzle for once
>it's super easy
>>
>>107512225
my god rust looks miserable
>>
lost a couple rank spots because hand rolled C hashmap wouldn't play nice. next time I'm just using python fuck this shit
>>
>>107512249
rust looks cool as hell though
>>
File: code.png (318 KB, 1864x1660)
318 KB
318 KB PNG
easy day
>only one good puzzle all year
sloppy job eric
>>
File: carbon.png (74 KB, 1296x656)
74 KB
74 KB PNG
>count all paths
>not all shortest paths
>the count is the same for part 1
FUCK YOU ERIC
>>
>>107512241
Good Morning Sir!
>>
>>107512233
not really an "aha" moment but yeah after i accounted for circles just in case i bit the bullet and did memoization. having to include the booleans for having visited the two reactors in the cache key briefly tripped me up, but otherwise a pretty boring second to last day
>>
I thought this was going to be more complicated, I just used memoization and multiplied the number of paths from svr to fft, fft to dac, and dac to out.
>>
>added some animations to the front page graphic
well at least that's something
>>
>>107512202
It means I can do dumb shit like
count_paths("svr", "fft") * count_paths("fft", "dac") * count_paths("dac", "out")


After debugging adders last year, it pays to examine your inputs.
>>
>>107512314
It's almost noon, sir.
>>
>>107512343
even that was more work than needed, can just include whether you've visited dac and fft in your cache key
>>
File: carbon(4).png (212 KB, 990x2320)
212 KB
212 KB PNG
wtf that was easy
>>
File: FINAL.png (56 KB, 624x411)
56 KB
56 KB PNG
reminder that it's just about over
>>
File: 1719450042673550.jpg (51 KB, 1032x774)
51 KB
51 KB JPG
there is only half a puzzle left to go
>>
>>107512293
which was the good puzzle exactly? certainly not yesterday
>>
>double check visited node tracking
>it's broken
>part 1 still completes
fffffuck
>>
>>107512438
9
>>
>>107512438
Day 9 was beyond based
>>
goodbye /g/, ive been told i waste too much time here after finishing the puzzle. will log back on an hour before the next one, don't have any interesting conversations behind my back as I'll feel left out
>>
>Fucked up my own cache for 45 minutes and just imported solution
common theme this year i guess. Looks like everyone has the same program today (again)
>>
>>107512090
you have to click "Leaderboards" and then "Personal Times" will be in the first section. idk why it's hidden on that page and not just at the top on every page
>>
>>107512351
I am doing this but idk why the ans is coming out too low :<
>>
Now that the dust has settled. This aoc was shit I regret staying up for it.
>>
i like how concise my solution turned out to be
>>
>>107512495
the hardest aoc problem is remembering how to navigate eric's site each year
>>
This is the last year I use python. Import solution on Eric's leetcode easy problems is just simply too boring. Why even bother.
>>
File: 25d11.png (2.28 MB, 2260x3588)
2.28 MB
2.28 MB PNG
It took embarrassingly long to realize it was a [spoiler] dag [\spoiler]
>>
File: carbon.png (98 KB, 809x642)
98 KB
98 KB PNG
Day   -Part 1-   -Part 2-
11 00:06:29 00:44:33

Took me 15 minutes to conclude that part 2 must be a DP problem (after seeing if it was brootable), then another 15 minutes to realize it's definitely a directed acyclic graph (DAG) which means it's easier to handle, then like 5 minutes to write the memoized recursive DFS after that.
Felt like it was too simple, but both my DFS function, and the first answer I submitted which was trying (svr -> fft) * (fft -> dac) * (dac -> out) worked first try.
>>
>>107512477
>, ive been told
Lol, who bosses you around like that?
>>
>>107512573
probably his gf/wife
>>
>>107512477
>he tells people he browses this site
NGMI
>>
>>107512547
Use whatever language gets you the solution quickest, and then implement it again in your alternative language.
>>
How long will part 2 take if I just broot with DFS?
>>
>>107512608
depends if you have cache or not
>>
>>107512608
There are over 95 quadrillion paths from svr to out, so I guess you need to determine how many complete paths you can evaluate per second.
>>
>>107512608
15 digit number. You do the math.
>>
>>107512626
What would I cache?
>>
>>107512642
If you go from Texas to New York, that's a certain amount of paths. If you test NM -> Texas -> New York, and OK -> Texas -> New York, are you re-figuring out the Texas->New York paths twice? If so, you're cooked
>>
>>107512642
The result of walking down a path.
>>
>>107512626
he said broot
>>
>>107512662
a broot with caching is still a broot
>>
>>107512640
That's just the number of correct answers, he still has to walk all the wrong paths, which will be about 17-18 digits. Basically this guy is never going to finish.

>>107512667
No it's not. That's memoization.
>>
>>107512682
it's a memoized broot
>>
>>107512685
Not a thing. Bruteforce is testing all outcomes, with memo you're eliminating massive subtrees at a time.
>>
>>107512667
a complete search is a broot
... unless the problem has:
1. optimal substructure
2. overlapping subproblems
... and you cache solutions to subproblems
in which case it's dynamic programming

and yes, that's all there is to dynamic programming
it's a complete search with a cache on the above conditions
>>
>>107512192
the path from me to a gf
>>
File: 11.png (350 KB, 713x435)
350 KB
350 KB PNG
>>
today was too easy, back to brooting yesterday
>>
>>107512763
Implying such a path even exists.
>>
this 2 hour time was brought to you by:

- me mixing up the order of my seen_fft and seen_dac variables in a recursive call
- me caching my pt2 result in my pt1 cache that had an entirely different data structure as the key - how the fuck did c++ not stop me
>>
anons wtf am I doing wrong? the graph is acyclic, right?
fn count_paths(g: *const std.StringHashMap(std.ArrayList([]const u8)), seen: *std.StringHashMap(void), u: []const u8, to: []const u8) u64 {
if (std.mem.eql(u8, u, to)) {
return 1;
}

var count: u64 = 0;

seen.put(u, {}) catch unreachable;
const adj = g.getPtr(u) orelse return 0;
for (adj.items) |v| {
if (!seen.contains(v)) {
count += count_paths(g, seen, v, to);
}
}

return count;
}

then I do count("svr", "fft") * count("fft", "dac") * count("dac", "out") + vice versa
>>
>>107512831
wait, lmao. I ignore the result of seen once
>>
Well I guess it was a little tricky realizing I needed to use DP after a no-memo part 2 was running for 10 minutes with no sign of stopping. Other than that pretty easy. Hopefully tomorrow will actually be 2 parts of a real puzzle with a 3rd secret star where you cash in the other 24. That would also make it a nice round 25 so that two years equal 50 like years past. Probably not though.
>>
>>107512831
>>107512835
fucking finally. as soon as I asked for help lmao. 17mins for p1 and 2hrs for p2
>>
>>107512839
>she doesn't know about the 13 secret puzzles for AoC++ users
>>
File: TTD.png (87 KB, 799x799)
87 KB
87 KB PNG
>>107512274
>next time I'm just using python fuck this shit
no
>>
File: carbon.png (139 KB, 1486x710)
139 KB
139 KB PNG
I don't mind today being easy, maybe I'll have time to fix my ILP solver in rust.
>>
>>107512839
would've been nice, but judging by how piss easy tonight was, i think eric has lost the sauce and we'll just have an easy one part problem tomorrow
>>
File: 2025-11.png (411 KB, 1480x3116)
411 KB
411 KB PNG
$ mix aoc.solve -y 2025 -p b -d 11 -r input/real -b 1
511
458618114529380

Ran in 6.054ms


Surprisingly tame after yesterday's.
>>
>>107512853
no onto optimizations. the best I think would be kahn's for topo + iterative dp

>>107512896
anon the nodes are 3 chars. just encode it into an int

>>107512899
based impl. you can do this too:
return source == tgt or sum(paths(s, tgt) for s in g.get(source, ())
>>
Wtf, the ascii art for day 11 is animated?!
>>
>>107512920
so was day 10, but you have to install Microsoft™ Z3 to see it
>>
how would anons solve this challenge if the graph was allowed to have cycles, but the answer still existed?
>>
>>107512927
>but you have to install Microsoft™ Z3
Oh but I did ;)
>>
>>107512896
saved
>>
>>107512642
the fact an anon made it this far without knowing how to cache a dfs says everything about this year
>>
>>107512917
>return source == tgt or sum(paths(s, tgt) for s in g.get(source, ())
I thought I couldn't golf it like that but forgot about get() default value, nice idea.
>>
>>107512917
>return source == tgt or sum(paths(s, tgt) for s in g.get(source, ())
I thought I couldn't golf it like that but forgot about get() default value, nice idea.
>>107512936
The same, but exclude fft when pathing to dac and vice versa.
>>
>>107512936
i wasn't sure if it would have cycles so i included a "seen" set with each part of memoization function that would just kill the path if it looped back

though i guess technically the problem would be fucked if there were cycles, since if there was a cycle on a valid path, then there would be an infinite number of unique paths as you could just keep going around in the circle to get a unique path (A-B-C, A-B-A-B-C, A-B-A-B-A-B-C, etc)
>>
>>107512987
>>107512998
Nice captcha work there, I thought only reddit does double posting
>>
I was hopeful because it look like a manual input verification day (2024 day 24);
>>
i'm in the yookay so 4chan may be blocked in a couple of days
if that happens, then i won't be able to post my day 13 puzzle

i made a temporary irc channel #aocg on rizon
if you have no irc client, then use https://rizon.net/chat
type /join #aocg
to help plan extra puzzles without spoiling them for anons
>>
File: carbon.png (528 KB, 1480x3128)
528 KB
528 KB PNG
kind of a cannibalization of my day 7 code. maybe i'll go back and do day 10 now, i was 100% convinced tonight would be some massive nightmare problem and i just wouldn't want to do at all, it still ended up taking forever because i'm retarded and started working on it right after waking up.
>>
>>107513015
only doing your puzzle if you include some gay story shit about elf hijinks
>>
>>107513027
it will come with a story, don't worry
i will include female elves somehow
>>
>>107512936
Would likely add them to the state while checking, or run another simpler pass first to eliminate them.
Cycles by definition couldn't be on the main path or the answer would be infinite, so the looping connections could be severed in advance.
>>
>>107512936
if dac and fft are on a path with a cycle then return inf
mark all cells in a cycle as unreachable
proceed as normal
>>
>>107513015
i thought they were telling uk bozos to pound sand, are they actually going to block them?
>>
>>107511820
good luck
please add some more info to your site because I sure as fuck will forget what's that link in few months
>>
>think i can make it by trimming visited nodes
>20GB RAM usage
Ok, let's do something else.
>>
>>107513040
>run another simpler pass first to eliminate them
A really shitty way would be to go through each node and BFS to see if it reaches itself. If it does, remove the node - any valid solution cannot possibly pass through it without the answer being infinite.
Would be a more interesting twist on the puzzle to include DFS traps, but not much harder.
>>
>>107512560
anon why are you importing a library for just dict[str, list[str]] :<

>>107513003
by answer exists what I meant was a cycle wasn't in a way from some valid source to valid dest. so cycles would be kind of an offshoot. like a chain would extend from the main graph and then it would loop

>>107513007
stfu

>>107512998
>exclude fft when pathing to dac and vice versa
idgi

>>107513040
hmm, yeah it's not that difficult of an extension to the problem.
while reading the problem I thought it was min flow because I read "flow" somewhere lol
>>
File: 1761536700554009.png (108 KB, 1322x654)
108 KB
108 KB PNG
kek that was the jankiest solution ever. I even visualised the matrix and current state as a sanity check
>>
>>107513058
the gov may block 4chan's servers directly
isps already block ips for child safety
once cloudflare's 1.1.1.1 was blocked by accident;
i visited the http page and it accused me of trying to access csam
>>
>>107513078
do they actually properly block it? aus gov made some isps "block" 4chan when the christchurch thing happened, but it was just a dns block so easily avoided
>>
>>107513084
often it is just a dns block like when they blocked rt and other russian outlets
but there is also a direct ip blocking system mirrored by all isps
if they use that system, then i need to either find a vpn 4chan doesn't block or buy a vps
>>
>>107511901
Just take literal leetcode mediums and wrap a christmas story around them. It's boring but will definitely get us through the month and get people to remember your website.
>>
which year was the problem where we had to scan a video file for pictures of a tree? that one was sovl
>>
>>107513117
https://adventofcode.com/2024/day/14
>>
File: carbon.png (77 KB, 809x493)
77 KB
77 KB PNG
>>107513066
>anon why are you importing a library for just dict[str, list[str]] :<
I was being lazy and used some NetworkX functions to do most of part 1, which I ended up deleting when my part 2 code was better and worked with part 1 anyway.
I also used nx to visualize the graph for part 2 before I had a real solution.
>>
>both fkn and fap appear right at the bottom of my input
Has anyone been checking their input for slurs/swears this year? Wouldn't be surprised if Eric's filtering most of them out now
>>
>>107513205
my 2016-04 and 2021-08 inputs both contain fag
>>
File: 1753667675883045.png (4 KB, 382x62)
4 KB
4 KB PNG
>>107513205
he can't keep getting away with it!
>>
>>107513117
I'm 95% sure that was only written like that to make it impossible for LLMs to solve. Some of 2023 and a lot of 2024 had shit like that, even though Eric denies it.
>>
awk
looking at other solutions it could have been way shorter if I'd done it recursively
oh well
>>
>>107513235
ERIC NO
>>
Stop it eric!
>>
I failed Linear Programming in college because I'm a beaner nigger faggot so I need more time for day 10. Day 11 looks ez, trie + backtracking with memo or DFS.
>>
>>107513298
>backtracking with memo or DFS
heh try it ;)
>>
>>107513235
I remember when a "fag" slipped into one of his inputs, and redditors got upset.
>>
>402000000 is still too low
Fuck.
>>
>>107513348
my answer had 15 digits for what it's worth
>>
>>107513348
mine is 15 digits
>>
>>107513368
>>107513370
>giving him the digit length

Faggots. You've stolen the ultimate broot from him.
>>
>>107513348
did you try 402000001?
>>
DAC, FFT? It looks like we cant stop winning EE bros.
>>
>>107513374
plenty of 15 digit numbers to try still
>>
>>107513348
Is your counter only 32 bit?
>>107513405
Eric is an englet, physlet, and mathlet... he's trying to get cheap cred.
>>
now that the dust has settled. did anyone solve day 10 part 2 withOUT import solution, writing a diophantus linear equation system solver for non negative numbers that minimizes the L1 norm of the unknown vector?
>>
>>107513445
yes, see >>107507176
>>
>>107513405
unfortunately it has nothing to do with dac or fft (that would be too fun)
>>
>>107513405
input also kinda looks like this huh
>>
>>107513451
>buttons mask
So it's basically brute? I tried the same button mask thing in python and it was too slow. 100s isn't really a solution but better than import solution I guess.
>>
>>107513425
>Is your counter only 32 bit?
No. I think it was just poor logic (I was trying to use a dict as buckets, merging histories to prevent loops, but I think that actually eliminates a bunch of paths).
>>
File: carbon (1).png (274 KB, 812x1836)
274 KB
274 KB PNG
>part one: 472 (took 164.875µs)
>part two: 526811953334940 (took 428.75µs)
BORING
>>
>>107513445
What do you define as "import solution", am I allowed linear algebra libraries?
>>
>boring day
THANK YOU ERIC
(now I can spend more time on yesterday ;_;)
>>
>>107513578
everything outside your language's standard library is import solution
it's ok to get both stars using import solution but showing off is lame
>>
>However, the paths you find must all also visit both dac and fft (in any order).
>there are no paths between dac and fft
Fuck Eric.
>>
>>107513597
what about >>107506290
>>
>>107513600
that just makes it easier
>>
>>107511264
today was easier than i expected, i spent like 10 minutes debugging a reference bug in python
>>
>>107513620
Yeah, if you knew that you could automatically prune all paths that reach dac without touching fft.
And at least in my input there were a LOT of paths that reach dac first.
Basically dac was being the hole that swallowed all the paths.
>>
>>107513578
Who cares? I'm more proud of my solutions where I get to offload the hard work to a library than ones I write entirely from scratch. Means I know what the right tool for the job is.
>>
>>107513647
Might as well use ChatGPT. That's even better tool for the job.
>>
>>107513647
>i need to check if this number is even
>i know the right tool for this job, the isEven npm package
>>
>>107513647
My question wasn't asking that guy for his approval, but constraints on what he wanted to work out. Maybe he's using C++ and just wondered if he could get to the solution with some simple linear algebra libraries.
>>
>>107513600
If there were paths both directions the answer would be infinite
>>
>i have a part 2 for day 9 that doesn't require a lot of RAM usage
Now I have to unwrap this shit into something I can put into assembly. Pray for me.
>>
so where's the bigboy anon. filtered for good?
>>
does anyone here have the code for theo browne's (t3gg) private leaderboard?
>>
>>107513786
who?
>>
>>107513600
>no infinite loops
you say that like it's a bad thing?
>>
>>107513802
some yt webshit streamer, seen like 4 posts of him bragging about topping his leaderboard just want to see if it's skill (by which i mean he's using ai) or others in there are lobotomites
>>
>part 2 demo input is different from part 1 demo input
fuck off there was no reason for this
>>
>Chanukah (Hanukkah) 2025 starts at nightfall on December 14, 2025 and ends with nightfall on December 22, 2025
Can we get eight puzzles together? I'm still working on mine...
>>
>>107513890
maybe check out https://easters.dev/
only three problems though.
next year's gonna be more difficult.
>>
File: carbon(10).png (267 KB, 1970x1616)
267 KB
267 KB PNG
Spent way too much time trying to figure out why there were too many loops before realizing my program was hanging because the memo table was, in fact, not a memo table.
I'm not yet good enough at Haskell that I understand at a glance the scope of objects.

Still filtered by yesterday's p2 though. I don't fancy writing linear algebra in Haskell nor learning how to use a linear optimization lib, so I'll let it go for the time being.
>>
File: carbon(11).png (167 KB, 1970x1056)
167 KB
167 KB PNG
>>107513916
Aaaaaand its a DAG so I don't even need to prune loops. Man mistaking that bad DP for loop existence really fucked my time.
>>
>>107513909
not much programming but festive enough:
https://www.gchq.gov.uk/files/gchq%20christmas%20challenge%202025.pdf
>>
>>107514061
Thanks, I'll do this after AOC. That said, I did one of these a few years back, and the solution turned into a QR code that just linked to a job application form.

What would I even do there? Spy on native Britons for using slurs to accurately describe the untermenschen deposited to their shores?
>>
>>107514097
yeah they use it for recruitment
the same way sponsors use aoc for recruitment
>if solving puzzles feels like a Christmas treat then you're our kind of programmer!
>>
File: aoc_day11.png (288 KB, 894x2370)
288 KB
288 KB PNG
>babby's first kahn

If your solution takes >1ms you got filtered
>>
rewrote my day 10 solution in zig with some heuristics and it runs in 7s now
>>
>>107514271
you challenging me, anon? I wanted to use kahn's but today's is too boring of a problem. and optimizing it feels more and more like just overfitting on the shape of input. for example, assuming that there are no cycles, nodes are 3 len strings, at most k outputs per node, etc
>>
File: carbon11.png (389 KB, 1076x2256)
389 KB
389 KB PNG
Easy and nice.
>>
>>107511353
even if you know some linear algebra (game dev or whatever) this LP solver crap is EXTREMELY niche
>>
is a broot feasible? I don't want to memo this shit
>>
>>107514305
If someone asks you what 7 times a million is, are you gonna start counting up in 7s? Wouldn't want to overfit and optimise with fancy "multiplication" algorithms.
>>
>>107514356
nope at all
>>
>>107514353
3x+y=7
x+y=1

Whoops, sorry anon, didn't mean to scare you with niche advanced maths
>>
i might have a good question formulated for another day that I could contribute if anynon (any anon) is running an extension of this till christmas or something?
>>
>>107514356
>count how many edges point into each node
>start at the nodes with 0 inward edges (since no paths lead into these, their #paths can't possibly increase)
>add their #paths to all their outward nodes
>this node is now accounted for, so for these outward nodes, decrement their indegree count by 1
>if the indegree hits 0 for a node, you process that node too (push onto a stack, recurse, whatever)

You only touch each edge once, no memoisation
>>
File: aoc2025-11.png (110 KB, 478x952)
110 KB
110 KB PNG
Easy, other than me temporarily forgetting how to make a memoized thing
>>
Are there any cycles in this? I feel like eric is fucking with me.
>>
>>107514487
Yes, Eric fucked with your input in particular
>>
>>107514487
Not in my input
Puzzle doesn't really make sense if cycles are present
>>
>>107514371
one must always anticipate the bigger boys. and no, I would count up in 1 millions
>>
>>107514401
yeah and a cpu is just compressed sand! a toddler would grok it.
>>
File: day 10.png (813 KB, 1630x3563)
813 KB
813 KB PNG
genuine day 10 solution
>>
>>107514622
Gaussian reduction is what you get when you write a computer program to solve simultaneous equations. It doesn't require any insight beyond what's needed to solve >>107514401, just the basic programming ability to encode logic you already understand.
>>
>>107514689
nice. post times
>>
was today easy mode?
>>
>>107513607
looks great I'm a fan
>>
>>107514802
yes, day 9 and 10 were from an alternate timeline where eric actually gave a shit, now we're back to normal
>>
>>107514825
>day 10
fuck that, brainless import solution puzzle
>>
another day I get fucked by small storage. might as well just use u64 for everything...
>>
>>107514877
>brainless import solution puzzle
it's not though
>>
>>107515014
yes it is
>>
File: out.png (725 KB, 4901x5241)
725 KB
725 KB PNG
>>
File: theonering.png (635 KB, 1000x1000)
635 KB
635 KB PNG
i just ordered this replice of one ring from that company that did movie props for the films
>>
>>107515051
filtered
>>
>>107515066
what?
>>
>not a SINGLE fun puzzle

this year was shit but i still had good time with you guys
>>
>>107515086
day 4 and 6 were kinda fun
>>
>>107515042
more idiomatic than idiomatic rust anon
>>
Will the last problem have 1 or 2 parts?
>>
>>107515168
1 of course. it's traditional
>>
>>107515086
what do you mean? day 8 and 9 were fun, i haven't done todays and won't be able to until monday but it appears fun from a glance
>>
File: file.png (203 KB, 480x360)
203 KB
203 KB PNG
>>107515086
i enjoyed day9
>>
>>107514939
the answer will always fit in a signed, positive 64-bit integer or be a string
>>
>>107514939
js and python are truly the only langs worth doing advent of code in
>>
>>107515168
same as every year, 2 parts but part 2 only unlocks of you have all previous stars (including from previous years)
>>
>can run in <5ms
good day
#include <stdio.h>
#include <string.h>
#define MAX_DEV 17576+1
#define MAX_OUT 21
#define OUT 10003+1
#define SVR 12731+1
#define DAC 2030+1
#define FFT 3529+1

#define findAndShadow(ret, idx, trg) \
{ \
int vis[MAX_DEV] = {0}; \
ret = findPaths(dev, vis, idx, trg); \
}

static inline int getIdx(char c1, char c2, char c3){
return 676*(c1-'a')+26*(c2-'a')+(c3-'a')+1;
}

static inline long findPaths(int dev[MAX_DEV][MAX_OUT], int vis[MAX_DEV], int idx, int trg){
long ret = 0;
if(idx == trg) return 1;
vis[idx] = -1;
if(!dev[idx][0]) return 0;

for(int i = 0; dev[idx][i] != -1; i++){
if(!vis[dev[idx][i]]) ret += findPaths(dev, vis, dev[idx][i], trg);
else if(vis[dev[idx][i]] != -1) ret += vis[dev[idx][i]];
}
if(ret) vis[idx] = ret;
return ret;
}

int main(){
char buf[MAX_OUT*4+1] = {0}, c1=0, c2=0, c3=0;
int dev[MAX_DEV][MAX_OUT] = {0};
long dto = 0, fto = 0, dtf = 0, ftd = 0, std = 0, stf = 0;
for(int i = 0; i < MAX_DEV && scanf("%c%c%c: ", &c1, &c2, &c3) != EOF; i++){
fgets(buf, MAX_OUT*4+1, stdin);
int idx = getIdx(c1, c2, c3), j = 1;

char *tok = strtok(buf, " ");
dev[idx][0] = getIdx(tok[0], tok[1], tok[2]);
for(j = 1; j < MAX_OUT && (tok = strtok(NULL, " ")) != NULL; j++){
dev[idx][j] = getIdx(tok[0], tok[1], tok[2]);
}
dev[idx][j] = -1;
}
findAndShadow(fto, FFT, OUT)
findAndShadow(dto, DAC, OUT)
findAndShadow(ftd, FFT, DAC)
findAndShadow(dtf, DAC, FFT)
findAndShadow(std, SVR, DAC)
findAndShadow(stf, SVR, FFT)
printf("%ld\n", stf*ftd*dto + std*dtf*fto);
}
>>
>>107514796
1.5ms for either part
>>
>>107515356
oh wow, really cool. what's that approach called? mine takes 6s with gauss-jordan + brute with heuristics
>>
>>107515014
It was for me because I brainlessly imported it
>>
>>107515421
nta but branch & bound
>>
You are decorating the north pole base as you go
>>
>>107515500
who actually looks at this gay shit?
>>
>>107515519
Me
>>
>>107515532
see >>107513265
>>
>not filtered anymore
>13mn for both parts
WE ARE SO BACK BROS
>>
File: im-1765462071881.png (56 KB, 628x485)
56 KB
56 KB PNG
pretty happy with my solve today
cannot say the same about yesterday
>>
>>107515548 (Me)
13min to solve it obviously, it runs in 60ms otherwise
>>
>>107513890
I have a puzzle if anyone has a website
>>
>>107515563
likewise
>>
151.641µs and that's with a hashmap. Could get sub 100µs if you cheese it and swap the hash for an array.
>>
new threat

>>107515633
>>107515633
>>107515633

new threat
>>
i std::shuffled the perimiter lines on day9/p2 and got it down to ~2ms
>>
>>107515641
>page 3
>>
>>107515519
nobody would care if it wasn't for the gay shit
>>
>>107513817
i don't know him but i'm pretty sure he's just using claude to solve everything lol
and when he's not he's got a greybeard in his community willing to spoon-feed him
>>
>>107515336
Representing states as an int makes sense, but
>MAX_DEV 17576+1
You're kinda limiting yourself by not having an easy hashmap implementation to use for situations like this.
the actual input only has 631 of these states (maybe a little different per input).
so your big array needs about 30 times as much memory as actually needed.
> MAX_OUT 21
My input has a maximum of 25 outgoing connections, so your table for connections still wouldn't be big enough
>>
>>107512379
I returned 4 values from my function (number of paths indexed by bitmask of dac/fft visited) but I now realize that your approach is equivalent but simpler.
I also could have counted those that have at least that rather than exactly that so I wouldn't need a sum when repurposing part 2 for part 1
>>
>>107513636
Considering switching my aoc language due to this. It happens to me like 1/3 days.
>>
>>107512936
My solution would still work.
>>
>>107515741
beef is the best right now
>>
>>107515704
it also runs 30 times faster than yours
>>
>>107515704
Fair comment, I was just more intrested solving for speed and for nice algorithms. Also I want to minimize the lines of code while including only standard library stuff, so including my own libraries would feel like cheating.
Admittedly optimizing for memory is the least interesting part for me so I simply don't :D
>My input has a maximum of 25 outgoing connections, so your table for connections still wouldn't be big enough
Mine had up to 19 lol, I figured that 20 would be the limit
>>
File: 25_D11_C#.png (98 KB, 1370x530)
98 KB
98 KB PNG
Took me way to long to work out this solution to Part 2.
>>
Sorry lads, but my company installed a beer tap at the office, guess I won't be able to do the todays puzzle after all...
See you tomorrow
>>
>>107516119
>american shaped keg
that's not beer. maybe beer scented gypsy piss, but not beer.
>>
File: rusty.png (173 KB, 1255x791)
173 KB
173 KB PNG
Why is my Rust code so weak? I feel like this is not so clean.
>>
>>107516420
holy shit, turn off the inlay hints. what a fucking eye sore.
>>
>>107516441
It's the only way I can tell how many references deep I am
>>
>two threads
>both are dead
>>
>>107516371
>>american shaped keg
>PilsnerUrquell print front and center
you don't drink beer and you should leave, uncultured swine
>>
>>107512763
I woke to this and laughed. You're this optimistic, so I'll be optimistic too. I'll make it to day 25!
>>
Hi
>>
File: 1725724307124524.jpg (104 KB, 740x895)
104 KB
104 KB JPG
>>107517011
>I'm literally in Czech Republic, the home of beer
You're the uncultured pig, not medxm8h
>>
>>107517394
hello



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.