I didnt realize that bfs could solve this, nice one dude!😊
@nilsburlat167610 күн бұрын
Hey, thanks for the videos! Could you please give the definition of the `hpush` and `hpop` functions? Thanks for that!
@dracuul7810 күн бұрын
It has been really fun watching someone else solve the same problems. And I'm generally impressed how fast you scan (and guess) the core of the question, and then parse the input and solve the problem it so super quickly. Have you ever considered making videos where you solve puzzles from ProjectEuler, LeetCode, or Codingame? Anyway, I enjoyed watching someone master the power of Python (being a .NET dev myself).
@agnesakne440913 күн бұрын
one of the better explanations of part 2
@noomade14 күн бұрын
I mean... how do you even come up with "they won't overlap"???
@TK-ju4xi14 күн бұрын
Really enjoyed your live solutions to AOC this year, hope you backsolve previous years. Your explanations are pretty good too. If you were a quant I would not be suprised. LOL
@JMaximusIX17 күн бұрын
Very interesting to watch, I had many of the same thoughts when it came to part2 (in particular the thing about each robots just doing a round trip to one or two keys and aligning with all layers above on the A key). I also started out with some simple rules on which direction to prioritize, but instead of switching to just trying both (like you did) I continued adding a few rules, which took me a looong time to wrap my head around, but I was very happy when it finally worked. So it is possible to solve that way! Like @bikkel77 pointed out in his comment, the main difference it always comes down to is that the < key is more expensive to get to, so v<<A>^A>A is better than <Av<A>>^A because you can stay on the < key and don't have to come back to it twice (which was the example where your code broke)
@namsZINGER17 күн бұрын
not a fan of these reverse engineering days, but really liked seeing how you approach finding the wrong gates. I developed a more general solution but had to make the assumption that for each wrong bit there is a single swap that fixes it (or what your referred as no obfuscation). same thing for the 3-bit computer quine challenge, I converted the program into a z3 expression and "solved it". manually solving just feels icky.
@bikkel7717 күн бұрын
I did not bother introspecting the circuit. Instead I made the observation that the only way for 1s to occur in the state is from another 1. If you test x and y, bit by bit, you can test three operations (0+1=1, 1+0=1, 1+1=1 at next bit, carry). To automate finding the errors: - Find the 1s in the circuit when one of these bit operations fail for bit 'i' (group 1) - Find the reachable nodes by traversing the inputs from the output bit (z[i] or z[i+1]) which should be 1, but isn't (group 2) - The candidates for swaps are in these two groups (first is from the first group, the second is from the second) - For each of the candidate swaps perform it and count the number of errors after the swap. Total error count should go down and the bit operation should be fixed for a "good" swap. This is because one output can be swapped at most once (compare with sorting, the sort order should improve for a successful swap) - Emit the set of candidate swaps after testing all 45 input bits, this is a very limited set of candidates (26 pairs for my input) which can easily be brute forced. - For each of these swaps, emit unique sets of permutations for the swaps to try and perform them, first test the failed operations, if all succeed, test all bits if all succeeds, test a set of random additions, if succeeds you have your result. - Runs in about half a second on my machine
@nthistlethwaite17 күн бұрын
@@bikkel77 Woah, that's a pretty cool pure algorithmic approach. Nice, thanks for sharing!
@bikkel7716 күн бұрын
Thanks! I made a KZbin video about my solution on my channel.
@Kyle-nt7nl17 күн бұрын
Thanks for posting Neil! It really enhances my experience participating in AoC, and I think you deserve many more views for the quality of the content you create. In terms of other types of videos, I'd be curious to see you talk about your day to day work too. I assume you're a SWE or are in academia. Maybe talking through interesting papers or technologies could be compelling. I think the web dev youtuber space is pretty crowded, but other CS related topics I think could attract a following -- or would be interesting to me at least.
@benjamineskildsen964918 күн бұрын
This is my second year doing AoC and watching your videos and yours are my favorite of the people recording them because you're doing them really fast but not just sitting there in silence so I can follow along with your reasoning. It also makes me feel better when you're not just instantly writing out the right solution, but rather speed-running a lot of the mistakes I also made. I've been doing them in C# and I like to do them "properly" with classes, etc. But watching you do them last year really opened my eyes to how much of computer programming exists just inside the programmer's head. e.g. this plain array is actually a stack if the programmer just commits to only pushing/popping the first element. Or this dictionary is actually an adjacency representation of a graph. Whereas in C# I would write a full class with appropriate getters/setters, you're just manipulating the data structures inline. Very cool. I would watch any video you make! But like others I am curious about your dev environment/why you chose this over other possible setups. Otherwise, see you in a year
@MarkBlakeney18 күн бұрын
Neil, thanks very much for creating these videos. Really enjoyed watching your super-human speed and efficiency compared to myself.
@Beesman8818 күн бұрын
Congratz on the leaderboard! Today was fun, day 25 being chill day in the xmas chaos is always nice, glad it's a trend. Once I realized they don't have to fit perfectly, I just made both keys and locks int made from the 5x5 inner square- just |= shifting # as 1 <<i*5+j, ignoring top and bottom row (other than checking first row to know if it's key or lock) then for each key-lock pair and check for key&lock==0 to ++ans guess for perfect keylocks it would also work, just checking for key|lock==2^25-1 For sure do older AOCs or other similar content, always a blast.
@TheBIX66618 күн бұрын
I will also start doing AOC 2015. Would love to get some help from your videos 😅
@fastwebcam18 күн бұрын
Explore the same problems using something different. Use a different language. Might be useful for those of us who do not speak Python. Write one-liner solutions. Instead of time constraint use source code size constraint. Write the code with all the edge cases covered. Like what happens if the input is some garbage, or an empty file, or an insanely big file? Will your program just crash or will it print some helpful message? Might be useful to learn the difference between hacky competition style and enterprise style. Write tests to make sure that your program works correcrly before sending the answer back to the site. Investigate if tests are helpful at all in the competitive programming. This will give you enough content til AoC 2025.
@gbegerow18 күн бұрын
I expect a successor to the 1 Billion Row challenge in early janurary. Would be interesting to see how you would tackle that. (More speed of code instead of speed of coding :-) )
@shrimpsizemoose18 күн бұрын
that wiring is giving out sick beats!
@yajusgakhar696918 күн бұрын
Why haven't you added pypy to the environment variables? All you then need to do is pypy <name of file>.py
@stekks19 күн бұрын
Merry Christmas, thanks for your videos!
@rastislavsvoboda436319 күн бұрын
congrats and thanks for all your videos; some educational videos would be welcome 🙏 you looked stressed to make up this "complicated" solution ;-) def solve1(text): blocks = text.split(" ") block_rows = blocks[0].splitlines() R = len(block_rows) C = len(block_rows[0]) locks = [] keys = [] for block in blocks: block_lines = block.splitlines() pins = set((r, c) for r in range(R) for c in range(C) if block_lines[r][c] == "#") if all(x == "#" for x in block_lines[0]): locks.append(pins) elif all(x == "#" for x in block_lines[-1]): keys.append(pins) else: assert False return len([1 for lock in locks for key in keys if len(lock & key) == 0])
@Mark-ij4lp19 күн бұрын
Congrats on the making the leaderboard, despite recording/commenting while solving and all the LLM competition you've had! I've really enjoyed your channel and look forward to more!
@Bundas10219 күн бұрын
Merry Christmas! Congrats on the extra points for the last day! I also forgot to quickly click the part2 link for a second. It took me 11 seconds :D still got me rank 887 -> 736. I Guess there are quite some people who missed a few problems (at the time of writing this there are 4.1k gold stars and 1.7k silver stars on day 25). I spent around 21 hours programming the solutions in total (and 4 hours of it is day21 part2 :D), I'm quite happy with that. Thanks for the videos Neil! I think many of us would watch if you made other videos. I don't have any specific ideas but I'll definitely watch them :)
@utkarsh_bansal19 күн бұрын
This was my first year solving AOC and I really enjoyed your videos and explanations this year. Thank You.
@xhyrom919119 күн бұрын
I'm glad you're recording these videos I can always watch after I solve the puzzle. Would be amazing to see some other competitions like everybody.codes or even solving 2015, 2016... AOC. Merry Christmas :) 🎄🎁
@bodeneinheit19 күн бұрын
Merry Christmas Neil! I would like to thank you for the daily videos that got me through December and helped me out at one time or another this year!
@joellidin19 күн бұрын
Thank you for all these videos. It has been great fun watching you solve after I finished myself. I will subscribe and look out for new videos. Merry Christmas! 🎅
@eagely442219 күн бұрын
You should totally do 2015 and 2016 on camera, maybe even a livestream? Also, I saw jonathanpaulson do everybody.codes in november, he said it was nice so maybe you should take a look at that.
@CheeseFest-19 күн бұрын
so 2015 was actually around a decade ago so thats impossible. Hope this helps!
@n0ne0ne12 күн бұрын
@@CheeseFest-tf are you talking about. The puzzles from previous years are still there bogo . Hope this helps.
@artemistrubacheev770419 күн бұрын
Merry Christmas! Would love to see a setup exploration video, in particular I’m interested how this repl-like setup that allows you to do stuff manually in the same environment where your code is ran
@MattDog_22219 күн бұрын
I'm slightly embarrassed at the 10 minutes I spent not realizing it didn't need to be a perfect fit, because I super skim read the problem and assumed the obvious, which was wrong. GGs and I'm glad u survived the army of LLMs. Maybe you could try speedrunning leetcode problems or something, idk, they aren't really 'competitive programming' though. But if u cant think of anything I look forward to AOC 2025
@yuxiang421819 күн бұрын
merry christmas!
@lukegarrigan589419 күн бұрын
Merry Christmas mate, thoroughly enjoyed your videos this year.
@FidelisAkilan-nu6vm19 күн бұрын
merry christmas Neil
@rastislavsvoboda436319 күн бұрын
maybe one day you can make video describing your "setup", how you use this shell staff.. (if you haven't done it already...), thx; and good luck for final day! I know, a lot of AI "cheaters" are there this year, maybe they should admit it some settings and have a separate leaderboard
@matteolugli160717 күн бұрын
It's just the Python shell.
@atlifreysi19 күн бұрын
you look like paul dano i assume you've gotten that before. i have no clue what is going on in part 2 i am so lost lol
@joule16253419 күн бұрын
At first I have solved it by actually drawing the graph and searching manually for connections that do not fit the pattern. Thats how i have earned my star. However I haven't felt satisfied with that approach afterwards. So now i have been searching for the cables programatically. Works but takes something like 7-8 minutes to find the solution. Pretty sure i could be optimized a lot but I'm happy with it. Rank 12 is really really great.
@God-i219 күн бұрын
Will we be missing you for another 11 months brother?
@1vader19 күн бұрын
Interesting that you unpacked the split line via indexing instead of just "a, op, b, _, out = line.split()". That way, you can't mess up the Indices.
@nthistlethwaite19 күн бұрын
@@1vader Ah shoot yeah that's just me being rusty - in general unpacking the split directly is good and less error-prone
@rastislavsvoboda436319 күн бұрын
congrats! I've isolated which bits are wrong by adding "same" bits on x,y x,y = 0b0...0001 x,y = 0b0...0010 x,y = 0b0...0100 ... x,y = 0b1...0000 I've found 3 "z" not being XOR, but it took me very long to detect what is changed... nice trick with pprint ;-)
@Bundas10219 күн бұрын
Nice solve! Don't forget to do day 18 before day 25 😬
@nthistlethwaite19 күн бұрын
Thanks! And yeah, I haven't forgotten haha. Although I do appreciate the reminder :)
@MattDog_22219 күн бұрын
I ended up brute forcing the solution by writing a method to check for connected nodes (using looped set intersections), then from a given source node, brute force all combinations* of its adjacent nodes from size 10 to 13 (would go lower if no solutions), and try each of those for connectedness. Took about 1 second in java single thread
@ora1005319 күн бұрын
i used a similar approach, but just printed out the whole recursive tree into a file first, then looked for bad bits where adder breaks and referenced the tree with the eyes to see what's the issue with that bit :D
@TheTrienco19 күн бұрын
One of those days where printing the graph and fixing it by hand was easier than doing it in code. At least the usual AI suspects are nowhere to be seen today. And a nice touch to make you use different inputs to find the final pair.
@ciscou19 күн бұрын
Congrats on rank 12, impressive! I took a very similar approach (like, build an adder from scratch, there should be an and gate whose inputs are "foo" and "bar", if there isn't, find an and gate whose one of the inputs is "foo", and swap the other input and "bar") - but it took me nearly 3h 😁
@billgrant726219 күн бұрын
what'd you do with Enzo?
@vbcgoat19 күн бұрын
GG!
@fornerobj20 күн бұрын
I am doing this years advent of code in GO, and am trying not to use any libraries outside of the standard library. I realized this was going to be a maximal clique problem while I was doing part 1, so I googled for some maximal clique algorithms searching for the easiest to implement. I found the bron-kerbosch algorithm and implemented it in GO. My whole program including part 1 and 2 runs in half a second!
@urban2420 күн бұрын
"Can we move the robot arm over empty tiles? It doesn't actually matter for this part I think" - famous last words
@bikkel7720 күн бұрын
I think the reason why some paths are cheaper than others is mainly due to the left command (<). That command costs a lot looking at the directional keyboard. So they need to be grouped together if possible.
@NStripleseven20 күн бұрын
Not a fan of the graph theory ones, tbh. It always just boils down to “do you remember that one specific algorithm?”
@Tresorthas20 күн бұрын
Weird problem for day 23. Literally 6 lines of code for both parts with networkx. import networkx as nx G = nx.Graph() for line in open('input.txt').read().strip().split(' '): G.add_edge(*line.split('-')) print(sum(1 for c in nx.enumerate_all_cliques(G) if len(c) == 3 and any(n.startswith('t') for n in c))) print(','.join(sorted(max(nx.enumerate_all_cliques(G), key=len))))
@NStripleseven20 күн бұрын
Having a graph theory library definitely does help when your problem is exclusively graph theory.
@JamesSorenson20 күн бұрын
You can shave off a few lines with: G = nx.parse_edgelist(open('input.txt'), delimiter='-', create_using=nx.Graph(), nodetype=str)