← Home ← Back to /g/

Thread 107096381

303 posts 126 images /g/
Anonymous No.107096381 [Report] >>107097608 >>107098191 >>107107885 >>107110227 >>107114708 >>107118632 >>107124003 >>107124023
Everybody Codes
>Everybody Codes is a free space for honing your coding skills, experimenting with ideas, and learning from others. At its heart lies the belief that programming is best when shared - whether through solving puzzles, streaming your progress, or discussing solutions.
https://everybody.codes

Advent of Code but in November.
First puzzle opens in a little less than half an hour.
Anonymous No.107096533 [Report]
I'll be playing along, but I get the feeling it's not going to have the activity of the AoC threads.
Anonymous No.107096660 [Report]
It's out
Anonymous No.107096848 [Report]
>The creator's name at the bottom of the page is a link to his LinkedIn profile
Soulless. I already have a job
Anonymous No.107096861 [Report]
It will do. The first few were never going to be overly complex.
Anonymous No.107096907 [Report] >>107097030
Spent probably ten minutes trying to debug a one-liner for the part 3 swap before giving up and just storing one of the names in a temp variable and got the right answer immediately.
Not a good sign for day 1. Still global place 66 though. How many people are participating?
Anonymous No.107097030 [Report] >>107097424
>>107096907
Looking at the stats for last year, a few thousand people got around to starting it and barely 200 managed to finish. It's a few percent of the people who do AoC.
Anonymous No.107097087 [Report]
Let's see if this can compare to AoC.. giving it a shot
Anonymous No.107097108 [Report] >>107097261
Why does this guy have to harvest my github email? ::angry::
Anonymous No.107097176 [Report] >>107098181 >>107114992 >>107115591 >>107115604 >>107115711
Rustchads rise up
Anonymous No.107097261 [Report]
>>107097108
So your data is more valuable when he sells the company. Just make a leddit account with temp mail
Anonymous No.107097313 [Report]
Oh, I didn't realize he gives you a different input for each part.
Anonymous No.107097373 [Report] >>107097438 >>107101005
I still made 100-ish place taking my sweet-ass time in a language I don't really know
Anonymous No.107097386 [Report] >>107098153
I have no idea about rust, I'll keep reading the book tomorrow and read some solutions
Anonymous No.107097424 [Report]
>>107097030
tbf I'm part of that, only heard about EC a few days ago
Anonymous No.107097438 [Report] >>107097454 >>107101005
>>107097373
What weirdass language is that
Anonymous No.107097454 [Report] >>107101005
>>107097438
f# I think
Anonymous No.107097580 [Report] >>107097598 >>107098634
>thread is 2 hours old
>multiple rustroon solutions
>not a single cnile

/g/ has changed
Anonymous No.107097598 [Report] >>107097604
>>107097580
Ya, they're probably figuring out rust is actually easy to use and just works. Same shit happened with systemd hate quieting down over a decade.
Anonymous No.107097604 [Report] >>107097767
>>107097598
What if you still have your penis though?
Anonymous No.107097608 [Report] >>107097847
>>107096381 (OP)
MORE!
BLACK!
FAT!
GAY!
WOMEN!
IN!
PROGRAMMING!
Anonymous No.107097767 [Report]
>>107097604
Keep it, the typical rust user is a huge fan of gock
Anonymous No.107097782 [Report] >>107098369
Wow these are so easy with Go.
Anonymous No.107097791 [Report] >>107098634
Not sure if I'll have time to do all of these, but here's quest1.
Anonymous No.107097823 [Report]
I guess it's ok. For some reason I find the duck stuff and the yellow and black theme cringeworthy.
Anonymous No.107097847 [Report]
>>107097608
Every body is a coding body!
Anonymous No.107098153 [Report] >>107099931
>>107097386
>`if index < 0 { true } else { false }`

Come on anon, you're better than this
Anonymous No.107098181 [Report] >>107098195
>>107097176
>parts 1 and 2 identical except for a single closure
Anonymous No.107098191 [Report]
>>107096381 (OP)
cute ducky
Anonymous No.107098195 [Report] >>107098229
>>107098181
so what?
Anonymous No.107098229 [Report] >>107098243 >>107101465
>>107098195
Unreadably bloated code. Do better next time.
Anonymous No.107098243 [Report]
>>107098229
you're afraid about like 3 extra lines in a text file?
Anonymous No.107098369 [Report]
>>107097782
>Doesn’t post code
Anonymous No.107098518 [Report]
Anonymous No.107098634 [Report]
>>107097580
They're still parsing.
>>107097791
Golfed and dark mode (for zoomers)
Anonymous No.107098991 [Report] >>107099502
Who is this guy? He's no Eric. Eric weaves eleborate joyus christmas elf tales. He's the george rr martin of our time. I don't care about ducks.
names = "Gaeraris,Thazther,Aurepyxis,Ulkzris".split(",")
inputs = [(x[0], int(x[1:])) for x in "L10,R15,L14".split(",")]
n = len(names)
i = 0
for dir, dist in inputs:
if dir == "L":
idx = (i - dist) % n
else:
idx = (i + dist) % n
names[0], names[idx] = names[idx], names[0]
print(names[0], names[idx])
Anonymous No.107099368 [Report] >>107101465 >>107115038
Anonymous No.107099502 [Report] >>107099518
>>107098991
Um sir did you do part 2 and 3?
Anonymous No.107099518 [Report]
>>107099502
I mean the code is unwash ass but that is indeed 3 my good duck.
Anonymous No.107099931 [Report]
>>107098153
Sorry, I'm kinda retarded anon. I'll try to get better
Anonymous No.107100024 [Report] >>107100034
where's the /g/derboard
Anonymous No.107100034 [Report]
>>107100024
4151e976-7b9f-4fda-bb33-fa7c70fdceea
Anonymous No.107100929 [Report]
>only 75% of people who opened the puzzle solved all three parts
is it the great filter?
Anonymous No.107101005 [Report]
>>107097373
Cleaned it up and possibly made it less readable
>>107097438
>>107097454
F# yes
Anonymous No.107101465 [Report]
>>107098229
Happy now?

bravo to >>107099368 I couldn't get part 3 to work without making the closure ugly as shit
Anonymous No.107101551 [Report]
At the end of the page there's a link that searches for reddit threads on EC:

https://www.reddit.com/r/everybodycodes/search/?q=title%3A%22%5B2025+Q1%5D+Solution+Spotlight%22

If we ask nicely will the duck guy add a /g/ link? We could standardise the thread title so a catalog search always finds it.
Anonymous No.107101583 [Report]
I am still learning Haskell so I'm sure this is dogshit but it was fun.
Anonymous No.107101832 [Report] >>107105005
https://everybody.codes/event/2024/quests/10

part 3 has me felted. I had an extremely neat solution but partially sharing between grids ruins it.
Anonymous No.107102118 [Report] >>107103287
>we have advent of code at home
Anonymous No.107103287 [Report] >>107105261
>>107102118
AoC is too easy, except a lot of anons to get filtered by part 3. Which is p concerning since we have a couple dozen entrants max.
Anonymous No.107104437 [Report] >>107104715
don't die
Anonymous No.107104715 [Report]
>>107104437
cancer music
Anonymous No.107105005 [Report] >>107105047 >>107105069 >>107105084 >>107105108
>>107101832
what's the puzzle in part 3

I did part 1 by hand, and now I don't want to write the code to do part 2
Anonymous No.107105047 [Report] >>107105087
>>107105005
swappy swap instead of moving
Anonymous No.107105069 [Report]
>>107105005
Anonymous No.107105084 [Report]
>>107105005
I cocked it up
Anonymous No.107105087 [Report] >>107105116
>>107105047
no not the one for today, that was trivial, look what I was replying to
Anonymous No.107105108 [Report]
>>107105005
surely this time I got it right
Anonymous No.107105116 [Report]
>>107105087
I'm way too lazy to do something from last year
Maybe after aoc runs out this year
Anonymous No.107105149 [Report]
ah fuck, i heard about this last week and did about half of the last one but didn't remember to get on for the new one yesterday. the top 100 leaderboard is extremely do-able if the guy in 100 took 40 minutes
Anonymous No.107105251 [Report] >>107105720 >>107105768
How common is it for part 2/part 3 to just add extra input/parsing bullshit? Got to day 7 of the 2024 challenge and got pretty annoyed by the extra shit that got added there. I'm not autistic enough to care if your puzzle input isn't exactly the same for each part, but just adding completely new shit to parse is annoying

that said, the fact that this shit drops at 5 PM for me instead of 11 PM with weekend breaks makes it better than AOC by default
Anonymous No.107105261 [Report]
>>107103287
>except a lot of anons to get filtered by part 3
you mean today's or just in general?
Anonymous No.107105297 [Report] >>107105318 >>107105479 >>107105584 >>107106301
>For every user who completes this event fully by the end of November,
Everybody Codes will donate $1 to #TeamWater

you are literally killing a poor african child if you get filtered
Anonymous No.107105318 [Report]
>>107105297
I will make sure to "get filtered" then.
Anonymous No.107105479 [Report]
>>107105297
You think if I finish I can email and ask that my $1 be withheld and not sent to africa?
Anonymous No.107105584 [Report]
>>107105297
Leave one answer blank until Dec 1st, fuck them kids
Anonymous No.107105720 [Report]
>>107105251
It's no overly common but I know there's a few. Quest 10, which was mentioned previously, for example. There's also a number of puzzles that change things around slightly or add a new kind of symbol, but if your parsing code's so brittle it can't handle that then it's a you problem,
Anonymous No.107105768 [Report] >>107107056
>>107105251
One nice feature EC has over AoC is that the leaderboard features a "local time" page. Here you can compare how long it took each person to solve the problem from the moment they opened up the puzzle, so this is time-zone agnostic.

Now of course cheaters can easily circumvent this by peaking early at a thread or with an alternate account, but for the most part, it's useful to see how you'd really place.
Anonymous No.107106301 [Report]
>>107105297
(water)filtered
Anonymous No.107107056 [Report]
>>107105768
Hopefully AI kills off cheating. Why bother copying someone's code when a bot could solve the whole thing in 30 seconds?
Anonymous No.107107130 [Report] >>107107243
25 minutes until day 2
Anonymous No.107107242 [Report]
2024 day 7 is down to 28ms. Still aiming for sub 1ms.
Anonymous No.107107243 [Report]
>>107107130
OH FUG 15 MINUTES
Anonymous No.107107393 [Report]
Anonymous No.107107395 [Report]
It's out
Anonymous No.107107396 [Report]
FUCK
Anonymous No.107107546 [Report]
Oh shoot. This started yesterday.
I forgot about it.
Anonymous No.107107647 [Report] >>107108092
What the hell is part 2 even asking? you multiply [35300,-64910] by [1000,1000] thats fine and easy but then its asking to divide it into a 101x101 grid? And you somehow get that crazy map? I don't understand.. wouldn't it just be [359, -633] over and over?
Anonymous No.107107654 [Report]
>part 3
brutebros?
Anonymous No.107107744 [Report]
>wasted a bunch of time on part 1 because i misunderstood that x2 was the first number of the second set instead of the second number of the first set
>this part 2
wtf i don't get how to decide on the "area"
Anonymous No.107107842 [Report] >>107107874
how the fuck is [35300,-64910] the "top left" corner if the opposite corner is [36300,-63910]? wouldn't that be bottom left?
Anonymous No.107107874 [Report] >>107107952
>>107107842
Anonymous No.107107885 [Report]
>>107096381 (OP)
I'm still solving the 2024 ones, I only started a couple of days ago. I don't feel like interrupting my run right now and starting the 2025 ones. I should've waited and have fun with anons here.
Anonymous No.107107886 [Report]
They really are going for the AoC-tier clarity with these descriptions.
Anonymous No.107107891 [Report]
Lazy broot after wasting 20 minutes over a stupid bug. I'll try put something better in place at some point.
Anonymous No.107107942 [Report] >>107108059
>solved it in 10 mins
>but spent 50 mins hunting down a bug (using i32 instead of i64)

I hate my life
Anonymous No.107107952 [Report] >>107107982
>>107107874
>y increasing goes down
what is this gay bullshit
Anonymous No.107107969 [Report] >>107108165 >>107108258
>6 off in the part 2 example
well shit
Anonymous No.107107982 [Report]
>>107107952
https://en.wikipedia.org/wiki/Scan_line
Anonymous No.107108059 [Report] >>107108115 >>107108259
>>107107942
I tripped up handling division, which somehow worked for part1. Ran out of time, had to run some errands, before realizing what went just as I sat down. Now to make it quick I guess...
Anonymous No.107108078 [Report]
Too easy
Anonymous No.107108092 [Report]
>>107107647
Step in increments of 10, covering 1000 in total. So your first x numbers are

35300
35310
35320
35330
...

That's 101 numbers to reach from the start to 1000 units away.
Anonymous No.107108115 [Report] >>107108185
>>107108059
>before realizing what went just as I sat down

Stuff like this is a reminder that only a tiny fraction of your brain is conscious, and the rest of it enjoys fucking with (You).

>why yes I have the solution, I'll wait for you to give up, or maybe reveal it in a dream
Anonymous No.107108165 [Report] >>107108226
>>107107969
fencepost error nigga
Anonymous No.107108168 [Report]
I sure got fooled by those dang 32 bit integers
Anonymous No.107108185 [Report]
>>107108115
*went wrong

Exactly. It was some non-local consciousness calling me a retard for not recalling that Quotient rounds negative numbers down by taking a floor.
Anonymous No.107108226 [Report] >>107108258
>>107108165
i don't think so, i verified that the correct number of points are being checked (10201) and the first/last five coordinates from the example are right
Anonymous No.107108258 [Report] >>107108299
>>107108226
>>107107969
I think I had a similar error, check division example 4 from part 1.
Anonymous No.107108259 [Report] >>107108299
>>107108059
>I tripped up handling division, which somehow worked for part1
oh fuck, thanks, i just noticed that i'm doing the same thing. i thought "//" in python just drops the remainder but it does "floor" instead, which fucks up the negative numbers
Anonymous No.107108286 [Report] >>107108488 >>107108604
P3 picture
Anonymous No.107108299 [Report]
>>107108258
yep it was division, negative numbers were getting floor'd instead of ceil'd >>107108259
Anonymous No.107108340 [Report]
thought part 3 was gonna be one of those "brute force wont finish til the heat death of the universe" problems, even my shitty code ran in like a minute
Anonymous No.107108488 [Report] >>107108604
>>107108286
If you didn't gen an image did you really solve it?
Anonymous No.107108604 [Report]
>>107108286
>>107108488
yeah, good idea
here's mine
Anonymous No.107108718 [Report] >>107108736 >>107108757
I don't know how to make images
Anonymous No.107108735 [Report] >>107108739 >>107108866 >>107108872
https://everybody.codes/event/2025/leaderboards/time/ranking/everybody/total

>#3 is Hannah Lenk
>github url is Philipp Lenk

Huh, must be a brother-sister team.
Anonymous No.107108736 [Report]
>>107108718
ChatGPT does
Anonymous No.107108739 [Report] >>107108866
>>107108735
sir what if it's a troon
Anonymous No.107108757 [Report] >>107108793
>>107108718
https://oceancolor.gsfc.nasa.gov/staff/norman/seawifs_image_cookbook/faux_shuttle/pgm.html

Once you make a .pgm you can imagemagick it into a .png for upload
Anonymous No.107108793 [Report]
>>107108757
nta but cool format. thanks!
Anonymous No.107108866 [Report] >>107108941
>>107108735
>>107108739
Now I'm legitimately curious. Has a blog and YouTube with no updates in 4 years, GitHub is just AoC etc, signed up to EC as Hannah but happily linked the "Philipp" repo. Trains are usually sensitive about names.
Anonymous No.107108872 [Report]
>>107108735
The real news is /our guy/ tenth got cucked out of top spot by a Canuck
Anonymous No.107108892 [Report]
>hmm, I wonder what it would look like if you zoomed out?
>pic related
oh, it's just a mandelbrot set
Anonymous No.107108941 [Report]
>>107108866
https://www.hu-berlin.de/de/hu/verwaltung/ccww/career-center/lehrveranstaltungen/dozent-in/hannah_lenk

https://www.chessprogramming.org/Philipp_Lenk

It's official: C++ is the language of the neofoid, Rust is for chvds
Anonymous No.107108993 [Report] >>107109001
This is actually the first time I've done a mandelbrot. Cool thanks /g/!
Anonymous No.107109001 [Report]
>>107108993
> it didn't upload
embarassing :-(
Anonymous No.107109096 [Report] >>107109400
Quest2 code. Fun with mathematica's new compiler functions.
Anonymous No.107109220 [Report] >>107109549
uhh guys this is too hard for day 2, my python is too slow
Anonymous No.107109261 [Report]
rust-cels, our response?
Anonymous No.107109400 [Report]
>>107109096
Same again but using built-in complex numbers. Because I'm retarded, it just occurred to me that despite the examples, we only ever apply scalar division, which makes things easier.
Anonymous No.107109480 [Report]
>fractals
Use case?
Anonymous No.107109549 [Report] >>107109585 >>107109787
>>107109220
Are you cutting off the cycles as soon as they go out of range? If you’re waiting until the end, those numbers could become arbitrarily large.
Anonymous No.107109585 [Report] >>107110484
>>107109549
This, you want to break the loop as soon as +/-1000000 is exceeded

Fwiw my singlethreaded python on a Pi4 finishes in less than 60sec
Anonymous No.107109787 [Report]
>>107109549
oh yeah, that was it, thanks
Anonymous No.107109864 [Report]
Anonymous No.107110044 [Report] >>107110119 >>107110120
wtf is #TeamWater? Africans really need people halfway across the world to buy them water?
Anonymous No.107110119 [Report] >>107110125 >>107110226
>>107110044
Ugh
Anonymous No.107110120 [Report]
>>107110044
it's purely performative ofc. probably required something like this to apply for more sponsorships
>$1 per person who solves every problem
That's probably like 10000 zlotys for him, but Jane Street will cover it
Anonymous No.107110125 [Report] >>107110226 >>107110297
>>107110119
>Bangladesh, Cambodia, Kenya, Mozambique, Nigeria, Rwanda and Tanzania
Pay up white man. It's your fault these people cannot drink their water after they pollute it.
Anonymous No.107110226 [Report] >>107110630
>>107110125
I mean, at least there are three countries where white(french) companies are still fucking everything up, but given >>107110119
it just looks like the usual jew bullshit to me.
Anonymous No.107110227 [Report] >>107110285
>>107096381 (OP)
> missed the start
Too late for me to join?
Anonymous No.107110285 [Report] >>107110537
>>107110227
Not at all. Plus it'll even time you when you open the puzzle, so you can compare your time to complete against others, regardless of when they began.
Anonymous No.107110297 [Report] >>107110474
>>107110125
I have a hot take. If there's a bunch of humans living in an area where water has to be flown in they should move.
Anonymous No.107110459 [Report]
Day 2 was too EZ
Anonymous No.107110474 [Report]
>>107110297
I have another hot take: They aren't humans.
Anonymous No.107110484 [Report] >>107110531 >>107110621
>>107109585
>60 sec
Fuck, I knew Python was slow but that is just horrible.
Anonymous No.107110531 [Report] >>107110572 >>107110621
>>107110484
Well, I did say it was on a raspberry pi. Also I'm doing some retarded shit that makes it slower. But I placed top 30, so whatever. Python is suitable for this stuff at the non-champion level
Anonymous No.107110537 [Report] >>107110554
>>107110285
Cool thanks, I'll give it a go later today.
How's the difficulty compared to aoc?
Anonymous No.107110554 [Report]
>>107110537
You can do some problems from 2024 first to get an idea of the format and what's expected (how the inputs work, how many parts the problems have, and the type of feedback you get when your answer is wrong).

I would say it is close to AoC stylistically and the difficulty has been like AoC on one of the "easier" or less-frustrating years.
Anonymous No.107110563 [Report] >>107110620
Anonymous No.107110572 [Report]
>>107110531
Not blaming you, I'm blaming Python
Anonymous No.107110620 [Report]
>>107110563
>gif
Was half expecting a jump scare.
Anonymous No.107110621 [Report] >>107111405 >>107114863
>>107110484
>Fuck, I knew Python was slow but that is just horrible.
Truth.
#CPU: Intel i5-6300U (4) @ 3.000GHz
#Memory: 6951MiB / 15874MiB
#real 1m22.677s
#user 1m22.636s
#sys 0m0.022s
>>107110531
Why is your rapberry pi faster than my thinkpad?
def mult(c1,c2):
x1, y1 = c1
x2, y2 = c2
return [x1 * x2 - y1 * y2, x1 * y2 + y1 * x2]
def add(c1,c2):
x1, y1 = c1
x2, y2 = c2
return [x1 + x2, y1 + y2]
def div(c1,c2):
x1, y1 = c1
x2, y2 = c2
return [int(x1 / x2), int(y1 / y2)]
a=[35300,-64910] # 406954
r = [0,0]
res = 0
for y in range(0,1001):
for x in range(0,1001):
r = [0,0]
included = True
for _ in range(100):
r = mult(r,r)
r = div(r,[100000,100000])
r = add(r, add(a,[x,y]))
if not (-1000000 < r[0] < 1000000 and -1000000 < r[1] < 1000000):
included = False
break
if included:
res += 1
print(res)
Anonymous No.107110630 [Report] >>107111365
>>107110226
>still fucking everything up
Without the white man, these nations wouldn't even have basic transportation infrastructure. There would be no airport, harbour, rail roads or roads. Even viewed as exploiting, you cannot deny the immense technology transfer these nations benefit from. The real problem is probably that they still retain too much autonomy, failed states should be run by an international body until they can get it together.
Anonymous No.107110641 [Report]
Can't believe I wrote a complex number library and it turns out you only do one calculation
Anonymous No.107111365 [Report]
>>107110630
A classic.
Anonymous No.107111405 [Report] >>107114863
>>107110621
My unwashed c++ code executes in milliseconds and I just wrote the first sloppy shit that came to mind this morning before coffee. Unless I somehow blacked out after running the program and woke up minutes later. That is a possibility, will check when I get home
I don’t know what to tell you, man.
Anonymous No.107111797 [Report]
cleaner
Anonymous No.107111865 [Report] >>107111908 >>107112330
is it worth it? I haven't even opened day one.
Anonymous No.107111908 [Report]
>>107111865
Depends if ur a faget or no. U faget?
Anonymous No.107112004 [Report]
Looks neat, will give it a go tonight
Anonymous No.107112077 [Report] >>107112254
>needs email
w-why?
Anonymous No.107112254 [Report]
>>107112077
From reading comments on reddit..
He was going to make it so you could have one EC account, and even if you forgot which service you used to log in, if you picked another one with the same email, it would log you into the same account.
But he gave up on that.
So now it just uses the part before the "@" as one of the possible default name signals if it can't find another.
As it stands now, I think he should remove it as it's pretty annoying.
Anonymous No.107112330 [Report] >>107112366
>>107111865
>your answer for part2 is wrong
>it's a different fucking input file
what the fuck is this niggerlicious bullshit?
Anonymous No.107112366 [Report] >>107112374 >>107112448
>>107112330
>he can't read
Anonymous No.107112374 [Report] >>107112386
>>107112366
AoC always used the same input file for p1 and p2. this sucks in comparison
Anonymous No.107112386 [Report] >>107112544
>>107112374
the thread op clearly states that this thread is about "everybody codes".
why did yo u bring up aoc?
Anonymous No.107112448 [Report] >>107112558
>>107112366
your right, I can't. still fucking gay. I literally wasted all my time on p2 because of this shit. even p3 got me only because the example didn't match up, til I realized that changed too. whatever. I'll try quest 2, but I'm probably self filtering. this is gay in comparison.
Anonymous No.107112544 [Report]
>>107112386
because it's clearly inspired by and derivative of aoc
Anonymous No.107112558 [Report]
>>107112448
If you hadn't realised by part 3 you can't pattern match. Hate to break this to you anon, but you're retarded.
Anonymous No.107112581 [Report] >>107112594 >>107112826
Free fractal maker

```
fn read(filename: &str) -> (i64, i64) {
let raw = std::fs::read_to_string(filename).unwrap();
raw[3..raw.len() - 1]
.split_once(',')
.map(|(x, y)| (x.parse().unwrap(), y.parse().unwrap()))
.unwrap()
}

fn step(x: i64, y: i64, d: i64, px: i64, py: i64) -> (i64, i64) {
((x * x - y * y) / d + px, (2 * x * y) / d + py)
}

fn part1(filename: &str) {
let (px, py) = read(filename);
let (mut x, mut y) = (0, 0);
for _ in 0..3 {
(x, y) = step(x, y, 10, px, py);
}
println!("[{x},{y}]");
}

fn check(px: i64, py: i64) -> u8 {
let (mut x, mut y) = (0, 0);
for i in 0_u8..100 {
(x, y) = step(x, y, 100_000, px, py);
if x.abs() > 1_000_000 || y.abs() > 1_000_000 {
return i;
}
}
255
}

fn part23(filename: &str, diff: usize) {
let (x0, y0) = read(filename);
let mut ans = 0;
let d = if diff == 10 { 101 } else { 1001 };
let mut pixels = Vec::<u8>::with_capacity(d * d);
for py in (y0..=y0 + 1000).step_by(diff) {
for px in (x0..=x0 + 1000).step_by(diff) {
let result = check(px, py);
if result == 255 {
ans += 1;
}
pixels.push(result);
}
}
let imagefile = format!("pattern_{d}.pgm");
save_pgm(&imagefile, d, d, 255, &pixels);
println!("{ans}");
}

fn save_pgm(filename: &str, width: usize, height: usize, max_val: u8, pixels: &[u8]) {
use std::fs::File;
use std::io::{BufWriter, Write};
let mut file = BufWriter::new(File::create(filename).unwrap());
writeln!(file, "P2 {} {} {}", width, height, max_val).unwrap();
for row in pixels.chunks(width) {
for &pixel in row {
write!(file, "{} ", pixel).unwrap();
}
writeln!(file).unwrap();
}
}

fn main() {
part1("in1.txt");
part23("in2.txt", 10);
part23("in3.txt", 1);
}
```
Anonymous No.107112594 [Report]
>>107112581
LOL
Anonymous No.107112826 [Report]
>>107112581
don't run this, it creates mustard gas
Anonymous No.107113211 [Report]
How does the formula for the animated mandelbrot stuff work? From what I remember they usually just have it zooming in?
Anonymous No.107113412 [Report] >>107114643
I fucked up in reading comprehension on part 1 and 2 but at least I've finished it. Still trying to learn rust
Anonymous No.107113445 [Report] >>107115108
Its fun to play around with the size and the coordinates
Anonymous No.107114006 [Report]
don't forget to join the /g/derboard

4151e976-7b9f-4fda-bb33-fa7c70fdceea
Anonymous No.107114643 [Report] >>107115872
>>107113412
Learning Rust is easy.
>Step 1. Cut off your dick
>Step 2. Go to Github and look for some stressed out maintainer for some obscure FOSS project
>Step 3. Make angry demands that he rewrites it in Rust and introduces a tranny friendly Code of Conduct
>Step 4. ???
>Step 5. Neck yourself
Anonymous No.107114708 [Report] >>107114736 >>107117199 >>107117245
>>107096381 (OP)
I'm sorta getting rationalist fanfic meets eragon vibes and it's making me puke
Anonymous No.107114736 [Report]
>>107114708
>reading the "story"
cringe
Anonymous No.107114863 [Report]
>>107111405
>>107110621
Just checked. Like I said, unwashed shit, still 250 ms. WTF are you doing?
Anonymous No.107114992 [Report] >>107115038
>>107097176
>.max().min()
ok, that was based. I didn't know this was a thing. thanks rust bros.
now I wish there was a .between(0..n) as well.
Anonymous No.107115038 [Report] >>107115045
>>107114992
see >>107099368
Anonymous No.107115045 [Report]
>>107115038
oh, I see the Ord trait has clamp. cool. thanks.
Anonymous No.107115108 [Report]
>>107113445
Kino desu
Anonymous No.107115415 [Report]
Anonymous No.107115591 [Report]
>>107097176
In BQN this is just
name { max Length names
i LastElementOf BoundSum numbers
i Index names
}
"Lornthyris"
Anonymous No.107115604 [Report] >>107115745
>>107097176
In BQN this is just
name Is { max Is Length names
i Is LastElementOf BoundSum numbers
i Is Index names
}
"Lornthyris"
Anonymous No.107115711 [Report] >>107115745 >>107116774 >>107120772
>>107097176
In BQN this is just
name Is { max Is Length names
i Is LastElementOf BoundSum numbers
i Index names
}
Anonymous No.107115745 [Report]
>>107115604
>>107115711
OH NO!!!! RIGHT IN THE HORMONES, RUST-SISTERS!!!
Anonymous No.107115872 [Report]
>>107114643
It has some really cool shit. Other things are weird like the loop keyword and not having a ++ operator. But don't worry I always have a C book at hand
Anonymous No.107116774 [Report] >>107117106
>>107115711
Impressive, very nice. Let's see the runtime.
Anonymous No.107116820 [Report]
LESS THAN 10 MINUTES
Anonymous No.107116857 [Report]
>9 8 3 7
>Up to boulderbloke road
Anonymous No.107116875 [Report]
It's out
Anonymous No.107116920 [Report] >>107117087
turn the decimal into a comma
Anonymous No.107116946 [Report]
dude
crates.sort_unstable();
crates.dedup();
lmao
Anonymous No.107116952 [Report]
okay this is easy if you figure out the trick to simplify the problem
Anonymous No.107116962 [Report] >>107116983 >>107117141
wtf this was easy as shit. took two hours yesterday and finished all three parts today in like 8 minutes. are they expecting people to not know how to use sets?
Anonymous No.107116983 [Report]
>>107116962
>needing sets

Consider yourself filtered
Anonymous No.107116984 [Report] >>107117247
Ridiculously easy, three one-liners.
Anonymous No.107116987 [Report] >>107117161 >>107117170
crates = [] #input goes here
sets = [set()]

for c in crates:
packed = False
for s in sets:
if c not in s:
s.add(c)
packed = True
break
if not packed:
sets.append(set([c]))

print(len(sets))


gg ez
Anonymous No.107117045 [Report] >>107117061
https://everybody.codes/event/2025/leaderboards/time/ranking/everybody/quest/3/total

ISLE OF MAN IN THIRD PLACE LET'S FUCKING GOOOOOOOOOOOOOO
Anonymous No.107117061 [Report]
>>107117045
>Marios Konstantinos Marouditsis Rapanakis
do greek people really?
Anonymous No.107117085 [Report] >>107117095 >>107117127 >>107117247
crates.sort_unstable();
let mut ans = 0;
let mut row = 1;
for i in 1..crates.len() {
if crates[i] == crates[i - 1] {
row += 1;
} else {
ans = ans.max(row);
row = 1;
}
}
println!("{ans}");


Anyone do anything clever (or dumb) with the first two? Did the author not realise you can just dedup+sum?
Anonymous No.107117087 [Report]
>>107116920
it's been fixed if you refresh the page
Anonymous No.107117095 [Report]
>>107117085
Just realised I could've got it wrong if the longest run was at the end. But we didn't even get that minor curveball.
Anonymous No.107117106 [Report]
>>107116774
It's illegal to benchmark array languages
Anonymous No.107117119 [Report] >>107117247
huh
Anonymous No.107117127 [Report] >>107117151 >>107117153 >>107117247
>>107117085
not clever but:
#part 1
print(sum(set(crates)))

#part 2
print(sum(sorted(list(set(crates)))[:20]))
Anonymous No.107117129 [Report]
Shouldn't ocaml be forced if this is janeshittingstreet?
Anonymous No.107117139 [Report]
198.918µs


So trivial it barely matters, but still. Anyone get under 100µs?
Anonymous No.107117141 [Report] >>107117217
wtf was that? Early days are easy, but what fucking babbys first puzzle was that?
>>107116962
>yesterday took two hours
filtered
Anonymous No.107117151 [Report] >>107117170
>>107117127
Where's part 3? You did solve part 3, right?
Anonymous No.107117153 [Report]
>>107117127
>not clever

Aesthetically pleasing tho
Anonymous No.107117161 [Report]
>>107116987
You know what was my first though. But then I was thinking the only time you actually have to make a new set is when you have a duplicate number. So you can actually just get the count of the most common number and you're done.
Counter(nums).most_common(1)
Anonymous No.107117166 [Report]
Is this a record? I've never seen an easier puzzle in AoC or anywhere else. Hardest part was rereading the question cause surely you misunderstood, it couldn't be as straightforward as it seemed.
Anonymous No.107117170 [Report]
>>107117151
already posted it >>107116987

probably a cleaner way of doing it, basically just need to know how many times the most repeated element is in the list
Anonymous No.107117199 [Report]
>>107114708
>I'm sorta getting rationalist fanfic meets eragon vibes and it's making me puke
DUDE RIGHT I actually hate this shit. It makes me miss Eric. Eric's Cristmas elf shit gave me a few half chuckles. MAYBE even a smirk. This guys writing is trash.
Anonymous No.107117217 [Report] >>107117260
>>107117141
the only thing filtered is that bottle of aquafina some congolese warlord will be drinking on december first, courtesy of my stars
Anonymous No.107117245 [Report]
>>107114708
i'm surprised a man made this, the writing reads very "woman obsessed with YA lit" to me. at least they put the story blurb in a box the past two days to let you know where you can start reading for the actual puzzle
Anonymous No.107117247 [Report] >>107117291
>>107116984
>>107117085
>>107117119
>>107117127
You call these obvious or non-clever, but under time pressure, I defaulted to a for-loop to throw away duplicates
Anonymous No.107117260 [Report]
>>107117217
I hope my water goes to Boko Haram
Anonymous No.107117291 [Report]
>>107117247
>I defaulted to a for-loop
the way god intended
Anonymous No.107117305 [Report] >>107117618
#include <stdio.h>
#include <stdlib.h>
#define MAX_CRATES 10000
#define MAX_SET_CRATES 20

static inline int compare(const void *a, const void *b){
return *(const int *)a < *(const int *)b ? -1 : 1;
}

int main(){
int crates[MAX_CRATES] = {0}, sets = 0, n = 0;

for(n = 0; n < MAX_CRATES && scanf("%d", &crates[n]) != EOF; n++)getchar();
qsort(crates, n, sizeof(int), compare);

for(int i = 1, cc = 0; i < n; i++, cc++){
if(crates[i] != crates[i-1]) {
if(cc > sets) sets = cc;
cc = 0;
}
}
printf("%d\n", sets);
}

Last part in c
Anonymous No.107117324 [Report]
I was expecting part 2 to be something like
>the boxes are now marked with the maximum amount of boxes that can fit inside it, regardless of their size
>sometimes a smaller box size is more useful if it can fit more boxes inside it than a larger box that can't
Anonymous No.107117341 [Report] >>107117384
Not that I'm complaining, but this puzzle was really missing some parsing bullshit. Surprised there wasn't 10 steps first just to get the list of crates instead of just giving us the list to copy paste in
Anonymous No.107117365 [Report]
This should have been day 1 honestly.
Anonymous No.107117367 [Report] >>107117457
why can't it be comfy midnight release?
Anonymous No.107117384 [Report] >>107117394 >>107117396
>>107117341
Its weird because the 1º example input has a float and non of the numbers in the next examples nor in the input has any floating point number.
Wait I dont see it now. I swear to god that the 8 in the first example was a float
Anonymous No.107117394 [Report] >>107117553
>>107117384
nah you're right, example had 8.5 but it was supposed to be a comma. they fixed it pretty quick
Anonymous No.107117396 [Report] >>107117553
>>107117384
it was a typo, they had a full stop instead of a comma
Anonymous No.107117457 [Report]
>>107117367
It is a comfy midnight release for me

Actually I think I prefer AoC's release time, since it means I do the puzzles in the morning and don't worry about leaderboard times
Anonymous No.107117553 [Report]
>>107117396
>>107117394
I wasted like 2 minutes on that, fell out of the top 15 because of it. Polacks truly are niggers
Anonymous No.107117618 [Report]
>>107117305
am I wrong in feeling there is something very non-C-ish about qsort()? It is really convenient, and works really well
Anonymous No.107117799 [Report]
reminder that if you are using a web browser to retrieve the data or x to copy paste you have to add all that code to your line count.
Anonymous No.107118193 [Report] >>107118283 >>107118341 >>107118354 >>107118481
why isn't there as much hype as AoC
Anonymous No.107118283 [Report] >>107118286 >>107118454 >>107118461 >>107118512
>>107118193
I completely forgot about it and my interest in joining last isn't very high. No Christmas theme also kills a lot of the joy. Just seems like doing random codewars puzzles.
Anonymous No.107118286 [Report]
>>107118283
late* not last
Anonymous No.107118341 [Report]
>>107118193
It's new and not as popular.
Anonymous No.107118354 [Report] >>107118407
>>107118193
no memes specific to this thread yet
Anonymous No.107118407 [Report]
>>107118354
People shit on AOC story, but I think that’s what makes them memeable and fun. This is like memeing a scantronic multiple choice test
Anonymous No.107118454 [Report]
>>107118283
>my interest in joining last isn't very high.
I'm doing these in the middle of work, who cares about the time lol.
Anonymous No.107118461 [Report]
>>107118283
There aren't puzzles on weekends, so you can use saturday and sunday to catch up if you start now and insist on doing 1 per day.
Anonymous No.107118481 [Report] >>107118485 >>107118488 >>107118500 >>107119000
>>107118193
barely anyone knows about it, i only found about because somebody mentioned it in an aoc thread a few days ago. /g/'s interest in aoc is also definitely waning, threads even early in december get slower each year now and they get extremly dead after the first week. now that it's only 12 days and with no global leaderboard, interest is gonna die even more i feel
Anonymous No.107118485 [Report] >>107118488 >>107119000
>>107118481
IQs are dropping.
Anonymous No.107118488 [Report]
>>107118485
>>107118481
damn someone should make an Advent of generating AI Slop pictures
Anonymous No.107118500 [Report]
>>107118481
I think we didn't even use an overflow leaderboard last year.
Anonymous No.107118512 [Report] >>107118704
>>107118283
you can sort the leaderboard based on "local time", which doesn't start the clock until you open the window with the puzzle, so you can still have a little bit of a competitive enjoyment with that

unfortunately, the default rankings are completely retarded and just add your elapsed times together from puzzle release, so if you miss a day you're basically permanently fucked. with AOC's scoring, it's possible to claw your way up a few places if you're significantly better than people
Anonymous No.107118523 [Report] >>107118542
I first learned about AoC on 8/tech, and there were only about 8 people in the thread, was still fun.
Anonymous No.107118542 [Report] >>107118593
>>107118523
small can be comfy, but i'm still nostalgic for like 2016-2018 when half the threads were just shitflinging about the calendar images. i don't think people have even done the calendars the past couple except for a few guys who just make their own
Anonymous No.107118576 [Report]
your low effort calendar image for today, sir
Anonymous No.107118593 [Report]
>>107118542
Funny, I remember being annoyed at the calendar feuds, but now I miss that level of interest.
Anonymous No.107118632 [Report] >>107118648 >>107118709
>>107096381 (OP)
>the same thread for 3 days
why even bother?
Anonymous No.107118648 [Report]
>>107118632
Why would multiple threads improve your experience? Use case?
Anonymous No.107118704 [Report] >>107118714
>>107118512
>so if you miss a day you're basically permanently fucked
>missed 3 days already
fuck
maybe next year
Anonymous No.107118709 [Report]
>>107118632
things start out small anon
if you want to hop on the latest bandwagon millions of people are doing, perhaps I can interest you in tiktok or windows 11?
Anonymous No.107118714 [Report] >>107118726
>>107118704
why even care about the leaderboard? I just think of it as comfy christmas* puzzles
*I guess thanksgiving
Anonymous No.107118726 [Report] >>107118761
>>107118714
relatively unknown and not filled with cheaters means it's actually possible to place high
Anonymous No.107118761 [Report] >>107118772
>>107118726
So catchup and place high tomorrow.
Anonymous No.107118772 [Report] >>107118817
>>107118761
No you don't understand, if I can't be rank 1 on the global leaderboard for all problems it's not worth doing at all. Everyone must bow to my greatness.
Anonymous No.107118817 [Report] >>107118848
>>107118772
Damn straight.
Anonymous No.107118848 [Report] >>107118857
>>107118817
Now to log on to chess.com and show everyone I'm a grandmaster.
Anonymous No.107118857 [Report]
>>107118848
I hope you meant lichess.org
Anonymous No.107118884 [Report]
The mandelbrot stuff makes me want to try it on PS2.
Anonymous No.107118927 [Report]
/ebcg/ - everybody codes general
Anonymous No.107119000 [Report] >>107119031 >>107119033
>>107118481
>>107118485
No it's because programming isn't interesting at all unless you are a researcher
This is how every puzzle goes
"solve x"
hmm can I solve y or z instead
need to implement solve_x_y_or_z()
how do I do that
look it up
you need these_functions()
how do I implement these_functions()
look it up
repeat, fighting API and software the whole time
get mediocre solution
look up the best solution
"I happened to find this solution during my phd research work"
Anonymous No.107119031 [Report]
>>107119000
Meds
Anonymous No.107119033 [Report]
>>107119000
what structured programming does to a mf
I just chain together words until the computer does what I want it to
Anonymous No.107119086 [Report]
Ahem


TOTAL RUSTGOD VICTORY
Anonymous No.107119175 [Report]
rust solution
Anonymous No.107119232 [Report] >>107120370
rust solution
Anonymous No.107119414 [Report] >>107120072 >>107120107
Just curious: do you guys do LeetCode or anything else like that? I started doing some leet code dailies after AOC two years ago to get better. I definitely got a bit better, but most of the hards crush me.
Anonymous No.107119465 [Report] >>107120112 >>107120159 >>107120441
>still on day 2
>havent written c++ in years so i wanted to get back into it
>spent over an hour debugging my code
>used int instead of long long
>first iteration of the multiplication has -64880^2
i have never fucking used long long before today
Anonymous No.107119778 [Report] >>107120112
wtf is long long? you have to stutter to use c++?
Anonymous No.107120072 [Report] >>107123978
>>107119414
Never, but I really should get back into Project Euler.
Anonymous No.107120107 [Report]
>>107119414
i did leetcode dailies for a little while, maybe like 20 of them. the easies were piss easy, the hards felt impossible, and like half the mediums were just double-sliding scale problems so i ended up losing interest
Anonymous No.107120112 [Report]
>>107119465
>If at the end of any of the 100 cycles the X or Y coordinate of the result exceeds 1000000 or falls below -1000000 , that point will not be engraved
thats too long!
>>107119778
Yes, I'm not a scientist, but I believe C++ was first invented by the beetles historically speaking.
Anonymous No.107120159 [Report] >>107120195 >>107120229
>>107119465
I haven't touched C++ in a decade, but I think long long is 'long dead' for new code. It's obviously going to stay for compatibility, but you should be using precise types here https://en.cppreference.com/w/cpp/header/cstdint.html
Anonymous No.107120195 [Report] >>107120244
>>107120159
Primitive types with underscores are disgusting. Especially with several dozen variations. I'll stick to int, long, and long long.
Anonymous No.107120229 [Report]
>>107120159
yeah no. I’m writing C++ for a computer,l
>what kind of computer?
you know, a computer. not a fossil, and not some embedded mystery chip with a datasheet in chinese

gif related
Anonymous No.107120244 [Report] >>107120280
>>107120195
C++ itself is disgusting (although maybe not as bad as Rust). This is retarded, but you could do something like
using uint64 = std::uint64_t
Anonymous No.107120280 [Report] >>107120422 >>107120452
>>107120244
how about
using int = std::uint64_t
Anonymous No.107120332 [Report] >>107120343
India not even in the top 25. I thought they were a tech superpower?
Anonymous No.107120343 [Report] >>107120400
>>107120332
Canada is #4
Anonymous No.107120370 [Report]
>>107119232
unreadable crap
Anonymous No.107120400 [Report]
>>107120343
Implying they'd use the flag.
Anonymous No.107120422 [Report]
>>107120280
You can, but you'll piss off anyone reading your code. If someone else ends up maintaining it, they will hunt you down.
Anonymous No.107120441 [Report] >>107120468
>>107119465
>long long
>not specifying the numbers of bits you want e.g. int64_t
Anonymous No.107120452 [Report]
>>107120280
>what do you mean ”unsigned”???
Anonymous No.107120468 [Report] >>107120612
>>107120441
>type noise is good because it just is okay?!
Anonymous No.107120612 [Report] >>107120912
>>107120468
>type noise
Specifying the number of bits is noise now?
>good
There is nothing good about the fundamental types in C++. Therefore you should specify the number of bits they have.
As an example, how many bits does a int have? Answer: Depends on your architecture.
Question: Is there a difference between a short and a signed short int? Answer: no.
Question: What type is a "signed"? Answer: int.
Question: How many bits is an int guaranteed to have? Answer: 16.
Question: How many bits is a short in guaranteed to have? Answer: 16.
Question: Why??? Answer: Fuck you
Question: Who thought that it would be useful for a language to have the following defined?
>char
>signed char
>unsigned char
>short
>short int
>signed short
>signed short int
>unsigned short
>unsigned short int
>int
>signed
>signed int
>unsigned
>unsigned int
>long
>long int
>signed long
>signed long int
>unsigned long
>unsigned long int
>long long
>long long int
>signed long long
>signed long long int
>unsigned long long
>unsigned long long int
>size_t
>wchar_t
>float
>double
>long double
Answer: A fucking moron
Anonymous No.107120772 [Report]
>>107115711
Forgot to mention how I clean up numbers
numbers Is (Directions Times StrToInts) numsdirty

If directions U, D, F, B are added then only the Directions function needs to change and the change is trivial.
Anonymous No.107120792 [Report]
Finally finished day 2 after spending yesterday ripping up a french drain.
Anonymous No.107120912 [Report] >>107122349
>>107120612
>Specifying the number of bits is noise now?
yes, they're nothing but a distraction
>how many bits does a int have?
how is this information even useful?
if you need a bit vector, use a bit vector
Anonymous No.107121616 [Report] >>107123393
>Three days in and the thread is already dead
Probably doesn't help that today's was absurdly simple. Perhaps the next thread should be for coding challenges in general, to try and take advantage of a steady trickle of people bitching about AoC's changes.
Anonymous No.107121926 [Report] >>107122005
Apparently relatively few people code.
Anonymous No.107122005 [Report]
>>107121926
It's not coding season.
Anonymous No.107122349 [Report] >>107122468
>>107120912
How is the information useful? Are you one of those no-coders?
The information is useful because you generally (read: almost always) want to keep your memory compact especially in data structs. Therefore you (almost always) want as few bits as possible without risking overflow. If you instead go for the largest type all the time you’ll waste tons of space for no reason at all (I hope to god that you atleast know what padding is).
>bit vector
You mean bitset, not fucking bit vector.
Jesus christ, /g/ is full of tards. I’m going to take a wild guess and assume that you’re also afraid to use malloc or new.
Anonymous No.107122468 [Report] >>107123009
>>107122349
>bitset
You mean bit array, not fucking bit bitset.
Anonymous No.107122767 [Report] >>107123924
getting to try out clojure.
there seems to be a lot of built-in functions.
Anonymous No.107123009 [Report]
>>107122468
No, I mean bit set which is the C++ name.
Anonymous No.107123393 [Report] >>107123650
>>107121616
only like 10 people from /g/ are participating (or at least only 10 joined the leaderboard), that's not enough to shitpost in the thread 40 times per hour. especially 12 hours from puzzle release when you posted this
Anonymous No.107123650 [Report] >>107123943
>>107123393
Especially not for puzzles that barely filter no-coders. In AoC threads the riffraff who dare not even look at a big boy join every year in hopes that they will somehow be good if they can prove that they can get like five stars. But Everybody Codes is still for enthusiasts who have claimed all 500 stars and wish the big boys were bigger and fatter
Anonymous No.107123924 [Report]
>>107122767
That looks pretty nice! That ->> operator thing is like a unix pipe? Neat.
Anonymous No.107123943 [Report]
>>107123650
You know I used to struggle with big fat big boys. But then I became the biggest fattest boy and now I can’t blow em no problem.
Anonymous No.107123978 [Report]
>>107120072
> Project Euler
Is this a math thing? I tried out a few and the solutions it shows afterwards look more mathy than just straight data structures.
Anonymous No.107124003 [Report]
>>107096381 (OP)
>picrel
Any site that doesn't allow normal registration is a datamining operation and should be ignored.
Anonymous No.107124023 [Report] >>107124049 >>107124212 >>107124306
>>107096381 (OP)
>picrel
Any site that doesn't allow normal registration is a datamining operation and should be ignored.
Anonymous No.107124049 [Report]
>>107124023
dumb retard
Anonymous No.107124065 [Report]
did it all in the REPL today. didn't even bother with creating a file. it was pretty easy.
Anonymous No.107124212 [Report]
>>107124023
You do have fake mails, right? I’ve got like 5 fake gmail accounts
Anonymous No.107124306 [Report]
>>107124023
it sucks, but i get it. some solo web dev who just wants to make some puzzles probably doesn't want to deal with the hassle of making sure they've got secure infrastructure, smtp services, password handling, etc when there's an easy plug and play solution that 99% of your users are fine with. not like i really care that much if github knows i'm doing this gay challenge