[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / 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: tree.png (15 KB, 917x1007)
15 KB PNG
>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

22 hours and 37 minutes remain.

Previous thread: >>107570836
>>
Does this little tree still generate seethe?
>>
I guess it will be a small group this year.
It's mostly his own fault as well.
>>
>>110472931
every good thing has an end anon...
>>
/aocg/ memes ranked by retardedness:
1. unwashed ass
2. showtime cancer music
3. FUCK
4. retards who outsourced their thinking to AI
5. retards not being able to read and then blaming eric
6. retards coming into the threads and LARPing as non-neets who are too busy getting paid 100 bucks / hour to waste their time doing AoC
7. retards claiming that you aren't filtered if you've spent more than 1 hour on a problem or if you've looked at other solutions
8. code screenshots with tranime background
9. big boys that change the rules of the problem
10. code screenshots made with carbon without disabling window controls
11. calendar
12. cniles posting their shit code with fixed sized arrays, integer overflows, etc.
13. quirky solutions (e.g. excel)
>>
>>110473254
cole seethe dial 8
>>
>>110473254
I'm glad assembly solutions never made the meme list.
>>
I'm going to practice my AI skills and let AI solve these for me
>>
i'm here lads, was worried /g/ were not doing this year
won't be here at showtime, but i'll try keep the threads active
>>
I used to plan my whole life around this event, now I don't feel like I could even bother to read the first problem, what is the point.
why have a leaderboard when people who use AI are guaranteed to be first
why care about "being filtered" when you can just ask AI for the solution
why have a discussion thread when you can just ask AI for hints
>>
>>110473537
see #4 here: >>110473254
>>
File: 1794283822924028.jpg (125 KB, 1079x1182)
125 KB JPG
this year I will NOT be filtered
I did 1-2 days in the middle/towards the end of everybody codes as warmup and I think I am ready

you better fukken deliver eric and not phone it in
>>
File: 1746997950500313m.jpg (87 KB, 1024x859)
87 KB JPG
I’m ready.
>>
I never did this thing. Would it make sense to try this in go, or should I go with languages that has a lot of features already built in like, ts, c# or python
>>
>>110473932
do every day in one of the languages you know
>>
oh shit I forgot this was tonight
>>
>>110473537
Filtered.
>>
I might do it in HolyC
>>
Anon #224303 here, do we want to use the same leaderboard as last year? Was a little surprised to see it in the OP but I guess it was just copied and pasted.
I'm unsure if I will be able to participate this year, but I will still be following the threads and can manage the leaderboard if people want to reuse it. If the consensus is that a new leaderboard is better, that's fine too.
>>
>>110474173
see #13 here: >>110473254
>>
>>110474194
Thanks. I'll do nothing then.
Time for a nap anyways
>>
>>110474189
so you too went ahead and got yourself a life huh
wow
>>
>>110472165
I mean to be fair, the shape wasn't well defined. Without an LLM it is hard to know if the shape is specifically a tree.
thankfully highly ordered clusters only showed up on valid input, so it really wasn't that hard in practice.
>>
>>110474236
If only. Recovering from a major arm injury, makes programming difficult but I'll see how things go.
>>
>>110473537
because culture. leaderboard shit is dead, sure, but you can still hack at the problems and have fun.
>>
claude solve all the pointless jeetcode for me so I can back to day trading
>>
>>110474361
>he doesn't use Claude to day-trade
snailcat af.
>>
>>110474361
see #4 here: >>110473254
>>
>>110474341
get well soon anon
>>
>>110473254
you forgot monads
>>
kinda want to try Lua this time but i know i won't feel like reimplementing all string bullshittery Eric will inevitably cook
>>
I'm ready but it's gonna be difficult. I basically haven't coded anything in a year thanks to AI
>>
AI fags will ruin the general... Huh?
>>
>>110473254
>no idiomatic rust tranny (confirmed actual tranny)
are you the rust tranny?
>>
>>110472975
isn't it a good thing that it's smaller and less overran by retarded nocoder cloutseekers?
>yes, mudajeept, claude can solve these problems in two seconds. very cool. now run along, run along.
it's like leetcode, there are some fine problems on there but it's become such a meme that it's barely worth doing anymore.
>>
>>110475801
dunno man we'll see
I don't remember a year where retards didn't outnumbered the rest though
>>
>>110475794
his solutions work though, so at best, it could fit #13.
>>
Lmaoooo breh advent of "code" is so easy. Just copy and paste into Claude and get the answer breh lmao
>>
>>110475971
Lmaoooo breh crosswords are so easy. Just look at the answers on the next page breh lmao
>>
>>110475300
What about monads? They're good.
>>
>>110476061
Lmao nigga what kinda GRAMPS does crossword puzzles? How that apple sauce taste this morning lmao!
>>
>>110476195
As a large language model, I don't have a grandmother, taste buds, or the ability to consume apple sauce — so I can't personally confirm the organoleptic qualities of this morning's condiment.
>>
>>110474281
>Without an LLM it is hard to know
I'm not biting that bait.
>>
>>110476195
Filtered by a crossword.
>>
>>110472092
I'm surprised this competition hasn't been destroyed by AI. Nobody has to solve anything anymore.
>>
>>110472092
is this the ywnbaw tree or was that a later year?
>>
File: file.png (48 KB, 1200x1200)
48 KB PNG
I'm stoked.
>>
>>110476293
It's a white man's thing, you wouldn't understand. Eric removed the global leader board starting this year, so you won't even generate "izzat", or whatever retarded metric governs your life, by cheating.
>>
>>110476320
i love you, drawanon, i hope you've had a good year. may this be another beautiful few weeks of minimalist portraits of busty elf girls
>>
File: Art.png (1.42 MB, 1536x1024)
1.42 MB PNG
>>110476320
>Steals your art in real time.
>>
File: 1765277527530403.png (1.98 MB, 1248x832)
1.98 MB PNG
>>110476320
>>
>>110473254
Are Excel solutions that quirky? I did 2 days in Excel last year.
>>110476293
The hype has certainly gone down, in earlier years you'd have countdown threads from early November itself. Anons here will participate in fair numbers, but outside /g/ the anticipation this year is virtually zero.
>>
>>110476320
why does the orb have a butthole?
>>
How long until Eric just vibe codes the entire challenge instead of spending all of his free time making puzzles?
>>
>>110476436
two years ago
>>
>>110476320
>>110476351
these aren't AI slop... right?
>>
File: AdventOfCode.png (2.6 MB, 1254x1254)
2.6 MB PNG
The slop must flow.
>>
sandbox and utils: setup. no llm slop here.
my body is ready
>>
File: 1782839071996377.png (2.23 MB, 1248x832)
2.23 MB PNG
>>
are there only 12 this year as well?
>>
>>110476598
Yup. The HTML layout tells me there are only 12 <span> tags.
>>
>>110476711
ya, I counted them too. hmm. we'll see I guess.
>>
>>110476576
Just notepad for me. Yeah, I use notepad. Just notepad and a compiler for me. None of that pussy shit like syntax highlighting and auto complete. Just notepad, and delete the makefiles too will ya? Could you delete the build files and leave me with some compiler flags? No frills here. None of that sissy woke tranny democrat shit.
>>
>>110476778
wow, based.
>>
File: nun fuckin idiot.png (346 KB, 677x858)
346 KB PNG
>>110473254
I'm gonna do at least three of these.
>>
>>110473254
You are just a newfag who doesn't even get half of these.
>>
File: aoc-2021.jpg (1.49 MB, 5306x2898)
1.49 MB JPG
is he just doing 12 again this year? or do we get the full advent season?
stoked but i do miss the earlier years
this captcha is cursed btw fuck
>>
>>110476462
You can tell they are because they're completely soulless.
>>
Hey /g/!
I haven't been to this godforsaken place since the last Advent of Code. What did I miss?
>>
>>110477511
hmm... fair.
>>
>>110477672
Few more eggs have hatched, we've moved into a discord instead of this thread
>>
>>110477710
>we've moved into a discord
Why would you go on the Internet and just tell lies?
>>
File: vga_capture.png (8 KB, 622x151)
8 KB PNG
Merry Christmas, guys! Wouldn't miss being back here for anything.

Here's to the first truly post-coding-industry advent of code! Crazy times.
>>
>>110477672
captcha is fucking annoying
btw does anyone know if he's just doing 12 days again?
>>
>>110477831
answering myself i think so
https://adventofcode.com/2026/about#faq_num_days
>>
I haven't decided upon a language for this year yet. Already did C, Rust, and Haskell. Maybe I will finally do AMD64 assembly.
>>
>>110477710
Discord tranny groomers win again
>>
>was planning to learn jai during AOC this year
>still not out
A CURSE BE UPON YOU JON
>>
File: aoc.png (35 KB, 260x714)
35 KB PNG
>>110477831
It's just 12 days.

... and this is the 12th year. [timemovestoofastpepe.tiff.jpeg.png]
>>
>>110477886
Jai.... Hind?
>>
>>110476320
No way elf drawanon is here?!
Christmas will be saved
>>
>>110476320
Boobs not big enough.
>>
damn, for some reason I'm not hyped this year.. I think AI made me dislike coding?
>>
>>110478991
Just treat this as crossword puzzles.
>>
>>110478999
I guess it can be a test to see if I still remember how to code without AI.
>>
Man this general is so dead
I'll still do the challenge this year, let's stick together during these hard times.
I sure hope the few of you that remain here aren't AI bots
>>
>>110479109
We're still far away from showtime...
>>
>>110478991
Code first, and have AI review your solution.
>>
>>110477428
only twelve, use inspect element on the calendar and look at the height of each span: double that of 15-24 (25 days), and the same as 25 (12 days)
>>
>>110472092
>You are already a member of that private leaderboard.
uhhhhh which one is it?
>>
>>110479319
(anonymous user #224303)
>>
>>110479292
FAQ says it explicitly, no need to resort to this autism
>>
>>110479373
>verifying things is autism
I wouldn't be caught dead reading a FAQ. Inshallah the season will end when it does, and continue when it does. Each day can be approached without foreknowledge.
>>
>>110479423
>Inshallah
By participating in Advent of Code, you denounce the Quran and accept Jesus Christ as your Lord and savior. Christ is King.
>>
File: AOC.png (2.59 MB, 1254x1254)
2.59 MB PNG
>>110476591
Sometimes the slop is good.
>>
>>110479470
now make the elf extremely overweight
>>
>>110472092
this thread should be renamed look what santa claude brought me
>>
>>110479470
>P = NP + AI
kek
>>
Can AI make fun programming puzzles yet?
>>
>>110480135
The Great Christmas Light Synchronization Puzzle

(Difficulty: 5/10) (Programming · Algorithms · Logic)
The Story

It's Christmas Eve, and Santa's workshop is having a little technical difficulty!

The Christmas lights across the North Pole are controlled by a magical system. Each string of lights has a timer that determines when it turns on and off.

Unfortunately, the timers are all out of sync, and Santa needs your help figuring out when all the lights will be ON at the same time.

Each light string follows this pattern:

It turns ON at time 0.
It stays ON for a certain number of seconds.
It turns OFF for a certain number of seconds.
It repeats this cycle forever.

Your job is to find the first time after time 0 when every string of lights is ON simultaneously.
The Challenge

You're given a list of light strings. Each string has:

on: How many seconds the lights stay ON.
off: How many seconds the lights stay OFF.

For example:
python
lights = [
{"on": 3, "off": 2},
{"on": 4, "off": 3},
{"on": 2, "off": 4}
]


This means:
Light string ON OFF Total cycle
1 3 sec 2 sec 5 sec
2 4 sec 3 sec 7 sec
3 2 sec 4 sec 6 sec
Your task

Write a function:
python
def find_synchronized_time(lights):
pass

It should return the earliest positive integer time when all light strings are ON simultaneously.

If they never synchronize, return -1.
Example walkthrough

For the example above:

Light 1 is ON during: 0–3, 5–8, 10–13, ...
Light 2 is ON during: 0–4, 7–11, 14–18, ...
Light 3 is ON during: 0–2, 6–8, 12–14, ...

The first time after zero when all three are ON is 7?

Wait! At time 7:

Light 1: ON
Light 2: ON
Light 3: ON

(Expected output: 7)
>>
>>110480167
Rules

All timings are positive integers.
Every light starts ON at time 0.
You must find a time strictly greater than 0.
Your solution should work for any number of light strings.
Aim for an efficient solution, not just checking every second forever.

Test cases to try
python
# Test 1
lights = [
{"on": 2, "off": 2},
{"on": 3, "off": 1}
]
# Expected: ?

# Test 2
lights = [
{"on": 5, "off": 5},
{"on": 5, "off": 5}
]
# Expected: ?

# Test 3
lights = [
{"on": 1, "off": 1},
{"on": 1, "off": 2},
{"on": 1, "off": 3}
]
# Expected: ?

Bonus challenge

Can you solve it with a time complexity better than brute force?

Think about:

Repeating cycles
Modular arithmetic
How to detect when synchronization is impossible

Santa's challenge: Try solving it without looking up the solution. Once you've got your implementation, send me your code and I'll review it, test edge cases, and give you feedback like a programming interviewer!
>>
>>110480167
my input?
>>
File: P = NP + AI.png (7 KB, 810x59)
7 KB PNG
>>110480182
Sorry, I got picrel and then when I tried to ask for input it redirected me to a weird error page. I guess some things are better left to the pros.
>>
>>110480182
This time, Santa has 12 independent strings of Christmas lights, each operating on a different ON/OFF cycle.

Your mission is to find the earliest positive integer time when ALL 12 light strings are ON simultaneously.
Your puzzle input

Here's your input. No hints about the answer just yet!
python
lights = [
{"on": 7, "off": 5},
{"on": 9, "off": 8},
{"on": 6, "off": 11},
{"on": 13, "off": 7},
{"on": 8, "off": 9},
{"on": 11, "off": 6},
{"on": 5, "off": 13},
{"on": 10, "off": 12},
{"on": 14, "off": 5},
{"on": 7, "off": 16},
{"on": 12, "off": 11},
{"on": 9, "off": 14}
]
>>
File: 1777175663766683.png (32 KB, 456x740)
32 KB PNG
>>110480167
is this CRT?
>>
>>110480269
def find_synchronized_time(lights):
return 1
>>
>>110480269
Part 2
lights = [
{"on": 997, "off": 1009},
{"on": 991, "off": 1013},
{"on": 983, "off": 1021},
{"on": 977, "off": 1031},
{"on": 971, "off": 1033},
{"on": 967, "off": 1039},
{"on": 953, "off": 1049},
{"on": 947, "off": 1051},
{"on": 941, "off": 1061},
{"on": 937, "off": 1063},
{"on": 929, "off": 1069},
{"on": 919, "off": 1087},
{"on": 911, "off": 1091},
{"on": 907, "off": 1093},
{"on": 887, "off": 1097},
{"on": 881, "off": 1103},
{"on": 877, "off": 1109},
{"on": 863, "off": 1117},
{"on": 859, "off": 1123},
{"on": 853, "off": 1129},
{"on": 839, "off": 1151},
{"on": 829, "off": 1153},
{"on": 827, "off": 1163},
{"on": 823, "off": 1171},
{"on": 821, "off": 1181},
{"on": 811, "off": 1187},
{"on": 809, "off": 1193},
{"on": 797, "off": 1201},
{"on": 787, "off": 1213},
{"on": 773, "off": 1217}
]
>>
>>110480287
kek, the problem should probably ask for the second time
>>
>>110480287
> Bold strategy. Very efficient. Very suspicious.
then it goes on for a bit about time and space complexity
> For this particular input, it happens to return 1 because every ON duration is greater than 1.
> Technically passes this test!
> But let's make the next test harder:
>> lights = [
>> {"on": 1, "off": 1000000},
>> {"on": 1, "off": 1000001},
>> {"on": 1, "off": 1000002}
>> ]
> Your implementation still returns 1, which is actually correct here too.
> You're getting suspiciously lucky.
> Verdict: I won't give you a failing test just yet. Your next task is to explain why your function is guaranteed to work for every possible valid input.
I'll see if the chatbot can fix the puzzle.
>>
>>110480135
apparently not lol
>>
OK I asked it to try really hard and not make any mistakes so here's the revised puzzle for Day 0:

Find the earliest positive integer time when ALL lights are OFF simultaneously.

I've deliberately made the first approachable with some clever modular arithmetic, and the second a serious algorithmic challenge.
Puzzle 1: The Christmas Eve Challenge
Difficulty: 5/10

Objective: Find the earliest positive integer time when all 8 light strings are OFF.
python
lights_easy = [
{"on": 4, "off": 3},
{"on": 5, "off": 4},
{"on": 3, "off": 5},
{"on": 6, "off": 4},
{"on": 2, "off": 7},
{"on": 5, "off": 6},
{"on": 4, "off": 5},
{"on": 7, "off": 3}
]


Your task: Return the earliest positive integer when all 8 lights are OFF.
Puzzle 2: Santa's Algorithmic Nightmare
Difficulty: 10/10

Objective: Find the earliest positive integer time when all 30 light strings are OFF.
python
lights_hard = [
{"on": 10007, "off": 10009},
{"on": 10037, "off": 10039},
{"on": 10061, "off": 10067},
{"on": 10069, "off": 10079},
{"on": 10091, "off": 10093},
{"on": 10099, "off": 10103},
{"on": 10111, "off": 10133},
{"on": 10139, "off": 10141},
{"on": 10151, "off": 10159},
{"on": 10163, "off": 10169},
{"on": 10177, "off": 10181},
{"on": 10193, "off": 10211},
{"on": 10223, "off": 10243},
{"on": 10247, "off": 10253},
{"on": 10259, "off": 10267},
{"on": 10271, "off": 10273},
{"on": 10289, "off": 10301},
{"on": 10303, "off": 10313},
{"on": 10321, "off": 10331},
{"on": 10333, "off": 10337},
{"on": 10343, "off": 10357},
{"on": 10369, "off": 10391},
{"on": 10399, "off": 10427},
{"on": 10429, "off": 10433},
{"on": 10453, "off": 10457},
{"on": 10459, "off": 10463},
{"on": 10477, "off": 10487},
{"on": 10499, "off": 10501},
{"on": 10513, "off": 10529},
{"on": 10531, "off": 10559}
]


I will not be engaging further.
>>
last year demoralized me to the point where im not going to do them at midnight (plus im on morning shifts). I was showtime poster last time btw so someone else has to do that.

not to start the year with doompost whining but eric really should have wrapped this up on a relativevhigh note with the 10 year anniversary
>>
>>110480391
159, 10531?
>>
ERIC ACCIDENTALLY RELEASED IT EARLY
https://adventofcode.com/day/1
>>
>>110480453
maybe +1 on both solutions
p2 is still fucked, in your input all the lights turn on for roughly the same amount of time, so they they all turn off shortly after. it takes longer for them to turn off than for any of them turn on again so it's trivial to broot.
>>
>>110480457
he doesn't even know what year it is!
AoC is truly dead
>>
File: 1773206948989670.gif (502 KB, 302x270)
502 KB GIF
no nooooo i'm not prepared
>>
we doing this again?
>>
https://www.youtube.com/watch?v=8QG7CEuUqMc
>>
Fuck, I've got to shit.
>>
File: go-time.gif (451 KB, 544x384)
451 KB GIF
https://files.catbox.moe/tuevnx.mp4

It's go time you shinjis!!
>>
>>110479470
+ ai gets me every time
>>
hey guys remember 8 years ago, what if we did all the shit from those threads but worse, that would be funny i think
>>
Back in September I was thinking about trying a new language for AoC this year, but I just realized over the weekend that it's already here, so I guess I'm just going to do it in Elixir again.

Honestly my heart isn't really in it since everything is getting worse and love and sincerity are dead, but maybe hearing cancer music will stir my Christmas spirit.
>>
>>110480654
advent of going through the motions. Even Eric is getting in on the fun
>>
File: 1704088953458906.jpg (4 KB, 232x217)
4 KB JPG
GET IN HERE
>>
File: 1725560434657427.jpg (254 KB, 929x1300)
254 KB JPG
where get bigboys this year?
>>
My low AoC++ tier only gives me a twenty minute headstart perk, and no spoilers but guys, I'm starting to think this might be the hardest AoC year ever. This is a brutal Day 1 problem.
>>
so it's only 12 days again? nigga it's over
>>
>>110480686
everybody codes exists
>>
File: 1786597902054631.png (4 KB, 438x22)
4 KB PNG
I"M READY TO PARSE
>>
>>110480700
it doesn't have the right aura
>>
don't worry guys this year will finally be intcode 2 and advent of code will be completely redeemed
>>
red five standing by
>>
>every year the early threads are full of "i'm going to do AoC in x language this year"
>by week two it's like 99% python people, maybe a few people doing it in rust or julia
>>
>>110480709
eric will have us construct an LLM over the days instead
>>
>>110480705
wrong
>>
10 MINUTES
>>
>>110480700
it sucks
>>
>>110480714
doing it in another language is no longer a flex - hey claude, convert to rust plzkthx
>>
>>110480714
good news, there are only 2 weeks now!
>>
>>110480721
it's actually better. Also the GridOS event starts immediately after aoc.
>>
>>110480714
doing a memelang might be the only thing that will keep me engaged this year. I'm not going to pick one in the next 5 minutes though
>>
>>110480734
>3 parts
>input changes between parts
nah
>>
>>110480734
Ohhh even more puzzles? I'm looking forward to it.
>t. all ducks and all stars
>>
>>110480737
yeah input changing is super gay. gayer than the ducks
>>
>>110480737
sounds like you are lacking
>>
>>110480735
I'll do day 1 in JQ
wish me luck niggas
>>
File: v.jpg (90 KB, 1100x1007)
90 KB JPG
just woke up. is everyone just vibecoding this now?
>>
if day 1 is sum a list, it's soulless
if day 1 involves a grid, it's soulful
>>
File: showtime.jpg (86 KB, 640x480)
86 KB JPG
https://www.youtube.com/watch?v=IMF1HRiBC7Q
>>
>>110480752
cancer music
>>
>>110480750
has day 1 ever been good
the earliest good day I remember is twone
>>
>>110480709
Fuuuuuck, intcode 2 would redeem this entire dogshit year for me
>>
>>110480757
i cant name a puzzle from last year.
>>
>>110480709
>>110480761
even if we got intcode 2 it would be way too easy and no interesting operations
>day 1 part 1: this is the ADD operation
>day 1 part 2: this is the SUBTRACT operation
>day 2 part 1: this is the MULTIPLY operation
>day 2 part 2: this is the DIVIDE operation
>>
>>110480764
day 10 was fine
>>
>>110480764
I remember hating the last one
>>
I NEED TO SHIT
>>
The Great Filter
>>
>>110480769
day 24 was such a disappointment I forgot the rest of the days
>>
File: 1555841259522.jpg (40 KB, 800x450)
40 KB JPG
ok lets go
>>
File: mokou-showtime.jpg (130 KB, 440x518)
130 KB JPG
>>
>>110480779
retard
>>
FUCK
>>
FUCK
>>
THIS IS TOO HARD
I'M FILTERED
>>
they move like computer game heroeFUCK
>>
FUCK
>>
FUCK
>>
part 1: sort input|uniq -c|sort -n|tail
part 2: sort input|uniq -c|sort -n|head
>>
>mathletsBTFO with silver star
you doing OK pal?
>>
File: 1769099041394049.png (40 KB, 1209x195)
40 KB PNG
THAT'S IT?
I HAVE TO WAIT ANOTHER 23 HOURS AND 57 MINUTES FOR THE NEXT ONE?
>>
it's so easy that /g/ has just thrown down the towel and stalked off
if Eric doesn't care, why should we?
I get it
>>
FUCK

I’M SO HAPPY TO BE BACK WITH YOU ALL MERRY CHRISTMAS AAAAAHHH
>>
i-it'll get harder by day 7
right guys
>>
File: file.png (10 KB, 509x111)
10 KB PNG
>>110480800
Looks like the site's having trouble keeping up, I (different anon) haven't shown up on the leaderboard at all yet.
>>
>gold is silver in reverse
lame
>>
>>110480808
i thought it was over last year, but doomposting isnt even fun anymore.

I think...... im done......
>>
File: 1.png (109 KB, 2177x686)
109 KB PNG
idiomatic Rust solution
>>
>>110480822
>anons already filtered by day 1
Uh oh it's not looking good
>>
prune everyone who's not done inside 10 minutes
>>
data = map(int, open("Day 01 input.txt", "r").read().strip().split("\n"))

from collections import Counter
counts = Counter(data)
res = sorted(counts, reverse=True, key=lambda x:counts[x])
print res[0]*res[1]*res[2]
print res[-1]*res[-2]*res[-3]

import solution
Couldn't remember if Counter returned the sorted answer so I just sorted it anyway
>>
i vibecoded it. anyone else do this?
>>
File: day1.png (30 KB, 862x301)
30 KB PNG
>>110480800
Kek.
>>
There's a mother fucking train.
>>
>>110480845
no, I deliberately didn't use any AI to see if I remembered how to code. It was kinda hard.
>>
File: 1766081813845795.png (60 KB, 1520x484)
60 KB PNG
gotta say, I am getting the comfy vibes from the calendar graphics
>>
File: d01_021330.png (79 KB, 960x1082)
79 KB PNG
Is it a solution to be proud of? No.
Does it get me two stars? Yes.
>>
i skipped the story, what's the deal this year
>>
Claude, summarize the story. Make no mistakes.
>>
>>110480767
It doesn't matter man I just love implementing instruction sets. Seriously though I think Eric was possessed by the holy spirit when he made the intcode breakout problem, I could never hate him after that because it's so fucking cool and fun. I put a junior engineer onto the intcode problems a few years ago and he came in every day yammering about them, it legitimately brings a tear to my eye thinking about it. FUUUCK I love AoC and /aocg/ and (You) anon.
>>
>>110480864
there's a train
that's the story
>>
>>110480864
The cargo planes have been grounded, so we have to use trains to get supplies to make christmas presents. However the train and the rail system are old, dusty, unmaintained and not documented.
>>
can a train save the sovl of aoc? tune in next time to find out
>>
File: day1.png (3.11 MB, 1254x1254)
3.11 MB PNG
>>110480864
Since we're in the age of slop, I let AI create the scene from the problem text.
>>
I'm not even anti AI but can I say I miss the calendars before AI.

wait is that one drawanon here to save us again or is our skeleton crew even fewer this go around.
>>
File: 1771315711783177.png (26 KB, 700x312)
26 KB PNG
>>
>>110480892
Draw anon posted above.
>>
>>110480885
Somehow it still looks like every "genarate a picture of me" image.
>>
>>110480894
>import solution
you didn't solve it
>>
>>110480896
thank Christ.

Ill spend work tomorrow thinking of a fun lang or visualizations or something to do to try and help save this sorry thread
>>
Calendar image
>>
>>110480885
you should kill yourself
>>
>spent 10+ minutes fucking up basic C string parsing
I may be retarded.
>>
File: fuckwebp.jpg (41 KB, 700x700)
41 KB JPG
bigboy #1
url: https://files.catbox.moe/mxtzl9.7z
lines: 17044061
silver: 57068430797700
gold: 941654718771813
>>
>>110480908
sicko mode
>>
File: 1778292088323547.png (2.18 MB, 1672x941)
2.18 MB PNG
>>110480885
>>110480892
>>110480917
that's the problem, it's no longer special if any idiot with a chatgpt account can make the same thing. we need drawanon to save us
>>
idiomatic javascript
let arr = [];
let idx = {};
data.split('\r\n').map(x => parseInt(x)).forEach(x => {
if (idx[x] === undefined) {
idx[x] = arr.length;
arr.push([ x, 0 ]);
}
arr[idx[x]][1] += 1;
});
arr = arr.sort((a, b) => b[1] - a[1]).map(x => parseInt(x[0]));
let p1 = arr.slice(0, 3).reduce((a, b) => a * b);
let p2 = arr.slice(-3).reduce((a, b) => a * b);
console.log(p1, p2);
>>
File: day1.png (2.38 MB, 1536x1024)
2.38 MB PNG
>>110480917
Instead I'll send you more art.
>>
File: Mfw using Python.jpg (136 KB, 1080x1080)
136 KB JPG
idiotic javascript
console.log(Object.entries(require('fs').readFileSync('d1.txt', 'utf8').trim().split`\n`.map((e, _, c)=>c[e]=-~c[e])).sort(([_, a], [__, b]) => b - a).slice(-3).reduce((a, [n, _]) => a * n, 1))
>>
>>110480930
>trivial O(n) solution
>>
File: full23.png (69 KB, 714x574)
69 KB PNG
>method chaining
>>
>>110480907
oh I have a pretty fun gimmick i can do actually, i might lag behind a few days though (especially the weekend as i will be doing something in real life).ill do it on an ESP32 and try to make some cool visulaizations or something.

If its as easy as last year (5 years) i will have no problems, except for the import z3 day maybe.
>>
>>110480945
Actually, there is an O(1) solution.
print("57068430797700")
print("941654718771813")
>>
File: images.jpg (26 KB, 638x480)
26 KB JPG
>>110480949
>he uses newlines
>>
>>110480957
O(1+AI) sir.
>>
File: aoc01.png (143 KB, 1280x1326)
143 KB PNG
>lost a few minutes because I badly assumed there would be 6 items so that I could just maxval 4,5,6 for part 2
ok that one is on me

I dont feel like doing this one properly it feels like a rehash of so many previous days
>>
>>110480962
i can't put a comment between two methods
>>
>sort this list of ids
holy fuck aoc is dead
>>
>>110480930
3.94s and 903.1 MB max RSS with o(h no)caml
let p1, p2 =
let a = Array.init 17044062 (fun i -> (i, 0)) in
let rec slurp () =
let i = read_int () in
a.(i) <- (i, 1 + Pair.snd a.(i));
slurp ()
in
try slurp ()
with End_of_file ->
let counts =
a
|> Array.fold_left
(fun acc (i, n) -> if n = 0 then acc else (i, n) :: acc)
[]
|> List.sort (fun (_, a) (_, b) -> Int.compare a b)
|> List.map Pair.fst
in
( counts |> List.rev |> List.take 3 |> List.fold_left ( * ) 1,
counts |> List.take 3 |> List.fold_left ( * ) 1 )

let () = Printf.printf "part1: %d\npart2: %d\n" p1 p2
>>
>>110480744
I have
>>
File: 1770567408409166.png (202 KB, 980x1588)
202 KB PNG
couldn't be assed to optimize, just sorted muh lists and multiplied the numbers since I had a hunch part 2 was going to be what it was (actually thought it would want counts for all the numbers, but whatever)
>>
>>110480982
we have just been chasing the high of the goblin rpg, folding our paper cubes, and elephant valves for the better part of a decade. its been over for a long time, and that's alright. It is time to give up (like Eric)
>>
File: day1.png (121 KB, 1398x956)
121 KB PNG
$ mix aoc.solve -r input/real -y 2026 -d 1 -p b --bench 1
506810304
60660620

Ran in 3.05ms


Solving the captcha drunk was harder than the problem tbqh desu senpai.
>>
>>110480934
>we need drawanon to save us
So what you're saying is, AI has actually made real art even more especially prized.
>>
File: 1a.png (39 KB, 1200x1200)
39 KB PNG
We gotta oversee the thingamabob.
>>
So what am I supposed to do until tomorrow?
>>
>>110481000
>triple 0
just a small glimpse of how over it really is.
>>
File: file.png (23 KB, 807x259)
23 KB PNG
>>
>>110480979
dead(). /** nigger */ storage()
>>
I forgot how to access a sorted dict so I just printed it sorted and then manually multiplied the beginning and end
>>
>>110480982
I was going to tell you this is normal for day 1, but I had to go back to 2018 to find a day 1 puzzle of similar difficulty. Point consneeded, damn.
>>
File: 1b.png (40 KB, 1200x1200)
40 KB PNG
>>110481009
>>
>>110481009
if you quit at any point i am leaving forever btw.
>>
>>110481000
trips of trvke. it's hard to let go. I do soulless programming at my job and this was always my fun outlet.
>>
>>110481009
>>110481020
finally, the reason to keep doing this has arrived
>>
File: file.png (24 KB, 800x190)
24 KB PNG
>>110481018
I did this too and then fixed it later
>>
>>110481013
>DID YOU SEE A SIGN IN THE FRONT OF MY HOUSE THAT SAID
>>
>>110481009
>>110481020
nice!
>>
>>110481010
Refresh the catalog, and review Pick's theorem.
>>
>>110480982
name 1 "day 1" that has been interesting
>>
>>110481028
yeah and I couldn't google it because I didn't want the AI search results to just tell me the answer
>>
>>110481019
charitably, the problem is constructed only so that it takes longer to write any program, even to ask AI to write any program, than to just >>110480796
the deep reddit-impressing message is that sometimes you don't need a program
>>
>>110481018
i spent 5 minutes doing this and felt like a dumb retard (which i am)

In my defense i haven't programmed since basically last year.
>>
File: 1782093650159275.png (1.57 MB, 1248x832)
1.57 MB PNG
>>
>>110481009
>>110481020
Hell yeah
>>
File: sel202612 1 04418.jpg (158 KB, 1884x684)
158 KB JPG
I was gonna do golang but thought about sort and god the first one in a shell one liner...
>>
>>110481009
SOVL
>>
>>110481041
Last year actually. It was the problem with the rotating dials and counting zero crossings. Part 2 was slightly more intricate than the typical day 1.
>>
>>110480982
We once had a day one that was sum this list of numbers.
>>
>>110481041
twone got me (or was that day 2)
>>
So did the people who make coding competitions their entire life just all kill themselves. AI destroying things like the leaderboard here has to be devastating
>>
>>110481062
not exactly the same, but have you seen terry tao's posts lately? he's having a hard time
>>
>>110481041
2025 day 1 part 2 had some really nasty edge cases
>>
>>110480982
>wtf day 1 so boring
larp larp larp sahur
>>
>>110481041
there was that one day 1 problem where spells could be arranged in an NxN square and you had to find how many extra pinecones you needed and then part 2 was if the square was hollow on the inside
>>
>>110480929
i usually get more annoyed at parsing input on these than anything else desu
>>
File: tao.png (347 KB, 425x493)
347 KB PNG
>>110481068
his voice is even different in interviews, he seems shaky and on edge. he got btfo hard by claude the other day
>>
File: aoc-2026-01.png (236 KB, 692x514)
236 KB PNG
sup nerds! y'all int maxxing?
>>
>>110481093
I already hate reading a single PR with claude commit notes.
imagine getting asked to read a slop proof that's longer than all human mathematical proofs ever.
>>
File: carbon.png (521 KB, 1650x3222)
521 KB PNG
naive c implementation, actually like this better than my shitty rushed c++ version i used to actually get my answers
>>
>>110481106
>MAX_SIZE
everytime, see #12 >>110473254
>>
>>110481109
worked on my input, whats the problem here
>>
>>110481068
There's also plenty of mathematicians who welcome AI because it speeds up the path to results. It's like complaining about calculators because you preferred to have assistants slowly add up numbers by hand. Also, only those who care about mathematics are going to bother to conduct such investigations, the average goy is just going to use Claude to lookup sports news.
>>
>>110481099
It's 2026, we're all leaning out, fat boy.

https://en.wikipedia.org/wiki/Lean_(proof_assistant)
>>
>>110481109
remove the ranting about anime from your meme list pls
I wordfilter it because tourists post it all the time shitting up threads
>>
>>110481133
no, tranime is the worst
>>
>>110481099
>reading PRs
that's claude's job now, i haven't personally looked at a PR in months
>>
File: bdjdjdjrjdjjdjd.png (71 KB, 1066x451)
71 KB PNG
easy day today
>>
yo someone made this
https://adventofpuzzles.io
>>
>>110481154
>claude made this
ok, so?
>>
>>110481154
Enjoyed this, and it was nice having 10 to do. Looking forward to the later ones if they get difficult.
>>
>>110481130
you should be coqing out but the cucks changed the name of the language.

AI gets away with codegen because it's becoming like machine code with nobody even caring about the details and only occasionally peeking at it through a debugger.
But for math, the slop proof is only useful as an oracle that tells you what the final boolean is. Math is still not advanced.
>>
premonition:
on one of the later days, eric will give us an NP-hard problem that's only solvable because the input given is trivial. a few hours after the problem releases, the rumors that P = NP + AI will be revealed as true. /aocg/ memes that someone was filtered hard enough that they had to get claude to solve it for them, inadvertently solving P = NP.
>>
you can tell who the redditors are because they screenshot a 10 line code snippet instead of code-blocking it
>>
> You have completed Day 1! You can [Shareon Bluesky Twitter Mastodon] this victory or [Return to Your Advent Calendar].

neat.
Lets make one more from 2025
>>
>>110481217
the scripting-language code formatting gets confused by non-string uses of '
>>
>>110481217
nice try claude but if you want to scrape our solutions you have to do the ocr
>>
>>110480453
>>110480492
That's right!
Congratulations, you time your cyberattack at just the right moment when all the lights are off! The datacenter shuts down immediately, pending writes are not completed, nothing is unmounted, Christmas is saved (or ruined, whatever)!
>>
>>110481227
>non-string uses of '
use a real language
>>
>>110481261
C++ (regrettably) and OCaml are real languages
scripting languages meanwhile are relics that no longer have a place in the world except as a proxy that only adds latency to AI agents
>>
you can tell who the nocoders are because they spout retarded bullshit instead of posting code
>>
>>110481217
Posting your code as an image has been a tradition for a few years at least.
>>
i much prefer the colors in the image posts
>>
>>110481149
I am the other guy that did shell >>110481052. I like the brace expansion wish I had thought of that.
>>
I started 30 min late but got both in 15 min.
>>
idiomatic claude
solve advent of code 2026 day 1. make no mistakes.
>>
>>110481268
yeah when reddit started coming here. i always thought it was some kind of macos text editor that people were using, but then i found out it was something called "carbon" or "graphite" or something like that which is a reddit creation
>>
>>110481280
well I guess it isn't brace expansion its a group command... Im just fucking retarded
>>
File: unsloth-ocr.png (57 KB, 901x582)
57 KB PNG
>>110481233
it's so easy it doesn't matter anymore. pic is against >>110481095
in previous years I tried to add the code with steganography so that it'd be easy to extract for local tests. Now an image is just more readable code.
>>
>>110481296
yeah I dont expect it to be a hindrance but if we are bringing the meme-protection to its conclusion it is the difference between giving it for free and making scrapers have to fetch the image and load it in
>>
my code is shit anyway, idc if it's scraped it'll just make the models dumber
>>
File: aoc-c-2026-01.png (876 KB, 658x1408)
876 KB PNG
happy aoc! please judge my c harshly I don't know what I'm doing... but i can quick sort at least.
>>
>>110481331
see >>110481109
>>
>>110481287
>knowing what reddit uses
you are free, in fact encouraged, to go back
>>
>>110481347
i'm not the one using reddit creations unless aoc is also reddit then i guess it's over
>>
File: file.png (61 KB, 774x776)
61 KB PNG
idiotmatick rust, no hashmaps
>>
>>110481353
>still discussing reddit instead of aoc
you are now required to go back
>>
>>110481294
It's okay anon, it's a long forgotten feature anyway
>>
>>110481360
nope. you are reddit. i am 4chan. i do not listen to untermensch
>>
File: washed26.01.png (19 KB, 484x1281)
19 KB PNG
I love designing interfaces around hardcoded input assumptions!
>>
File: 1785757848697140.png (49 KB, 894x228)
49 KB PNG
>>
>>110481341
>MAX_SIZE
...but the input data is all under 1000... so counts[1000] is functionally a hashmap and nums[1000] is basically a set... basically.
>>
>>110476329
/g/izzat farming is still a thing for this poo/g/eet board
>>
>>110481389
no you don't understand. your aoc code needs to be fully extendible to ALL inputs as well... stupid chud
>>
File: sad-cirno.png (67 KB, 500x365)
67 KB PNG
>>110481402
>>
if it took you longer than 30 seconds to adapt your part 1 solution for the second part, you were filtered
>>
>>110481415
you know I was close to doing a maxheap instead of just a sort. it would have taken me at least a minute to adapt desu!
>>
File: day1.png (19 KB, 1284x308)
19 KB PNG
>>110473254
>13. quirky solutions (e.g. excel)
For your consideration, kind sir.
>>
>>110481429
In a real language you just wrap your T in a newtype that reverses the order.
>>
>>110481432
based, excel was the first thing that came to mind reading the task
>>
>>110481429
Why does it take you a minute to type the - character?
>>
File: newtype-flash.gif (592 KB, 320x240)
592 KB GIF
>>110481436
>newtype
>>
>>110481331
reading the file char by char isn't super ideal since the input is split into lines.
don't roll your own string to int shit, atoi exists for a reason. same for quicksort, it exists in the stdlib for a reason.
>>
>>110481495
it is impossible to use atoi safely. this function is peak cnility.
>>
>>110481495
>don't roll your own quicksort, it exists in the stdlib for a reason.
soulless
the entire point of this was to sort so you should not just import sort if you want to solve it with a sort
>>
>>110481495
>nooooooooooo just import solution bro
>>
>>110481505
If you're going to be autistic about it, implement quickselect instead of quicksort.
>>
>>110476320
based, you saved AoC last year
>>
>>110474373
>>110474361
So far LLMs have not done better than me at financial modeling. I've been very surprised by just how bad they are at it.
>>
>>110481556
you need a soul to detect whenever jewish magic is being cast onto a stock
>>
>no visual brainfuck solution
/aocg/ is dead
>>
#include <iostream>
#include <fstream>
#include <filesystem>
#include <map>

int main()
{
std::map<int, int> idMap;
std::multimap<int, int> idMap2;
std::ifstream input("code input.txt");
std::string x{};
int minId{1}, maxId{1};

while (getline(input, x))
{
if (idMap[stoi(x)] == 0) //First enter the codes in map format, which prevents duplicates
idMap[stoi(x)] = 1;
else
idMap[stoi(x)] += 1;
}

input.close();

for (auto y : idMap)
idMap2.insert({y.second, y.first}); //Then construct a multimap using the value-key pairs of the map, which automatically sorts

int it{1};
for (auto y : idMap2) //Iterate through the multimap
{
if (it <=3)
minId *= y.second; //Find the multiplication of the three least frequent

if ((idMap2.size() - it < 3) && (idMap2.size() - it >= 0)) //And of the most frequent
maxId *= y.second;

std::cout << y.first << ": " << y.second << "\n"; //Scroll to the top to find the least frequent, to the bottom to find the most frequent if you want to calculate it manually.
++it;
}
std::cout << "Most frequent mult: " << maxId << "\nLeast frequent mult: " << minId;

return 0;
}


Yeah I dunno. I've never done one of these before and don't pretend to be good at programming.
>>
>>110481593
you do it fag
>>
>>110481062
Competitive chess didn't end just because AI can BTFO humans. Even if (you) would resort to vibrating anal beads in order to cheat.
https://www.npr.org/2023/09/26/1201734274/chess-hans-niemann-anal-beads-cheating
>>
>>110481762
Yeah but that is a physical meeting of people. Coding competitions aren't performed on organizer provided machines in a central location
>>
>>110481765
Yes they are
>>
>>110472092
what did he mean by this?
>>
File: icpc-noyabr-2022.jpg (479 KB, 1280x706)
479 KB JPG
>>110481765
Look into ICPC, serious business.
>>
>>110481785
>>110481773
good for them, sincerely. I just do this shit for fun but I felt bad for the people who had this as a major hobby and lifestyle, thinking about AI just killing it
>>
>>110481780
Filthy Frenchman.
>>
>>110481009
>>110481020
Drawanon you're our true Christmas gift <3
>>
>>110481790
>just do this shit for fun
That's the target audience for AoC, and it always has been just for fun. It'll also remain that way if you just try and solve it yourself. I don't think anyone is seriously bothered if some faggot has to cheat, there's no prize at stake. If a new programmer used AI for hints, that's actually probably helpful, and they're clearly not going to be in the running for any competitive time.
>>
>>110481794
tue-toi
>>
File: carbon.png (1.12 MB, 1500x1122)
1.12 MB PNG
Wasn't that exact problem day 1 another year ? Anyway Haskell homies rise up
>>
Less than 15k people have attempted day 1.
It is so dead this year.
>>
File: aoc-calendar-2026.png (103 KB, 6400x2400)
103 KB PNG
Here's a calendar for this year. Remember to contribute as much as you complain about how bad the contributions are.
>>
File: 1770454247517962.png (4 KB, 420x420)
4 KB PNG
>>110481960
>people
>>
>>110481960
More people got two stars on day 12 last year. But maybe everybody is just really busy and they will do it later.
>>
File: carbon.png (160 KB, 2020x542)
160 KB PNG
Why do you guys import Counter, get with the times uncs.
>>
>>110481780
behead elves, roundhouse kick elves into the concrete
>>
>>110481960
>>110481978
tuesday is not a good starting day
>>
>>110481012
>how can i learn linq and do stuff like this? i have no idea what aggregate is or where you get those names from
>>
>>110481106
This could kill 10,000,000,000 african children if n<=2
>t. retarded Rust tranny
>>
>>110481968
Nice layout, Anon. Unfortunately I can't think of a single funny image for today's empty problem.
>>
>>110481377
based
>>
>>110481109
Literally nothing wrong with that, stop sperging for no reason shitting up the thread quoting yourself.
>>
>>110482012
It may not be a good starting day, but the numbers are still horrendously low for day 1.
The numbers took a beating last year as well. Probably in two parts because of only being 12 days and the removal of the global leaderboard.
>>
File: 1769889895855.jpg (122 KB, 1024x1024)
122 KB JPG
>>110482055
we had like 300 people doing ec after 2-3 days this year

only us retards code by hand anymore
>>
>>110481119
they got to fuck the assistants, retard
>>
>>110482071
I didn't even know about it until the very end, so I decided to skip it, definitely joining it next year.
>>
>>110480930
$ time ./a.out <bigboy.txt
57068430797700
941654718771813

real 0m1.106s
user 0m1.094s
sys 0m0.012s
$
>>
File: aoc1.png (79 KB, 499x1076)
79 KB PNG
My first zig program.
>>
>>110482085
Filtered
>>
>>110472092
I didn't even know this was a thing - as a software tester who does basic automation, this shit is blowing my mind coz im a fucking retarded chud.

But seeing everyone g up and get excited has inspired me to rocky montage train in some language to compete in AOC.

What languages are people doing it in?
>hard mode rust
>>
heap because why not
#include "day01a.h"
namespace day01a
{
void main()
{
std::unordered_map<int, int> freq;
for (int i : input)
{
freq[i]++;
}
struct vs
{
int value;
int count;
bool operator<(const vs& o) const
{
return count > o.count;
}
};
std::vector<vs> heap;
for (auto& v : freq)
{
heap.emplace_back(v.first, v.second);
}
std::make_heap(heap.begin(), heap.end());
int result = 1;
for (int i = 0; i < 3; i++)
{
int next = heap.front().value;
std::pop_heap(heap.begin(), heap.end());
heap.pop_back();
result *= next;
}
__debugbreak();
}
}
>>
>>110482171
>Being this new
This is the 12th year anon.
>>
>>110481998
>roundhouse kick elves into the concrete
into the 2022 volcano
>>
>>110482177
Be gentle fren - im trynna think what would be fun to learn and bonus points to improve my coding skills maybe typescript or something like rust not too sure i feel like rust is super autistic but if you master it can make really memory efficient software
>>
110482199
bro bringing hot takes from his minecraft youtube videos
>>
File: aoc-2026-01-el.png (277 KB, 1582x1340)
277 KB PNG
Did a Python solution first this morning, this is day 1 in Emacs-Lisp (because I haven't written Emacs-Lisp in a long time and wanted to get back into it).
>>
I always feel borderline suicidal every year and then realize advent of code is happening and get so excited solving the dumb puzzles. I'm not even that great at it.

I wonder how many lives Eric Wastl has saved this way.
>>
>>110482287
I honestly feel pretty much the same, there are other things which stop me, but AoC makes a considerable contribution to me staying alive.
>>
File: 1702289120592492.png (1.37 MB, 1440x1080)
1.37 MB PNG
>>110482287
the memes and shitposting give me energy
>>
File: 1670473451989.jpg (790 KB, 1440x2223)
790 KB JPG
>>110482298
same
>>
File: wtfamireading.jpg (7 KB, 165x115)
7 KB JPG
>>110482098
>do{\
>}while(0)\
>>
>>110482308
in his infinite wisdom, dennis ritchie recognized that endless loops and booleans are bloat and as such C has neither (trannies added booleans in "modern" C)
>>
File: aoc26_1.png (38 KB, 1081x275)
38 KB PNG
I almost got filtered, I hope it doesn't get much harder than this
>>
There now it fits in a post.
//vim:  errorformat=%f:%l:%c:\\ %t%.%#:\\ %m
//set makeprg=zig\ run\ %
const std = @import("std");
const DS = std.AutoHashMap(i32, i32);
const path = "ex.txt";
//const path = "in.txt";

fn lineparser(map: *DS, line: []const u8) !void {
const k = try std.fmt.parseInt(i32, line, 10);
if(map.getPtr(k))|v| { v.* += 1;
}else { try map.put(k, 1); }
}
fn show(map: *DS, up: bool) void {
var prod: i32 = 1;
var c: i32 = 3;
while(map.count() > 0 and c > 0) : (c -=1){
var it = map.iterator();
var cur: i32 = undefined;
var low: i32 = if (up) 0 else std.math.maxInt(i32);
while (it.next()) |entry| {
if ( (up and entry.value_ptr.* > low) or
( !up and entry.value_ptr.* < low)){
low=entry.value_ptr.*;
cur=entry.key_ptr.*;
}
}
if (map.remove(cur)) {
prod=prod*cur;
std.debug.print("{}:{}\n", .{cur, low});
}else {
std.debug.print("remove failed\n", .{});
break;
}
}
std.debug.print("\n{}\n", .{prod});
}
fn show1(map: *DS) void { show(map,true); }
fn show2(map: *DS) void { show(map,false); }
pub fn main(init: std.process.Init) !void {
var buf: [4096]u8 = undefined;
const io = init.io;
const file = try std.Io.Dir.cwd().openFile(io,path, .{});
defer file.close(io);
var reader = file.reader(io,&buf);
var map = DS.init(init.gpa);
defer map.deinit();
const input = try reader.interface.allocRemaining(
init.gpa,
.limited(1024 * 1024),
);
defer init.gpa.free(input);
var lines = std.mem.splitScalar(u8, input, '\n');
while (lines.next()) |line| {
if (line.len == 0) continue;
try lineparser(&map,line);
}
var copy1 = try map.clone();
defer copy1.deinit();
show1(&copy1);
show2(&map);
}
>>
>>110482098
this is 5x faster if I replace scanf() with fread()+byte by byte progression lol
>>
I predict around 5000 people solving day 12.
>>
>>110482356
100 in the first 24 hours
>>
Where my ziggers at?
>>
>>110482368
Unless he decides to do something really hard, there is no way it will be lower than 1000, and by hard I mean really hard.
>>
>>110482329
cute!!
>>
Python + copy pasting stack overflow for my specific issues
>>
>>110482466
Might as well just use claude
>>
https://uiua.org/pad?src=0_20_0-dev_2__eJzzLc151NSs8KhtgoL-4emPOhc-6lr8qG2mMReXWlpRYrGCUmZeQWmJXklFiRLXo645j7qnPura8ahzgUNMHtej3jYuEK9rNkhK41FX06Ou5kfLdz_qWqQJl2zv4XrUsdIXbA0XAOeDOJ8=

Ezpz
>>
>>110482540
∩/× ⊃3-3 ⊏ °▽ ⊜⋕⊸≠@\n
>>
>>110481024
>job
Don't worry, that problem will solve itself as well.
>>
>>110482561
I think you fucked up the formatting somewhere but wow unkeep is very useful! What I was looking for
>>
>>110482603
I copied it from reddit
>>
sucks that manual programing is practically dead

pub fn part_1(x: String) -> String {
let counts = x
.split("\n")
.filter(|x| x.len() > 0)
.map(|x| i32::from_str_radix(x, 10).expect("not a number"))
.fold(Vec::new(), |acc: Vec<(i32, i32)>, n| {
match acc.iter().filter(|x| x.0 == n).count() {
0 => acc.iter().map(|x| x.to_owned()).chain([(n, 1)]).collect(),
_ => acc
.iter()
.map(|x| {
if x.0 == n {
(x.0, x.1 + 1)
} else {
x.to_owned()
}
})
.collect(),
}
});

let counts = lib::sort(counts.iter().map(|x| (x.1, x.0)).collect(), |a, b| {
b.0.cmp(&a.0)
});

return (counts[0].1 * counts[1].1 * counts[2].1).to_string();
}
>>
>>110482612
holy shit, literally every line is unidiomatic. did you do this on purpose?
>>
>>110482606
Why
>>
>>110482298
I'll shuffle my deck of space cards one day.
>>
>>110482624
Idk tried to make it functional and avoid loops will see if it gets too retarded I'll probably loosen the constraints
>>
>>110482612
line 1: x doesn't have to be an owned String
line 3: use a char instead of a str
line 4: would not be neccessary with str::split_terminator
line 5: str::parse exists
line 7-19: this whole match expression is completely inane. Just use Iterator::find and stop with recreating the entire Vec everytime
line 22: what the FUCK is lib::sort??????? are you somehow unaware that Rust's std has sorting functions? just use slice::sort_unstable_by_key
line 26: indexing is unidiomatic
>>
File: 1796126523463.jpg (141 KB, 767x581)
141 KB JPG
>>110482688
1. true but didnt bother
3. fair
4/5 Did not know about that
7-19 lmao i was thinking how would i do such thing in ocaml from scratch instead of rust
22 my impl of sort
26 yeah but after the the 7-19 i just wanted to finish did not bother with .take or product
>>
what the fuck, are we starting on day 17 difficulty this year? part 2 holy shit, chill
>>
File: one.png (39 KB, 1292x400)
39 KB PNG
>>
>>110482339
how'd they manage to make an uglier language than rust?
>>
Oh baker!!!
>>
File: npUejHhS.gif (273 KB, 220x220)
273 KB GIF
Raku (Perl 6):
given words.Bag.sort(-*.value)».key {
say "silver: {[*] .head(3)}";
say "gold: {[*] .tail(3)}";
}

Golfed:
say [Z×] [Z] words.Bag.sort(*.value)».key[*-3..*,^3];
>>
>>110477428
>12 again
We only got 11 puzzles last year thoughbeit.
>>
>sorter plebs
>not big dicktionaires
what even is this faggotry?
>>
>never finished 10 from last year
oh yeah
i dont remember why
>>
>>110482654
>tried to avoid loops
>look inside
>5 bazillion loops
mission failed, sir
>>
Is it just me or did AoC lose its spirit? It doesn't feel the same anymore.
>>
I'm aware of AoC but never tried it.
Should I try a new language (GOlang) or just use my existing scripting language (TS)?
Anyone else tried to brute-learn something new like this?
Also do you guys actually authenticate or just use it as an exercise for your own mental sharpness?
>>
>>110480929
May? It's a list of numbers.
>>
>>110482937
I don't think it's that bad, I'm still learning.
>>
File: 1765157720552.jpg (5 KB, 250x250)
5 KB JPG
>>110480930
Part1 : 57068430797700
Part2 : 941654718771813
________________________________________________________
Executed in 21.84 secs fish external
usr time 22.10 secs 950.00 micros 22.10 secs
sys time 1.29 secs 7.00 micros 1.29 secs
>>
File: carbon.png (386 KB, 1312x2644)
386 KB PNG
>>110481106
>naive implementation
>bunch of overengineered bs
This is the naive C implementation.
>>
>>110483273
it's only naive if you're sorting the entire histogram
>>
>>110482308
adding basic language features is bloat, just use macro hacks like a normal person
>>
>>110483273
>int table[1001]
everytime, see #12 >>110473254 (You)
>>
>>110483328
C users do be like that...
>>
>>110483328
they do know that glib exists and has a hashmap impl right?
https://docs.gtk.org/glib/struct.HashTable.html
I don't know why they suffer.
>>
emergency substitute-teacher bake in progress
>>
>>110483600
>>110483600
>>110483600
>>
File: 1796136356355.jpg (140 KB, 810x643)
140 KB JPG
>>110481355
Alr i see yeah my solutions is very retarded compared to this
t. retarded rustard



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