#advent-of-code
1 messages ยท Page 33 of 1
at least yall have something to show
ok
i can now find closest pairs
great fucking progress ig.
gl :-)
i am also stuck on part 1, so no :-)
nope! you'll get it!
todays was really dumb
it wasnt clear up to what point i needed to stop
i got caught up so many times cuz i was doing it for the amount specified in the example, which was different from the amount required for the actual solution
yeah, i misread that part at first too ๐ฎโ๐จ
aaahhhh i got part one
at the very least i like that an O(n^2) solution in a lot of cases can be considered fast enough
yeah idk everything i can think of requires loops
multiple loops
Better than me. I'm just going to ignore day 8 til the heat death of the universe
lol im sure its not that bad
i prolly just cant think of the right data structure to use
and am instead forcing functionality onto lists that they dont have
It's not clear when to stop connecting nodes
too much leetcode has rotted my brain. turns out, a lot of problems can be solved by throwing more resources at them
do you have some samples?
it was this, he sent me the generator
oh, like a bomb fuse
yeah, it's pretty cool
do you have it as text?
i think i deleted the generator, lemme check
smh get more floppies
all my floppies are on the cloud
had to change the print to go to file though
size 10 makes my code take about 69 ms, size 20 is about 1 second
so it does check out
i don't remember what size i used in the visualization... like 15?
and size 20 is only around 245**2 large
for reference for my solution in crystal
10: 0.047s
20: 0.166s
40: 0.586s
80: 2.211s
```linear in the size of the grid
also, kat wtf?
@cyan sleet how do you read a line in zig
i have been here for an hour
i'm starting to remember why i added that node to the flowchart last year
fn read_line(reader: *std.io.Reader, line: *std.io.Writer.Allocating) !void {
line.clearRetainingCapacity();
_ = try reader.streamDelimiter(&line.writer, '\n');
_ = reader.toss(1);
}
fn solve(reader: *std.io.Reader, ally: std.mem.Allocator) !struct { u64, u64 } {
var line = std.Io.Writer.Allocating.init(ally);
defer line.deinit();
try read_line(reader, &line); // Reads one line into the writer
line.written() // The line as bytes
...
}
pub fn main() !void {
...
// Set up buffered reader for stdin.
var stdin_buffer: [1024]u8 = undefined;
var stdin_reader = std.fs.File.stdin().reader(&stdin_buffer);
const stdin = &stdin_reader.interface;
const result = try solve(stdin, ally);
}
it's a bit spread out
but at least the read logic itself is in one place
ah you read it into the writer
ok
omg it prints
finally
i'm just going to presume p2 is asking for the total number of tachyon beams where each split is a unique beam
||yeah||
Idris 1 is deprecated.
Idris 2 is still a work in progress
spent a good 10 minutes today on somehow misreading the problem statement and thinking I need to connect 12 boxes in the test, rather than 10 ๐ฅด
As such, documentation is no longer available through the website. If you still require access to the Idris 1 documentation, the following Internet Archive (aka. Wayback Machine) snapshots are available
AAAAAA
how large were your ints?
u64
finally
whoops shadowed a variable lol```
Error: While processing right hand side of main. Can't solve constraint between: length junctionBoxes and length junctionBoxes.
you know what
after all, it's better to leave a day unsolved rather than to submit a dishonest solution (ie written by llm)
๐
ill figure out this ||DSU|| thing sooner or later
DSU isn't actually so complicated, it's a very obvious structure that you put some optimizations on top of to make it perform well
basically you have the idea of representatives of a set, to start with everything is their own representative, which we can represent as arrows to themselves
in practice, this is probably just represented as [0, 1, 2, 3]
0 points to 0, 1 to 1, ...
Algorithms and data structures. Semester 1. Lecture 8.
In the eighth lecture, we discussed another useful data structure, the Disjoint Sets (Union-Find).
Discussion and home tasks: https://codeforces.com/blog/entry/84224
ITMO University, 2020
when we want to take the union of two sets we just re-point one of the arrows, e.g. merging A and B could be done by putting an arrow from B to A (or A to B)
-# (non spoiler chat?)
https://github.com/cheran-senthil/PyRival/blob/master/pyrival/data_structures/DisjointSetUnion.py
This is my go-to implementation of dsu
โก Competitive Programming Library. Contribute to cheran-senthil/PyRival development by creating an account on GitHub.
To query which set something belongs to you just follow the links until something points to itself
how does this look like in code?
like, the re-pointing
union of disjoint sets
it's not really a problem specific thing, so it's hopefully fine
Pointing is generally represented by normal variable references
||Well, it's super relevant to day 8...||
Pretty easy. Just maintain a parent array. For each index i, parent[i] can store the index of the parent of the set containing i.
representative = [0, 1, 2, 3]
representative[1] = 0
the issue with doing it naively is that you can end up with long chains, worst case O(n)
but there is a very simple idea to make it amortized O(log n)
Isn't this where path compression comes in?
while during traversal you are figuring out where all of the nodes in the path should end up at the end, so we could just update them to point there (often done in the return part in a recursion)
so if we queried C we would update C, D, B to all point to A directly
and we end up with the now more optimized
so later queries got cheaper
there are other optimizations you can do, but this is enough to get you going
in particular what you can do is to always merge a smaller set into a larger set, this on its own also produces amortized O(log n) operations, but you can combine it with the process discussed above to get something even better
iirc if you drop path compression it should be fairly pure
and you still get O(log n) operations
i implemented a dsu in purescript last year as well
i'm getting flashbacks
if im understanding correctly, ||each day 8 circuit is a node here, right?||
||each junction box is a node||
||what are the circuits then?||
||The sets||
||every junction box (node) starts out as its own circuit (set)||
and then you ||merge circuits||
||And any group of nodes that are connected by pointers is a set||
||Initially there are as many circuits as junction boxes, and then you start connecting the closest junction boxes together||
||so basically i merge all the closest nodes?||
you ||try to merge|| until you have ||successfully merged whatever many times||
||except if they're already connected fully, but using a DSU you don't have to worry about it the DSU logic takes care of that||
you need to check that you don't ||count combining things already in the same set already||
but that's easy
yeah
if ||find(x) == find(y)|| then ||they are in the same set||
||how do i actually get the list of sets/circuits? like, iterate through every node and see which other nodes point to it?||
if you add in ||tracking sizes|| for the sake of ||union by size|| you already have the information you need
but you can also just ||iterate over all the nodes and count how many times find(x) appears is to get the sizes of each component||
i.e. you could do something like ||Counter(find(x) for x in nodes)||
#advent-of-code message
evergreen message
has anyone finished idris yet?
no
no
understandable
I haven't managed to read the input
I can read one line and parse that
but finding docs is...hard
i've read it but i'm having issues with fins and nats and vects and lists
and imports bringing everything into scope
If you run out of memory while attempting to link Idris, try using ld.gold
wow
i'm mostly using these
https://www.idris-lang.org/Idris2/base/
https://idris-community.github.io/idris2-tutorial/
ok thx
i was using the first one, but i was on a specific page and i didn't know how to get to the home page
||https://idris-community.github.io/idris2-tutorial/Tutorial/Traverse.html|| might help if you can already parse one line
you know, maybe I should be lazy and just use their csv module
fair lol
the idris2 repl is so bad compared to the original
not even readline integration/completions
i have syntax highlighting at the very least
i just want a repl that accepts arrow keys ๐ญ
implementation Show JunctionBox where
show = joinBy ", " . (\[x,y,z] => [x,y,z]) . map show . components
I tried installing idris1 to see what y'all are struggling with, but the suggested solution cabal install idris only works for cabal <= 3.4, which is too ancient to get from apt ๐ฅด
idris1 is deprecated, don'cha know?
it has been deprecated for like 4 months!
there's a toList lmao i thought i tried that lol
tf does Error: Undefined name unsafePerformIO. mean
am i performing unsafe IO or do i have an undefined variable name?
I have decided to join you in suffering
I should probably install the lsp for my own sanity
same
same
the only valid program i have written is hello world
note for others: the plugin espects a idris2 project idris2 --init
i have managed to read and print a file
i already have this many tabs
ok for my own sanity i'm just gonna quickly do a python sol first
Today is crazy, I just got my first star and have been working on it since half past nine.
congratulations!๐
what's this about
https://adventofcode.com/ a little bit of fun
a series of programming puzzles that runs every December. we have a dedicated space in this server to discuss them and (if you want) have some friendly competition among ourselves.
cursed syntax highlighting
deep inhale
compiling hole
the 3d bit isn't the major thing
ohh reading more yeah lets ee
||all you need to know is to compute straight line distance||
okay
now that i have read it
it doesn't really matter
its just distance between two
then make circuits of two pair
Mfw by the time the next Sunday will come aoc would have ended alr
I should have been studying for exams, but priorities have to be set
so real, I had an exam this morning that I did AOC ahead of, and exams tomorrow and the day after (and Friday) but here we are
TIL there's comments in the problems ๐
wt d fuck
how do one even see it lmao
try hovering over it
ฤฐm code
it doesn't highlight for me either, weird. maybe it's disabled until you solve aoc2025?
firefox actually
i did solve it though
and its not
The CIA wishes it had our level of AoC redactions
can we have the epstein files?
we have epstein files in pydis
epstein files in pydis:
It looks like it's missing in the styles. Back in 2023 there was a CSS style for article [title] highlighting those, and in 2025 it's missing.
For day 2 are the examples correct for part 1?
yh
@minor cave i'd like to say
me from 2 days ago kinda wished to have some functional languages in the roulette
i would like to retract that wish, functional languages are terrible except gleam
I still have exams until the 22nd, so it's probably good for my grades that it's only 12 puzzles.
oh, it's an inline stylesheet. so probably it's intentionally not highlighted, and will be once you solve aoc 2025
95-115 has one invalid ID, 99.
998-1012 has one invalid ID, 1010.```
How so 998-1012 has 1010????
day 1 comments,
between 998 and 1012
comes 1010
its a range
Ohh okok thanks
yes
Don't understand this but will try after
wait what are you asking about
its like comments hidden but yeah
the range or the comments
around this part
comments
relatable
i have an exam in 6 hours and i'm sitting here idris'ing
what stickie actually meant was functional functional langs
The range
I gave up :)
if you give me polyml i'd be happy
ocaml ๐
that's about it
idris was insistent that a List of points was actually a singular point and not a list of points
i have about 2 hours of experience with ocaml
they did mention that these were ranges a few times...
Lmaoo 
i would give up but it's been 3 hours
and i'm almost there
Lmfaoooo, I was tempted to add Gleam into the rotation. I might still.
I think I've managed to pick really incompatible languages with the puzzles for the day except for 1 day
which ๐๏ธ
wait how'd you solve p1 without this knowledge nvm I misread
or, maybe it's that the languages you picked are incompatible with most problems ๐ฅด
:)
still not done p1
I think y'all thought the crystal day was fine? Or maybe the zig one?
alright man
I think C would've been fine for most other days... except the day rolled it for
ah yeah zig was kinda chill. parsing was easy, so it was just fast. no complex data structures needed
zig was not chill for me
i struggled with a lot of docs being outdated
once i got past parsing it was fine
me fr
why cant i do today's problem?
granted ive only been at it for like
2 ish hours
but not evn gettting part 1 is horrendous
Problems get harder
yeah. solving the problem itself was fine
eh i did yesterday[s immediately after getting up while literally brushing
not making much progress with today's is
:<
sometimes you might just not be familiar with a specific algorithm/data structure
bruh
hm yeah
i also made this mistake tbh. I did for a,b in data: for x in [a,b] and confusedly stared at the problem description when it didn't work
bruh
๐ญ
me too ๐
I'm glad we're finally numbering our debug prints
the issue for me was forgetting to include the end point
i've always numbered my debug prints
gotta know which joever it was
wtf is joever
tho this is the first time i've actually got a printed joever
For part 2 of day 2,
In
1188511880-1188511890
1188 is repeated twice in all numbers in this range!
So y only consider 1188511885?
it's not just any substring is repeated twice
the entire number has to be some number repeated twice
or actually if you're talking part 2 then not necessarily twice
Alr alr that's make it easier(not really
)
but the entire number still has to be one specific number, repeated some number of times
it does though
only took me half an hour
and the solution sucks ass
should have used regx or something
ohh mb is this spoiler..
lol
accidentally pasted my fucking input in
:D
ok fuck me
okay what could i be doing wrong
it works on the example input
Bro can anyone help me
is there a thing today with confusing example input
not really, do you wanna move to #aoc-solution-hints?
well, today I misread 10 as 12 somehow
besides that, not really
oh I guess make sure you're doing 1000 and not 10
make sure you're changing the number of connections to make
it's 10 for example and 1000 for real input
i did do thaaat hm
failing that there is more debugging you can do
I have a test case posted in #aoc-solution-hints
ok lets try that
wasn't aware day one resets the inputs it gives you if you get it wrong๐ญ
i was trying for so long and was sure code worked
it doesnt?
mine was different i swear
maybe i just copied it in wrong the first time
i used ctrl A but i guess it didn't copy it in right cause the second list is way longer i've just noticed
can sql solve these i'm not sure of its limits
trust me
theres people doing day 7 in excel
sql can probably solve some of these
wouldn't even be surprised i saw someone code minecraft in power point last time
there are technically no limits in (modern) sql, it is turing complete
but I don't know how feasible it would be to solve any given problem practically
thats interesting something i'd have to look into more at some point since i only really know its most important basics (even though i'd never attempt these tasks in sql lol)
procedures might help a fair bit
has been going for a while now
Ah
since 25/11
Dang
some great commit names today
Works on example
But fails on actual
๐ญ โ ๏ธ
Whatโs ur approach
follow the saga in #aoc-solution-hints
can anyone spoiler p2 for me?
truly in the trenches with "bleh" ๐ญ
in any case ill post both parts when im done
how did you do p1
you solved p1?
it's not a huge leap at all
||continue joining, find the first connection that causes everything to be connected||
once you do p1 you should be able to do p2 directly
good, so ||actually tracking 'groups'|| is the way to go
I should write my python like I do my C...
"objects? no! index hell."
ok I did that
||```py
i2c = [] # index -> coords
c2i = {} # coords -> index
i2g = [] # index -> group
g2i = {} # group -> indices
i2c will never not be Inter-Integrated Circuit in my mind lmao
OK I actually do not know why I made c2i
ohh that's what it stands for
No idea why I'd never actually checked despite using it
<@&831776746206265384>
!compban 1443489344273776836
:incoming_envelope: :ok_hand: applied ban to @final mesa until <t:1765564442:f> (4 days).
what happened here
crypto spam got removed
ok so
part 2
we're continuing to pair closest points?
until we get one contiguous circuit?
im not sure what we're pairing lol
is it asking what the last closest pair is
or what pair closes the already mapped circuit?
yes
ok
lets see
bruh
my code thinks everything is connected in example input after pairing 23 numbers
which is ok ig
but then it thinks the list formed has like 18 elements
which isnt believable
idk whats going on
argh
this shouldnt be hard at all
wow Zig was an experience, I can see why this was chosen for that one financial database and why it is as niche as it is.
at least the day itself wasn't ||too difficult||.
part 1 is just ||dsu|| right?
i feel like the only solution i can think of is extremely suboptimal
i dont want to implement it
every day uses ||data structures and ulgorithms||. but yes
300 ms solution for both parts is good enough?
Probably the sorting is the slowest step
tfw the discpline that is made up of ||data structures and algorithms|| requires ||data structures and algorithms||
||ulgorithms*||
yeah, naive sorting took about 300ms for me too
are y'all making your own implementations?
I have in the past, this time I just borrowed scipy's
same
laziness at it's peak
ok
ffs
im gonnna be here a while
come to think of it, shouldve written a ||binary search||
ykw
i cant be fucked to write one
imma do it manually
works
Hey guys Im new to Python (and coding lets say). Im doing the 1st task and Im stuck on how to read the text from each line.
I made an if statement using an array to read whether to move left or right.
But now Im stuck with how to read the numbers after since they vary from 1-3 digits.
we typically read from a txt file
you can use with open
then you have methods like read(), readlines()
stuff
this is what i have as a basic template in my aoc files:
with open('d4.txt') as input:
puzzle_input = [i.strip() for i in input.readlines()]
then you can do whatever you want in there
add your stuffs
lets say you wanna split at '-', you can use ||the .split() method||
my parsing for d1 is:
||```py
with open("d1.txt") as input:
puzzle_input: list[str] = [i.strip() for i in input.readlines()]
instructions: list[tuple[str, int]] = [(i[0], int(i[1:])) for i in puzzle_input]
its stored like that just cuz its convenient
for me
Yes thx I was looking for this
||(i[0], int(i[1:])||
yes thx
am i understanding correctly that for star 2 we need to start from the circuits we got in the end of star 1? (after connecting 10 first pairs). And then continue until we get one circuit?
day 8 (today)
Yeah, you can restart the computation if that really tickles your fancy but otherwise...
just keep pairing
but then isnt the first connection already exactly one circuit?
just A--B
no
it sure isn't a circuit that spans all the points
the rest are unconnected
good on you for finding that tho
im sure some people had that in their first iteration and had to change their code
i forgot how to write ||binary searches|| tbh
what would you be ||binary searching|| over?
just ||run the computation a bunch of times, and see when the first time it returns a single connected list is||
otherwise its tooooo many iterations
at least the way i implemented it
i had to do it manually tbh
but for final code i should write the thing
i wonder how yall did it without that
How would ||you be able to skip computation in this binary search case||?
ig youd have faster connection making
well youd just have to do fewer.
I don't see any way of ||skipping iterations|| here
If you were here for last year, you would know ๐
the invisible hand of the kat has been known to manipulate the wheel on certain days
It stops being stockatstic, some would say
๐ญ
:)
The house always wins
not for the computations
for how many times you have to do it
ok so i just ||have a function that does the bloody computation for n pairs||
LMFAO those are wise words
yes that's what I'm referring to
and i didnt wanna modify the function to ||keep pairing until everything is paired||
so like for part 1:
Ok, but then if you do that your runtime gets an extra log(n) tacked on for fun
now i can just ||binary search over the possible number of pairs|| and do that
im doing a lot of repeat computations tho yea
yep
ig its cuz of how im handling the pairing
alr lemme try to change it-
very scary
presenting more great commit names
LMFAO
total sanity loss, a tale in 6 acts
I guess it's pretty expected depending on how you implement the solution
that part 2 would be fast
i might be missing something but in day 8 part 1 why do they only make the 10 closest connections? for the actual input data do i make the 500 closest connections (n / 2) or only 10?
After making the ten shortest connections, there are 11 circuits
It's an arbitrary limit. 10 for the example, 1000 for the real input.
Your list contains many junction boxes; connect together the 1000 pairs of junction boxes which are closest together.
thanks, not sure how i missed this
that difference should have been bolded i think
like how a lot of other important info on the prose is bolded
cuz it took forever to actually find that
The 1000 is in bold
๐
tbh it was night
might as well be cuz of late
I believe I'm legally blind in my left eye!
Oh. nvm. I don't meet the legal US requirements.
bruh
Visual Acuity: 20/200 or worse in the better eye with corrective lenses.
I was told (incorrectly) that if you need -10 corrective lenses, you're legally blind. Google says it's the corrected vision that counts, not the without-glasses vision.
I also have no idea how 20/200 translates to prescriptions.
isaac put on the glasses because
60 seconds!!
lol. I always have glasses on unless I'm sleeping
i hope there is no more parsing
i really don't wanan do it tonight
im too sleepy for it
5 seconds!
<@&518565788744024082> Good morning! Day 9 is ready to be attempted. View it online now at https://adventofcode.com/2025/day/9. Good luck!
is the carbon compiler even finished
fr ๐
well
easier than some of the previous ones imo ๐ญ
fr
i shit you not
LMAOO
at least i got it done
LOL ๐ญ
From my brief look into it there should be a stable enough compiler for it. If not I have a backup language
i shall look into it after i finish my exam
though someone else will hopefully have done that before then
never even heard of carbon
google's c++ successor thingy
Ultimately, the largest rectangle you can make in this example has area 50. One way to do this is between 2,5 and 11,1:
am I crazy or is this wrong?
!e print(abs(2 - 11) * abs(5 - 1))
:white_check_mark: Your 3.14 eval job has completed with return code 0.
36
you're ||off by one, there's 11 - 2 + 1 tiles between 11 and 2||
If I had a nickel for every time I hit an ||off by one|| I'd be rich
inclusive ranges, amirite
i am a fan of this backup language
||If I had one (1) nickel for every time i hit an OBE, I'd have no nickels||
get WA
add additional conditions to shrink answer space
get higher answer than before
AC
Damn giant inputs ๐
oh wow carbon version 0.0.0-0.nightly.2025.12.09 released 3 hours ago
๐
enable execution :D
oh right, forgot the error message:
<source>:2:16: error: `package` declarations must end with a `;`
package sample api;
^~~
<source>:2:1: error: semantics TODO: `handle invalid parse trees in `check``
package sample api;
^~~~~~~~~~~~~~~~~~~
Compiler returned: 1
but apparently it just works if i don't modify anything ๐
it hurts so much to see so many libraries that do exactly what i need to do to solve part 2
and force myself to not use any of them
!e
print('..............'.count('.'))
:white_check_mark: Your 3.14 eval job has completed with return code 0.
14
new york?
wow, there's only three days left ๐
lets see if im almost done
#1445278429372219422 message
How could I've made this better
whoops
now trying to solve day9 in julia
once again I try julia and once again I have to wait multiple seconds for the REPL to load, etc. I wonder if I'm doing something wrong
!e
print(len('.......X.'))
:white_check_mark: Your 3.14 eval job has completed with return code 0.
9
let me guess
part 2 has something to do with counting the tiles in the rectangle
ok not confident at all
yeah no ||floodfill|| just wont work ig
ok im gonna think about the part 2 later
Oh shit, we're doing carbon?
yeah it's honestly not that bad
fuck variable shadowing
i am running out of variables and shadowing like 1e9 times and not realizing that i am shadowing
ERROR: MethodError: no method matching filter(::var"#star##6#star##7"{โฆ}, ::Base.Generator{โฆ})
I'm doing Julia instead of Carbon ๐ฅด
Before I throw myself at todays puzzle, will I need as much time today as I did yesterday?
More
well, I don't have much time today, but in that case, the rest will have to wait.
more prolly
The first one was easy, but the second seems to take a while.
this what the first one looks like
Damn on-call pages blocking AoC work
while my very efficient part 2 solution runs... how are y'all doing? ๐
my solution got slimed by oom killer
umm.... time to think of another solution
Am I correct in assuming the 'curve' never intersects itself?
||If you mean the boundary, yes.||
Hmmm... I see a nยฒ log n solution I think
it took me 6 fucking hours
Idk why I assumed for the first part that if dist btw 2 points is maximum area will be maximum too , corrected it and part 2 has shocked me too much
hahahahhaa
indeed
i think i have a working algorithm in mind
lets see
might go out to eat rn so ill implement it later
Please explain
are you doing tuple(map(int, ...)) somewhere in your parsing code?
yes
My inputs are basically a list of pairs of 2 coordinates ((x1, y1), (x2,y2))
yeah, so when you do that, python doesn't know that your input specifically has 2d points, so the type is a tuple of unknown size of ints
oh understood so I've to change the parsing
i usually just put a pyright: ignore[whatever the rule is] in my parser for that
no the code is fine
the type checker just doesn't know your input looks like that
usually you try and narrow it down as early as possible
so I'd probably do like points: list[tuple[int, int]] = ... and then ignore the type warning there
k Thanks!
!compban 1357282860972642314
<@&831776746206265384>
:incoming_envelope: :ok_hand: applied ban to @errant saddle until <t:1765643797:f> (4 days).
Why are they banned for 4 days ?
Compromised account
If they regain control of their account they can re-join. It is very rare for them to join the server while still compromised
Ohhh I see makes sense
Are most of the scam accounts nowadays just normals peeps
Compromised
Yeah
Dang
is it just me or has the number of compromised accounts seen an uptick in the past week or so
Probably coincides with holidays time off and increased activity on discord in general
hm, makes sense
this is how my data looks
I haven't done p2 yet aaa
can someone tell me whether the following is true:
||a rectangle is valid for p2 if at least two corners are red tiles, AND there is at least one red tile each that is
- to the top-right of the rectangle
- to the top-left of the rectangle
- to the bottom-right of the rectangle
- to the bottom-left of the rectangle
where I count the red tiles that are just on the edge of the rectangle, and therefore at least two of these are fulfilled by the two corner red tiles||
||the other 2 corners need not be red at all they can be green too i.e there is a red tile somewhere if you extend x and y outward||
that's what I mean with 'to the x-y'
ah I misunderstood
yeah that's correct then
funny, I made a lucky guess with the scaling, all numbers are ||between 0 and 100.000||
I mean coordinates
but you can also obviously see the final number must be under 10.000.000.000
No i mean that too
I was trying to render
And it said out of range
Hmmm
Index error
how is 0.7 sec for day 9 part 2?
Whats that
time of code running
Hmmm what does code mean
you're trolling ryt?
Yes im trolling
goddamn great code
That's what I got as well
holy shit dude
my code is gonna take forever to run
it gets the right inside for example input but itll take forever for actual input
idk if i should let it run
we're talking about half an hour here maybe
@hidden musk how build a carbon binary?
there's an example on the github, you have to manually use the linker
๐ญ
#/usr/bin/env bash
VERSION="0.0.0-0.nightly.2025.12.09"
~/carbon_toolchain-${VERSION}/bin/carbon compile --output=generated.o generated.carbon \
&& ~/carbon_toolchain-${VERSION}/bin/carbon link --output=generated generated.o \
&& ./generated
ok i made it slightly faster
now itll take just some mins
hopefully its not wrong

> bash build.sh main.carbon
ld.lld: error: undefined symbol: _CRange.Core
>>> referenced by main.carbon:13
>>> main.o:(_CMake.Sieve.Main)
>>> referenced by main.carbon:13
>>> main.o:(main)
ld.lld: error: undefined symbol: _CInclusiveRange.Core
>>> referenced by main.carbon:34
>>> main.o:(main)
error: linker command failed with exit code 1 (use -v to see invocation)
do I need to reference the lib directory manually?
show code? though honestly i have no idea
I solved AoC 2015 day 19 part 2, so now I'm all set for ||this year's path-finding||
I copied one of their examples and modified the "main" function
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
import Core library "io";
import Core library "range";
// Compute and return the number of primes less than 1000.
class Sieve {
fn Make() -> Sieve {
returned var s: Sieve;
for (n: i32 in Core.Range(1000)) {
s.is_prime[n] = true;
}
return var;
}
fn MarkMultiplesNotPrime[ref self: Self](p: i32) {
var n: i32 = p * 2;
while (n < 1000) {
self.is_prime[n] = false;
n += p;
}
}
var is_prime: array(bool, 1000);
}
fn Run() {
var s: Sieve = Sieve.Make();
var number_of_primes: i32 = 0;
for (n: i32 in Core.InclusiveRange(2, 999)) {
if (s.is_prime[n]) {
++number_of_primes;
Core.Print(n);
s.MarkMultiplesNotPrime(n);
}
}
Core.Print(number_of_primes);
}
made it even a bit more faster
maybe their examples are outdated?
oh it's the range. i'm pretty sure that doesn't exist. @feral hazel played around with the ranges more i think
do you have some minimal example file that works? ๐ฅฒ
istg if after all this minutes of runtime its wrong ill cry
also, why does Print not accept a string?
mfw no generics
oh actually, there is ReadChar, so maybe i don't need python today at all ๐ค
also, the language server is ass
that or I messed up some part of the setup
all the errors
oh yeah i couldn't get the built in range functions to work but the constructor for the actual object they create does work
oh these look helpful
ah the lang should have options but it still overloads the output lol
https://carbon.compiler-explorer.com/z/41YMeEcvd
todo
how is it 255 when it's an i32 ๐ฅด
oh what i didn't even notice that
it looks like it's converting the output to a u8
fucking shit
it must be a u8 at some point in the function itself i guess
does carbon have dynamic arrays implemented?
I'm guessing no
and no type inference? ๐ฅฒ
is 88 seconds good
It was my initial time.
But I got it down to 600 ms.
So...
..
insane
idk where my lag is
but im having to ||import cache|| so it couldnt be good
I used pyinstrument to profile, it's pretty neat
I also made some algorithmic changes
Profile the code, to see where most of the time is spent
yeah
part 2 day 9 takes so long to compute loll
Depends how you did it. 0.4s for me.
my first pass involved calculating all red/green points and took like 5 minutes to run
my second pass was a 1 liner ||using shapely|| and finished instantly. ๐
I got mine down to about 170ms
60ms, but not python
I could probably get it down a decent amount more in a language that isn't kinda pain
I rewrote it in rust and it runs in ~9ms
I wrote mine in python and then goofed off. ๐
<@&518565788744024082> Good morning! Day 10 is ready to be attempted. View it online now at https://adventofcode.com/2025/day/10. Good luck!
today might be one I'm not able to finish right away ๐
could you do the redt
wdym?
the last two have been brutal
yeah I managed to finish the rest, most it took me on any day was 5 hours I think?
this one I have 0 idea on how to even approach
finally a language that is not pain and suffering
||regex support, how do I make the groups be all of them and not just the last match?||
hmmmm?
it is all of them no
it should be?
ah the joltages arent working
but maybe I'm doing nested groups wrong?
put the + inside the group? is that what you mean?
you'll probably want to nest a non capturing subgroup
||why even regex this one though||
so like ||`((?:\d+,?)+)||
actually i take it back its prolly a good idea
yeah I felt like manual parsing will get a bit too long
but yeah i have no clue how to approach this one
i dont think brute force would work.
alrighty then
go finish day 9\
i need to brush and have breakfast
ill be wondering about the problem while i do that
very interesting problem
i cant even think of what type of problem it is
other than just general 'optimisation'
i know exactly what to do to get day 10 part 2 to work
the only problem is
its muuuuuuuuch easier to do with libraries
and ||i just had a final for one of my classes about this exact thing today|| ๐ญ
i dont even really know how to make part 1 work
you could possibly semi brute force it
Tuff
woot finally got an answer for ||the first line in my input|| ๐ญ
I am best python developer with 10+ years experience.(
NumPy
pandas
SciPy
xarray
statsmodels
Dask
Matplotlib
Seaborn
Plotly
Bokeh
Altair
Pygal)
Who will co-work with me?
no one if you spam random channels with off-topic bullshit
...i feel like its a joke
show us your aoc resume
DM me

You missed shapely
No portfolio = no freinds
does the trivial O(2^n) solution work?
for?
p1? Yes. p2? No.
nยฒ log n ๐ฅ
p2 today is destroying me
conceptually i understand what to do, the implementation is the hard part
Importless aoc enthusiast ๐
dw youll get there!
this is the breakdown
i started in 2022 lol
Yeah I'll probably start doing past years when I get stuck on this year eventually, I don't have too much time to spend on programming anyway
alr finally got around to doing today's
part 1 done
make that 101
hmmmmmmmmm
interesting
very interesting
looks really annoying
i love multiples of 10
i am all over the place ๐
What's AoC++?
Supporter https://adventofcode.com/2025/support
damn
bruh u guys alr day 10 ๐ฉ
I lagged on day 6
and when I start I had seg fault on the data set but not on test data ๐ฉ
its cuz youre doing it in non-python then
lol
nah I wanna do string manipulation on cpp
oh yeah parsing
day 6 was fun
why not
why is there only star in this ascii art :(
cus im more comfortable with OOP
python has oop
buts it's not c++ :3
i cant imagine doing it in cpp
must be really annoying
afaik strings in general are annoying on cpp
shouldve been rust
do yall also have this
try that on c ๐
its more fun on c ๐
day 6?
yea
brace yourself tho
d7 is only slightly annoying
d8 is annoying if you dont know the required algorithm
i only got through it through having faith in 'throw resources at it'
i am still stuck at day 9 part 2
imagine
const char* a= "data";
const char* b= "data";
if (strcmp(a,b) == 0);
turns out i couldve just done it in like an hour or two then
oh its fun
can you get it to work on example input yet
my previous solution worked on example input (constructing a string grid ๐ข)
but it was super super super slow on the real
did you consider ||functools.cache|| yet?
it's not ||recursive||
i somehow forgot thats a super helpful thing
no, for the inside checks
||the rectangles you check for will have a bunch of repeating coords||
i had like ||16k hits|| or smth
why rewrite, just ||slap on the decorator||
||160k lol||
yeah but i did it yesterday and my vscode doesn't have the edit history to revert back to it
the solution was very bad though
shouldve ran git commit huh
why would i commit a non working solution
trust me mine is shit too
it runs in like
80 seconds?
but it does the job
just good practice if youre gonna tear down code
maybe youll find a way to reuse an old idea
in order to ||fill the polygon, i iterated the grid twice: top to bottom first, then left to right||
there is probably a better algorithm
i think its called ||flood fill||
you can always just branch from it
yeah no thats shit
the border of the actual inputh has like ||500k elements||
we're talking like ||25*25*10^6 elements on the inside||
uhh the day 6 data looks weird.... don't tell me on part 2 it'll add trailing 0 ._.
how did you fill it
:')
did you even do the ||string grid approach|| yourself
its just 4-5 lines
looks weird cuz of wrapping
no like 4-5 lines of input
i mean youve done part 1 right
youd know
its like this
the page looks weird cuz of wrapping
well ofc if you do like 10 lines you'll need super beefy data type cus pretty sure long long won't be enough

