← /g/

/aocg/ - Advent of Code General #3

New launches split creator fees 50% to the poster and 50% to the launcher. No tripcode is needed to launch; poster claims require verified ownership.

Anonymous12/03/26(Thu)10:58:11 No.110501961
no-cutting-trees-allowed-sign-600nw-2239376001
>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

no cutting down the trees

previous >>110492229
Anonymous12/03/26(Thu)10:58:37 No.110501964
solve
idiomatic Rust solution
Anonymous12/03/26(Thu)11:00:56 No.110501980
it is hard to come up with good op images ok
Anonymous12/03/26(Thu)11:03:46 No.110501997
three
idiotmatic python solution
Anonymous12/03/26(Thu)11:07:46 No.110502026
>>110501980
Visualizations are always an option, there were a couple in the last thread.
Anonymous12/03/26(Thu)11:11:49 No.110502054
4135413-silent-hill-3-render-insane-cancer
bigboy #3
url: https://files.catbox.moe/txpi26.txt
grid: 3333x3333
silver: 839913
gold: 700901761
Anonymous12/03/26(Thu)11:12:25 No.110502058
Which year would you say was the best year?
Anonymous12/03/26(Thu)11:12:50 No.110502063
smolboy for slowanons
https://files.catbox.moe/6uq5vr.txt
silver 17132
gold 4471945
Anonymous12/03/26(Thu)11:13:14 No.110502069
>>110502058
2021-2022 for me since those were my first but I hear good things about intcode
need to get around to it at some point
Anonymous12/03/26(Thu)11:19:49 No.110502105
>>110502056
I have over 10 years of Rust experience.
Furthermore, I have all stars in advent of code, all ducks in everybody.codes and solved 317 project euler problems.
Lower your voice when speaking to me.
Anonymous12/03/26(Thu)11:19:54 No.110502106
>>110502058
>>110502069

2019 (intcode) was good but it was definitely far from difficult, every problem description was just a step by step guide on what to do, there was not much thinking involved at all, which is probably why /g/ likes it so much. I liked the year with lantern fish and that infinite tape, whichever year that was.
Anonymous12/03/26(Thu)11:22:20 No.110502132
>>110502058
2017 hands down
Anonymous12/03/26(Thu)11:23:24 No.110502138
>>110502106
>lantern fish
2021#6
Anonymous12/03/26(Thu)11:24:54 No.110502150
duly noted
>>110502105
woah watch out, we have a badass over here
Anonymous12/03/26(Thu)11:26:44 No.110502166
>>110502105
Good girl!
I was just asking, perhaps you can comment on yours compared to the other anon's solution? My rust is not very good, and I find yours less readable.
Anonymous12/03/26(Thu)11:28:01 No.110502178
>>110502106
The challenge was having a working interpreter.
Anonymous12/03/26(Thu)11:31:40 No.110502219
2021 was a ball puncher in general. Pretty even difficulty throughout.
Anonymous12/03/26(Thu)11:35:30 No.110502273
>>110502105
Wow based
Anonymous12/03/26(Thu)11:48:27 No.110502387
>>110502105
I'm sorry but Gemini is better than you and it's not even close
I lower my typing noise when talking to her, you're nothing in comparision
Anonymous12/03/26(Thu)11:49:36 No.110502398
file
>>110501964
I like mine more
Anonymous12/03/26(Thu)11:53:40 No.110502440
>>110502398
yours is extremely inefficient though
Anonymous12/03/26(Thu)12:00:56 No.110502506
can we deport this fucking indian immigrant agniggha from the leaderboard?
Anonymous12/03/26(Thu)12:03:13 No.110502530
>>110502178
so the challenge was following step by step instructions
Anonymous12/03/26(Thu)12:04:18 No.110502546
agniggha
>>110502506
you won't do shit, timmy.
Anonymous12/03/26(Thu)12:07:44 No.110502573
>>110502546
that's not agniggha though
Anonymous12/03/26(Thu)12:18:03 No.110502676
anons, if you use HashSet to look up only two tree locations. it will cut the execution cost from 140s to 4s
Anonymous12/03/26(Thu)12:19:33 No.110502685
>>110502105
I want to get into Rust myself. What brand of estrogen do you recommend I take?
Anonymous12/03/26(Thu)12:19:47 No.110502690
>>110502676
indexing into an array is cheaper than hashing the key and then probing the hashtable.
sop talking nonsense.
Anonymous12/03/26(Thu)12:21:21 No.110502706
In Prolog, this is just
:- initialization(main, main).
:- dynamic t/2.

square(R, C, DR, DC) :-
t(R, C),
t(R2, C2), DC is C2 - C, DC > 0, DR is R2 - R, DR >= 0,
R3 is R + DC, C3 is C - DR, t(R3, C3),
R4 is R2 + DC, C4 is C2 - DR, t(R4, C4).

% part 1
count(1, N) :- aggregate_all(count, square(_, _, 0, _), N).
% part 2
count(2, N) :- aggregate_all(count, square(_, _, _, _), N).

load(File) :-
read_file_to_string(File, Str, []),
split_string(Str, "\n", "", Lines),
forall((nth0(R, Lines, Line), sub_atom(Line, C, 1, _, '#')),
assertz(t(R, C))).

main :-
current_prolog_flag(argv, Argv),
(Argv = [P|Rest] -> atom_number(P, Part); Part = 1, Rest = []),
(Rest = [File|_] -> true; File = input),
load(File),
count(Part, N),
format("~d~n", [N]).
Anonymous12/03/26(Thu)12:21:46 No.110502709
>>110502440
rust's privilege
>>110502685
don't worry you got enough from all the microplastics
Anonymous12/03/26(Thu)12:22:42 No.110502722
carbon
>>110501961
my p1 solution had a naive kinda raycaster thing going on, gave up and did it the proper way for p2
Anonymous12/03/26(Thu)12:25:20 No.110502747
>>110502690
1. put tree coordinates in set
2. pick each pair from set
3. check 1st is topmost, 2nd is rightmost
4. derive next pair
5. check next pair in set

much cheaper
Anonymous12/03/26(Thu)12:26:06 No.110502762
>>110502706
based
we need more like this in this thread
there used to be so many anons solving in niche languages
can't believe how rare you niggers have become now
Anonymous12/03/26(Thu)12:27:08 No.110502771
>>110502747
1. put tree coordinates in a list
2. pick each pair from list
3. check 1st is topmost, 2nd is rightmost
4. derive next pair
5. check next pair in list

notice how I'm not hashing anything?
Anonymous12/03/26(Thu)12:28:46 No.110502792
>>110502747
>much cheaper
in theory
Anonymous12/03/26(Thu)12:29:28 No.110502794
carbon(1)
Reposting in new bread
Anonymous12/03/26(Thu)12:29:42 No.110502800
>>110502792
>in theory
post algorithmic complexity proof
Anonymous12/03/26(Thu)12:29:47 No.110502801
>>110502771
>5. check next pair in list
this is rape btw
Anonymous12/03/26(Thu)12:29:58 No.110502804
3a
This puzzle blows.
Anonymous12/03/26(Thu)12:30:59 No.110502812
Anonymous12/03/26(Thu)12:33:07 No.110502834
i dont wanna google an algorithm, someone give me a hint on how you rotate a square
Anonymous12/03/26(Thu)12:33:48 No.110502841
>>110502834
(x, y) rotated 90 degrees around (0, 0) is (-y, x).
Anonymous12/03/26(Thu)12:34:36 No.110502853
>>110502841
90 degrees is the easy one, its all the degrees in between that confuse me
Anonymous12/03/26(Thu)12:35:32 No.110502862
>>110502853
you dont need any of that, it's liek a chessboard
think of how a knight moves
Anonymous12/03/26(Thu)12:36:49 No.110502871
Anonymous12/03/26(Thu)12:37:36 No.110502880
Anonymous12/03/26(Thu)12:38:06 No.110502885
>>110502812
is this a witness reference
Anonymous12/03/26(Thu)12:42:28 No.110502916
not yet
>>110502885
here is a tip
Anonymous12/03/26(Thu)12:51:27 No.110502990
>>110502800
I don't need to. Checking each pair in the list will cost more than simply indexing an array to see if there's a # there
Anonymous12/03/26(Thu)13:14:13 No.110503161
>>110502871
https://en.wikipedia.org/wiki/Taxicab_geometry
If you're still confused. You rotate the slope basically.
Anonymous12/03/26(Thu)13:20:56 No.110503222
>>110502990
>simply indexing an array to see if there's a # there
but that's what I'm saying, see >>110502690
Anonymous12/03/26(Thu)13:23:49 No.110503243
carbon(12)
comfy broot today
>>110502916
kek
Anonymous12/03/26(Thu)13:25:24 No.110503260
>>110502794
pretty based
Anonymous12/03/26(Thu)13:29:47 No.110503290
>>110503222
yeah I agree with that I'm not this nigga >>110502747
Anonymous12/03/26(Thu)13:32:53 No.110503322
Tried a set solution for part A. Increased my time from 2 sec to almost a minute. Good experiment, though. Unfortunately I'll just have to accept my bigboy time at 25 min single threaded.
Anonymous12/03/26(Thu)13:42:41 No.110503402
day3
where my nimmers at?
Anonymous12/03/26(Thu)13:53:15 No.110503499
part 3
Lanternfish! While we wait for day 4, BigInt edition.
5,3,2,2,1,1,4,1,5,5,1,3,1,5,1,2,1,4,1,2,1,2,1,4,2,
4,1,5,1,3,5,4,3,3,1,4,1,3,4,4,1,5,4,3,3,2,5,1,1,3,
1,4,3,2,2,3,1,3,1,3,1,5,3,5,1,3,1,4,2,1,4,1,5,5,5,
2,4,2,1,4,1,3,5,5,1,4,1,1,4,2,2,1,3,1,1,1,1,3,4,1,
4,1,1,1,4,4,4,1,3,1,3,4,1,4,1,2,2,2,5,4,1,3,1,2,1,
4,1,4,5,2,4,5,4,1,2,2,4,2,2,2,1,3,5,2,5,1,1,4,5,4,
3,2,4,1,5,2,2,5,1,4,1,5,1,3,5,1,2,1,1,1,5,4,4,5,1,
1,1,4,1,3,3,5,5,1,5,2,1,1,3,1,1,3,2,3,4,4,1,5,5,3,
2,1,1,1,4,3,1,3,3,1,1,2,2,1,2,2,2,1,1,5,1,2,2,5,2,
4,1,1,2,4,1,2,3,4,1,2,1,2,4,2,1,1,5,3,1,4,4,4,1,5,
2,3,4,4,1,5,1,2,2,4,1,1,2,1,1,1,1,5,1,3,3,1,1,1,1,
4,1,2,2,5,1,2,1,3,4,1,3,4,3,3,1,1,5,5,5,2,4,3,1,4

part 1, 80 days: 359789
part 2, 256 days: 1631058187388
part 3, 10000 days: picrel
Anonymous12/03/26(Thu)13:54:01 No.110503508
HashSet::contains(tree) -> bool
is a 3500% improvement over
Iterator::contains(tree) -> bool
and that's a fact
Anonymous12/03/26(Thu)13:56:44 No.110503531
>>110503508
even as the source of the Iterator gets smaller gets smaller it is much worse than a full size HashSet lookup
Anonymous12/03/26(Thu)14:03:02 No.110503582
>>110503508
well how are you building the hashset? by checking what each iterator contains and copying it over, retard
Anonymous12/03/26(Thu)14:12:10 No.110503676
I know how to optimize this but I don't feel like writing the code for it
Anonymous12/03/26(Thu)14:13:05 No.110503686
>>110503508
I have to admit. i did break something in Part2 and now it's wrong. even though i didn't change any logic
Anonymous12/03/26(Thu)14:14:02 No.110503693
people are going to get filtered
Anonymous12/03/26(Thu)14:16:06 No.110503712
>>110503508
no shit?
Anonymous12/03/26(Thu)14:17:06 No.110503721
>>110503582
also this. you niggas aren't really using a hashset for this problem right? I could understand if you have like a 500+MiB text file where only like 1% are trees, but really.
Anonymous12/03/26(Thu)14:26:29 No.110503797
>>110502853
Not needed for this problem. However in general, it's best not to memorize formulas, rather you want to know why it works. Ask AI or consult books to walk you through it, here's a prompt:
>Don't give me the rotation matrix upfront. Walk me through discovering it. Start with the standard basis vectors in 2D, show how arbitrary vectors are built from them, then investigate what happens when the basis vectors are rotated. Use that to motivate matrix multiplication as a transformation, and eventually derive the rotation matrix. Ask me questions along the way rather than immediately giving me the answer.
Anonymous12/03/26(Thu)14:27:32 No.110503805
>>110498727
I have no fuckling clue where to begin on making sense of this. Can anyone give a breakdown on how this shit works? I already got the two stars but my approach is looks at all pairs of points and checks the squares on the edge pairs using math.

Explaining how this works might require a whole ass blog post so i don't really expect anyone to do it. But still it could help people learn how to do ts.
Anonymous12/03/26(Thu)14:27:58 No.110503811
>>110503797
>banned for trying to do model distillation
Anonymous12/03/26(Thu)14:28:07 No.110503813
>>110503797
you forgot "make no mistakes", fucking imbecile
Anonymous12/03/26(Thu)14:29:18 No.110503823
>>110503813
>make no mistakes
You're poor, frontier models don't need that.
Anonymous12/03/26(Thu)14:30:09 No.110503830
>>110503499
I mean... snoreville? shit runs instantly or will overflow u64 if too large...
Anonymous12/03/26(Thu)14:32:21 No.110503854
>>110503811
kek.
>>110503797
anon, this shit is trivial babby shit though.
https://en.wikipedia.org/wiki/Rotation_matrix
literally instant google result. since you only get cardinals 90, 180, 270 it's as trivial as swap, negate as already said. You can't do any other rots because that opens up the doorway to floating point inexactness.
Anonymous12/03/26(Thu)14:39:27 No.110503913
>>110503854
>shit is trivial babby shit though
Which you weren't born knowing. Googling is will give you a direct answer, but won't develop any understanding.
Anonymous12/03/26(Thu)14:40:15 No.110503919
// if hashset.contains(&key_bottom_left) && hashset.contains(&key_bottom_right) {
// squares += 1;
// }
if coordinated.iter().any(|&k| k == key_bottom_left) && coordinated.iter().any(|&k| k == key_bottom_right) {
squares += 1;
}
the hashset solution doesn't work because the above are not equivalent and i don't know why
Anonymous12/03/26(Thu)14:40:17 No.110503920
>>110503913
what? if you took trig in skool, you could figure it out from first principles.
Anonymous12/03/26(Thu)14:43:12 No.110503943
>>110503920
Well the anon is old enough to enter an AoC contest and said he had trouble with other rotations, so I guess he didn't...
Why is it that when you try to help one retard, a bigger idiot comes along to brag that he already knows it?
>HURRR THING I KNOW MENTIONED.
Anonymous12/03/26(Thu)14:44:05 No.110503950
>>110503943
the wikipedia page I linked is a better place to learn than any LLM slop.
Anonymous12/03/26(Thu)14:45:36 No.110503964
Never spoon feed the retards! You will regret doing it every single time. Retards will always be retards, because they prefer to be. It's like giving money to the poor, it changes nothing, they'll be poor tomorrow.
Anonymous12/03/26(Thu)14:46:42 No.110503973
>>110502706
I kneel, this is the first program I ever wrote in prolog and it sucks
:- initialization(main, main).
:- dynamic pair/3.
:- dynamic npair/4.

rpair(Lines, R, C1, D) :-
nth1(R, Lines, Line),
string_chars(Line, Cline),
nth1(C1, Cline, '#'),
nth1(C2, Cline, '#'),
C2 > C1,
D is C2 - C1.

r2pair(Lines, R1, C1, Dx, Dy) :-
nth1(R1, Lines, Line1),
string_chars(Line1, Cline1),
nth1(R2, Lines, Line2),
string_chars(Line2, Cline2),
nth1(C1, Cline1, '#'),
nth1(C2, Cline2, '#'),
C2 > C1,
R2 =< R1,
Dx is C2 - C1,
Dy is R1 - R2.

main :-
read_string(user_input, _, In),
split_string(In, "\n", "", Lines),

forall(rpair(Lines, R, C, D), assertz(pair(R, C, D))),
aggregate_all(count, (pair(R, C, D), R2 is R - D, pair(R2, C, D)), Result),

format("~d~n", Result),

forall(r2pair(Lines, R, C, Dx, Dy), assertz(npair(R, C, Dx, Dy))),
aggregate_all(count, (npair(R, C, Dx, Dy), R2 is R - Dx, C2 is C - Dy, npair(R2, C2, Dx, Dy)), Result2),

format("~d~n", Result2).
Anonymous12/03/26(Thu)14:48:31 No.110503993
>>110503964
I used to be a total retard and some people in the python irc channel were incredibly patient with my retarded questions about every other paragraph in the tutorial/official docs
Anonymous12/03/26(Thu)14:48:53 No.110503997
>>110503950
Wikipedia is a horrible place to learn, mostly just formula dumps.
>LLM slop
Ah, you're an anti-AI retard. Well, your LLM could be instructed to use the 'Socratic method' to teach, and in the process discover what small piece anon was lacking.
Anonymous12/03/26(Thu)14:49:26 No.110504002
>>110503973
had it as a part of a course I had and I could not wrap my head around the prolog strategy of appending to a list
Anonymous12/03/26(Thu)14:49:59 No.110504009
>>110503805
It's not nearly as interesting as it might look, anon. Your solution is guaranteed better, in fact. I thought I was being clever in part 1 and rather than doing it properly in part 2 I kinda just kept churning.

Each row of the map becomes one big number, with a 1 bit wherever there's a tree. ANDing two rows then tells you every column where both have a tree, all at once for the given set of rows.
Anonymous12/03/26(Thu)14:52:03 No.110504022
>>110503993
They were grooming you.
Anonymous12/03/26(Thu)14:52:31 No.110504026
ar
The published bigboys take forever to complete. This sample takes around 2000 times the puzzle input.

day: 3
url: https://files.catbox.moe/b1d3y9.zip
grid: 920x920
time: x2000
silver: 361674
gold: 26584377
Anonymous12/03/26(Thu)14:53:41 No.110504039
why would I do this when claude could solve it in second?
Anonymous12/03/26(Thu)14:54:42 No.110504046
file
scrubbed my ass a lil, the good solution
Anonymous12/03/26(Thu)14:55:25 No.110504054
>>110504039
In that case take a sit in the cuck chair while you see the AI doing it for you.
Anonymous12/03/26(Thu)14:58:27 No.110504088
>>110504054
ok snailcoder
Anonymous12/03/26(Thu)14:58:27 No.110504089
>>110504039
fleshcels will NOT be able to reply because they know it's over for them
Anonymous12/03/26(Thu)14:59:34 No.110504102
>>110503997
not that anon but I sometimes have questions where I dont know if I can trust the llm explanations because the explanations are hard to verify
mainly for stats and ml stuff where I guess an example that comes to mind is asking why you optimize for a taylor or newton approximation of the loss or gradient instead of the loss or gradient in some cases
and while the llm answer might make sense you have no way of knowing whether it is making stuff up or if the actual reason is something else
Anonymous12/03/26(Thu)14:59:43 No.110504105
>>110504088
ok cuckcoder
Anonymous12/03/26(Thu)15:01:45 No.110504120
>>110504026
think everyone brooted today, is there actually a smarter solution?
Anonymous12/03/26(Thu)15:02:17 No.110504123
>>110504026
only if your solution sucks, anon. mine completes in a few seconds.
Anonymous12/03/26(Thu)15:05:06 No.110504141
>>110504120
I don't believe so.
Anonymous12/03/26(Thu)15:05:24 No.110504144
Anonymous12/03/26(Thu)15:06:33 No.110504153
>>110504123
What’s your solution?
Anonymous12/03/26(Thu)15:07:50 No.110504162
>>110504026
squares=26584377 in 97.768641s
on a i5-2400 CPU
i would really like to know how fast it would be on a good one
Anonymous12/03/26(Thu)15:08:38 No.110504167
>>110504120
There can be n^2 squares and I can't see any way to avoid enumerating every square
Anonymous12/03/26(Thu)15:09:20 No.110504174
>look over 2025 stuff
>remember problems that Eric protected babbies from edge cases
why did he do it?
Anonymous12/03/26(Thu)15:09:59 No.110504179
mylittlebroot
>>110504144
not that anon but you cant call your solution a broot if you at any point iterated over trees instead of rawdogging the whole (padded) array and every possible side-vector
Anonymous12/03/26(Thu)15:11:03 No.110504192
>>110504002
The teacher for the course I was supposed to learn it in had a sabbatical, the temporary replacement one taught us haskell instead
Anonymous12/03/26(Thu)15:12:01 No.110504196
>>110504162
P2 26584377

real 0m16.484s

12th Gen Intel(R) Core(TM) i9-12900K
Anonymous12/03/26(Thu)15:12:10 No.110504199
>>110504192
wew those are two entirely different language paradigms though
you got scammed
Anonymous12/03/26(Thu)15:13:02 No.110504210
>>110504196
I can probably make it faster with parallelization.
Anonymous12/03/26(Thu)15:14:35 No.110504231
>>110504039
Good question, anon. You should ponder it as you close the tab.
Anonymous12/03/26(Thu)15:19:50 No.110504267
>>110504199
The class is called "logical and functional programming", so its just kinda stupid in that regard
Anonymous12/03/26(Thu)15:20:28 No.110504276
>>110504267
I would expect a bit of both to be fair rather than just one or the other
Anonymous12/03/26(Thu)15:20:41 No.110504279
Screenshot From 2026-12-03 21-17-32
I don't give a shit to optimize this when it's already fast enough. Learning rust is hard but at least it's easy to debug when needed (no segfaults)
Anonymous12/03/26(Thu)15:30:39 No.110504362
carbon
Anonymous12/03/26(Thu)15:39:59 No.110504437
>>110504276
I would expect the same desu
Anonymous12/03/26(Thu)15:41:43 No.110504450
>>110504362
pre- and post-increments are so gross
Anonymous12/03/26(Thu)15:48:16 No.110504506
>>110504120
see >>110504046

the smarter solution scales with the amount of trees, not grid size
Anonymous12/03/26(Thu)15:48:51 No.110504510
C, and mapping file to memory.
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
typedef struct { HANDLE f_, m_; PBYTE begin, end; } MemFile;
void MapF(const char* s, MemFile* o) {
o->m_ = NULL, o->begin = o->end = 0;
o->f_ = CreateFile(s, GENERIC_READ, FILE_SHARE_READ,
0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (o->f_ == INVALID_HANDLE_VALUE) return;
LARGE_INTEGER z;
if (!GetFileSizeEx(o->f_, &z)) return;
o->m_ = CreateFileMapping(o->f_, 0, PAGE_READONLY, 0, 0, 0);
if (o->m_ == NULL) return;
o->begin = (const PBYTE)MapViewOfFile(o->m_, FILE_MAP_READ, 0, 0, 0);
if (!o->begin) return;
o->end = o->begin + z.QuadPart;
}
void UnMapF(MemFile* o) {
if (o->begin) UnmapViewOfFile(o->begin);
if (o->m_ != NULL) CloseHandle(o->m_);
if (o->f_ != INVALID_HANDLE_VALUE) CloseHandle(o->f_);
}
#include <stdio.h>
typedef unsigned N;
int main(int argc, const char** args) {
if (argc < 2) return puts("Missing filename");
MemFile in; MapF(args[1], &in);
N s = 0;
for (auto p = in.begin; p != in.end; ++p) if (++s, *p == '\n') break;
N h = (in.end - in.begin + 1) / s;
N p1 = 0, p2 = 0, x = 0, y = 0;
for (auto p = in.begin; p != in.end; ++p) {
const char c = *p;
++x;
if (c != '#') {
if (c == '\n') x = 0, ++y;
continue;
}
const N mx = s - x, my = h - y, m = mx < my ? mx : my;
for (N l = 1; l < m; ++l)
if (p[l] == '#' && p[l * s] == '#' && p[l * s + l] == '#')
++p1, ++p2;
for (N l = 2, ls = s + s; l < my; ++l, ls += s)
for (N r = 1, rs = s; r < l; ++r, rs += s) {
if (x + l - r >= s) continue;
if (x <= r) continue;
if (p[l + rs - r] == '#' &&
p[ls - r - rs] == '#' &&
p[ls + l - r - r] == '#') ++p2;
}
}
printf("%u\n%u\n", p1, p2);
UnMapF(&in);
}
Anonymous12/03/26(Thu)15:52:19 No.110504541
>>110504510
>#include <windows.h>
yuck I I thought this was supposed to be portable assembler
Anonymous12/03/26(Thu)15:56:40 No.110504574
>>110504541
It works with Wine in Linux.
Anonymous12/03/26(Thu)15:58:38 No.110504592
code
ok i am NOT filtered, inspiration finally hit me and i understood how to do it
pretty tricky for a day 3
Anonymous12/03/26(Thu)16:02:30 No.110504624
code
>>110504592
actually i guess just do both parts at the same time
Anonymous12/03/26(Thu)16:05:05 No.110504641
>>110504624
now, bigboy
Anonymous12/03/26(Thu)16:10:55 No.110504684
>>110504641
too slow, i gave up
im sure theres better ordering/pruning that could be done to make it work, dunno if i can be bothered though
Anonymous12/03/26(Thu)16:11:39 No.110504689
>>110501961
ugliest site ever award
Anonymous12/03/26(Thu)16:20:59 No.110504750
day3
Problem 1 actually took me longer because i tried a by-diagonal approach instead of a by-line one.
Here's my solution for the second puzzle.
Anonymous12/03/26(Thu)16:24:21 No.110504778
>>110504689
you have not seen many sites
Anonymous12/03/26(Thu)16:28:22 No.110504803
d3_brute
simd brute

>>110502054
Silver: 839913
Gold: 700901761

Performance counter stats for './3 ../../../inputs/3/bigboy.txt':

75,818,714,058 cycles:u
155,693,512,192 instructions:u

19.060802172 seconds time elapsed


>>110504026
Silver: 361674
Gold: 26584377

Performance counter stats for './3 ../../../inputs/3/aoc_2026_day3_cg.txt' (100 runs):

0 user_time
0 system_time
902,013,085 cycles:u ( +- 0.08% )
2,031,030,792 instructions:u ( +- 0.00% )

0.227341747 +- 0.000174865 seconds time elapsed ( +- 0.08% )
Anonymous12/03/26(Thu)16:32:54 No.110504837
>>110501961
Today's could be brute forced. Yes, there are faster options, but brute force worked enough.
I'm guessing that from tomorrow I might need to start thinking about algorithms, lol.
Anonymous12/03/26(Thu)16:46:42 No.110504919
>>110504837
brooters dont give up
Anonymous12/03/26(Thu)16:54:29 No.110504977
can we have a normal conversation instead of posting code that nobody reads.
like how do we figure out who the group leader is?
Anonymous12/03/26(Thu)16:57:10 No.110504993
>>110504977
the one that posted the best solution is the group leader, but since no one reads the posted solutions, we'll never find out.
Anonymous12/03/26(Thu)17:02:02 No.110505030
>>110504803
Dayum, nice
What's the mmap size?
Anonymous12/03/26(Thu)17:03:12 No.110505037
>>110504046
Ran it for >>110502054
Day 3 Part 1 (142.8311599s): 839913
Day 3 Part 2 (927.3642393s): 700901761
Anonymous12/03/26(Thu)17:08:03 No.110505076
yo Rust coders. how can we measure cycles instead of seconds. i think that makes so much more sense to compare
Anonymous12/03/26(Thu)17:09:14 No.110505088
>>110505076
Just add more digits to your time measurement.
Anonymous12/03/26(Thu)17:11:32 No.110505106
>>110503830
>BigInt edition
read, faggot
Anonymous12/03/26(Thu)17:15:28 No.110505150
probably just me but bigint problems are uninteresting unless you implemented your bigint library yourself
>wowee I changed my longs to bigint haha gocha :D
Anonymous12/03/26(Thu)17:21:13 No.110505201
tf is bigint, you mean int64 or is it some other mental illness
Anonymous12/03/26(Thu)17:29:52 No.110505274
>>110505201
so certain yet you know so little. i could tell you, as long as you understand the rules of the house.
*unzips*
Anonymous12/03/26(Thu)17:30:25 No.110505282
>>110505201
For most architectures it is the same as a double word.
Anonymous12/03/26(Thu)17:38:52 No.110505351
>>110505282
usually it means a type to represent arbitrary ranges of numbers
Anonymous12/03/26(Thu)18:12:49 No.110505590
>>110505106
No. You're gay.
Anonymous12/03/26(Thu)19:12:52 No.110506018
2026-12-04_02-10-41_907x616
haskell is fun :)
Anonymous12/03/26(Thu)19:32:41 No.110506174
Screenshot 2026-12-03 at 7.31.52 PM
I am not a clever man, but I will bend this language to my will.
Anonymous12/03/26(Thu)19:47:18 No.110506276
>>110506174
beautiful
Anonymous12/03/26(Thu)19:51:31 No.110506303
Lol nobody gives a shit about advent of shit now that everybody has AI. its not going to boost your linkedin anymore
Anonymous12/03/26(Thu)19:51:55 No.110506307
carbon(4)
$ mix aoc.solve -r input/real -y 2026 -d 3 -p b --bench 1
283
947

Ran in 89.21ms

Muddled through last night but just now finished washing. For part 1 I only enumerated pairs of trees within the same row, but I threw that out for brevity since part 2 practically solves both anyway. I might redo part 1 at some point since I had the idea of just making one pass over the input string, maintaining a list of candidate squares and checking for trees in the bottom left/right corners as you reach them.
Anonymous12/03/26(Thu)19:53:35 No.110506318
>>110506303
I basically got my interview for my current job because one of the senior engineers checked my Github and saw that I'd done a bunch of problems in his favorite niche language, lol.
Anonymous12/03/26(Thu)20:02:30 No.110506378
>>110506303
Look we get it, you were filtered. Fuck off to your desktop thread.
Anonymous12/03/26(Thu)20:02:31 No.110506379
day3
These part 2's are kind of brutal so far innit?
Not exactly hard in the sense that you have to arrive at special intuitions or anything, but painful to implement.
Anonymous12/03/26(Thu)20:23:04 No.110506514
>>110506318
that's basically it. you still gotta be someone to get invited to the big companies to get a slice. Everybody uses AI but everybody is still a nobody to someone who can give you something.
if it wasn't programming, maybe it would be a sport or something
Anonymous12/03/26(Thu)20:30:47 No.110506567
im-1796347834-905
brainlet solver, required pen and paper for formula and even then it took an embarassingly long time. maybe ai has rotted my brain.
in fact i'm sure it has.
>tfw can still complete captcha tho
Anonymous12/03/26(Thu)20:39:47 No.110506638
day3
Started today, this years goal is to learn vi

Took me 3 hours to make the 3 days
Anonymous12/03/26(Thu)20:41:44 No.110506652
Anonymous12/03/26(Thu)20:46:25 No.110506688
day1
>>110506652
Day 1 was the gnarliest for some reason, I assumed step 2 would be to do for N first items, but I could just use 3 accumulators in hindsight

Gotta love short names when being a noob with vi
Anonymous12/03/26(Thu)20:56:24 No.110506755
>>110506638
>calloc
personal style or plain retardation?
Anonymous12/03/26(Thu)20:58:41 No.110506772
>>110506755
Initially int data[][2] vas void*, didnt want to bother with zeroing, then too much casting made me forsake the genericity of my vector
Anonymous12/03/26(Thu)20:59:36 No.110506781
aoc-calendar-2026-day-03
Calendar image proposal for day 3 based on
>>110499834
Anonymous12/03/26(Thu)21:04:02 No.110506802
>>110506379
what font is this?
Anonymous12/03/26(Thu)21:04:48 No.110506806
>>110506802
looks like iosevka curly slab
Anonymous12/03/26(Thu)21:11:48 No.110506849
>>110506772
static char a[256][256]?????????????
Anonymous12/03/26(Thu)21:16:09 No.110506880
>>110506849
>char arena[142][142];
> ld: warning: reducing alignment of section __DATA,__common from 0x8000 to 0x4000 because it exceeds segment maximum alignment

You mean I just need to add static???
Anonymous12/03/26(Thu)21:18:34 No.110506897
file
Javashitscript again.
>>110504026
24secs on this one and still running on the other. I don't know if I can keep doing this javascript thing bros.
Anonymous12/03/26(Thu)21:19:20 No.110506906
>>110506880
yes nigger static means put this in .bss so it's initialized to zero at startup
Anonymous12/03/26(Thu)21:20:25 No.110506915
Anonymous12/03/26(Thu)21:27:31 No.110506968
>>110506897
nice font doe
solaris had a font like this
Anonymous12/03/26(Thu)21:28:49 No.110506981
>>110506781
kek nice
Anonymous12/03/26(Thu)21:28:54 No.110506984
>>110506897
My raw estimate is 40 mins for the other.
Anonymous12/03/26(Thu)21:30:15 No.110506995
>>110506897
wtf are your tab indents 8 spaces?
Anonymous12/03/26(Thu)21:30:24 No.110506997
disgusting
>>110506897
>tabs instead of spaces
Anonymous12/03/26(Thu)21:32:06 No.110507006
>>110504153
Probably the one that uses SIMD to work with 256 bit flags at the same time getting ~ 100x speed boost.
Anonymous12/03/26(Thu)21:34:28 No.110507020
>>110502834
if you just look at the examples you'll notice that the top left vertex slides right along the top row, the top right vertex slides down the right column, the bottom right vertex slides left across the bottom row, and the bottom left vertex slides up the left column. they all move the exact same amount of tiles for any given rotation angle / the taxi cab distance is constant. this means you can take your part1 expanding distance check and simply add an offset to it based on the current distance you're checking to 'slide' the 4 vertexes to all possible positions.
Anonymous12/03/26(Thu)21:36:04 No.110507030
>>110507020
its alright i figured out a way to do it
Anonymous12/03/26(Thu)21:36:11 No.110507031
>>110506997
>im a nigger
tabs for indentation, spaces for alignment
kill yourself
also this argument is obsoleted by formatters
Anonymous12/03/26(Thu)21:39:18 No.110507050
Anonymous12/03/26(Thu)21:41:54 No.110507064
just checked the AoC++ leaks, it's going to be an advent of parsing day
Anonymous12/03/26(Thu)21:46:56 No.110507101
bigboy
2secs part 1
30mins part 2

used a digital tablet to approach the second part, it was fun
Anonymous12/03/26(Thu)21:51:46 No.110507136
>>110507064
what do you mean by aoc++ leaks? Do aoc++ get early access to the problems?
Anonymous12/03/26(Thu)21:59:17 No.110507180
>>110507136
Depending on your AoC++ tier, you can get hints a few hours before the puzzle drops, and a small head start (access to the puzzle a couple minutes before everyone else).
You also get a bonus Part 3 every now and again.
Anonymous12/03/26(Thu)21:59:30 No.110507182
>>110507136
>tfw not in aoc++ discord
ngmi
Anonymous12/03/26(Thu)22:00:27 No.110507189
>>110507180
doesn't say anything on the website
https://adventofcode.com/2026/support
Anonymous12/03/26(Thu)22:14:19 No.110507293
I don't know if you changed it, but Eric gave you a minute head start for every $10 you donated. The AoC++ puzzles are sometimes fun, but the real value is the head start.
Anonymous12/03/26(Thu)22:15:20 No.110507301
>>110507293
*you->he
Anonymous12/03/26(Thu)22:17:00 No.110507319
>less than 90k gold on day 1 after 3 days
Yeah this shit is niche again.
Anonymous12/03/26(Thu)22:33:40 No.110507454
aoc-2026-03
my brain is ai rotted. I was looping through different lengths, and looking up slope and rotation formulas, but you can actually just WRITE the square check by just fucking looking at the grid dots.
Anonymous12/03/26(Thu)22:33:59 No.110507458
>>110507293
A couple years ago my company group all pitched in to donate $14,400 on one account so that we could have a full day head start on the problems.
Anonymous12/03/26(Thu)22:48:13 No.110507568
>>110507301
>but Eric gave he a minute head start for every $10 he donated
who?
Anonymous12/03/26(Thu)23:05:42 No.110507699
aoc-2026-03-c
>>110507454
C version because why not. see you nerds in an hour!
Anonymous12/03/26(Thu)23:14:01 No.110507752
Good evening everybody you're playing AoC. My name is Eric Wastl we have a great challenge for you tonight, very excited to be back here with you tonight on Thursday. We have a lot to solve tonight, lots to get into, big challenge.
Anonymous12/03/26(Thu)23:20:56 No.110507796
they don't know i am elon musk aka Kekius Maximus :P
Anonymous12/03/26(Thu)23:21:48 No.110507805
>>110507752
It better be, don't flake out on us Eric, you delivered a good day 3, don't mess it up now.
Anonymous12/03/26(Thu)23:25:53 No.110507820
Today is the Great Wall of our Congress' representative's enemy China
Anonymous12/03/26(Thu)23:25:55 No.110507821
1782366237484403
how would klossy do on aoc?
Anonymous12/03/26(Thu)23:33:28 No.110507869
Anonymous12/03/26(Thu)23:33:39 No.110507872
im bored of waiting can you release it early today eric
Anonymous12/03/26(Thu)23:35:31 No.110507887
I need to sleep can you wait 8 more hours to release it eric thx
Anonymous12/03/26(Thu)23:37:31 No.110507897
>>110507872
while you wait
https://adventofpuzzles.io/2026/day/4
Anonymous12/03/26(Thu)23:41:35 No.110507923
>>110507869
this is misogynistic and antisemitic
Anonymous12/03/26(Thu)23:42:37 No.110507930
>>110507869
my terminal literally looks like this when I'm working THO
Anonymous12/03/26(Thu)23:43:16 No.110507939
>>110507869
>crazy_strings.rb
Anonymous12/03/26(Thu)23:43:45 No.110507944
beacon
>>110507821
was she the one who made a video on drawing a square with turtle/scratch
and the code was wrong but anyone who pointed it out in the comments was jumped at by whiteknights
Anonymous12/03/26(Thu)23:44:33 No.110507953
>>110507939
I'd shoot some crazy strings on her IYKWIM ;)
Anonymous12/03/26(Thu)23:45:43 No.110507963
i don't get it
Anonymous12/03/26(Thu)23:45:56 No.110507966
>>110507953
You know, I don't think I know what you mean! Can you recommend me an index in the library I can look up more information at?
Anonymous12/03/26(Thu)23:47:04 No.110507976
>>110507944
idk but I need to see this video
Anonymous12/03/26(Thu)23:48:06 No.110507985
thewallcometh
TONIGHT'S THE NIGHT!
Anonymous12/03/26(Thu)23:50:16 No.110507999
>>110507985
Yesterday was the night, actually. It's easy from here on out.
Anonymous12/03/26(Thu)23:52:28 No.110508016
>>110507752
but today is friday
Anonymous12/03/26(Thu)23:53:10 No.110508021
>>110508016
It's Saturday here.
Anonymous12/03/26(Thu)23:53:12 No.110508022
>>110508016
No, it'll be Friday in 7 minutes, it's still Thursday night
Anonymous12/03/26(Thu)23:53:52 No.110508028
>>110502862
the knight moves to all the closest squares the queen can't move to
Anonymous12/03/26(Thu)23:54:43 No.110508036
>>110507897
I get that showing the Xs is helpful for the user and that trying to keep track of the invalid squares without them would be annoying, but they also make it a bit trivial as the lone valid square in each region almost instantly reveals itself.
Anonymous12/03/26(Thu)23:54:56 No.110508040
GET READY. IT STARTS IN 5 MINUTES
Anonymous12/03/26(Thu)23:55:36 No.110508044
I have no toilet paper in here
Anonymous12/03/26(Thu)23:55:59 No.110508048
I'm out of Human-AI tokens... aAAAAACCCKKK
Anonymous12/03/26(Thu)23:56:28 No.110508052
by shooting crazy strings I mean ejaculating streams of semen onto karly's stomach, preferably nowhere near her vagina so I don't accidentally procreate with her and generate a litter of midwits also she seems like a bitch so I don't want to raise kids with her
Anonymous12/03/26(Thu)23:56:44 No.110508055
its too peaceful here, someone start a calendar so we can all fight about it
Anonymous12/03/26(Thu)23:57:26 No.110508057
>>110508052
She's married to Jared Kushner's brother.
Anonymous12/03/26(Thu)23:57:37 No.110508059
I NEED TO SHIT
Anonymous12/03/26(Thu)23:57:39 No.110508060
xQc screaming in the background. intense focus required. I'm feeling comfy, it's a good 6am
Anonymous12/03/26(Thu)23:57:43 No.110508062
>>110508055
someone made a template in the first thread but nobody has suggested images for it
Anonymous12/03/26(Thu)23:58:06 No.110508065
1555841259522
>>110507944
>>110507976
>>110507821
https://www.youtube.com/watch?v=BGeT8IyKd2M

I think this is fukken it

ok time to lock in for showtime
Anonymous12/03/26(Thu)23:58:14 No.110508068
go-time
It's go time!
https://files.catbox.moe/tuevnx.mp4
Anonymous12/03/26(Thu)23:58:32 No.110508070
>>110508055
ah, the good ole days, when the first week was 90% fighting over calendar images
Anonymous12/03/26(Thu)23:59:01 No.110508072
>assembly interpreter on day 4
WOW Eric is really stepping up the difficulty this time
Anonymous12/03/26(Thu)23:59:20 No.110508075
IMG_5325
Now is the time of my power
Anonymous12/03/26(Thu)23:59:21 No.110508076
Anonymous12/03/26(Thu)23:59:29 No.110508077
Anonymous12/04/26(Fri)00:00:02 No.110508084
advent of grids
Anonymous12/04/26(Fri)00:00:02 No.110508085
FUCK
Anonymous12/04/26(Fri)00:02:48 No.110508110
wtf am i reading
Anonymous12/04/26(Fri)00:03:32 No.110508116
uhhhhhh
Anonymous12/04/26(Fri)00:04:00 No.110508122
it was a good run fellas
Anonymous12/04/26(Fri)00:04:23 No.110508126
oh fuck
Anonymous12/04/26(Fri)00:08:03 No.110508151
I think this is it this is the big filter >>110507985
you take that back >>110507999
Anonymous12/04/26(Fri)00:09:12 No.110508164
????????????????????????????
= 1 mhm mhm
Anonymous12/04/26(Fri)00:09:21 No.110508165
so, uh, how the fuck do you even do this?
Anonymous12/04/26(Fri)00:10:22 No.110508171
bleh for the second day I'm working right up to drop time, and this rainbow (gay) task is resisting my interest
Anonymous12/04/26(Fri)00:11:09 No.110508176
it seems like you could get away with simply counting how many unique colors are present for some of them, but the ones with the ????s separating the valid colors complicate it
Anonymous12/04/26(Fri)00:11:29 No.110508179
Over half the lines in my input can be trivially filtered as single-instruction ones.
Any trailing ?s can be ignored I think.
Then what? Just broot the rest?
Anonymous12/04/26(Fri)00:11:30 No.110508180
itstime
https://www.youtube.com/watch?v=hjGZLnja1o8
Anonymous12/04/26(Fri)00:11:37 No.110508181
1781366862840789
interesting problem but a trivial part 2
Anonymous12/04/26(Fri)00:12:05 No.110508184
>>110508165
breadth-first search that ends as soon as it recreates the barcode
then probably part 2 breaks that
Anonymous12/04/26(Fri)00:22:26 No.110508236
>>110508179
>Any trailing ?s can be ignored I think.
Is the same true for leading ?s
Anonymous12/04/26(Fri)00:24:09 No.110508249
what the fuck is the edge case this shit works with the examples but wrong for the input
Anonymous12/04/26(Fri)00:25:32 No.110508254
>>110508236
Nope, because like
>???fag
would be producible with just fag, but
>??fag
would require agf
Although the length is 3 either way.
Anonymous12/04/26(Fri)00:26:10 No.110508259
easy day :|
Anonymous12/04/26(Fri)00:27:33 No.110508265
you guys are seriously overcomplicating it it's only day 4
Anonymous12/04/26(Fri)00:27:54 No.110508271
4
Anonymous12/04/26(Fri)00:27:57 No.110508273
CHINESE REMINDER?????
Anonymous12/04/26(Fri)00:31:37 No.110508294
>>110508271
the fuck, I'm doing the exact same but it fails for my input
Anonymous12/04/26(Fri)00:32:13 No.110508298
1675963497131987
>part 2 ran for 12 seconds because I solved the puzzle the wrong way round
It's 6 in the morning and I haven't got much sleep last night.
Anonymous12/04/26(Fri)00:33:25 No.110508305
I thought part 2 was going to give a way to fill in the question marks and then solving for part 1 on the completed bar codes
Anonymous12/04/26(Fri)00:33:50 No.110508308
>>110508294
ok I'm fucking retarded, I was missing the = in the length iterator
Anonymous12/04/26(Fri)00:40:29 No.110508349
btw if it took you more than one minute to solve part 2 after part 1 you were filtered
Anonymous12/04/26(Fri)00:40:46 No.110508350
washed webshit

let repeats = (barcode, idx, step) => {
let a = barcode[idx];
while (idx < barcode.length) {
let b = barcode[idx];
a = a == '?' ? b : a;
if (a != b && b != '?') return false;
idx += step;
}
return true;
};

let findSize = barcode => {
let size = 0;
outer: while (++size && size<barcode.length) {
for (let i=0; i<=size; i++) {
if (!repeats(barcode, i, size))
continue outer;
}
break;
}
return size;
};

let solve = input => {
let barcodes = input.split('\r\n');
let p1 = barcodes.reduce((a, b) => a + findSize(b), 0);
let p2 = findSize(barcodes.join(''));
console.log(p1, p2);
};
Anonymous12/04/26(Fri)00:42:57 No.110508365
2026_day4
Anonymous12/04/26(Fri)00:44:06 No.110508372
1786700328329284
done, so glad I saw the trick in part 1 lmao
Anonymous12/04/26(Fri)00:45:10 No.110508380
IMG-07d5cde27052d6530c37e11660f1771e-V
haven't posted this year because first 3 days trivial but the idiomatic js 2hu fag is back
Anonymous12/04/26(Fri)00:46:49 No.110508386
>part 2 running for 5+ minutes
>damn are we needing to memo or sumshit?
>realise I wasn't incrementing the counter
>solves instantly
fml
Anonymous12/04/26(Fri)00:48:40 No.110508396
We're visiting a factory tomorrow
Anonymous12/04/26(Fri)00:49:00 No.110508400
aoc-2026-d02
day 2 BQN solution
Anonymous12/04/26(Fri)00:54:01 No.110508426
Can't believe I'm going to have to broot this hard this early on...
Anonymous12/04/26(Fri)00:55:58 No.110508438
>part2: are you a brooting retard or do you know how to solve a puzzle
Anonymous12/04/26(Fri)00:59:16 No.110508457
Okay Part 2 is filtering me. I don't know substring trickery. I brooted part 1. Can a mathfag give me a hint of how to approach the problem?
Anonymous12/04/26(Fri)00:59:33 No.110508460
Did any of you retards start building strings?
Anonymous12/04/26(Fri)00:59:34 No.110508461
>part 2
brootbros....
Anonymous12/04/26(Fri)01:01:30 No.110508471
>>110508457
part 1 solution solves part 2 just fine though?
Anonymous12/04/26(Fri)01:01:42 No.110508472
>>110508457
it's not a math thing, you just have to look at the problem in a different way
Anonymous12/04/26(Fri)01:02:10 No.110508474
>a good puzzle in 2026
eric-sama...... I kneel.......
Advent of Code is dead. Long live the 12 days of codemas
Anonymous12/04/26(Fri)01:02:48 No.110508479
>>110508457
I didn't use any math tricks, but you don't need to brute the '?'
Anonymous12/04/26(Fri)01:02:57 No.110508480
Anonymous12/04/26(Fri)01:03:57 No.110508486
>>110508457
If the shortest length were n, then
s[0]==s[0+n]
s[1]==s[1+n]
s[2]==s[2+n] etc...

Find the first n that works.
Anonymous12/04/26(Fri)01:04:36 No.110508490
1788467864594174
all(len(set(line[i::length]) - {'?'}) <= 1 for i in range(length))
Anonymous12/04/26(Fri)01:06:54 No.110508503
ocaml4
>>110508471
I went with logical code which is already slow enough but works fine with a cap of 8 instructions
I'm sure this works for part 2 as well but it's glacially slow
Anonymous12/04/26(Fri)01:08:06 No.110508511
4
idiomatic Rust solution
Anonymous12/04/26(Fri)01:09:01 No.110508517
>>110508400
Welcome to Earth, traveller.
Anonymous12/04/26(Fri)01:10:45 No.110508527
part 2 brooters, how we holding up?
Anonymous12/04/26(Fri)01:14:02 No.110508546
carbon
>>110508527
Sadly my part 1 broot didn't hold up at all
Anonymous12/04/26(Fri)01:15:18 No.110508555
code
>figured out the trick to part 2
well that was dumb
Anonymous12/04/26(Fri)01:16:58 No.110508563
>>110508555
uhhhhh you mean the trick to part 1, right?
Anonymous12/04/26(Fri)01:17:26 No.110508566
>>110508563
no i brooted that shit
Anonymous12/04/26(Fri)01:23:45 No.110508595
26_D04_C#
Lost so much time on part one because I forgot to reset the code I was testing.
Anonymous12/04/26(Fri)01:27:02 No.110508614
Barnyard_Biggie_Cheese
bigboy #4
url: https://files.catbox.moe/06foyq.txt
silver: 529318
gold: 3341637

I'll make a bigger one if requested
Anonymous12/04/26(Fri)01:34:56 No.110508661
code
>>110508555
guess it was pretty simple after all
Anonymous12/04/26(Fri)01:35:55 No.110508668
d04_033456
I got stuck for a while because I needed extra checks in part 2 but it was fun.
Anonymous12/04/26(Fri)01:39:54 No.110508695
so let me get this straight:
instead of generating a possible pattern, we want to take a substring of the barcode of increasing length - and the only way it can be validated is if we run through the whole barcode and check if the substring has a color that isn't the same color as the barcode has at that position? the question marks are just redundant, because if there's a ? in the barcode and not in the pattern we're testing, that's fine, and if there's a ? in the pattern but not the barcode we can just set that position in the pattern to whatever the barcode has?
Anonymous12/04/26(Fri)01:45:27 No.110508719
>>110508695
You can probably skip the first bit of barcode that's the length of the substring, and all the ? that pads the end of the barcode. That's what I did
Anonymous12/04/26(Fri)01:47:07 No.110508737
>>110508695
Well, the substring can't have a ? that ends up aligning with two different colors in the barcode so you need to keep track of that, too.
Anonymous12/04/26(Fri)01:48:30 No.110508746
day4
>>110506688
What am I doing
Anonymous12/04/26(Fri)01:55:15 No.110508796
carbon
>>110508695
interesting. took me a while to understand what was happening.
Anonymous12/04/26(Fri)01:59:01 No.110508809
aoc-2026-04-cpp
>>110508796
I had the same approach. I used Qt because it has the classes QByteArray and QByteArrayList, basically char[] and char[][] with .length().
Anonymous12/04/26(Fri)01:59:46 No.110508813
>>110508614
9s 28ms
529318
3341637
Anonymous12/04/26(Fri)02:03:59 No.110508831
>stuck on part 2
>realize you don't have to bfs at all
>just leave the ? in your candidate until it HAS to be something and then use that in your validation

dam this was simple in retrospect, my part 2 runs waaaay faster than my part 1
Anonymous12/04/26(Fri)02:07:51 No.110508848
def check(bcode, cand):
if not cand:
return False
for idx,c in enumerate(bcode):
if c == "?":
continue
cidx = idx % len(cand)
if cand[cidx] == "?":
cand = cand[:cidx] + c + cand[cidx+1:]
if c != cand[cidx]:
return False

return True

ans = 0

idx = 0
cand = ""
for idx,c in enumerate(bcode):
cand += c
if check(bcode, cand):
ans += len(cand)
break

print(ans)


ezpz
Anonymous12/04/26(Fri)02:11:08 No.110508867
Anonymous12/04/26(Fri)02:16:35 No.110508899
It's a throw out the broot and try again day.
Anonymous12/04/26(Fri)02:21:35 No.110508930
Screenshot 2026-12-04 102041
>>110508614
about 1m
Anonymous12/04/26(Fri)02:22:18 No.110508938
carbon (1)
>>110508614
Semi-cleaned >>110508546

part1: 529318
part2: 3341637
8.7s with CPython
1.05s with pypy
Anonymous12/04/26(Fri)02:22:37 No.110508942
>>110508900
at this point I doubt that even compiles
Anonymous12/04/26(Fri)02:29:25 No.110508986
>>110508930 (You)
what am I even memcpying for lmao
Anonymous12/04/26(Fri)02:31:40 No.110509000
>>110508942
what? why wouldn't it compile?
https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=fc1524614fce4dc4459ab2cc70c988bf
Anonymous12/04/26(Fri)02:34:15 No.110509019
>>110508899
Why can't you broot?
Anonymous12/04/26(Fri)02:36:47 No.110509041
Screenshot 2026-12-04 103557
>>110508930
0.5s, much better now
Anonymous12/04/26(Fri)02:36:49 No.110509042
>>110509019
by broot, i assume he means BFS where you just try every color in place of a question mark. works fine on part 1 but fucks you on part 2
Anonymous12/04/26(Fri)02:50:49 No.110509098
How many digits in the final solution?
I'm already up to 11 character substrings in under 5 minutes and I'm wondering if I should wait around for the result or go to bed.
Anonymous12/04/26(Fri)02:52:26 No.110509106
Anonymous12/04/26(Fri)02:55:33 No.110509117
>>110509098
You mean how many instructions for the super long barcode? I had just under 2000.
Anonymous12/04/26(Fri)03:01:41 No.110509140
>>110509041
Try reduce branching by replacing && with & and using less ifs
Anonymous12/04/26(Fri)03:05:45 No.110509162
>>110508273
I still have no idea what the chinese reminder theorem is, and I have all stars from all years.
Anonymous12/04/26(Fri)03:06:53 No.110509169
It makes me sad that programming is dead.
Anonymous12/04/26(Fri)03:13:12 No.110509208
>>110509140
yeah it's 330ms now, thanks
I won't be spending more time on it
Anonymous12/04/26(Fri)03:14:06 No.110509213
>>110509169
Programming isn't dead. AI still occasionally makes mistakes which I have to ask it to fix, and it doesn't even work that much faster than I do, only about 20x. Plus, LLMs are fundamentally flawed and not capable of true reasoning, so they won't get much better than they currently are.
Sorry cuckcoders, programming is here to stay.
Anonymous12/04/26(Fri)03:19:12 No.110509239
welp
>>110508912
Will try to improve it tonight
Anonymous12/04/26(Fri)03:27:55 No.110509286
d4
what did he mean by this?
Anonymous12/04/26(Fri)03:31:20 No.110509303
>>110509286
Goyim in abundance.

Someone invite Peter Norvig to our leaderboard
https://github.com/norvig/pytudes/blob/main/ipynb/Advent-2026.ipynb
Anonymous12/04/26(Fri)03:39:53 No.110509365
> works on example
> your answer is too low
aight see you next year
Anonymous12/04/26(Fri)03:40:32 No.110509368
>>110509286
there was a previous day in advent of code history where reddit complained about slurs in a randomly generated input right? and eric responded to it? or did i make that up?
Anonymous12/04/26(Fri)03:41:22 No.110509372
>>110509368
FAG appeared and they had to reissue corrected inputs.
Anonymous12/04/26(Fri)03:43:01 No.110509380
Part 1:
data = open("Day 04 input.txt", "r").read().strip().split("\n")

def search(code, inst="", pos=0):
#print inst
if len(inst):
for num, char in enumerate(code):
if char != "?" and char != inst[num%len(inst)]:
break #fail
else:
return len(inst)

best = len(code)
for opt in "roygbv":
if code[pos] == "?" or code[pos] == opt:
result = search(code, inst + opt, pos+1)
if result < best:
best = result

return best

total = 0
for line in data:
total += search(line)
print total

Part 2
data = "".join(open("Day 04 input.txt", "r").read().strip().split("\n"))

def check(length):
assigned = {}
for offset in range(length):
for char in range(offset, len(data), length):
if data[char] == "?": continue
if offset in assigned:
if assigned[offset] != data[char]:
return False
assigned[offset] = data[char]
return True

for length in range(1, len(data), 1):
if check(length):
break
print length

Started late. Overthought part 1, for part 2 I had to pivot to the sieve approach I really should have been using from the beginning.
Anonymous12/04/26(Fri)03:43:11 No.110509381
1772706221412651
Anonymous12/04/26(Fri)03:45:21 No.110509393
>>110509381
I hate the faggy text it automatically adds.
Anonymous12/04/26(Fri)03:46:30 No.110509399
>>110509303
Some of the best python I've seen.
Anonymous12/04/26(Fri)03:46:46 No.110509402
>>110509393
yeah well blame eric for shoving the pride rainbow into all the puzzles. Real rainbows typically have seven colors
Anonymous12/04/26(Fri)03:53:27 No.110509435
>>110509286
I received 2 "goy" lines in my input.
Anonymous12/04/26(Fri)03:54:15 No.110509441
smug
>>110509399
mines better
Anonymous12/04/26(Fri)03:56:23 No.110509458
>>110509441
Post code
Anonymous12/04/26(Fri)03:56:56 No.110509461
>>110509458
already did
Anonymous12/04/26(Fri)04:09:58 No.110509547
>>110502150
Holy shit is that Reboot?
Anonymous12/04/26(Fri)04:38:01 No.110509697
ss
damn, at the firs reading I thought I will get filtered that's why I used Python not Zig. It turned out to be pretty simple.

unwashed python. will tackle bigboy later
Anonymous12/04/26(Fri)04:39:05 No.110509709
>succeed on example
>fail on input
FUCK
is eric fucking me with cutting off sequences at the start or is that part 2
Anonymous12/04/26(Fri)04:46:03 No.110509747
>>110509709
Part 2 is easy when you've completed part 1. But it does require you do do part 1 in an efficient way or it will take forever.
Anonymous12/04/26(Fri)04:46:48 No.110509749
>>110509709
Are you getting any sequences that require the entire sequence length in order to print a valid barcode?
Anonymous12/04/26(Fri)04:50:21 No.110509763
>>110509747
I didn't do the part 1 that's why I am asking
>>110509749
yes
found answer of len 3 for g?y (fulllen: true):
gry
found answer of len 2 for gy (fulllen: true):
gy
found answer of len 7 for vg???yo (fulllen: true):
vgrrryo
Overall my answer is too high
there are probably some more efficient solutions if I could cut off the start but Im not sure if that's allowed by the wording of the part 1, it seems like a good twist for part 2
Anonymous12/04/26(Fri)04:53:45 No.110509778
strong man crying
>brooted part 1
>see part 2

go on without me fellas...
Anonymous12/04/26(Fri)04:57:20 No.110509802
>>110509763
I've written a first implementation in Python this morning that took 12 seconds for part 2. Thought about it for a bit and then came to the conclusion that I'd done it the wrong way round. My second implementation in C++ was faster. Basically I try to compose a program for the barcode and see if it fits. If it doesn't fit, I start with a new program that is one instruction longer, and so on until it fits and then I output the number of instructions. Part 2 can use the exact same function.
Anonymous12/04/26(Fri)05:08:53 No.110509854
I figured it out, printing out my permutations helped
instead dividing my permutation country by 6^(nth ?) i was just dividing it by (nth ?)
Anonymous12/04/26(Fri)05:22:17 No.110509927
wtf eric forgot the lube
Anonymous12/04/26(Fri)05:23:39 No.110509934
I have reviewed every posted solution in these threads thus far and have come to the conclusion that I'm the only one actually writing code. You faggots all use AI.
Anonymous12/04/26(Fri)05:24:23 No.110509939
>>110509854
>permutation
What? Why? Don't you realize that the positions in your programs are dictated by the colors in your incomplete bar code? There's no need for permutations. In fact I think if you do permutations, part 2 will run for a long time.
Anonymous12/04/26(Fri)05:30:15 No.110509967
so what's the fastest way to do it? i settled on
>put letters into x bags in a cyclical loop, where x is instruction length i'm testing
>ignore ?, if more than one letter would go into given bag it means the instruction length is impossible
>increase instruction length by one, repeat

200ms in python
Anonymous12/04/26(Fri)05:31:57 No.110509979
file
>>110509939
nah anon don't worry, I'm just gonna do it real quick
>*dies*
Anonymous12/04/26(Fri)05:35:41 No.110509999
>>110509967
Yes, that's the way I did it on my 2nd attempt.

The new puzzle comes out at 6 in the morning in my timezone. I wasn't really awake yet and I didn't get much sleep last night, so on my 1st attempt I made the program the length of the barcode and then tried to reduce the program until I reached a minimal length. That worked, but it took 12 seconds to complete for part 2.
Anonymous12/04/26(Fri)05:43:51 No.110510034
On my fixed version I start with a max len of 1 up to the length of the target string and I fill a list with ?
Then I move that mask along the target comparing it to the target, any ? that align with letters are converted into that letter, if a letter in the mask aligns with a different letter in the target then it is invalid.
The first one that covers the entire target will be the shortest. 200ms compared to like 40s for my original solution.
Anonymous12/04/26(Fri)06:05:51 No.110510187
Anonymous12/04/26(Fri)06:08:18 No.110510202
>>110509948
damn, I thought I didn't but on second thought, maybe I did after all...
Anonymous12/04/26(Fri)06:29:16 No.110510311
>>110510202
I reverse engineered the steps, including the prompt. First you took your moms credit card and bought a video tutorial on "efficient prooompt engineering" and then you pasted todays problem description into chatGPT, told it what language to use and to avoid importing solutions, bare minimum core lib utility. This didn't work, so you copied something you found on reddit and carbon'd it. The absolute state of /g/...
Anonymous12/04/26(Fri)06:35:23 No.110510342
Screenshot 2026-12-04 at 12-33-51 Stats - Advent of Code 2026
At first I thought people were getting filtered. But then I noticed that the numbers for days 1 - 3 actually climbed today. People are still solving the first puzzles, just a few days late.
Anonymous12/04/26(Fri)06:35:26 No.110510343
aoc04
I might be retarded
I spent like 5-6 hours trying to do a recursive memoization + pruning solution

pls tell me I am not retarded and a bunch of redditors cheated by asking for help and that is the reason 10k people completed it before me
Anonymous12/04/26(Fri)06:38:28 No.110510357
adv_2026_04
4 days of warming-up problems..
Anonymous12/04/26(Fri)06:41:42 No.110510370
rust

I had to take my beautiful permutation-based solution out back and blast it after reaching the 6^13 point. Hence this ugly allocating solution, yuck!
Anonymous12/04/26(Fri)06:41:54 No.110510372
>>110510342
People are always solving days late.
We are still well below normal day 1 numbers, though. Also, day 3 filtered a quarter of people.
Anonymous12/04/26(Fri)06:43:29 No.110510378
file
>>110510370
forgot fmt
Anonymous12/04/26(Fri)06:46:59 No.110510396
>>110510372
>day 3
Yeah, I was worried for a moment over part 2 and was asking myself "how do I detect rotated squares?". But when you read the examples, you realize that if corner 2 is 3 steps to the right and 1 step down, then corner 3 is going to be 1 step to the left and 3 steps down, and so on. Yesterday an anon tried to explain that with vectors and the cross product, and technically he was right. Practically though you can work it all out with simple addition and subtraction arithmetic on the x and y coordinates.
Anonymous12/04/26(Fri)06:58:38 No.110510461
>>110509778
my broot could not even broot the second demo example after waiting for a few minutes