#advent-of-code

1 messages Β· Page 31 of 1

pulsar drum
#

ithink the puzzle descriptions are clear enough, but i have been doing them for a while

#

but i anyway mainly skim through the descriptions, and use the example input and output to deduce what needs to be done

tender swallow
#

I thought it was quite clear.

peak dock
#

huh how does this happen

winged trellis
#

i dont know

#

just found it randomly while testing the hyperfine tool

winged trellis
#

yeah... now it is the same

dense osprey
#

really enjoyed solving today's problem

bright spindle
#

I feel like today was the easiest one so far

warm berry
#

Oh no part 2. Since I don't know DSA this is going to be fun....

shy tulip
#

I looked at my colleagues code and learned some new syntax (being able to define variables and use them in a function using let/in) I wouldve done part 1 very differently otherwise

#

RIght now I did part1 recursivly

warm berry
#

I am really really bad at identifying and implementing recursive solutions

#

.

ripe meteor
#

ok hold up a second

#

today's problem is fixing escalators?
can we not simply walk down the stopped escalators?

#

"But, don't worry! It's not fried; it just needs power. Maybe you can get it running while I keep working on the elevators."
what kind of lazy ass xmas helper are we

bright spindle
ripe meteor
#

christmas hopes and dreams are at stake and we're stuck doing maintenance work instead of just walking down some steps

white arrow
#

can somebody help me with day1 part 2 im really struggling

maiden drum
#

guys what is this channel?

#

can someone explain me please?

bright spindle
#

AoC is not associated with this server, but we open a set of channels for it every year, as a server event.

#

And we have a server leaderboard and such.

oak flax
#

i like the first 3 days of this year so far py_strong

bright spindle
#

In fact, you can do this year as well as all previous years whenever you want

#

We only have a leaderboard for this year integrated with the server though

#

But the puzzles themselves are doable forever

bright spindle
mortal bronze
#

Hey the day 3 is much easier than the day 2 :D

shy tulip
bright spindle
mortal bronze
silent nymph
shy tulip
#

For example here it wasn't used in number == 0
||```diff
| number == 0 = (read :: String -> Int) batteries

  • | otherwise = findJoltage2 (batteries ++ [nextDigit]) (number - 1) (drop 1 (dropWhile (/= nextDigit) bank))
  • where
  • nextDigit = maximum (take (length bank - number + 1) bank)
  • | otherwise =
  •  let nextDigit = maximum (take (length bank - number + 1) bank)
    
  •   in findJoltage2 (batteries ++ [nextDigit]) (number - 1) (drop 1 (dropWhile (/= nextDigit) bank))```||
    
hollow wharf
#

how you doing

#

guys

#

sorry i wasn't up at 12 😭

vast jetty
#

lol doing regex for day2 is apparently ridiculously easy

#

i was scared of doing it cuz

#

i dont have enough regex practice really

#

but i could write it up in just a few minutes and well

#

yeah!

#

ok its not exactly DONE DONE yet but its ridiculously easy

#

just a few lines of code total

uneven grail
#

If im a starter in python its good for me to do advent-of-code?

vast jetty
#

yes!

#

i mean

#

do you mean in python or in coding

#

even if its coding, yes!

#

i started from 2022 and im sure i wrote some really shit code

#

but this is how you learn lol

#

and nothing is more fun than aoc for coding practice

#

tbh aoc is the only time i really do any intensive coding at all

white zealot
#

I'm still stuck on day one LOL I think I might be too new to do these LOL

thick bluff
uneven grail
warm berry
#

Yeah I don't think I'm going to do part 2 on my own

warm berry
tender swallow
white arrow
#

@bright spindle i finished day 2!!

#

found that one alot easier

#

both parts done

bright spindle
#

Good job

white arrow
#

i would do it right now but im going to a careers event thing which is obviously more important

bright spindle
uneven grail
#

How easy are these little puzzles and waht type of puzzles are they?

shy tulip
shy tulip
#

I've seen some beginners do a few tasks

#

Some found it more challanging than others

hollow wharf
blissful granite
#

Δ°m not a coder Δ° just know print

uneven grail
#

Thanks

vast jetty
#

well

#

d3 is honestly easier than days 1 and 2

#

at least for me

#

day 2 is kinda hell if you dont wanna ||regex|| it

#

day 1 is a thinker

shy tulip
#

I just bruteforced day 1 πŸ˜…

zealous gate
#

what is advent of code

south musk
#

Right at the top

white arrow
#

how did you guys find day 3? now about to start

shy tulip
white arrow
#

day 1 was HELL

#

and i mean hell on earth

coarse wagon
#

Yeah day 3 is only hell on Mars /j

white arrow
#

dont say that viv ;-;

coarse wagon
#

(I have no clue haven't done any of them)

south musk
#

although i think i have a solution after a few hints

white arrow
#

i actually dont know what approach to take

#

im wondering how hard || regex || would be

jovial imp
#

Day 3 part 2 is so nice

worthy horizon
#

advent of code baiting us with easy puzzles to drop some category theory stuff on day 11

hollow wharf
#

πŸ’€ πŸ’€ πŸ’€ πŸ’€ πŸ’€ πŸ’€

worthy horizon
#

santa needs help with his monad

jovial imp
#

how do i do spoilers

hollow wharf
south musk
worthy horizon
#
||
backtick backtick backtickpy
code
backtick backtick backtick
||
jovial imp
#

||you have to admit though that the double reccursion is nice||

hollow wharf
#

Why is the protagonist keep going more down the

#

Ground

#

lmao

worthy horizon
#

||Santa is actually Satan||

hollow wharf
#

😭

#

☠️

white arrow
#

when i print lines from a file is there a way to remove the whitespace between each one lol

#

its just annoying

hollow wharf
#

White lines between them

white arrow
#

like when i do for line in file i get

line 1

line 2
...
#

just looks annoying

#

i want it to be like

line1
line2
...
hollow wharf
south musk
#

end=""?

minor cave
#

This is what I use vast majority of the time to read the input file:

with open(r"day#/input.txt", "r") as f:
    data = f.read().splitlines()
south musk
#

I just copy and paste lmao

hollow wharf
#

πŸ’€ πŸ’€ πŸ’€ πŸ’€ πŸ’€ πŸ’€ πŸ’€

minor cave
hollow wharf
#

Yeah

hollow wharf
#

No regex there

white arrow
hollow wharf
#

Lmao

white arrow
#

just the r""

minor cave
# white arrow what is that, looks regexy

It's not, I just added in the # placeholder since I have a different folder for each day. the r is just to read it as a regex/raw string. So a \ would be an actual \ and I don't need to \\

hollow wharf
white arrow
#

oh ive never used raw strings

hollow wharf
#

To solve ur problem

white arrow
#

i know im just doing this for debugging purposes

minor cave
south musk
white arrow
#

also can we take a moment to appreciate the fact im on day 3

#

im impressed

minor cave
hollow wharf
#

I gotta commit all my files

#

To GitHub as well

ripe meteor
hollow wharf
#

I do the same

south musk
#

but yeah no whitespace issues here

minor cave
#

yeah, looking at my input no trailing whitespace

void forge
#

Finally completed day 3

ripe meteor
#

πŸ˜”

hollow wharf
ripe meteor
#

Yet another thing that complicates my day

hollow wharf
#

😭

#

Trailing white spaces?

minor cave
ripe meteor
#

Ff

#

Im pretty sure i get extra newlines

hollow wharf
#

I use same

#

I don’t get them

#

πŸ’€

ripe meteor
#

Im too cozy on the couch to get up and double check

hollow wharf
#

I literally do ctrl c then p in vim

hollow wharf
naive wharf
#

wow the AoC dev really likes the idea of 'treating numbers as sequences of digits' this year

shy tulip
#

I don't think that's a this year thing

hidden musk
#

I don't remember it that much in previous years

naive wharf
low condor
#

Usually the AOC dev really likes 2D grids

#

we're yet to see one but they are definitely coming

normal loom
#

I can't wait for the first BFS

#

πŸ₯²

low condor
#

I can't wait for the first 3D puzzle :)

hollow wharf
#

There is 3d ?!

low condor
#

there are some 3D puzzles yes

#

those are always the bane of my life

hollow wharf
#

Dang

low condor
#

can never visualise them in my mind's eye, ever

hollow wharf
#

There is a lot of things coming lmao I’m excited

#

First AOC

low condor
#

one particular one took me several years to grok

#

plus the invention of LLMs

hollow wharf
#

Hopefully not such this year

bright spindle
#

This year feels so relaxed compared to the usual, since there's no global leaderboard

low condor
#

which is nice

bright spindle
#

Even though I know someone somewhere solved every problem in 45 seconds.

low condor
#

An Xmas themed puzzle series should feel relaxed IMO

bright spindle
#

But now I can't see indisputable proof.

hollow wharf
hollow wharf
#

Very true

#

Xmas is about fun and comfy

bright spindle
#

There were years back when I was younger when I'd get up at like 5 in the morning to try to get a good time

#

And it honestly was just frustrating

low condor
#

I never ever did that

hollow wharf
#

5 am

#

Lmao

low condor
#

I only ever logged in in the morning when I was already awake

hollow wharf
#

time zones

low condor
#

but never actually woke up to do 5am

hollow wharf
#

It’s every day at 12 am

#

For me and I usually up

#

Last night fell asleep 😭 ☠️

#

Did it in morning

#

but it was chill

bright spindle
#

Maybe it was 6am. It's 6am this year anyway.

tender swallow
#

my timezone has until now been very convenient

dense gale
#

i forgot abt aoc bruh imma wanna do 3 days ontop of homework 😭

south musk
#

day 3 might be the first one i don't get all stars within the day tbh, part 2 is so hard

shy tulip
#

What are you stick on

hollow wharf
#

what are you stuck on

ripe meteor
#

i had issues coming up with the part2 solution, got help from the gf

#

she did the examples on paper and that helped

remote mauve
#

Today was easy

#

EST users at 12AM

#

I do it at 6-7 PM though

#

no reason to wake up so early

old badge
#

my part 2 works on the test data but not on the real data😭

ripe meteor
#

many such cases

torn sapphire
#

sounds like for the most part, people are split over whether they accidentally already fixed part 2's gotcha during part 1 or not

ripe meteor
#

part1 is always a brute force for me

torn sapphire
#

i mean usually i'm the same, but today's "optimisation" kinda felt so free that i couldn't not do it

potent jacinth
#

Every day optimisation is free.

low condor
#

I had no idea there was even a gotcha

mossy basin
#

yeah, i didn't even consider the brute force method

#

i saw the meme on the reddit

low condor
#

Yeah now looking at the Reddit I see what the gotcha was meant to be but didn’t even consider it

flat glen
#

is this a typo? 99 and 10 are not repeated in those ids

hollow wharf
#

then 1010

#

two times 10

#

so they are repeating hence invalid

flat glen
#

yes, but it's not in the string given. 95-115 has only one 9

minor cave
#

It's the same way why 11 is an invalid ID. It's the digit 1 repeated twice

minor cave
hollow wharf
#

yeah

flat glen
#

oh

minor cave
#

The ranges are separated by commas (,); each range gives its first ID and last ID separated by a dash (-).

hollow wharf
#

95-115 is, 95, 96, ..., 115

steep ibex
#

Hello

rancid creek
#

hullo

ivory vigil
#

Howdy

hollow wharf
#

hello

#

15 mins left to

#

midnight

#

i agree with this

#

reminds me of 2021 day 22

#

6 mins to go

#

dude what if its smth like graph problem or smth lmao

#

already

sullen adder
#

aoc time, yippee

ivory vigil
#

I haven't done an AoC Dijkstra yet this year

shut trellisBOT
hollow wharf
#

ITS UP

sleek maple
#

No way

hollow wharf
#

its 2d

glass ridge
#

Wait?

hollow wharf
#

lmfao

sleek maple
#

How can I get removed from the ping

hollow wharf
vast jetty
#

ok lol

hollow wharf
#

remove it

vast jetty
#

im gonna have a hard time today

#

not more grid stuff

#

ok

sleek maple
#

I haven't been active on this server since I joined

vast jetty
#

lets try to be somewhat fast

sleek maple
#

I dont how I got added

earnest forge
#

That was pretty neat

#

@minor cave Spoilers channel? (Sorry for ping)

vast jetty
#

thought ill copy old code for this

#

and nah

#

suffering omg

#

ok ill take my time with this one

#

i dont rememberr how this re feature works

feral hazel
#

arggg lost 2 minutes to bugs

ivory vigil
#

Ugh. Part 1 was rough. I forgot how my tools work.

quaint haven
#

did someone ping me here?

earnest forge
ivory vigil
#

@quaint haven Pingggg!

feral hazel
#

first was ||dict.get(x, y)|| and second was ||creating sth then not using it so p2 never actually went through|| lol

quaint haven
earnest forge
# ivory vigil The `l` key? Or `w`?

No, literally the right arrow key. I've been having problems with it and it decided to not work while I was being indecisive about my code lol

feral hazel
#

it's been every day now lmao i should really test on the inputs

ivory vigil
#

My p2 reused my p1

earnest forge
#

(*usually)

ivory vigil
feral hazel
earnest forge
feral hazel
earnest forge
#

Fair enough lol

ivory vigil
woven oriole
#

i am so pissed they let the ||naive work||

feral hazel
#

reusing my template from https://everybody.codes/event/2025/quests with an ungodly amount of imports and yet it's still never enough

sullen adder
#

that was a fun 2d puzzle

earnest forge
#

I've just realised this is POSTing, which is probably not correct

#

But hey, it works

#

Less serious of a bug than when GETting your private leaderboard's delete URL would delete it, I guess

ivory vigil
#

So, I skimmed the intro. I saw "rolls of paper" and thought we were working with rolls of toilet paper. I even used t for toilet paper in a var.

earnest forge
#

Lmao

woven oriole
#

day4 chat where

feral hazel
#

oo roulette true

humble copper
#

this one is okay

earnest forge
woven oriole
#

lol

#

anyways i am so mad the intended p2 is not ||multisource bfs||

pine tiger
#

what's the join command

#

i forgor

sullen adder
earnest forge
#

''.join()?

woven oriole
#

lol

earnest forge
#

Ah yeah that makes more sense lol

humble copper
earnest forge
woven oriole
#

i have had enough

#

this is day 4 and only 12 this time

#

stop with this

earnest forge
#

I mean ||the grid's only 139x139 so you only need like 70 iterations at worst||

woven oriole
humble copper
earnest forge
#

Lmao yeah if this was day 15 in a previous year

humble copper
#

there was something like that in 2021 i remember

sullen adder
#

is day 4 the equivalent of old day 8? pithink

humble copper
#

oh yeah day 15 in 2021

#

LMAO

earnest forge
#

I think this was somewhat easier than a d8 puzzle

earnest forge
humble copper
#

yep that was the one

earnest forge
#

Guess I'm just traumatised /j

humble copper
#

πŸ’”

earnest forge
#

Tbh that one doesn't actually look too bad

humble copper
#

as long as eric doesnt do a d19 again.......

pine tiger
#

what was d19

feral hazel
humble copper
#

beacon scanners

pine tiger
#

forgor what was the intended sol

earnest forge
#

Oh god yeah beacons was awful lol

humble copper
earnest forge
humble copper
#

well, intended as in "i intended for it to work when i tried it, and it did"

pine tiger
#

hm i'm looking through past day 19s

#

the ore problem was also a 19

humble copper
#

oh

#

LMAO

#

i still cant do that one </3

pine tiger
#

my c++ sol takes ages

#

it's bf + heuristics

earnest forge
#

I think I actually got ores running decently fast

#

Which year was ores?

humble copper
#

2023 i believe

hollow wharf
#

okay

ivory vigil
#

No spoilers thread today?

earnest forge
#

2023 19 is apparently something about workflows

vast jetty
#

alr done with part 1 finally

#

that was hell

vast jetty
#

ok

#

wtf is part 2

hollow wharf
#

thats it?

#

@vast jetty

#

thats it??!?!

#

that easy?!?!

#

wtf

#

this shit too easy

vast jetty
#

yeah i think its gonna be quite easy too

hollow wharf
#

part 2 took 2 mins

#

literaly

vast jetty
#

but im not gonna code it fast

rancid creek
vast jetty
#

wtf sigh

hollow wharf
#

lmfao

humble copper
#

it might be too early to say (1/3 of the way through?) but ngl im not liking this year's set of challenges compared to previous year's

vast jetty
#

!e
[2,3]-[2]

marsh currentBOT
# vast jetty !e [2,3]-[2]

:x: Your 3.14 eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "/home/main.py", line 1, in <module>
003 |     [2,3]-[2]
004 |     ~~~~~^~~~
005 | TypeError: unsupported operand type(s) for -: 'list' and 'list'
rancid creek
vast jetty
#

but you can add em?

#

absurd

#

yeah indeed

hollow wharf
#

i took same code as of part 1 added in a while loop and that was it

vast jetty
#

!e

[1,3]+[2]

hollow wharf
#

lmfao

marsh currentBOT
vast jetty
#

yeah

#

ig its just a shorthand for extending

hollow wharf
#

did u solve it

rancid creek
hollow wharf
#

guys this is over even before it started 😭

#

sad

#

im sad now

sullen adder
#

is there a day 4 forum post?

woven oriole
#

not yet

sullen adder
#

ah

#

i thought my discord client was buggy

hollow wharf
#

same

woven oriole
#

kat caught lackin

mossy basin
#

kat went to bed early, i'm looking for a mod real quick

hollow wharf
#

usually its already up as soon problems are up

vast jetty
mossy basin
#

<@&831776746206265384> anyone mind opening a spoiler channel?

rancid creek
hollow wharf
#

club!

vast jetty
#

istg gary if youre above me in leaderboard now

hollow wharf
#

ngl this might have been warm up for us to prepare for whats coming

vast jetty
#

a few minutes of difference

vast jetty
#

did it update alr

vast jetty
vast jetty
#

i couldnt quite figure out the condition for a while loop

#

so

hollow wharf
#

i put on True

vast jetty
#

that should handle it

hollow wharf
#

bro

#

just use true

#

lmao

vast jetty
hollow wharf
#

just use

#

true

vast jetty
#

yeah while True is kinda messy tho

hollow wharf
#

bruh

vast jetty
#

just in

#

case

#

so i kinda automatically avoid while true lol

#

but yeah ok that works

hollow wharf
#

lmfao

#

while true

vast jetty
#

yeah indeed

#

but it does have one escape condition pithink

hollow wharf
#

i mean putting upper bound gonna work as well

#

its all same idea

#

but good job

vast jetty
#

yeah

#

imagine theres some stupid edge case in the input

#

and im fucking waiting for it to finishh runninng

#

but its just stuck in a while True πŸ’€

#

altho thats wayyyy too many iterations for an upper bound

#

(ok it was a bit lesser i bumped it up for meme pointss)

#

lets write clean code for the spoiler channel

#

dude

hollow wharf
#

nah too much work

vast jetty
#

how is this easier than any of days 1,2,3

hollow wharf
#

this don't need any cleaner code

#

it works

#

its 12:43 am for me now and tmr morning i need to shovel snow

#

its snowing

#

;-;

worthy horizon
vast jetty
#

canada vibes

vast jetty
#

for day 4

#

at least we dont appear to have one

earnest forge
worthy horizon
#

I haven't even looked at the problem, so I can't look there

vast jetty
#

look at me with my type hints

#

lol

hollow wharf
#

πŸ’€

vast jetty
#

reminds me of the

hollow wharf
vast jetty
#
fish: Fish = Fish()```
hollow wharf
#

lmao

#

Your: Mom = mom()

vast jetty
hollow wharf
#

AOC as well

#

lmao

#

or u do it later

vast jetty
#

not till today

#

since i dont quite know what data structure i want

#

and its easier to change a [] to a ()

#

than to chage list to tuple

hollow wharf
#

im considering reading some DSA to get equipped for coming days

vast jetty
#

and im trying to be relatively fast

#

but i type hint after i get em done yeah

hollow wharf
#

i see

hollow wharf
#

or you started working

vast jetty
#

im

#

neither

#

im not in college yet

hollow wharf
#

oh

vast jetty
#

im in a gap year

hollow summit
hollow wharf
#

oh i see

vast jetty
#

whoops

hollow wharf
vast jetty
#

better

hollow wharf
#

this server is is really

#

just getting by

vast jetty
#

now i can justify the type hint too

hollow summit
hollow wharf
#

syntax

vast jetty
#

thats a thing?

hollow summit
#

yes

hollow wharf
#

next thing u gonna tell me

#

work as well

hollow summit
#

i'm gonna hold your hand when i say this

vast jetty
#

why not use type hints instead

hollow summit
vast jetty
#

or best:

hollow wharf
#

☠️

#

duh

#

lmfao

hollow summit
#

set[complex]() already tells your typechecker that the type is set[complex]

#

so no need

vast jetty
#

hmm

#

i eae

#

which would you prefer

#

since i have type hints on every single variable

hollow wharf
#

whatever gets to ur mind first

#

write it up

vast jetty
hollow wharf
#

real peeps let the type checker figure its shit out

hollow summit
#

use whatever you think looks cleaner
personally both are fine

hollow wharf
#

type hint only the functions

#

let variable do its stuff

#

by itself

#

πŸ’€

hollow summit
#

but, objectively, removed_positions: set[complex] = set() is more redundant

#

it's saying "removed_positions is a set of complex numbers which is an empty set"

#

compared to the set[complex]() that says "removed_positions is an empty set of complex numbers"

ivory vigil
#

Oooh. Generics. I should start using those.

vast jetty
#

hm

#

im just initialising it rn

loud slate
#

We've now entered the grid puzzle portion of AoC

ivory vigil
#

Auto parse ftw

vast jetty
#

gotta meme. it's tradition.

half swan
#

if it works it works

hollow summit
#

again, an example of santa and his elves' incompetence
why do they even have rolls of paper lying around??

half swan
#

someone call OSHA

hollow summit
#

"We're pretty sure there's a cafeteria on the other side of the back wall. If we could break through the wall, you'd be able to keep moving. It's too bad all of our forklifts are so busy moving those big rolls of paper around."
you are using forklifts to break through cafeteria walls??

half swan
#

I doubt the forklift operators are certified

hollow summit
#

i bet tomorrow involves fixing up the broken wall

#

does the cafeteria not have a door

bright spindle
#

Not to the printing room, presumably

half swan
naive wharf
#

wow today was easy

bright spindle
#

So far I feel like all of the puzzles have been amenable to solving in dumb obvious ways.

#

Like, you can do all of them in optimized somewhat clever ways, but you don't have to.

#

Which has not always been the case historically.

tender swallow
#

Of course, the optimization was not hard, but still

bright spindle
#

My intuitive solution worked and it didn't feel very clever

#

||Doing max on a moving slice window||

tender swallow
#

But today was... yeah
It felt like a 25-day day 4, not the day ~8 it should've been if the compression of the difficulty curve was linear
I wonder if the ramp in the later days is just going to be incredibly steep, then

bright spindle
#

The difficulty curve is not typically linear though

tender swallow
#

Yes, but the compression of it into 12 days might have been, though evidently it is not.

mortal bronze
#

I remember when I'm writing game of life on the day 4 part 1 ._.

bright spindle
#

This one is kinda like that

pulsar drum
#

Todays was easier than the previous ones imo, I liked todays cos it was a grid

pulsar drum
mossy basin
#

?

tender swallow
#

<@&831776746206265384> irrelevant crypto stuff

royal gull
#

!ban 1351973109065973813 crypto scam

marsh currentBOT
#

failmail :ok_hand: applied ban to @slate hemlock permanently.

cyan sleet
#

crystal, wtf is your problem?

#

why is this here?

#

does crystal not have a for loop? pithink

feral hazel
#

oh i never checked lol
for a range based for loop there's each with a range
and for foreach there's each on the collection
so i didn't reach for it

lyric sigil
#

why do we need batteries for an escalator anyways

rose citrus
#

Do these times start the moment the puzzle gets released

#

because I did not spend five hours on day 4

rose citrus
#

alr

#

was stressing lmao

teal field
#

yeah, unfortunately the time zone convenience is kind of just luck of the draw :p

remote mauve
#

I do it at like 6 PM though

low condor
clear sundial
polar sand
#

Ruby and Crystal are such nice syntaxes to work with after Clojure. I've never touched anything that looks like lisp. I was not enjoying getting errors every 2 lines of code I wrote πŸ˜‚

hollow wharf
#

πŸ’€

clear sundial
south musk
#

Grids are ok until you need to do anything with neighbors

magic oxide
low condor
#

The one and only exception that proves the rule

dense osprey
#

only annoying part was the case work

low condor
dense osprey
dense osprey
magic oxide
#

we sometimes do that for golf

#

just add a wall of fillers

tender swallow
dense osprey
# magic oxide just add a wall of fillers

yeah all of these ||```
for(int j=1; j<n-1; j++) {
int i=0;
if(mat[i][j]=='@') {
int cnt = (mat[i][j-1]=='@')+(mat[i][j+1]=='@')+(mat[i+1][j-1]=='@')+(mat[i+1][j]=='@')+(mat[i+1][j+1]=='@');
if(cnt<4) {
sol++;
mat[i][j] = 'r';
}
}

    i=m-1;
    if(mat[i][j]=='@') {
        int cnt = (mat[i-1][j-1]=='@')+(mat[i-1][j]=='@')+(mat[i-1][j+1]=='@')+(mat[i][j-1]=='@')+(mat[i][j+1]=='@');
        if(cnt<4) {
            sol++;
            mat[i][j] = 'r';
        }
    }
}
for(int i=1; i<m-1; i++) {
    int j=0;
    if(mat[i][j]=='@') {
        int cnt = (mat[i-1][j]=='@')+(mat[i-1][j+1]=='@')+(mat[i][j+1]=='@')+(mat[i+1][j]=='@')+(mat[i+1][j+1]=='@');
        if(cnt<4) {
            sol++;
            mat[i][j] = 'r';
        }
    }

    j=n-1;
    if(mat[i][j]=='@') {
        int cnt = (mat[i-1][j-1]=='@')+(mat[i-1][j]=='@')+(mat[i][j-1]=='@')+(mat[i+1][j-1]=='@')+(mat[i+1][j]=='@');
        if(cnt<4) {
            sol++;
            mat[i][j] = 'r';
        }
    }
}
south musk
#

I just wish all the stackoverflow answers and stuff for getting neighbors weren't so ugly and golfy

dense osprey
#

and whatever this is

south musk
#

They're all littered with 1 letter variables and excessively long list comprehensions

magic oxide
#

for the two main ways i represent grids (set[complex] and dict[complex, T]), i usually have

deltas = (-1, 1j, 1, -1j)
corner_deltas = (-1 + 1j, 1 + 1j, 1 - 1j, -1 - 1j)
all_deltas = (-1, -1 + 1j, 1j, 1 + 1j, 1, 1 - 1j, -1j, -1 - 1j)

defined, so i can just import them and loop over them
this AoC my repo is extra broken so imports don't even work correctly, so i just copy and paste the code

tender swallow
dense osprey
#

nvm

south musk
low condor
#

If I have to deal with neighbours in AOC grids I almost always ||convert to a container of coordinates first - usually a dictionary but maybe a list or set||

tender swallow
#
ALL_DIRECTIONS = [vec2(x, y) for x, y in product([+1, -1, 0], repeat=2) if (x, y) != (0, 0)]
CARDINAL_DIRECTIONS = (vec2(+1, 0), vec2(-1, 0), vec2(0, -1), vec2(0, +1))

from my utils

#

then it's as simple as

class vec2(NamedTuple):
    ...
    def all_neighbors(self) -> list["vec2"]:
        return [self + delta for delta in ALL_DIRECTIONS]
    def cardinal_neighbors(self) -> list["vec2"]:
        return [self + delta for delta in CARDINAL_DIRECTIONS]
bright spindle
tender swallow
#

in my real code it's @cached πŸ˜„

#

which does help, if I remember 2024 correctly

bright spindle
#

Hm, I'll see if I can do that for ||day 4 and not lose performance||

#

Oh, it's actually faster.

minor cave
sleek maple
#

Ty fam

minor cave
#

Also going to expand spoiler thread permissions to helpers.

_> I fell asleep early and then proceeded to sleep for 11 hours

magic oxide
minor cave
#

Not sure yet

tender swallow
magic oxide
mortal bronze
#

this is part 2

mortal bronze
minor cave
hidden musk
magic oxide
bright spindle
#

@jovial imp It's better to just post your solution un-spoilered in the corresponding day's spoiler thread.

bright spindle
jovial imp
#

there is a spoiler thread?

bright spindle
jovial imp
#

oh i see

#

no that one you can't post in

bright spindle
#

Choose the corresponding day's thread and post there

jovial imp
#

kk ty

tender swallow
naive wharf
low condor
#

I will admit it did drive creative solutions though

#

But my preconception of what the Xmas tree might look like drove me to completely the wrong path

naive wharf
# tender swallow 2024 day 14 part 2

oh I think I have a solution aproach
||modular arithmetic tricks:

  • the x-coordinate distribution obviously repeats every 101 steps
  • y every 103
  • you can see the pattern along one axis in some rendered images
  • chinese remainder theorem||
#

aaand it worked

tender swallow
#

The trick I used was ||looking for a bunch of pixels in a row||
Then I wanted to formalize it so I went with ||entropy measured by compressibility||

teal field
# naive wharf aaand it worked

the way i originally solved that one was by generating a movie of the positions over time then staring at it lol, i did do a CRT version afterwards, but it was very memorable just playing around with it
this is a .gif of near the relevant time πŸ™‚

tender swallow
teal field
naive wharf
#

lmao, currently doing 2015 day 25...
advent of code? more like advent of paper

#

advent of paper and modular arithmetic solvable with a single ||pow call||

white arrow
#

about to try again at day 3

naive wharf
white arrow
white arrow
naive wharf
white arrow
#

day 3

naive wharf
white arrow
#

oh right lol

naive wharf
#

(2024/14/p2)

white arrow
#

i have no clue what im doing on day 3

#

ive tried but i have no clue

naive wharf
mossy basin
#

i made an insane assumption on day 2024/14 and it paid off

mossy basin
#

for a real fast solve

#

i looked for the first position with no overlaps

naive wharf
# white arrow what lol
7452743069371751078107071070707120193107810
7426873278616578327865716857891378613278631

which number is larger?

#

why?

white arrow
#

first one

naive wharf
#

how do you know?

white arrow
#

the 3rd digit is higher and the 1st and 2nd are the same

#

therefore no matter what precedes it, its higher

naive wharf
white arrow
#

ive got a method working rn

#

just made my code work

#

its not doing whatever youre hinting at though

#

ive taken another approach

naive wharf
white arrow
# naive wharf which is?

|| iterate over each line and finding the highest digit, then search again to find the highest digit that comes after it ||

mossy basin
#

you can stop early if you find a 9

hollow wharf
#

YO?!?!

#

easter egg in the input?

#

this is so cool like genuinely

mossy basin
hollow wharf
#

have you been making animations for AOC

#

for a while

mossy basin
#

yeah, it was a cool problem

lime fulcrum
#

was not my favorite one

mossy basin
#

my first aoc was 2019, i started making visualizations that first year!

hollow wharf
mossy basin
#

this server

hollow wharf
#

thats cute

white arrow
hollow wharf
white arrow
#

||it also never goes all the way to the end, it stops at the 2nd to last digit ||

hollow wharf
#

this year's my first AOC and I started cuz of this server

#

haha

white arrow
#

me too

hollow wharf
#

I'm def doing it

mossy basin
#

it's a great event not just because of the problems, but because so many people participate in the discussions of the problems

hollow wharf
#

coming years

#

as well

white arrow
#

I SOLVED DAY 3

mossy basin
#

grats!

white arrow
#

well only part 1

#

but i didnt get any help this time

#

so thats an improvement

hollow wharf
#

sharing

white arrow
#

day 1: struggled alot
day 2: managed but needed help tweaking
day 3: all by myself

teal field
#

good news is, day 4 is probably the easiest so far?

naive wharf
#

hmmm...
funny idea
Advent(2) in Python

mossy basin
#

i still think 2019 was the greatest year for AoC

white arrow
hollow wharf
white arrow
#

except i havent finished day 3 yet

hollow wharf
#

i got this duck profile thing cuz of it

white arrow
#

still gotta do part 2

mossy basin
#

intcode machine was so much fun

teal field
# mossy basin i still think 2019 was the greatest year for AoC

ive only done 2024 and 2018, did 2018 together with a few other folks just a few months ago and it had some really fun problems, like with the water dripping from cavern ceiling and filling reservoirs, and some goblins vs elves games, i bet you did some fun visualizations for those lol

hollow wharf
#

This server has like the cuttest computer peeps

#

I love it

mossy basin
#

i haven't done 2018 yet

teal field
#

ooh youre in for a treat

mossy basin
#

past day 4 anyway

hollow wharf
#

πŸ’€

#

lil bro by himself

#

on this one

#

/jk

mossy basin
hollow wharf
white arrow
#

hmm || can i find the first 3 lowest digits and just cancel them out? ||

teal field
#

so cool

mossy basin
#

my first visuals just used curses

half swan
#

how did you solve p1

half swan
white arrow
# half swan what happens when ||123898765432111||

|| well im thinking that the algorithm first detects 123, doesnt replace them until it encounters 2 in which it replaces 3 with 2 to become 1, 2, 2 but then it encouters the 3 1s and replaces the 2 2's to become 1, 1, 1 so it will cancel out the first 1, second 1 and third 1, leaving the 1 at the end ||

teal field
naive wharf
tender swallow
mossy basin
#

post-assumption, you can justify it -- do you know the birthday problem?

lime fulcrum
#

23 people in a room means 50% chance 2 share a birthday?

mossy basin
#

yeah

#

so if the grid positions are birthdays you can kind of guess that it's very improbable for none of the particles to not share a birthday

half swan
#

(work it out so you don't just say the correct answer because you presume your algorithm to be correct)

white arrow
half swan
#

right, that leaves you with ||238987654321|| but the answer would be ||987654321111||

white arrow
#

oh yeah lol

tender swallow
mossy basin
half swan
# white arrow oh yeah lol

you're getting somewhere with the ||replace if smaller idea, not the final answer but right direction||

mossy basin
#

pre hoc, it was a wild guess

white arrow
teal field
#

btw salt-die, is there any font \ font family you recommend using in particular? i notice some characters from custom_button example and line_plot dont show up with what i currently have
Consolas, 'Courier New', monospace

mossy basin
teal field
#

ya

mossy basin
#

yeah, octants are newest unicode, not widely supported, lemme see what font i'm using

teal field
#

the examples that come with this library are so inspiring

mossy basin
#

currently using Cascadia Code NF

#

so actually a windows default i think

white arrow
#

so uhh

#

how did people go about day 3 part 2

mossy basin
#

i think they added octants like a year ago or so

mossy basin
#

one of the caskaydiaCoves

#

actually don't remember anymore

#

NF probably means nerd font though

#

i think i use the one without ligatures for terminal

teal field
#

alright thanks

remote mauve
#

Why is today so hard all of a sudden

mossy basin
#

because ligatures can do weird things to terminal apps

white arrow
#

i still have no clue how to do it either lol

warm berry
low condor
naive wharf
half swan
naive wharf
#

I should finally make my render-vulkan-to-framebuffer

mossy basin
low condor
#

I do x y - because I like alphabetical order :)

dusky escarp
#

i name the array x, and the coordinates x1 and xa

minor cave
#

For Language Rouletters, do y'all want a dedicated catch-all thread for your solutions?

earnest forge
rancid creek
low condor
#

I have a dataclass with x and y in that order

rancid creek
normal loom
#

I like to have a dictionary keyed with complex numbers. Quite neat, but a bit weird

earnest forge
#

Never mind apparently it does not

#

Oops lmao

#

My SparseGrid is [x, y] though

silent nymph
worthy horizon
#

i decided to not do any optimization anymore... I'm going to do small brain AoC

frigid mural
#

I have my exams next week so I'm fighting my optimisation urges so hard

#

I failed at this on days 2 and 3

low condor
#

I love committing and pushing directly to my master branch for AOC - feels so wrong yet so right

#

I might unprotect my remote master just for the added thrill

cyan sleet
ripe meteor
#

grid.🐴(i, j)

magic oxide
mortal bronze
#

bruh 20 minutes

peak dock
#

😀

#

i j is fine too

woven oriole
#

x, y

#

nx, ny

#

dx, dy

#

period

peak dock
#

πŸ‘Ž

sullen adder
#

time for day 5 :D

shut trellisBOT
half swan
#

I was just about to go out-

#

Well too late to turn back now guess we're doing this one slightly late

mortal bronze
#

let's goo

pine tiger
#

oh wow

#

did not expect ||prefix sums||

woven oriole
#

ez

weak hedge
#

Hey guys

woven oriole
#

but i wasted like 40 seconds due to 1 stupid wa

woven oriole
#

but yeah you can

vast jetty
#

riiiiiight

woven oriole
#

||coordinate compress or something||

vast jetty
#

i was like p2 is hella easy

pine tiger
#

what was ur approach

vast jetty
#

my code doesnt fucking run.

#

argh

woven oriole
atomic hill
#

I’m thinking of a system where my masturbation career is turned into a currency. Can anyone help me with this?

pine tiger
#

mods?

vast jetty
#

alr it appears itll take me a while

paper folio
#

I accidentally crashed pycharm with my brute force πŸ˜‚

vast jetty
#

should i feel bad for not having gotten it yet

#

and having taken 10 minutes for p1

#

rip

tepid cairn
vast jetty
#

@hollow wharf hows it go

#

im gonna let it run maybe lmfao

#

added print statements for some reassurance

#

look at it

#

only gonna take a few hours

#

lets think of better fucking logic till then πŸ˜…

wanton plover
#

wow i think that was the fastest ive done one of these πŸ‘€

ivory vigil
#

Congrats!

obsidian shell
#

this ones ez

rapid fog
vast jetty
#

lets see

#

i just sat outside in the sun for a bit until i could think of something

teal field
#

my (very naive) timer still staying under a second despite my bad day 2 solution πŸ™‚

vast jetty
#

its still quite shaky tho

rapid fog
#

I found a way that sped it up insanely

#

i think its O(n) too which is crazy

wanton plover
vast jetty
#

i wrote smth up

#

im not even convinced itll work

#

let alone run fast

#

lets see

rapid fog
#

🀞

vast jetty
#

nah wrong answer

#

but it did run fast πŸ’€

ivory vigil
#

My p2 is O(n) πŸ‘€

vast jetty
#

my p2 is non existent

sullen adder
#

i'm washed πŸ₯€

vast jetty
#

it doesnt even tell me whether its too high or too low

#

so it must be HELLA OFF

low condor
#

I’m quite happy for today - I wrote P1 in such a way that P2 was a one liner

mild sapphire
#

hello

vast jetty
#

exactly

low condor
paper folio
#

I had to watch a youtube video on ||interval merge algorithm|| but I think it was still better than day3 p2 ducky_skull

rapid fog
#

nvm its not linear bc i forgot ||sorting|| takes time lol, but its p fast

vast jetty
#

okay i wrote up some mock input

#

and i see some issues

#

so thats good thats progress

#

yall i took like 2 hours on day 2 being stuck on day 5 is fine i think

low condor
#

The day I’ve been β€œstuck” on the most is still Day 1 (Part 2)

paper folio
#

you know what, that's fair, I think I fumbled a lot on that too

rapid fog
#

I generally start to take a lot of time around day 13-14 so i was expecting it to be harder faster this time round considering we only get 12 days

#

but this year has been pretty decent so far

low condor
#

The first 5 days have basically matched a usual set of 5 days

rapid fog
#

yep

paper folio
#

I'll probably go back to prev years after day 12

#

gotta collect all the stars

#

I started in 2024, and backtracked 2015. Got stuck on 2016 day 11 and abandoned it

rapid fog
#

2024 day 8 is the only one ive attempted so far where ive gotten none of the stars

half swan
#

I did 2 extremely dumb things πŸ’€

#

summed the ranges instead of their lengths

#

and thought my 2nd answer for p2 after getting one wrong was the same and spent 10 mins debugging a non-existent issue

vast jetty
#

this is quite fun actually

half swan
#

it was only a few digits off so I didn't notice 😭

vast jetty
#

i mean im taking extremely long

paper folio
low condor
vast jetty
#

but its cuz i have actual stuff to do

#

and im writing my own dummy input and checking stuff

#

fun

#

just wish i didnt feel like literally everyone else has doe it already lol

#

i know its just like a dozen of you

paper folio
#

took me close to an hour!

#

enjoy the process πŸ™‚

vast jetty
#

also im sure the code im gonna write is gonna be needlessly roundabout

#

but we can refine it later

rapid fog
#

a lot of us solve stuff like this faster simply because weve done similar problems before, you odnt even know how much time I spent on aoc 2022 when i was first starting out

#

plus it feels super rewarding when you finally figure out the trick behind a certain problem

shut trellisBOT
#
Wrong Channel

You are not allowed to use that command here. Please use the #aoc-bot-commands, #sir-lancebot-playground, #bot-commands channel(s) instead.

low condor
#

Either figuring out the trick - or coding up a solution to one of the more involved problems- will do it for me in terms of being rewarding

vast jetty
#

well i apparently get 147

#

which def cant be right

#

argh

low condor
#

I presume this is day 5 p2?

vast jetty
#

ok wait

#

i might be an idiot

#

i mean i am an idiot for writing THAT

#

but i might be more of one

#

but at least thats one issue lol

vast jetty
#

i was gonna be like 'how does one even do that'

#

proceeds to do it himself

#

yeah this cant be right either

#

maybe it is

#

it just looks like what i had previusly

rapid fog
#

|| actually, for p2 that could be right. its in the range of what i had ||

vast jetty
low condor
#

Congrats!

vast jetty
#

ill post the spaghetti in spoilers

#

and then go make it better lol

bright spindle
#

I don't want to know how bad I am

#

Until afterwards

low condor
#

I don’t like to have any information on any of the puzzles until I fully solve them so I avoid Discord for the same reason

bright spindle
#

Yeah, that as well

#

Don't wanna accidentally spoil myself

ivory vigil
#

Now more than half of my AoC solutions don't need any explicit parsing inputs; the automated parse guesser parses them well.

naive wharf
#

does anyone have some code for sortin g and merging lists of ranges?

vast jetty
#

alright yall i asked gpt for a code review and

#

thanks gpt