[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology

Name
Options
Comment
Verification
4chan Pass users can bypass this verification. [Learn More] [Login]
File
  • Please read the Rules and FAQ before posting.
  • You may highlight syntax and preserve whitespace by using [code] tags.

08/21/20New boards added: /vrpg/, /vmg/, /vst/ and /vm/
05/04/17New trial board added: /bant/ - International/Random
10/04/16New board for 4chan Pass users: /vip/ - Very Important Posts
[Hide] [Show All]


[Advertise on 4chan]


File: 1765573151570448.png (27 KB, 1200x1200)
27 KB
27 KB PNG
we're still here edition

>Advent of Code is an Advent calendar of small programming puzzles for a variety of skill sets and skill levels that can be solved in any programming language you like. People use them as a speed contest, interview prep, company training, university coursework, practice problems, or to challenge each other.
https://adventofcode.com/

/g/ leaderboard join code:
224303-2c132471
anonymous-only leaderboard:
383378-dd1e2041

See also: https://obonofcode.com/ (Summer 2026)

previous >>107536609
>>
File: calendar.png (3.16 MB, 9779x3472)
3.16 MB
3.16 MB PNG
official /aocg/ calendar
>>
>>107570855
How do you become this good at rust or programming in general?
>>
>>107570870
program exclusively in Rust for 15+ years
>>
>>107570570
Rust onboarding is stellar, actually.
you won't start to dislike the language at all until you start to maintain code.
>>
no new stuff for today?
>>
>>107570855
>>107570870
>>107570912
Attention seeking samefag.
>>
File: file.png (44 KB, 1009x351)
44 KB
44 KB PNG
>>107555399
lmao
>>
File: all me.png (46 KB, 1460x500)
46 KB
46 KB PNG
>>107572101
what are you going to do about it? cry?
>>
>>107570926
>you won't start to dislike the language at all until you start to maintain code.
Really? My anger at the borrowchecker and desire to use raw pointers and unsafe blocks for everything has only decreased over time
>>
>>107570042
anon... plz.

use saturating subtraction and then you have no problems.
>>
someone please talk to me...
>>
>>107572469
wtf, those are my posts. stop stealing my posts.
>>
i'm sad I didn't do it this year
got filtered by 1b
i guess i could have just done the silver ones and kept up
>>
File: 1726786632203684.jpg (111 KB, 923x605)
111 KB
111 KB JPG
>>107573507
you still have like 8-9 more days to do a puzzle a day
>>
need to get around to solving the previous years
>>
chat dont let the thread die wtf
>>
>>107575243
It's over.
You need to let go.
>>
z3 is pretty interesting. Seems hard to tell WHEN to use it, though.
>>
>>107572124
I also did this in Zig (after solving it on paper lol). see >>107556558

LLVM is pretty good desu. although I would imagine these are simple reductions for an optimizing compiler

>>107575573
I have never used it but "linear optimization" seems pretty clear. when you can write your problem as a set of linear equations (no modulo stuff) and you need to find a solution that minimizes or maximizes some parameter

>>107572260
doesn't solve the reverse iteration pattern since you can't put i>=0 as a condition for an unsigned type. what I did in a lot of aoc days is use wrapping sub and test only for upper bound. in grid puzzles when you write a loop for iterating over neighbors then you would do if (ni >= 0 and ni < m and ...same for nj...) this can be done with just if (ni < m and nj < n) since if there is a negative overflow then it will wrap go u32 max.
>>
>>107570870
I think idiomatic rust anon's ability to use the entire set of Iterator methods in each solution is pretty impressive lol. he even uses nightly features
>>
>>107575741
I'm starting to feel sorry for you anon. Now you're writing compliments to yourself.
>>
rust melvins vs python CHADS
>>
>>107575573
>z3 is pretty interesting. Seems hard to tell WHEN to use it, though.
>>107575720
>when you need to find a solution that minimizes or maximizes some parameter
ya just this. also when / if your cached memoized dp runs out of space or takes infinity time.
>>
5 MINUTES
>>
FUCK
>>
>only day 17
>everyone already filtered
>thread is a graveyard
why did Eric ramp the difficulty up so hard? To BTFO LLMs?
>>
>>107577554
Eric got pregnant, hard to design puzzles during this time.
>>
>>107578763
I better go congratulate him on his baby.
>>
File: file.png (113 KB, 549x637)
113 KB
113 KB PNG
>>107575720
>transpiler program
bruh
>>
>>107575720
>doesn't solve the reverse iteration pattern since you can't put i>=0 as a condition for an unsigned type.
bruh just use ranges and iterators and .rev(), LLVM will take care of it
namely by checking whether i -= 1 overflows
>>
File: aoc2025rs-05.png (168 KB, 538x1438)
168 KB
168 KB PNG
I'm the only one still solving puzzles ;_;
>>
>>107579751
>day 5
giga filtered
>>
>>107579751
based

also holy shit captchas suck now
>>
File: 1764482833391341.jpg (41 KB, 634x360)
41 KB
41 KB JPG
I'm too retarded to do any of this
>t. java programmer
>>
>>107579751
I'm going to continue on friday when I have time, still need to do 10, 11, 12
>>
>>107581165
Unironically ask AI to help walk you through the problem. That's how we did it back then but we had to use StackOverflow instead.
>>
>>107581706
>StackOverflow
I keep using it, even if company payed for AI subscriptions. But i always felt like it's cheating, i want to do it all myself
>>
>>107581393
10 is the only hard one this year
>>
>>107579198
zig does not have such niceties. I support using iterators but I was arguing why saturating sub is not the panacea.

>>107578923
you have my respect

>>107575953
t'was me. I am a zigger
>>
>>107581788
i haven't even read it yet so i'll take your word for it, 1-9 has indeed been pretty easy
>>
>>107581855
>zig does not have such niceties. I support using iterators but I was arguing why saturating sub is not the panacea.
We were talking about Rust.
If you willingly choose to use Zig, you should be PROUD of having to write something very explicit like
    var i: usize = 100;
i -= 1;
while (true) {
// do something
if (i == 0) break;
i -= 1;
}
>>
>>107570836
>See also: https://obonofcode.com/ (Summer 2026)
How is this supposed to work? Obon is only a few days long, I could probably make that many puzzles by myself.
>>
>>107584684
>I could probably make that many puzzles by myself.
No one is stopping you.
>>
>>107581706
>That's how we did it
>we
Speak for yourself faggot, this isn't reddit where you use the collective voice. "We" here on 4chan don't like the way you speak to "us".

The better alternative is to just take computer science at a decent school, and actually read the textbooks they assign to you. That said, even with a 160+ IQ, I'm too low IQ to pass the captcha here so everything I say should be disregarded by my betters.
>>
the great filter in 4 hours
>>
>day 18 in less than an hour
>dead thread
what's up with that?
>>
>>107587949
We hit The Wall.
>>
Is this year’s AoC doable in Go?
>>
>>107588318
name one AoC problem not doable in Go
>>
>>107588318
No
>>
>>107588318
there's not much you can do with black and white rocks
>>
>>107588676
they could represent 0 and 1 and you are on your way
>>
>>107588676
You can just use it as an abacus, and implement the algorithm in your brain.
>>
I'd love to see someone solve AoC puzzles using children in a chinese sweatshop.
>>
>>107588676
lol
>>
>>107588318
https://github.com/ayoubzulfiqar/advent-of-code/tree/main/2025/Go/
>>
I've kinda fallen for assembly on the PS2.
I want to keep doing things in it. I think if I spend some more time I will develop some better techniques for handling and manipulating data which would help me get through more of the problems. And I haven't really ventured into using the VPUs at all yet.
Being able to quickly put together visualizations to go along with some problems would be neat, too.
But I do want to move to a different platform for next year's AoC because I already have this routine and a platform I want to do.
>>
File: aoc2025rs-06.png (114 KB, 490x1030)
114 KB
114 KB PNG
idk what I'm allocating anymore
>>
>>107590912
very unidiomatic
>>
>>107590912
In C this is just
#include <stdio.h>

static int
nb(const char *p, int k) {
int x = 0;
for (; *p == ' '; p += k);
for (; *p >= '0' && *p <= '9'; p += k)
x = x*10 + *p-'0';
return x;
}

int
main(void) {
static char s[0x8000]; /* XXX NUL-terminated */
int n, w, i, ni, j, x;
long long ag, au, cag, cau;
char *p;
n = fread(s, 1, sizeof s, stdin);
for (w = 0; s[w++] != '\n'; );
ag = au = 0;
p = s + n-w;
for (i = 0; i < w; i = ni) {
for (ni = i+1; p[ni] == ' ' || p[ni] == '\n'; ni++);
cag = nb(s+i, 1);
for (j = i+w; j < n-w; j += w) {
x = nb(s+j, 1);
cag = p[i] == '+' ? cag+x : cag*x;
}
cau = nb(s+i, w);
for (j = i+1; j < ni-1; j++) {
x = nb(s+j, w);
cau = p[i] == '+' ? cau+x : cau*x;
}
ag += cag;
au += cau;
}
printf("%lld\n%lld\n", ag, au);
}
>>
>>107591262
In idiomatic Rust this is just
fn solve(input: &str) -> [u64; 2] {
let [width, mut right] = array::repeat(input.find('\n').unwrap());
let height = input.len() / (width + 1);
let get = |x, y| char::from(input.as_bytes()[y * (width + 1) + x]);
let num = |acc, x, y| get(x, y).to_digit(10).map_or(acc, |d| acc * 10 + u64::from(d));
(0..width).rev().filter(|&x| get(x, height - 1) != ' ').fold([0; 2], |[a, b], left| {
let op = get(left, height - 1) as u8 & 1;
let (op, init) = ([Mul::mul, Add::add][usize::from(op)], 1 - u64::from(op));
let rows = (0..height - 1).map(move |y| (left..right).fold(0, |acc, x| num(acc, x, y)));
let cols = (left..right).map(|x| (0..height - 1).fold(0, |acc, y| num(acc, x, y)));
right = left.wrapping_sub(1);
[a + rows.fold(init, op), b + cols.fold(init, op)]
})
}
>>
>>107591262
>static char s[0x8000]; /* XXX NUL-terminated */
stopped reading right there, you did not solve it
>>
File: day1_adb.png (38 KB, 617x899)
38 KB
38 KB PNG
so bored, I figured I'd give this a shot. reckon I'll get filtered by day 3 though
https://ghostbin.lain.la/paste/4yxcf
t.nocoder



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