#advent-of-code

1 messages ยท Page 33 of 1

sullen adder
#

now I'm waiting on the submission rate limit because I misread one word ._.

vast jetty
#

at least yall have something to show

#

ok

#

i can now find closest pairs

#

great fucking progress ig.

sullen adder
#

gl :-)

vast jetty
#

guys

#

why am i stuck on part 1

#

is that insanely dumb of me

sullen adder
#

i am also stuck on part 1, so no :-)

mossy basin
#

nope! you'll get it!

humble copper
#

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

sullen adder
#

yeah, i misread that part at first too ๐Ÿ˜ฎโ€๐Ÿ’จ

paper folio
#

aaahhhh i got part one

humble copper
vast jetty
#

ill go touch grass

#

fuck the leaderboard for today

#

ill do it

#

just later

vast jetty
#

multiple loops

uncut mason
vast jetty
#

i can think of like an n^3 or n^4 solution which is def not good enough

#

so fuck it

vast jetty
#

i prolly just cant think of the right data structure to use

#

and am instead forcing functionality onto lists that they dont have

uncut mason
#

It's not clear when to stop connecting nodes

humble copper
paper folio
#

woot woot I got pt2 too

#

time to refactor and make it pretty

worthy horizon
#

do you have some samples?

mossy basin
worthy horizon
#

oh, like a bomb fuse

mossy basin
#

yeah, it's pretty cool

worthy horizon
#

do you have it as text?

mossy basin
#

i think i deleted the generator, lemme check

worthy horizon
#

smh get more floppies

mossy basin
#

all my floppies are on the cloud

#

had to change the print to go to file though

worthy horizon
#

size 10 makes my code take about 69 ms, size 20 is about 1 second

#

so it does check out

mossy basin
#

i don't remember what size i used in the visualization... like 15?

cyan sleet
#

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?

magic oxide
#

@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

cyan sleet
#
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

magic oxide
#

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

lime fulcrum
#

||yeah||

cyan sleet
#

Idris 1 is deprecated.
Idris 2 is still a work in progress

woven solar
#

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 ๐Ÿฅด

cyan sleet
#

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

vast jetty
#

Alright

#

I think Iโ€™ll get back to it in a bit

cyan sleet
#

god compiling idris2 is slow

#

oh god, don't run the tests ๐Ÿ˜ญ

#

:(((((((

cyan sleet
#

u64

cyan sleet
feral hazel
#

whoops shadowed a variable lol```
Error: While processing right hand side of main. Can't solve constraint between: length junctionBoxes and length junctionBoxes.

hollow summit
#

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

cyan sleet
#

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

whole schooner
cyan sleet
#

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)

feral hazel
#

-# (non spoiler chat?)

whole schooner
cyan sleet
#

To query which set something belongs to you just follow the links until something points to itself

hollow summit
#

like, the re-pointing

half swan
#

union of disjoint sets

cyan sleet
bright spindle
bright spindle
whole schooner
cyan sleet
#

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)

whole schooner
cyan sleet
#

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)

magic oxide
#

oh god i have to implement a functional dsu

#

please tell me there's mutability

cyan sleet
#

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

cyan sleet
#

and you still get O(log n) operations

magic oxide
#

i'm getting flashbacks

hollow summit
half swan
#

||each junction box is a node||

hollow summit
#

||what are the circuits then?||

bright spindle
cyan sleet
#

||every junction box (node) starts out as its own circuit (set)||

#

and then you ||merge circuits||

bright spindle
#

||And any group of nodes that are connected by pointers is a set||

half swan
#

||Initially there are as many circuits as junction boxes, and then you start connecting the closest junction boxes together||

hollow summit
#

||so basically i merge all the closest nodes?||

cyan sleet
#

you ||try to merge|| until you have ||successfully merged whatever many times||

half swan
#

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

cyan sleet
#

but that's easy

half swan
#

yeah

cyan sleet
#

if ||find(x) == find(y)|| then ||they are in the same set||

hollow summit
cyan sleet
#

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)||

woven solar
magic oxide
#

has anyone finished idris yet?

cyan sleet
#

no

feral hazel
#

no

magic oxide
#

understandable

cyan sleet
#

I haven't managed to read the input

#

I can read one line and parse that

#

but finding docs is...hard

feral hazel
#

i've read it but i'm having issues with fins and nats and vects and lists

#

and imports bringing everything into scope

magic oxide
#

how do you navigate the docs

#

where are the arrows

woven solar
#

If you run out of memory while attempting to link Idris, try using ld.gold
wow

magic oxide
#

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

feral hazel
cyan sleet
#

you know, maybe I should be lazy and just use their csv module

feral hazel
#

fair lol

cyan sleet
#

the idris2 repl is so bad compared to the original

magic oxide
#

oh

#

i haven't even looked at the puzzle yet

cyan sleet
#

not even readline integration/completions

magic oxide
#

i have syntax highlighting at the very least

feral hazel
#

i just want a repl that accepts arrow keys ๐Ÿ˜ญ

cyan sleet
#

the idris 1 repl supported that

#

and tab completion

feral hazel
woven solar
#

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 ๐Ÿฅด

cyan sleet
#

idris1 is deprecated, don'cha know?

woven solar
#

it has been deprecated for like 4 months!

feral hazel
magic oxide
#

tf does Error: Undefined name unsafePerformIO. mean

#

am i performing unsafe IO or do i have an undefined variable name?

half swan
#

I have decided to join you in suffering

cyan sleet
#

I should probably install the lsp for my own sanity

magic oxide
#

same

feral hazel
#

same

magic oxide
#

the only valid program i have written is hello world

cyan sleet
#

note for others: the plugin espects a idris2 project idris2 --init

magic oxide
#

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

terse mesa
#

Today is crazy, I just got my first star and have been working on it since half past nine.

static lily
#

what's this about

half swan
tender swallow
# static lily what's this about

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.

static lily
#

oo

#

interesting

magic oxide
#

cursed syntax highlighting

half swan
#

deep inhale

hidden musk
#

compiling hole

hollow wharf
#

WAIT

#

I JUST WOKE UP

#

AND ITS A 3d PROBLEM

#

LMAO

half swan
#

the 3d bit isn't the major thing

hollow wharf
#

ohh reading more yeah lets ee

half swan
#

||all you need to know is to compute straight line distance||

magic oxide
#

yeah

#

it could be 4d and it'd still be like the same problem

hollow wharf
#

okay

#

now that i have read it

#

it doesn't really matter

#

its just distance between two

#

then make circuits of two pair

woven oriole
#

Mfw by the time the next Sunday will come aoc would have ended alr

unborn carbon
#

lmao

#

i forgot about thus

#

this

terse mesa
#

I should have been studying for exams, but priorities have to be set

frigid mural
half swan
#

TIL there's comments in the problems ๐Ÿ‘€

hollow wharf
hollow wharf
half swan
#

not all text has it

hollow wharf
half swan
#

try hovering over it

blissful granite
#

ฤฐm code

hollow wharf
#

but i found it regardless

half swan
#

chromium or gecko?

#

this might be the one time there's a chromium L

woven solar
#

it doesn't highlight for me either, weird. maybe it's disabled until you solve aoc2025?

hollow wharf
half swan
#

damn

#

I'm on zen

#

not the engine's fault then

hollow wharf
#

and its not

minor cave
#

The CIA wishes it had our level of AoC redactions

hollow wharf
#

this is from day 7

#

nice easters lmfao

half swan
woven solar
hollow wharf
#

LOL

viral grotto
#

For day 2 are the examples correct for part 1?

magic oxide
#

@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

terse mesa
woven solar
viral grotto
# hollow wharf yh
95-115 has one invalid ID, 99.
998-1012 has one invalid ID, 1010.```
How so 998-1012 has 1010????
hollow wharf
#

day 1 comments,

hollow wharf
#

comes 1010

#

its a range

viral grotto
#

Ohh okok thanks

hollow wharf
#

lmao

viral grotto
#

Wait was that part of the puzzle??

#

Or I am just thick

half swan
viral grotto
half swan
#

wait what are you asking about

hollow wharf
half swan
#

the range or the comments

hollow wharf
#

around this part

hollow wharf
magic oxide
hidden musk
viral grotto
magic oxide
#

if you give me polyml i'd be happy

hidden musk
#

ocaml ๐Ÿ‘

magic oxide
#

that's about it

half swan
#

idris was insistent that a List of points was actually a singular point and not a list of points

magic oxide
#

i have about 2 hours of experience with ocaml

tender swallow
viral grotto
#

Lmaoo ducky_skull

magic oxide
half swan
magic oxide
#

and i'm almost there

minor cave
hidden musk
#

which ๐Ÿ‘๏ธ

half swan
hidden musk
#

or, maybe it's that the languages you picked are incompatible with most problems ๐Ÿฅด

minor cave
#

:)

vast jetty
#

still not done p1

minor cave
#

I think y'all thought the crystal day was fine? Or maybe the zig one?

vast jetty
minor cave
vast jetty
#

i cant do this one apparently

#

i suck today

hidden musk
#

ah yeah zig was kinda chill. parsing was easy, so it was just fast. no complex data structures needed

magic oxide
#

zig was not chill for me

#

i struggled with a lot of docs being outdated

#

once i got past parsing it was fine

vast jetty
#

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

minor cave
#

Problems get harder

hidden musk
vast jetty
#

eh i did yesterday[s immediately after getting up while literally brushing

#

not making much progress with today's is

#

:<

magic oxide
#

sometimes you might just not be familiar with a specific algorithm/data structure

vast jetty
#

hm yeah

woven solar
vast jetty
#

at least part 1

hidden musk
vast jetty
magic oxide
#

gotta know which joever it was

vast jetty
#

wtf is joever

magic oxide
#

tho this is the first time i've actually got a printed joever

viral grotto
#

For part 2 of day 2,
In
1188511880-1188511890
1188 is repeated twice in all numbers in this range!

#

So y only consider 1188511885?

magic oxide
#

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

viral grotto
#

Alr alr that's make it easier(not really ducky_concerned )

magic oxide
#

but the entire number still has to be one specific number, repeated some number of times

vast jetty
#

(at least twice)

#

(one doesnt count as a reptition)

viral grotto
#

only took me half an hour

#

and the solution sucks ass

#

should have used regx or something

vast jetty
#

alr ooookay

#

im getting somewhere with this crap

viral grotto
#

ohh mb is this spoiler..

vast jetty
#

accidentally pasted my fucking input in

#

ok fuck me

#

okay what could i be doing wrong

#

it works on the example input

fossil vigil
#

Bro can anyone help me

vast jetty
#

is there a thing today with confusing example input

fossil vigil
#

Probably i sent the wrong channel

#

Sory

magic oxide
woven solar
#

besides that, not really

magic oxide
#

oh I guess make sure you're doing 1000 and not 10

tender swallow
vast jetty
#

i did do thaaat hm

tender swallow
#

failing that there is more debugging you can do
I have a test case posted in #aoc-solution-hints

iron roost
#

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

iron roost
#

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

woven solar
#

I wonder if duckdb is in the language roulette

#

or, like, SQL

iron roost
#

can sql solve these i'm not sure of its limits

vast jetty
#

theres people doing day 7 in excel

iron roost
#

my mouth dropped

#

what am i looking at

half swan
#

it's not as intimidating as it looks

half swan
iron roost
#

wouldn't even be surprised i saw someone code minecraft in power point last time

half swan
#

but I don't know how feasible it would be to solve any given problem practically

iron roost
#

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)

hollow wharf
half swan
#

procedures might help a fair bit

half swan
hollow wharf
half swan
#

since 25/11

hollow wharf
#

Dang

vast jetty
#

some great commit names today

hollow wharf
#

But fails on actual

#

๐Ÿ˜ญ โ˜ ๏ธ

hollow wharf
vast jetty
naive wharf
#

can anyone spoiler p2 for me?

iron roost
#

truly in the trenches with "bleh" ๐Ÿ˜ญ

vast jetty
#

in any case ill post both parts when im done

half swan
tender swallow
naive wharf
#

I didn't do p1 yet

tender swallow
#

it's not a huge leap at all

magic oxide
tender swallow
#

once you do p1 you should be able to do p2 directly

naive wharf
half swan
#

yes

#

curious, what other ideas did you have?

#

(I can't think of another option)

naive wharf
naive wharf
half swan
#

i2c will never not be Inter-Integrated Circuit in my mind lmao

naive wharf
#

OK I actually do not know why I made c2i

frigid mural
#

No idea why I'd never actually checked despite using it

tender swallow
#

<@&831776746206265384>

frigid mural
#

!compban 1443489344273776836

marsh currentBOT
#

:incoming_envelope: :ok_hand: applied ban to @final mesa until <t:1765564442:f> (4 days).

naive wharf
#

what happened here

tender swallow
#

crypto spam got removed

vast jetty
#

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?

hidden musk
vast jetty
#

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

rapid wolf
#

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

dense osprey
#

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

hidden musk
vast jetty
#

hm

#

ok

#

lets see

sharp elk
#

300 ms solution for both parts is good enough?

#

Probably the sorting is the slowest step

vast jetty
#

||ulgorithms*||

frigid mural
sharp elk
frigid mural
#

I have in the past, this time I just borrowed scipy's

sharp elk
#

laziness at it's peak

vast jetty
#

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

tiny crater
#

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.

vast jetty
#

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

tiny crater
#

Yes thx I was looking for this
||(i[0], int(i[1:])||

vast jetty
#

there you go

#

do spoiler it tho

#

double brackets

#

are those brackets

tiny crater
#

yes thx

vast jetty
#

pipes

#

whatever

austere kettle
#

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)

vast jetty
#

eh

#

sure

#

point is the rules are the same

frigid mural
vast jetty
#

just keep pairing

austere kettle
#

just A--B

vast jetty
#

no

frigid mural
#

it sure isn't a circuit that spans all the points

vast jetty
#

the rest are unconnected

austere kettle
#

ohhh

#

i thought all points we already have

#

alright

#

thanks

vast jetty
#

good on you for finding that tho

austere kettle
#

thats why i thought we need to start from end of 1

#

okay thanks guys

vast jetty
#

im sure some people had that in their first iteration and had to change their code

#

i forgot how to write ||binary searches|| tbh

frigid mural
vast jetty
austere kettle
#

okay nice, got the second star

#

thanks again guys

#

good night

vast jetty
#

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

frigid mural
vast jetty
#

ig youd have faster connection making

vast jetty
frigid mural
hollow wharf
#

Will roulette ever land on python

#

๐Ÿ˜ญ

frigid mural
#

If you were here for last year, you would know ๐Ÿ‘€

hidden musk
hollow wharf
#

I was not

frigid mural
hollow wharf
#

๐Ÿ˜ญ

vast jetty
#

for how many times you have to do it

#

ok so i just ||have a function that does the bloody computation for n pairs||

hollow wharf
frigid mural
hollow wharf
#

Itโ€™s everywhere

#

Today for me

vast jetty
#

and i didnt wanna modify the function to ||keep pairing until everything is paired||

frigid mural
vast jetty
#

now i can just ||binary search over the possible number of pairs|| and do that

#

im doing a lot of repeat computations tho yea

vast jetty
#

ig its cuz of how im handling the pairing

#

alr lemme try to change it-

#

very scary

vast jetty
#

presenting more great commit names

hollow wharf
frigid mural
#

total sanity loss, a tale in 6 acts

vast jetty
#

compare this to yesterday's

#

seriously...

bright spindle
#

I guess it's pretty expected depending on how you implement the solution

#

that part 2 would be fast

warm gazelle
#

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

ivory vigil
#

Your list contains many junction boxes; connect together the 1000 pairs of junction boxes which are closest together.

warm gazelle
humble copper
#

like how a lot of other important info on the prose is bolded

#

cuz it took forever to actually find that

ivory vigil
humble copper
#

was it?

#

didnt seem it when i tried it last night

hollow wharf
#

๐Ÿ’€

humble copper
#

๐Ÿ’€

#

i might just be blind then

hollow wharf
#

might as well be cuz of late

ivory vigil
#

Oh. nvm. I don't meet the legal US requirements.

hollow wharf
#

bruh

ivory vigil
#

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.

hollow wharf
#

isaac put on the glasses because

ivory vigil
#

60 seconds!!

hollow wharf
#

AOC is just about to start

#

YEAH

#

LMFAO

ivory vigil
#

lol. I always have glasses on unless I'm sleeping

hollow wharf
#

of course you would not have it when u going to sleep ๐Ÿ˜ญ

#

no shit

hollow wharf
#

i really don't wanan do it tonight

#

im too sleepy for it

ivory vigil
#

(Or swimming or in the shower)

#

I sorta liked the parsing. But they're less common.

hollow wharf
#

Im guessing

#

more algorithmic

#

problems

ivory vigil
#

5 seconds!

shut trellisBOT
hollow wharf
#

and there

#

bruh

#

this is a path finding thing

ivory vigil
#

Uh.... p1 was easy.

#

And now I'm stuck.

magic oxide
#

is the carbon compiler even finished

dense drum
vast jetty
dense drum
#

easier than some of the previous ones imo ๐Ÿ˜ญ

vast jetty
#

oh well

#

p2 is interesting

dense drum
#

fr

vast jetty
dense drum
#

LMAOO

vast jetty
#

one of my best times

#

ignore yesterday uh

#

that was bad

dense drum
#

me too ๐Ÿ˜ญ

#

ignore me not doing part 2 ๐Ÿ˜”

vast jetty
#

at least i got it done

dense drum
#

real

#

got busy with stuff but i want to go back and do 7-8

vast jetty
#

my part 2's can take some time

#

but still only around 2 hours

#

except stupid d8

dense drum
#

LOL ๐Ÿ˜ญ

minor cave
magic oxide
#

i shall look into it after i finish my exam

#

though someone else will hopefully have done that before then

mossy basin
#

never even heard of carbon

half swan
#

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))

marsh currentBOT
magic oxide
#

you're ||off by one, there's 11 - 2 + 1 tiles between 11 and 2||

half swan
#

If I had a nickel for every time I hit an ||off by one|| I'd be rich

mossy basin
hidden musk
vast jetty
pine tiger
#

get WA
add additional conditions to shrink answer space
get higher answer than before
AC

uncut mason
#

Damn giant inputs ๐Ÿ˜

feral hazel
#

oh wow carbon version 0.0.0-0.nightly.2025.12.09 released 3 hours ago

hidden musk
feral hazel
#

enable execution :D

hidden musk
#

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 ๐Ÿ‘

vast jetty
#

alrighty

#

we're getting somewhere

humble copper
#

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

vast jetty
#

!e

print('..............'.count('.'))

marsh currentBOT
vast jetty
#

always

#

great to have a visualisation

humble copper
#

new york?

sullen adder
#

wow, there's only three days left ๐Ÿ˜”

vast jetty
#

lets see if im almost done

viral grotto
vast jetty
#

whoops

woven solar
#

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

vast jetty
#

!e

print(len('.......X.'))

marsh currentBOT
vast jetty
#

lets see if it works with actual input tho lol

naive wharf
#

let me guess
part 2 has something to do with counting the tiles in the rectangle

vast jetty
#

ok not confident at all

#

yeah no ||floodfill|| just wont work ig

#

ok im gonna think about the part 2 later

cyan sleet
#

Oh shit, we're doing carbon?

hidden musk
#

yeah it's honestly not that bad

woven oriole
#

fuck variable shadowing

#

i am running out of variables and shadowing like 1e9 times and not realizing that i am shadowing

woven solar
#

ERROR: MethodError: no method matching filter(::var"#star##6#star##7"{โ€ฆ}, ::Base.Generator{โ€ฆ})
I'm doing Julia instead of Carbon ๐Ÿฅด

terse mesa
#

Before I throw myself at todays puzzle, will I need as much time today as I did yesterday?

terse mesa
#

well, I don't have much time today, but in that case, the rest will have to wait.

feral hazel
#

no consts for you

terse mesa
terse mesa
#

this what the first one looks like

cyan sleet
#

Damn on-call pages blocking AoC work

summer tusk
#

yippee got my python solution down to 30ms

#

for both parts + parsing

hollow summit
#

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

naive wharf
#

Am I correct in assuming the 'curve' never intersects itself?

bright spindle
naive wharf
#

Hmmm... I see a nยฒ log n solution I think

terse mesa
#

it took me 6 fucking hours

sharp elk
#

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

vast jetty
#

indeed

#

i think i have a working algorithm in mind

#

lets see

#

might go out to eat rn so ill implement it later

sharp elk
#

Please explain

magic oxide
sharp elk
#

My inputs are basically a list of pairs of 2 coordinates ((x1, y1), (x2,y2))

magic oxide
#

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

sharp elk
#

oh understood so I've to change the parsing

magic oxide
#

i usually just put a pyright: ignore[whatever the rule is] in my parser for that

magic oxide
#

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

sharp elk
#

k Thanks!

warm berry
#

!compban 1357282860972642314

hollow wharf
#

<@&831776746206265384>

marsh currentBOT
#

:incoming_envelope: :ok_hand: applied ban to @errant saddle until <t:1765643797:f> (4 days).

hollow wharf
warm berry
#

Compromised account

hollow wharf
#

Lmao

warm berry
#

If they regain control of their account they can re-join. It is very rare for them to join the server while still compromised

hollow wharf
#

Ohhh I see makes sense

hollow wharf
#

Compromised

warm berry
#

Yeah

hollow wharf
#

Dang

half swan
#

is it just me or has the number of compromised accounts seen an uptick in the past week or so

warm berry
#

Probably coincides with holidays time off and increased activity on discord in general

half swan
#

hm, makes sense

naive wharf
#

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||
half swan
#

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

naive wharf
vast jetty
#

Pretty

half swan
#

yeah that's correct then

naive wharf
# vast jetty Prettt

funny, I made a lucky guess with the scaling, all numbers are ||between 0 and 100.000||

vast jetty
#

Huh

#

I was getting stuff ||over a million||

#

Must have made some stupid error

naive wharf
#

but you can also obviously see the final number must be under 10.000.000.000

vast jetty
#

No i mean that too

#

I was trying to render

#

And it said out of range

#

Hmmm

#

Index error

sharp elk
#

how is 0.7 sec for day 9 part 2?

blissful granite
sharp elk
blissful granite
#

Hmmm what does code mean

sharp elk
blissful granite
#

Yes im trolling

lyric sigil
#

darn.

#

i might not finish day 9

vast jetty
#

goddamn great code

humble copper
#

๐Ÿฅน

#

3 more days to go :D

bright spindle
signal summit
#

guys parrt 2 i cannot get

#

day 1 part 2 i'm failing

vast jetty
#

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

cyan sleet
#

@hidden musk how build a carbon binary?

hidden musk
#

there's an example on the github, you have to manually use the linker

cyan sleet
#

๐Ÿ˜ญ

hidden musk
#
#/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
vast jetty
#

now itll take just some mins

#

hopefully its not wrong

cyan sleet
#

do I need to reference the lib directory manually?

hidden musk
#

show code? though honestly i have no idea

bright spindle
#

I solved AoC 2015 day 19 part 2, so now I'm all set for ||this year's path-finding||

cyan sleet
# hidden musk show code? though honestly i have no idea

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);
}
vast jetty
cyan sleet
#

maybe their examples are outdated?

vast jetty
#

still gonna take forever

#

IT MIGHT BE WRONG lol

hidden musk
#

oh it's the range. i'm pretty sure that doesn't exist. @feral hazel played around with the ranges more i think

cyan sleet
#

do you have some minimal example file that works? ๐Ÿฅฒ

vast jetty
#

istg if after all this minutes of runtime its wrong ill cry

cyan sleet
#

also, why does Print not accept a string?

cyan sleet
#

mfw no generics

hidden musk
#

oh actually, there is ReadChar, so maybe i don't need python today at all ๐Ÿค”

cyan sleet
#

also, the language server is ass

#

that or I messed up some part of the setup

#

all the errors

vast jetty
feral hazel
cyan sleet
hidden musk
#

oh these look helpful

feral hazel
#

todo

hidden musk
#

how is it 255 when it's an i32 ๐Ÿฅด

feral hazel
#

oh what i didn't even notice that
it looks like it's converting the output to a u8

vast jetty
#

fucking shit

hidden musk
cyan sleet
#

does carbon have dynamic arrays implemented?

#

I'm guessing no

#

and no type inference? ๐Ÿฅฒ

vast jetty
#

is 88 seconds good

bright spindle
#

But I got it down to 600 ms.

#

So...

vast jetty
#

..

#

insane

#

idk where my lag is

#

but im having to ||import cache|| so it couldnt be good

bright spindle
#

I used pyinstrument to profile, it's pretty neat

#

I also made some algorithmic changes

vast jetty
#

profile what

#

lemme just post the bd code

bright spindle
#

Profile the code, to see where most of the time is spent

vast jetty
#

oh

#

i cant even post

#

lmfao

#

too long

bright spindle
#

Pastebin

#

Or Github

vast jetty
#

yeah

vivid dove
#

part 2 day 9 takes so long to compute loll

ivory vigil
#

Depends how you did it. 0.4s for me.

rancid creek
covert arrow
#

I got mine down to about 170ms

cyan sleet
#

60ms, but not python

#

I could probably get it down a decent amount more in a language that isn't kinda pain

covert arrow
#

I rewrote it in rust and it runs in ~9ms

rancid creek
#

I wrote mine in python and then goofed off. ๐Ÿ™‚

shut trellisBOT
half swan
#

today might be one I'm not able to finish right away ๐Ÿ‘€

vast jetty
#

morning

#

i just got up

vast jetty
half swan
#

wdym?

vast jetty
#

the last two have been brutal

half swan
#

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

magic oxide
#

finally a language that is not pain and suffering

half swan
#

||regex support, how do I make the groups be all of them and not just the last match?||

vast jetty
#

ok

#

this is

#

insanity

half swan
vast jetty
#

it is all of them no

half swan
#

it should be?

vast jetty
#

ah the joltages arent working

half swan
#

but maybe I'm doing nested groups wrong?

magic oxide
#

put the + inside the group? is that what you mean?

#

you'll probably want to nest a non capturing subgroup

vast jetty
#

||why even regex this one though||

magic oxide
#

so like ||`((?:\d+,?)+)||

vast jetty
#

actually i take it back its prolly a good idea

half swan
#

yeah I felt like manual parsing will get a bit too long

vast jetty
#

but yeah i have no clue how to approach this one

#

i dont think brute force would work.

magic oxide
#

I'm not looking at it until I finish day 9

#

you guys have fun

half swan
#

alrighty then

vast jetty
#

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'

humble copper
#

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|| ๐Ÿ˜ญ

vast jetty
#

i dont even really know how to make part 1 work

#

you could possibly semi brute force it

waxen hound
#

Tuff

feral hazel
#

woot finally got an answer for ||the first line in my input|| ๐Ÿ˜ญ

sage nacelle
#

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?

mossy basin
#

no one if you spam random channels with off-topic bullshit

vast jetty
#

...i feel like its a joke

sage nacelle
#

DM me

vast jetty
vast jetty
#

i wanna see their aoc stars

#

better have like 300 minimum

#

even i have 100

naive wharf
#

does the trivial O(2^n) solution work?

ivory vigil
naive wharf
#

today

#

wow I think I have a moderately elegant solution for yesterday

ivory vigil
naive wharf
humble copper
#

p2 today is destroying me

#

conceptually i understand what to do, the implementation is the hard part

woven oriole
#

Importless aoc enthusiast ๐Ÿ‘

sweet cove
#

I have 2

vast jetty
#

this is the breakdown

#

i started in 2022 lol

sweet cove
# vast jetty dw youll get there!

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

uncut mason
#

If you want a confidence boost, do 2015. It's not too hard.

vast jetty
#

alr finally got around to doing today's

#

part 1 done

#

make that 101

#

hmmmmmmmmm

#

interesting

#

very interesting

#

looks really annoying

peak dock
#

i love multiples of 10

strange zinc
#

i am all over the place ๐Ÿ™ˆ

uncut mason
#

What's AoC++?

keen trout
limpid grail
mortal bronze
#

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 ๐Ÿ˜ฉ

vast jetty
mortal bronze
#

lol

vast jetty
#

cpp?

#

just do em in python much better

#

day 6 i think was slightly annoying

mortal bronze
#

nah I wanna do string manipulation on cpp

vast jetty
#

oh yeah parsing

hollow summit
#

day 6 was fun

vast jetty
#

why cpp tho

#

the language roulette was c

mortal bronze
#

why not

vast jetty
#

why is there only star in this ascii art :(

mortal bronze
hollow summit
#

python has oop

mortal bronze
#

buts it's not c++ :3

vast jetty
#

i cant imagine doing it in cpp

#

must be really annoying

#

afaik strings in general are annoying on cpp

hollow summit
#

shouldve been rust

vast jetty
mortal bronze
#

its more fun on c ๐Ÿ˜€

vast jetty
#

hey im fine with my python

#

got it done in 22 lines

#

fine by me

hollow summit
#

day 6?

vast jetty
#

yea

vast jetty
#

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'

hollow summit
#

i am still stuck at day 9 part 2

vast jetty
#

i thought itd take like dayssss to run

#

but it ran in like under a second

#

whoops

mortal bronze
vast jetty
#

turns out i couldve just done it in like an hour or two then

vast jetty
#

can you get it to work on example input yet

hollow summit
#

my previous solution worked on example input (constructing a string grid ๐Ÿ˜ข)

#

but it was super super super slow on the real

vast jetty
#

did you consider ||functools.cache|| yet?

hollow summit
#

it's not ||recursive||

vast jetty
#

i somehow forgot thats a super helpful thing

vast jetty
#

||the rectangles you check for will have a bunch of repeating coords||

#

i had like ||16k hits|| or smth

hollow summit
#

bruh

#

i shouldve tried that

#

time to rewrite

vast jetty
vast jetty
vast jetty
hollow summit
#

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

vast jetty
#

shouldve ran git commit huh

hollow summit
#

why would i commit a non working solution

vast jetty
#

it runs in like

#

80 seconds?

#

but it does the job

vast jetty
#

maybe youll find a way to reuse an old idea

hollow summit
#

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

vast jetty
#

you can always just branch from it

vast jetty
#

the border of the actual inputh has like ||500k elements||

#

we're talking like ||25*25*10^6 elements on the inside||

mortal bronze
#

uhh the day 6 data looks weird.... don't tell me on part 2 it'll add trailing 0 ._.

hollow summit
vast jetty
hollow summit
#

did you even do the ||string grid approach|| yourself

vast jetty
vast jetty
#

looks weird cuz of wrapping

mortal bronze
#

lines of code??

vast jetty
#

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

mortal bronze
#

well ofc if you do like 10 lines you'll need super beefy data type cus pretty sure long long won't be enough

vast jetty
#

yes

#

do long long long long

mortal bronze
#

you would probably need int256_t

#

lol

vast jetty
#

i have to go give a test

#

3 hours

#

then ill actually sit and think about d10 p2