[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: 1764831368070574.webm (555 KB, 501x480)
555 KB
555 KB WEBM
babbies first grid problem 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: >>107424958
>>
File: solve.png (684 KB, 5546x3582)
684 KB
684 KB PNG
idiomatic Rust solution
>>
bigboy #4
https://files.catbox.moe/pj1x30.7z
2023510
5520583
>>
>>107430435
>@
what is that?
>>
>>107430443
https://doc.rust-lang.org/stable/reference/patterns.html#identifier-patterns
>>
>>107430449
cool
>>
>>107430441
>.7z
nice virus
>>
File: 3c.png (346 KB, 1000x1921)
346 KB
346 KB PNG
>>107430441
$ time ./a.out <bigboy.txt
2023510
5520583

real 0m0.552s
user 0m0.512s
sys 0m0.033s
$

not bad
>>
File: day04emu.webm (149 KB, 617x565)
149 KB
149 KB WEBM
Not a hard day. Fairly verbose, though.
>>
>bit maps are not available to rust native
>you can get this crate for it
Jesus fucking christ fuck you
>>
>>107430480
what an ugly font
>>
>>107430428
>AoC in 2025
What the fuck, did this nigger lie to me?
I thought he announced the end of AoC in 2024.
>>
File: day04.png (532 KB, 1477x2557)
532 KB
532 KB PNG
>>107430481
>>
>>107430489
classic
>>
>>107430496
You idiot. No, he didn't.
>>
>>107430493
lucida console, cousine, droid sans mono
cope, seethe, dilate
>>
File: carbon(2).png (186 KB, 1902x1168)
186 KB
186 KB PNG
WHEN IS IT GETTING HARDER ERIC
>>
day 6 will be the biggest filter /acog/ has ever seen
two more days. trust the plan
>>
Today's problem feels like something that should be pretty well handled on a GPU with a 3x3 kernel marching through and identifying relevant rolls to remove
>>107430489
Personally I'm a big fan of stuff not being in the standard library, other languages are full of poorly implemented or replaced implementations of stuff.
>>
am I the only retard who solved today's puzzle using a hashtable?
>>
those of you not already turned into gnomes by ebassi will be turned into elves by eric if you don't start showing some respect
>>
>>107430560
I just did it with a hashset, yeah. No need for a grid abstraction, you're just looking up coordinates
>>
>>107430560
I used Sets because they are more comfortable to me in haskell but arrays are of course way more performant.
>>
Javascript, visualizer.
Click to open the input file.
https://jsfiddle.net/e7g82urw/1/

Code fragment:
    const l = e => {
lines = e.target.result.split(/\r?\n/);
while (lines.at(-1).length < 1) lines.pop();
w = lines[0].length + 2; const h = lines.length + 2;
const fw = sw * h / sh;
cnv.width = fw, cnv.height = h;
const img = ctx.createImageData(w, h);
v = new Uint32Array(img.data.buffer);
reset();
const z = w * h;
const dirs = new Int32Array([1, -1, w, -w, w+1, w-1, -1-w, 1-w]);
i = w + 1;
let flip = 0;
loop = () => {
ctx.fillStyle = "#000";
ctx.fillRect(0, 0, cnv.width, cnv.height);
ctx.putImageData(img, (fw - w) >> 1, 0);
if (flip ^= 1) {
for (let i = 0; i < z; ++i)
if (v[i] !== roll)
v[i] = (v[i] & 0xFEFEFEFC) >> 1 | 0xFF000000;
} else {
for (let i = 0; i < z; ++i) {
if (v[i] !== roll) continue;
let c = 0;
for (const d of dirs) c += v[i + d] & 1;
if (c < 4) v[i] = 0xFF4F6FFF;
}
}
window.requestAnimationFrame(loop);
}
loop();
}
>>
>>107430565
>>107430575
good to know
>>
File: AoC-04.png (63 KB, 861x748)
63 KB
63 KB PNG
Lazy "Shove everything in a set and iterate over it" solution.
>>
>>107430560
i don't like writing out out-of-grid exceptions when finding neighbours so i use dicts to quickly filter candidates
>>
>>107430580
it says whitelist jsfiddle
>>
>>107430593
x < width && y < height

wow, that was hard
>>
>>107430593
same
too slow though
>>
>>107430596
>He missed the >= 0 checks
Apparently it is.
>>
>>107430619
all unsigned integers are positive
>>
>>107430595
LMAO, those are toddler wheels for normies, and 4chan believes that code is spam.
I am so tired of this shit.
>>
File: 1751464893533412.png (187 KB, 983x777)
187 KB
187 KB PNG
>they don't use God's own cursive hand
NGMI
>>
>>107430657
there are no silver stars though
>>
>>107430657
that is not cursive but ok
>>
Easier than yesterday
>>
File: 20251204_192533512.webm (1.15 MB, 853x480)
1.15 MB
1.15 MB WEBM
>>107430497
Something strange is going on. I am having more issues with the PS2 even when running days 1 and 2 still work fine.
I thought it might be the PS2slim dying but when I tried on the Fat I got the same thing.
>>
File: 1734670300861742.png (526 KB, 600x600)
526 KB
526 KB PNG
this is what millions in corporate sponsorship gets you in 2025
>>
>>107430537
I get that, but eh bit manipulation/sets are common enough practices that I would expect it in rust. I know chess programming has some techniques with it. Although if it is as simple as installing a crate (and hoping no virus/attack is on it) I guess it's fine in a way.
>>
>>107430773
writing a bitset is trivial though, dumb retarded nocoder.
>>
File: day4part2Clojure.png (104 KB, 895x519)
104 KB
104 KB PNG
>>107430657
that's not cursive.
You might like this font if you're into historical accuracy:
https://github.com/ctrlcctrlv/kjv1611
>>
>>107430786
I don't want to. I could, but coming from C++'s https://en.cppreference.com/w/cpp/utility/bitset.html, I'm just surprised Rust doesn't have this.
>>
>>107430480
pretty cute desu. nice times even with brute.

>>107430807
why does C++'s bitset take the len as a template param?
>>
By this point Everybody Codes was harder and better.
>>
>>107430872
this (unironically)
>>
>>107430872
true
>>
>>107430872
I miss 2023, that was a good year. Sure, it was my first year, but it was a good year.
2019 was the best, 2017 and 2018 were also very good. 2021 was decent.
But so far this year is worse than early 2015
>>
File: file.png (439 KB, 1360x2912)
439 KB
439 KB PNG
>>
>>107430872
Day 3 and 4 of EC were one-liners
>>
>>107430888
EC was 20 days, AoC is 12 days. We are a third in, so compare it against EC's day 6-7
>>
>>107430888
so? more loc != harder
>>
>>107430872
If I had known Everybody Codes was a thing I'd have joined in.
I suppose maybe next year.
>>
File: rape_me.png (25 KB, 783x723)
25 KB
25 KB PNG
day 1
>>
I hope none of you write code like this in prod codebases/at work
>>
>>107430888
the difficulty of those two problems comes from figuring out how to simplify the problem, which isn't immediately obvious
aoc day 4 is literally program these instructions okay you're done
>>
>>107430911
problem?
>>
>>107430911
I always leave every bit of code I touch just a bit more idiomatic than before.
>>
took me 19 min (15min in p1) cause i had a stupid bug, i was doing nj = i+dj, instead of nj=j+dj lol.
for optimizations, i guess saving the whole state for double buffering is extremely useless, and you can juste store the indices of the grid that changed and update at the end of the main loop
>>
>>107430872
EC has poorly written problem statements. Eric is a very good technical writer.
>>
>>107430911
>implying anyone participating in this is employed
>>
File: aoc2025-04.png (115 KB, 466x1073)
115 KB
115 KB PNG
>>
>>107430911
The only real difference between how I'd write it at work and how I write code for AoC is that I would be more flexible in how I handle input and output.
I'd also reduce the amount of long chained LINQ if that helps readability.
The only time AoC had any potential to do some software architecture was when we had the intcode puzzles.
>>
>>107430938
My total comp is $350K USD and I can't solve these problems nearly as well as people in here.
>>
>>107430933
Yes. But Eric's puzzles these last two years have too many times been Idiocracy tier:
>How many buckets do you have?
And then there's a filter question like the keypad robots that is actually fun and interesting. Only to next tday go back and ask me how many buckets I have again.
>>
File: 1747780670853244.jpg (94 KB, 517x471)
94 KB
94 KB JPG
>>107430911
as a CLEANCODE aficionado, all my code is good looks and production ready
>>
>>107430904
why not just use modulo? basically whats being done anyway
>>
>>107430958
I hate you
>>
>>107430977
Thanks. I'm set to get a promotion and get 600K TC next year. I can only do 40% of leetcode mediums.

If you want some advice to make this much money:

1) Get very good at leetcode
2) Get connections in the 'inner circles' - VC firms like a16z, hack VC, sequoia, schools like stanford mit harvard caltech princeton yale uiuc ETH - join their clubs, become friends with them. one one of them starts their own company they'll hire you, or when they get into jane street they'll help you get in

I can't leetcode for shit but I'm very social, good at architecture, product design, customer feedback, pitching, so I did number 2.

To anyone reading this: There's two groups of people in tech

1) The person who enjoys code for the sake it it and does side projects for fun. He will make 60k-200k

2) The person who realizes that code is a means to an end for business and spends more time on networking, events, pedigree, and leetcode

He will make 400k-2mil (Jane street, optiver, two sigma, nvidia, etc)
>>
I make fuckall as a programmer writing CADslop and I've never opened the leetcode website.
Is it like Project Euler without any of the fun?
>>
>>107430878
same, 2023 was my first year. i was a noob at that time though, so i got filtered after 5-6 days. managed to do some later problems a few months after, but never really got back to it. just looking at the description of the problems is daunting, this shit is too long
i did almost all of 2015 and really liked it, especially the RPG battles problems. i felt the year was original, short and straightforward, no need to decypher eric's bambling to find clues about what you're supposed to do
>>
>>107430807
It also has std::vector<bool>, which has caused all kinds of issues and should be a lesson to only add things that actually work to the standard library.
>>
File: rape_me.png (20 KB, 506x585)
20 KB
20 KB PNG
>>107430974
>>
>>107430737
tbf she looks better than eric
female attractiveness is primarily youth indicators anyway
eric could afford to fraud her youth indicators, but alas he is too busy writing Christmas stories about grid problems
>>
>>107431045
The only thing wrong with std::vector<bool> is that it is in std::vector. They should have just made a seperate boolvector class so you don't have a weird specialization of std vector for one type nobody expects to see.
std bitset is completely fine.
>>
File: code.png (212 KB, 1434x1128)
212 KB
212 KB PNG
>>107430972

BEHOLD
washed ass
the iter trick is cute i'll have to remember this one
>>
>>107430590
where is GetSurrounding8() defined?
youre only posting half your code
>>
>>107431173
Many such cases!
>>
>>107431027
it's fun
>>
>>107430911
you haven't seen production code
>>
File: day4.png (331 KB, 1312x2324)
331 KB
331 KB PNG
My unwashed solution.
>>
>>107431095
that trick is indeed cute, anon

waiting for speedy anons to post their times for bigboys
>>
File: rape_me.png (43 KB, 631x635)
43 KB
43 KB PNG
day 2
>>
>>107431223
What a weird language. Probably also your programming style makes this very opaque
>>
>>107431344
oh thats not day 2 thats just day 1 part 2
>>
File: Snippet.png (1.41 MB, 3092x6148)
1.41 MB
1.41 MB PNG
There's probably some DP wiz that i missed but it's bigboy ready so im settling
>>
>>107431173
You could say the same for anything not written in assembly.
>>
>>107431476
trudat
i cant believe people are doing these puzzles for years and just keep reimplementing the same boring ass parsing and grid/coordinate handling logic over and over instead of just making some utils
>>
File: aoc4_washed.rs.png (214 KB, 579x1169)
214 KB
214 KB PNG
Washed and de-dimensioned
>>
>>107431548
do the bigboi
>>
>>107431593
don't it's a virus
>>
>>107431593
800ms in Go. How bad is it?
>>
>>107431732
pretty good
>>
>download the bigboy
>run my code on it
>fans start running at full blast
>random powershell windows opening and closing rapidly
>windows explorer crashes
>disc drive starts opening and closing itself
>monitor turns black
>hear error noises dinging every few seconds
>harddrive ejects itself and runs out of the room
yep just another day in the life of a python dev
>>
File: aoc2025day3haskell.png (163 KB, 559x678)
163 KB
163 KB PNG
>>107430428
haskell solution reporting in.
my stupid bruteforce solution with a few quadrillion calls to `tails` was too slow for p2 so I had to think :/
big boy gets cleared in ~65 seconds.
onto day4 yoshi
>>
>>107431593
2023510
5520583
258ms

Not bad for no parallelisation + no adj caching
>>
>>107431808
>haskell solution reporting in.
(for day 3... im a little late cause of work & uni)
>>
File: carbon(3).png (577 KB, 1732x2494)
577 KB
577 KB PNG
Unwashed absolute retard solution.
>>
Chill day
How are you all doing?
>>
>>107431808
who's the qt
>>
File: carbon.png (363 KB, 2020x1474)
363 KB
363 KB PNG
This shit was bruteforceable, again. It's already day 4/12 what are you doing Eric
>>
>>107431841
Fine. Took my dog for a walk, he ate some homeless guy's poop. Hbu?
>>
Is there a way to do part 1 that isn't just iterating over every cell in the grid and checking the adjacent cells?
>>
>>107431807
>be me
>javascript dev
>download bigboy
>run bigboy.txt.exe
>weird gas starts coming out of computer
>panic
>it's actually only ketchup gas
>goes perfectly with my tendies
yep just another day in the life of a burger
>>
>>107431866
No. You can parallelise it but that's the only optimisation.
>>
>>107431889
>but that's the only optimisation.
wrong
only track the cells which have @ in them
>>
>>107430593
>i don't like writing out out-of-grid exceptions
just make your grid bigger
>>
>>107431866
iterate each cell, only check the adjacents of @ cells, you only have to check four out of eight adjacents if you increase the current cell's total and keep track of the adjacent @s' totals as well and increase each by 1
>>
File: trump-burka.png (63 KB, 293x248)
63 KB
63 KB PNG
>>107431850
have a guess
>>
>>107431819
holy shit, anon
  Time (mean ± σ):     257.1 ms ±   4.5 ms    [User: 241.5 ms, System: 14.1 ms]
Range (min … max): 251.8 ms … 262.9 ms 11 runs


we have pretty much the same sol, except yours is fancier due to having a fn for adj. I think I can do better by using a 1d index directly.
>>
>>107430489
why would you ever use a bitmap, especially for an iteration heavy problem like this? that's a size opt and it would introduce new race conditions since "adjacent" indices are no longer independent. literally the biggest problem with std::vector<bool> in C++.
>>
File: carbon.png (102 KB, 608x1103)
102 KB
102 KB PNG
The most grug method possible. 49 passes for part 2.
>>
7 lines of pytorch. Just let it run until the output value stops changing LMAO
import torch as tt
t = tt.tensor([[[int(x == "@") for x in l] for l in open("4.txt")]])
w = tt.tensor([[[[1, 1, 1], [1, 0, 1], [1, 1, 1]]]])
s = t.sum()
while True:
t[tt.nn.functional.conv2d(t, w, padding=1) < 4] = 0
print(s - t.sum())
>>
>>107431974
nvm, got it down by removing loop unrolling kek
  Time (mean ± σ):     148.9 ms ±   1.2 ms    [User: 138.2 ms, System: 10.3 ms]
Range (min … max): 147.1 ms … 152.4 ms 20 runs
>>
>>107431894
Still the same idea. Iterate over every cell and count (if that cell isn't a roll the count is zero). Number theory isn't helping anyone today.
>>
>>107431974
Which is your solution?
>>
Why such a low part 2 completion rate, these losers got jobs or somethin?
>>
>>107432448
you are reading it wrong anon, most people completed both
>>
File: Day-4.png (1.51 MB, 3296x5020)
1.51 MB
1.51 MB PNG
>>107432349
>>
File: d3.png (913 KB, 1000x3636)
913 KB
913 KB PNG
>>107415408
d3 bigboy
fuck intel
fuck compiler devs

single-threaded
Silver: 83984
Gold: 847316731798752

Performance counter stats for './3_st ../../../inputs/3/bigboy.txt' (300 runs):

28,003,668 user_time ( +- 0.04% )
2,655,490 system_time ( +- 0.31% )
111,173,521 cycles:u ( +- 0.02% )

0.0307085 +- 0.0000126 seconds time elapsed ( +- 0.04% )


multi-threaded (4 cores)
Silver: 83984
Gold: 847316731798752

Performance counter stats for './3_mt ../../../inputs/3/bigboy.txt' (300 runs):

29,914,621 user_time ( +- 0.04% )
3,504,553 system_time ( +- 0.15% )
117,081,580 cycles:u ( +- 0.16% )

0.0116120 +- 0.0000156 seconds time elapsed ( +- 0.13% )
>>
>>107430929
>>107431047
I keep seeing code like this. It is Python, not Java. Learn the idioms of your language, jeet.
>>107431851
A bit less worse.
>>
>>107432637
R8 >>107431095
>>
File: 2025-04.png (669 KB, 1950x3078)
669 KB
669 KB PNG
>>107430441
$ mix aoc.solve -y 2025 -d 4 -p b -r input/big -b 1
2023510
5520583

Ran in 91322.736ms


lol
>>
>>107432681
Extremely clean. I'm jealous to be honest.
>>
>>107432686
brute force chads can't stop winning
>>
File: smug.jpg (56 KB, 460x857)
56 KB
56 KB JPG
>>107432697
thanks anon
>>
File: 1757313218979738.png (55 KB, 621x828)
55 KB
55 KB PNG
>>107432558
Oh.
>>
What do you jam to while saving Christmas anons?
>>
>>107432730
Binaural mouth sounds
>>
>>107432730
french terrorcore
>>
File: showtime.jpg (46 KB, 640x480)
46 KB
46 KB JPG
>>107432730
https://www.youtube.com/watch?v=hjGZLnja1o8
>>
>>107432744
cancer music
>>
>>107432730
shoegaze and maidcore
>>
>>107432762
baste
>>
>>107431548
You know I always feel like I should just do these as a 1D array. But then I'm too small brain to conceptualize it if I get stuck. This looks nice though.
>>
another boring problem. meh.
>>
Part 2 was way too simple, what twist would you introduce to keep it interesting?
>>
>>107432221
I love problems where you can pull out a good old convolve
>>
File: 1733673915475080.png (1.02 MB, 1786x2250)
1.02 MB
1.02 MB PNG
>>107431457
I liked using maybe monad. It made dealing with elements on the boundary trivial.
This works on bigboy but it takes a bit of time to do that. I don't if it was a good or bad idea to use Matrix library.
>>
>>107432931
Start with a forklift at a given corner, what is the minimum number of moves needed to remove all the paper rolls?
>>
File: dance.gif (402 KB, 544x384)
402 KB
402 KB GIF
>>107432730
https://files.catbox.moe/tuevnx.mp4
New beat :D What do you think?
>>
>>107431548
Fun fact: this loop

for j in adj(i, h, w) {
g[j] = g[j].saturating_sub(1);
if g[j] == 4 { s.push(j); }
}


Is more than twice as fast on the bigboy as

for j in adj(i, h, w) {
if g[j] == 0 { continue; }
g[j] -= 1;
if g[j] == 4 { s.push(j); }
}


Cutting a branch gives a perf boost on par with parallelisation.
>>
>>107433123
>.mp4
nice virus
cancer music btw
>>
>>107432744
Classic
>>
File: file.png (82 KB, 1587x286)
82 KB
82 KB PNG
nothing works, I don't understand what I'm supposed to do
>>
>>107433127
both versiona have a branch, dumb retard
>>
>>107433162
sry, I'm retard. I read it wrong.
>>
>>107432730
https://youtu.be/FCGS84gb49U
>>
>>107433200
dw we're all retards here
>>
post the number of leetcode problems marked as solved on your profile
i'll start:
>171
your turn
>>
>>107433318
wow much izzat saar
>>
>>107433318
0
>>
did anyone actually come up with that *11 *101 *1001 *10001 shit on their own or am i just retarded
>>
>>107433127
The O(n)cel fears the branch remover
>>
>>107433326
what is izzat
thanks though
>>
vector<vector<bool>> bigboy takes 530ms for part two
I've got another idea: as set of points. I'll try it.
>>
>>107433318
>Easy 274/915
>Med. 324/1960
>Hard 27/889
I even got the hat. I'm basically still a noob though. I can do a lot of the mediums, but I really struggle with the hards.
>>
>>107433337
anon pls you're gonna give that one chatbot user ptsd
>>
>>107433318
0
>>
>>107433359
vector<bool> is weird in a lot of languages, try vector<u8>
>>
Just realized, this is how the north pole base is supposed to look like.
>>
>>107433365
i honestly cant imagine what its like to be able to see patterns in numbers like that. anyone who spotted that pattern without already knowing it from something prior is actually insanely smart on some level i cant comprehend
>>
>>107433318
>leetcode
>>
>>107433337
tf u on about m8?
>>
>>107433361
wow insane. you're certainly not a noob. At what day AOC usually starts becoming hard when you have that much training under the belt?
>>
>>107433390
there is a trick for day 2.. and its over my head
>>
>>107433372
Yes, we're going from room to room each day.
Day 5 takes place in a saloon btw.
>>
>>107433433
I'm trying my best but I can't even remember what day 2 was lol. Good I can keep my focus for 20mn-1h when solving those problems, otherwise I clearly have a tiktok brain.
>>
File: rape_me.png (15 KB, 385x311)
15 KB
15 KB PNG
day 2 bruteforce lol
>>
>>107433455
I guess the room looks like it. Has it been leaked?
>>
>>107430904
>>107431047
>>107431344
>>107433486
why does he name his files that...uncomfy
>>
>>107433512
>he
I'm a (hot) girl
>>
>>107433525
on thursdays, we kode
>>
>>107433318
>leetcode
miss me with that jeet shit
>>
>>107433337
can someone post code? idg what this does that helps.
> 464464 * 11 * 101 * 1001 * 10001
5165871770563504

????
>>
>>107433318
>jeetcode
>>
kek, I'm filtered by day 1 part 2. I've finished all the other years but I just can't even bring myself to debug this properly
>>
>>107433616
nothing just go back to sleep
>>
>>107433627
Don't try to be clever, just run your loop tick by tick
>>
File: day4.png (408 KB, 1396x1750)
408 KB
408 KB PNG
Once again, I am irritated that Swift does not consider (Int, Int) hashable. I had to define my own Point struct.
>>
>>107433318
110
>>
>>107433389
>>107433617
>>107433543
Filtered codelets coping lmao
>>
>>107433359
>part 1 4s
>part 2 8.3s
it's so so over for set. time to try a map.
>>107433371
I'm not complaining, just fooling around. vector<bool> takes bit per bool, so it's good, friendlier for cache and so on
>>
>>107433716
>I'm not complaining, just fooling around. vector<bool> takes bit per bool, so it's good, friendlier for cache and so on

True, but that comes at extra processing cost. If your grid can fit in L1 cache anyway u8 beats bool.
>>
too easy
>>
File: img.jpg (1.85 MB, 4032x3024)
1.85 MB
1.85 MB JPG
>>107433406
Lol thanks! I only started really studying a year ago for interviews. I think the difficulty is more tied to what you studied more or less. That said week 4 really kicked my ass last year. It's crazy how many smart and fast people are here. The leaderboard is nuts. Good luck with the grind!
>>
>>107433764
>2 line length limit columns
>both violated
>>
>>107433777
>filtered by negating boolean expressions
many such cases
>>
File: 2siu6l.jpg (49 KB, 739x500)
49 KB
49 KB JPG
>>107433764
bigboy takes almost exactly 1 second, too slow
was thinking: start by converting @ to count of neighbours, then never count them again
>>
>>107433764
god damn it that c looks nice. the sad thing is I'll never be able to program c professionally. escaping web dev is impossible.
>>
>>107433680
Sorry, never done a jeetcode problem ever so I can't be filtered by them. From what I've seen it is just useless shit.
>>
>>107432742
gimme some
>>
>>107433764
Does C not have some equivalent to saturating_sub? That's a lot of branching in count_neightbours
>>
File: IMG_20251204_173454.jpg (356 KB, 1076x1820)
356 KB
356 KB JPG
Pretty easy
>>
>>107433991
Post runtime
>>
>>107434028
213ms
>>
>>107433991
i could just mash random shit on the keyboard in one of these meme langs and no one would know
>>
>>107433882
>repeatedly looping over the whole array for part 2

It looks horrific. Canon needs to study his algorithms.
>>
>>107433680
I'd rather work on things I like and no AoC is not the same thing as jeetcode.
>>
>>107433680
>codelets responding to tell you how not mad they are
>>
>>107434071
if this is APL or something similar its really well suited to this specific problem. You could probably solve it with less than 80 characters.
>>
>>107433372
imagine how cool it would look with 24 days
>>
>>107433455
day 8 is in the elven brothel
>>
File: d04.png (170 KB, 922x1533)
170 KB
170 KB PNG
I am not enjoying rust.
>>
>>107434227
try writing idiomatic Rust instead of brain-damaged faggot Rust
>>
>>107433988
if you care about speed you can use a LUT, people just use the double loop cus it looks cool
>>
File: day4.png (76 KB, 944x1422)
76 KB
76 KB PNG
That was fun! Was not expecting BFS to be the optimal solution.

>inb4 why are you checking that the cell contains an "@" when you checked during the file read
because awk's hashtable implementation is cursed and sometimes it adds random fucking entries to your hash table for no reason
>>
>>107432349
I got it further down to 88ms for the biggest boy of them all :)
  Time (mean ± σ):      88.7 ms ±   1.6 ms    [User: 79.5 ms, System: 8.6 ms]
Range (min … max): 86.2 ms … 91.9 ms 32 runs
>>
>>107434295
update, if you're running this in POSIX awk, you need to pick different variable names than I and J in the blocked() function; awk doesn't create new scoped variables and just clobbers the initial ones. Oops!
>>
Of code
>>
i have no skill but i must bigboi
>>
haven't been in /g/ for a while what's this izzat meme?
>>
>>107434580
indian cloutmaxing/aurafarming
>>
>>107434346
awk doesn't have closures either. It needed to have such strange limitations to give us Perl.
>>
>>107434227
>nested vecs
oh no no
>>
File: 3a.png (235 KB, 982x1313)
235 KB
235 KB PNG
>>107434295
good to see an awk newbie
>>107434346
>awk doesn't create new scoped variables
it does if you list them as function arguments
like function blocked(r,c, i,j) { ... }
>>
File: izzat.png (788 KB, 3037x1972)
788 KB
788 KB PNG
>>107434580
if you've worked with Indians you'll recognize all of this immediately, but the word itself could be made up for I care.
>>
File: 1657968389476.gif (2.41 MB, 200x160)
2.41 MB
2.41 MB GIF
>>107434227
>>
File: rape_me.png (53 KB, 691x779)
53 KB
53 KB PNG
ahahaha
it actually worked
>>
half second for bigboy... it's over. my 1d2d vector library has failed me........
>>
>>107434699
>farms post
>screen shot and not even a link
I ain't reading all this shit, by (You).
>>
File: 1761401168362125.jpg (90 KB, 1286x785)
90 KB
90 KB JPG
what's your chess rating
>>
somewhere above that yellow line
>>
>>107434845
>those peaks around every interval of 100
psychology
>>
>>107434845
like 800 3-minute blitz
>>
>>107434830
that's the direct answer to the question that I had handy. You want me to do more work, give me some AoC solution to rewrite in d.
>screen shot
scrape it. Get an AI to read it aloud to you in an Indian woman's accent.
>>
>>107434874
many people achieve a rating and then squat it and never play again
>>
>>107430872
I still hate that the input changes from part to part. For me a big part of the fun of AoC is seeing what the twist of Part 2 is on the same input. Usually it is just some flavor of “do the same thing 100000000 times” but sometimes it is a really clever and fun reinterpretation.
>>
>>107430911
My job has it's own leaderboard with half the devs in it
>>
>>107430911
writing shit untested code is job security
>>
>>107430872
>NEW INPUT
>doesn't even tell you what to expect (answer wise) for older parts with new input
fuck off.
it's so ass.
>>
>>107434699
sir delete this you have damaged my izzat and insulted on me. my ai code is thought wrote on by me you bloody basted!
>>
>>107434992
but LE DRAGONS
>>
>>107434976
Lucky. I’ve tried to get other devs on my teams at 2 jobs now to participate with zero success.
>>
>>107435020
ugh.
I did up to 6 before self filtering because the input juggling was just gay.
>>
>>107434976
>My job has it's own leaderboard with half the devs in it
tf, where do you work? at my company, everyone was disinterested and of them, every single one of them is a shit coder, so that's probably why.
>>
File: rape_me.png (51 KB, 627x839)
51 KB
51 KB PNG
ok time to get filtered by day 3
>>
>>107435055
nigger what the fuck
>>
is 2022 worth finishing?
I've been doing all the intcode ones for 2019, haven't looked at the other problems yet...
>>
>>107435022
A few of the managers have gotten into it as well.

Looks like for whatever reason day3 part 2 was where whatever LLM they were using hit the wall

>>107435049
A startup in Atlantic Canada
>>
>>107431000
You are Jewish aren't you.
>>
>>107435074
you ok?
>>
>>107431000
How do I do number 2 if I am not a member of the Tribe?
>>
>>107431000
>2) The person who realizes that code is a means to an end for business and spends more time on networking, events, pedigree, and leetcode
I would rather kill myself this sounds like hell
>>
File: 1747047740197903.png (1.96 MB, 1829x930)
1.96 MB
1.96 MB PNG
December, the month of AOC and comfy side projects.
>>
File: 1763037949078029.png (41 KB, 800x800)
41 KB
41 KB PNG
>Reconsider whether you really want to be on the hook for $150,000 per puzzle input copied and per copy distributed.
>>
File: 7rmtd3yc8hcb1.jpg (37 KB, 520x600)
37 KB
37 KB JPG
>>107435238
>>
>>107435238
ban ritual posters.
>>
i'm just waiting for drawanon to post desu
>>
The schedule should have been every other day, with the final question on the 25th
>>
>>107434699
this is just brown people points/ brown thirdie nationalism and you can see LATAMs, especially brazilians, doing this exact same thing on /int/ and /sp/
>>
>>107435333
I love drawanon
>>
>>107435361
I don't get why he doesn't do this since it's less taxing than releasing daily.
Also it feels different having the last puzzle not on Christmas.
>>
You realise we will get to Day 12 and Eric will reveal the last 13 days.
>>
>>107434693
This is some incredibly idiomatic awk; wow. I can barely tell what it's doing, but it looks very impressive.
>>
>>107431000
Basically what >>107434580 is posting. It's a conception of face in which honor is zero-sum, shred by your group and justifies literally any duplicity or cheating to gain.

Unsurprisingly, countries that widely honor izzat are pretty terrible places to live.
>>
>>107435530
Fuck; swapped around the two quotes and misspelled "shared". My izzat has suffered.
>>
File: d-python3b.png (218 KB, 1406x1372)
218 KB
218 KB PNG
>>107435055
in d this is just

d fun: 1. building table at compile-time summoned the OOMkiller after locking up my laptop
2. to!int in the parts map gave me a ConvException without a useful line number even in a debugging build and was a pain in the ass to track down, I thought it was in the table construction.
3. As part of tracking that down I tried core.int128 which was garbage as expected. How do you even turn a string into one of these things? Isn't that what conv is for?
4. 'parts' hurt the most for the lack of a destructuring assignment
but Python is still the worse language for this bullshit range() where range(a,b,c) changes exclusivity depending on the sign of c.
>>
>>107434601
>>107434580
>>107435530
>>107434699
see
>>107435411
>>
>picrel
Im stealing that, Array doesn't have a safeGet ootb but it should be easy to whip up something

>This works on bigboy but it takes a bit of time to do that
My solution above took about 13.5s on ryzen 5600, should be easy to compare since it looks identical sans the Matrix library
>>
>>107435530
>countries that widely honor izzat are pretty terrible places to live
that may be, but Whites who lack such a concept are stupid enough to let their countries get flooded by people from those countries, so they just get the negatives without any of the positives.
>>
>>107435651
was in reply to >>107433024
>>
>>107435576
thats pretty cool to see, never messed with d before. thanks for taking the time
>>
File: file.png (32 KB, 491x430)
32 KB
32 KB PNG
pretty happy with this
>>
>>107435667
I'm not
>>
>>107435667
>import solution
>>
File: file.png (49 KB, 758x640)
49 KB
49 KB PNG
>>107435704
>she doesnt have a library of grid operations after doing the same algorithms dozens of times over the years
>>
>>107435667
>iterating the entire grid instead of propagating

You didn't solve it
>>
>>107432582
Language?
>>
>>107435945
zig.
>>
What image maker doesn't have retardedly large fonts?
>>
>>107436001
https://lib.rs/crates/silicon
>>
>>107436001
https://git.xolatile.top/emil/xolatile.top
>>
>>107436001
Actually it's this

https://git.xolatile.top/?p=xolatile-xarbon.git;a=summary
>>
>>107435172
You'd rather kill yourself than be a millionare in your 20s, free to pursue and hobby, code 24/7 for fun after you retire early, hire any tutor for anything, travel anywhere, buy any experience? k
>>
Wow that one was easy. Only thing that really stumped me was not knowing how multi dimensional arrays work, but worked around that by having a string array, converting that string to a char array when I had to modify it, then converting it back to store it when I was done.
I also tried to do some of the old cheating on part 2 by just counting the amount of @ symbols since I reasoned it was impossible one of them to be unreachable, but that didn't work.
>>
>>107435121
study hard and get into a top school
>>
>>107434845
Mirin, at around 2000 rapid on lichess I was playing 3/5 cheaters these days and I deleted my account since there was no point playing (I mostly enjoy playing rapid). My peak was 2100 rapid, 1850 blitz.
>>
>>107436148
If anyone believes these LARP posts then yes they should kill themselves. Even if it is true in your case, it does not follow if you do 2 you will be guaranteed such success. There are plenty of people who have done 2 and end up in the same salary range as your developer example 1. Genuinely happy for you if true for you though. Enjoy your riches and merry christmas friend.
>>
>>107434845
Like 300, it's terrible. I find gitting gud at chess very boring (or at least I tell myself that).
>>
>>107436183
Also because i didn't want to bother with checking for out of range exceptions I just added one character of padding on each side.
>>
>>107436202

It is true. But I wouldn't say I'm very happy. I feel a bit driftless

Merry Christmas to you too. I'll be active in these threads the next week if anyone wants career advice. Happy to do resume reviews too
>>
>>107434845
on lichess, 2150 blitz was my peak. today i'd be 1850-1950, i barely play anymore. i was mainly playing bullet though.
i wasted so much time on that stupid game.
>>
File: 20251202_225359.jpg (65 KB, 926x1201)
65 KB
65 KB JPG
anons, I used backtracking for day 3, and gpt tells me my solution is O(n*k) (n=row len k=batteries). I couldn't figure out wtf people meant by moving windows, I didn't find a need to do that.

is my solution retarded for doing it in what I feel is a dumb way (i.e. backtracking)? It runs fast enough on normal input, and in 10s on big boy. am i gmi?
>>
Nobody's making the calendar?
>>
File: carbon(149).png (571 KB, 1394x3052)
571 KB
571 KB PNG
Washed ass. Vectors means it's optimized
>>
>>107436395
>I used backtracking for day 3, and gpt tells me my solution is O(n*k) (n=row len k=batteries)
dumb bigger
>>
>>107435212
video game?
what is the scene representing?
>>
>>107436395
yes, you are gmi. don't listen to the deniers

>>107436439
cute
>>
>>107436452
explain saar
>>
used simd for the stack solution for day 3. mfw it's 16x slower kek
>>
>>107436422
Here's one, but hardly official.
>>
>>107436327
playing bullet actively destroys your ability to play other time controls
>>
>>107436466
use your brain
>>
>>107436463
Yes, setting stuff up for a flow-control puzzle game :3
>>
>>107436487
>SIMD on a stack where every operation is sequential

ngmi
>>
>>107436705
cool
>>
File: file.png (118 KB, 713x896)
118 KB
118 KB PNG
finally found some time to rework my shit for this year
>>
>>107436857
why prefix year when it's already implicit from the parent dir?
>>
>>107436857
I do like src/bin/YEAR-DAY.rs

cargo run --bin YEAR-DAY input
>>
>>107436897
identifiers (so module names too) cant start with a number
>>
File: yummy.jpg (986 KB, 1882x2044)
986 KB
986 KB JPG
Getting bored of solving these in plain python. I'm thinking of switching to either c++ or forcing numpy or some other python data processing library.
What do y'all think?
>>
>>107436909
I might do that later, I'm putting my inputs in the binary, so the exe is almost 1 meg in release
>>
>>107436966
You should try Rust
>>
>>107436966
Just say you will do x meme language, then switch to python on the first minor inconvenience.
>>
>>107436966
haskell
>>
>>107436966
use uiua.
>>
>>107436966
brainfuck
>>
>>107436966
the straight man's safety language is Ada
his meme language to switch away from at the first minor inconvenience is Erlang
his meta language is OCaml
his Iverson language is J or BQN
his esoteric language is Forth or Befunge
>>
>>107437177
>the straight man's safety language is Ada
you mean Rust, right?
>>
>>107436395
>I couldn't figure out wtf people meant by moving windows
The digit has to be between one-place-after-the-previous-selected-number and last-possible-place-this-one-could-be. That's the window that must contain the digit. It slides along as you process things, hence it's a sliding window.
You can go more elaborate than that, but it's plenty adequate to solve this stuff very fast.
>>
File: 1748565627622231.png (27 KB, 193x155)
27 KB
27 KB PNG
>>107437230
>Rust
>straight
>>
>>107437302
The straight man is comfortable enough with his sexuality to support others loving whomever they will
>>
>>107437324
>support
might as well go suck balls
>>
>>107437302
yes?
you think a language named after a nocoder made famous by a simp is more straight than Rust?
>>
>>107432730
Mike Oldfield - Ommadawn
>>
>>107430443
a roll of paper
>>
File: d4.png (1.05 MB, 1200x4167)
1.05 MB
1.05 MB PNG
>>107428721
>>107430441
somewhat unoptimized simd brute for today's bigboy

single-threaded
Silver: 2023510
Gold: 5520583

Performance counter stats for './4_st ../../../inputs/4/bigboy.txt' (300 runs):

51,935,864 user_time ( +- 0.01% )
2,136,650 system_time ( +- 0.28% )
202,864,234 cycles:u ( +- 0.03% )

0.0542926 +- 0.0000430 seconds time elapsed ( +- 0.08% )


multi-threaded (4 cores)
Silver: 2023510
Gold: 5520583

Performance counter stats for './4_mt ../../../inputs/4/bigboy.txt' (300 runs):

133,025,205 user_time ( +- 0.01% )
3,785,631 system_time ( +- 0.50% )
518,441,248 cycles:u ( +- 0.07% )

0.0365575 +- 0.0000567 seconds time elapsed ( +- 0.16% )
>>
File: rape_me.png (39 KB, 619x644)
39 KB
39 KB PNG
was missing the : in the substring for like 25 minutes. the kind of win that doesnt even feel good. it feels unfair that i saw people talking about the window in here. my part 1 was completely inapplicable to this
>>
File: Day4_2025.png (329 KB, 1272x1554)
329 KB
329 KB PNG
Guys, I've been learning lisp for a few days and now I'm writing python all... weird. My linter can't even keep up with me anymore.
I feel different.
I feel... Powerful.
W-whats happening to me?
>>
>>107436966
c++, terminal/vim only
>>
File: lol.png (65 KB, 735x262)
65 KB
65 KB PNG
>solves the same problems again and again
>when presenting a new problem, uses claude
do you want have him as your coworker?
>>
>>107437666
yeah very nice ngl, problem: ur code is UNREADABLE
>>
>>107435055
did this in Lil but it's going to take me about a month to find out if it works or not due to how slow this is
on frange lo hi do lo+range hi-lo end
on rrange lo hi do extract value orderby index desc from frange[lo hi] end
on repeat n b do "%f" parse ((2*b) take "%f") format b take n end
tbl:()
each j in rrange[2 11] each i in frange[1 10] tbl[repeat[i j]]:1 end end
each j in rrange[2 6] each i in frange[10 100] tbl[repeat[i j]]:1 end end
each j in rrange[2 4] each i in frange[100 1000] tbl[repeat[i j]]:1 end end
each j in rrange[2 3] each i in frange[1000 10000] tbl[repeat[i j]]:1 end end
each i in frange[10000 100000] tbl[repeat[i 2]]:1 end
tbl:extract key orderby key asc from tbl
total:0
each r in "," split 1 take "\n" split read["input"]
lohi:"%f-%f" parse r
skip:0
each n in tbl
if skip
else
if n < lohi[0]
else
if n > lohi[1]
skip:1
else
total:total+n
end
end
end
end
end
show[total]
>>
>>107437755
never heard of Lil, it looks cool. looking forward to next month for the results
>>
>>107430911
Of course not. You would never see code this clean in a real production environment.
>>
>literally just babby's first K core peeling

Eric is more washed than my solution
>>
>>107431894
And how do you determine which cells have an @ in them and which don't there Mr smarty pants? Oh yeah, you need to iterate over everything at least once.
>>
>>107430970
So write better puzzles yourself, while remembering that these are things that shouldn't take all day to solve.
>>
>>107437729
would you rather have a co-worker who doesn't use AI and writes incorrect code?
>>
>>107438302
yes, because I can correct them. a co-worker who uses incorrect AI generated code cannot be corrected and worse, they don't have the capacity to understand why their code doesn't work
>>
>>107438302
I would rather neither of them got the job in the first place. This industry is a joke.
>>
>>107438302
Yeah. At least he knows the code he is writing, even if it is incorrect.
>>
>>107430441
$ cargo run --release
2023510
5520583
125.460975ms
>>
>>107438302
I shit you not I had a "prompt engineer" coworker who was tasked with a fix feed obfuscated/minified code into claude (he has access to the actual source) and then inlined the solution and shipped it without testing. It broke of course.
>>
>drawfag got filtered on the easiest day
oof
>>
guys
I just pooped, so nothing will distract me for tonight's problem
>>
>>107438559
he got busy with something for sure, I still believe in him
>>
>Advent of Code is already halfway over
>>
>>107431808
Here i take the first 12 digits and when i want to add another one, i just remove the lowest digits from left to right or replace the final digit with the new one, surprisingly fast. Also, I am very new to haskell and does anybody know how to properly work with 2d arrays for day 4, i can only think of an imperative solution.
>>
File: file.png (68 KB, 660x994)
68 KB
68 KB PNG
finally had some time, day 1 for now
>>
File: bwakafeastanticipation.gif (1.18 MB, 500x549)
1.18 MB
1.18 MB GIF
holy guacamoley through a series of events I might actually be awake for showtime today
>>
NEW THREAD
>>107439547
>>107439547
>>107439547
>>
>>107437262
oh so a x=max(dropRight(row, batteries - 1)), return [x, ...recurse(splitAfter(row, x), batteries - 1)]
?
I tried that too and that wasn't that fast...



[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.