#advent-of-code

1 messages Β· Page 21 of 1

modern terrace
#

hint 2: ||part 2 only has unique ranges after processing, no need to worry about counting already-checked combinations||

flat sequoia
#

Oops I fell asleep before I could push my code

#

but this is some code

devout turtle
#

Good morning all,

I'm reading the puzzle and I think I understand what I have to do.
My biggest hurdle in handling the input is to get it worked into some form that I can use the workflow rules nicely, but I'll get that worked out somehow.

What I can't seem to get my head around though, is for the example input, how lines 1 and 3 are evaluated.
After reading the description a couple of times, I'm totally under the impression that every part goes through the workflows in order, I don't quite get WHY or HOW parts 1 and 3 seem to start at workflow 'qqz', instead of 'px' like the rest.

I wouldn't dare to say that there's an error in the puzzle itself, so clearly I'm missing something, but I can't figure out what it is.

Who can help me on that?

hexed axle
tidal mist
#

I set an alarm clock for aoc. I'm sure it costs me a few spots to turn it off each day.

lime fulcrum
#

aoc is too early. I will not stand up at 6 am

lime fulcrum
#

I always have a bit of problems with wrangling my input with splits and strip. are there better ways to do this?

hidden musk
#

omg a language that I actually know for once

ripe meteor
#

What's today's language

#

I dont see a pin about it

modern terrace
ripe meteor
#

🀒

#

Why isnt there a pin smh, mods dropping the ball

zealous basalt
#

wonder what day will uiua get

#

<--- doesn't know the mods don't know uiua

ripe meteor
#

Whats that

#

You mean oumuamua?

#

.wiki oumuamua

#

Smh

zealous basalt
thin blaze
#

Today was hard...

#

My gosh.

lime fulcrum
ripe meteor
#

I didnt

#

The language roulette is separate from other people just doing it in python

atomic cairn
#

Ah day 17

#

Another day another formula ive never used lol

noble skiff
#

day 19 may have been my favorite so far

earnest forge
#

Yeah I liked today's puzzle

noble skiff
#

the fact that it worked my first try probably biased me πŸ˜›
programming more fun when you don't spend an hour painfully debugging

magic oxide
#

i haven't done today yet

earnest forge
magic oxide
#

seems fun tho

noble skiff
#

the one with the broken gears parts or whatever

#

.#?

earnest forge
#

How did you get an off-by-one for hot springs lol surely you either get it right or massively wrong

noble skiff
#

When implementing the faster approach for part 2, I made some subtle error that only was incorrect for very large examples

#

idk

#

it wasn't off by one, to clarify

earnest forge
#

Ah

noble skiff
#

I didn't mean "an off by one I didn't manage to debug"

earnest forge
#

That makes more sense then

noble skiff
#

well, the underlying error is very likely an off-by-one

#

that doesn't mean the result is off-by-one

earnest forge
#

What was your general approach?

noble skiff
#

||DP||

#

So far, I didn't have time to fix that, and I also haven't had time to actually do 18; I looked up the formulas everyone's been using because I couldn't stand doing it the same way as day 10 again

#

And I also want to go back and optimize some days; I have 4 days that are over 1ms

#

but honestly not sure if any of that will happen

magic oxide
#

i got an OBOE for day 17

#

still not sure why it was OBOE tbh

noble skiff
#

oboe?

#

like the musical instrument? πŸ˜›

feral hazel
#

out of bounds error

#

wait no

#

off by one error

magic oxide
#

yeah off by one error

#

||i think i somehow did only 9 steps instead of 10 or something||

dim pivot
#

I'm terrified for the next 6 days

#

How many do you think will be very hard puzzles (gold lb cap >= 1 hour)

woven solar
#

well, we've reached day 19 and it wasn't beacon scanner πŸ₯΄

rapid wolf
#

I make the bold guess that the ||Chinese Remainder Theorem|| will be relevant tomorrow.

dim pivot
#

yeah the difficulty seems fairly static this year

woven solar
#

in 8 hours, i wake up at day20. it's called "bacon scanner". I go back to sleep.

dim pivot
#

I hate the beacon ones

#

I'd be happy with CRT

#

Or even something like modular inverses/slam shuffle

rapid wolf
#

I still have zero confidence that the beacon scanner was solvable in the general case

dim pivot
#

Some other things that can come are reverse engineering or z3able ones

rapid wolf
#

but whatever julia I scrounged up did work

dim pivot
#

Or a heuristic puzzle

#

Last year I only found 1 puzzle nasty (day 16, still don't get it) and 1 more that I couldn't do quickly (day 22, but it was a dumb problem)

rapid wolf
#

oh interesting, I only got up to day 11 last year.

dim pivot
#

This year is going better than last year in terms of lb rankings but I'm getting more and more scared every day

rapid wolf
#

I wonder what I was doing last year that I didn't manage to 50star AOC.

scarlet badger
#

what is this channel about

dim pivot
#

day 22 is definitely the worst day

#

so 48star

#

losing 1 star on 22 and 1 on 25

scarlet badger
#

advent of code? what does that even mean

dim pivot
#

For 22 I had to honestly copy my solution from online

#

It was worth it though as it got me like 60 points on 25

rapid wolf
scarlet badger
#

oo alr

rapid wolf
dim pivot
#

The ones I didn't do that year were "Amphipods" and that one

#

My favourite was day 24

#

The one with reverse engineering

rapid wolf
#

I just did that one with a constraint solver

cyan sleet
rapid wolf
#

Yeah, I can't really come up with a counterexample, but intuitively, I don't think the assumptions I made would hold on a malicious case.

#

but frankly, imagining possibly rotated beacons in 3D is straining my mind as-is

cyan sleet
#

I liked that problem

#

it really caught me off guard, took me a bit to see how to approach it in a good way

rapid wolf
#

I didn't find the clever solution, so I just "bruteforced" it in julia and had the answer in a minute.

lime fulcrum
#

I think I know how to start with this one though. lot of vectors for this one

noble skiff
#

I feel like that one was solvable in the general case

#

maybe not actually, idk

#

Actually, yeah. Basically, the idea was, scanners have at least 12 beacons in common. distances between beacons are invariant under translation and rotation of the beacons

#

so you could pretty rapidly start to establish connections between points

#

i'm not sure if it's possible to construct something sufficiently adversarial that would cause this to break down. Or even better than distance, a sorted list of 3 deltas.

#

You only need each beacon to have a single other beacon, which which it shairs a pair of points, that has a unique sorted list of 3 deltas

cyan sleet
#

you can ||try all rotations and compute differences between all points, the same vector should appear at least 12*11/2 times||

noble skiff
#

I think that year was the last time I fully solved AoC

cyan sleet
#

24

noble skiff
#

actually, no, that's a lie

cyan sleet
#

a factor 24 more work can hurt

noble skiff
#

I just mean in the grand scheme of things, x24 will not make a feasible solution infeasible

#

sure

#

I mean there's a reason I used the optimization πŸ™‚

#

looks like 2020 is the last time I got all 50; I felt like that year was easier. 2021 and 2022 had some real doozies in the last 5 days

cyan sleet
#

I think I needed it to do the whole year sub a second πŸ˜…

noble skiff
#

heh that's roughly my goal this year, first time i've really looked at perf much in aoc

#

I have 4 days over 1 ms atm

#

I suppose since I'm still under 1 second for everything, there's a decent chance I don't need to optimize any existing stuff... but still

cyan sleet
#

yeah, most tasks are pretty trivial, then you get the actually computationally heavy stuff

#

and 2022

noble skiff
#

very impressive

#

I probably won't actually make it; my algorithm chops tend to not be good enough, on average, to get all of the problems without a lot more work than I'm willing to put in (or more copying/getting help, I suppose)

hidden musk
#

hmm. i've only used c# for work, so now the thought of doing aoc in c# is kinda :(

rancid creek
hidden musk
#

well I know that, but meh

#

we'll see how it goes

noble skiff
#

I tried pretty hard to do that with kotlin (in a past year)

#

Kotlin has... a lot of stuff that lets you just keep chaining expressions forever

#

like it has all the typical iterator stuff but then on top of that it has Groupings and things that turn iterators into dicts/Maps or lazy versions thereof

#

and it has the scope functions which also let you keep chaining stuff

#

it does get a bit crazy though

hidden musk
#

huh. more ||range|| shenanigans today

cyan sleet
hidden musk
#

pretty similar strategy too πŸ˜”

#

with a little twist i guess

jovial jay
#

Pretty close to day 20 now.

earnest forge
#

GLHF everyone

modern terrace
covert arrow
#

GLHF

covert arrow
earnest forge
#

Pfft, it's clearly halloween

modern terrace
#

have you considered changing from octals to decimals

earnest forge
#

No, but they're the same day

#

31 Oct vs 25 Dec

modern terrace
#

fair

earnest forge
modern terrace
#

anyway

#

my expectations suggest that i can't solve this day

#

past 19 days were alright

covert arrow
#

same, we're overdue for a hard puzzle

minor cave
#

Language Roulette: Day 20
The language is ... C++

modern terrace
#

it's like those calamity predictions where a calamity happens every 100 years but it's been like 130 or something years

earnest forge
covert arrow
#

surely rust is in the pool, right? ferrisClueless

earnest forge
#

I can't imagine they'd put C++ in without also putting Rust in

#

Also Day 25 is clearly going to be Python

covert arrow
#

yeah

#

1 minute

modern terrace
earnest forge
#

Anyway GLHF everyone

covert arrow
#

GLHF

modern terrace
#

best wishes to everyone

#

less than 30 seconds

shut trellisBOT
modern terrace
#

absolutely wrecked trying to part 1

earnest forge
#

I made the mistake of trying to be smart instead of brute-forcing lmao (EDIT: FOR P1 DUMMIES)

#

Cost me loads of time

naive stone
#

i wish i could understand the problem as quickly as you guys solve it

modern terrace
earnest forge
covert arrow
#

how

modern terrace
#

i'm bruteforcing rn

covert arrow
#

same lol

modern terrace
#

how long does it take

earnest forge
#

Same

earnest forge
#

Mine's been going for 7 minutes already

modern terrace
#

uh oh

earnest forge
#

Might RIIR to hope for speedup

modern terrace
#

uh

#

what do i do

covert arrow
#

Join the language roulette and write it in C++

devout tusk
#

i don't think i even fully understand the state changes in the question today

modern terrace
#

neither rust

#

i'm officially damned

covert arrow
#

hmm, ||I think it's doing binary counting||

earnest forge
#

Yeah I think it probably is but I can't figure out a good way to speed that up with a program

#

||Tried doing it by hand but that will take ages||

modern terrace
devout tusk
earnest forge
#

((that would have made my half-finished attempt actually useful))

devout tusk
modern terrace
#

rewriting in c++ because why not

#

nvm idk how to do static scoping in c++

stray flower
#

cant use Short in switch case

#

Kotlin trash. Python way better

fleet fox
#

πŸ’€ advent of realizing i cant read is back

flat sequoia
#

gg gotta go

#

Will finish later

oblique pasture
#

or Idk Use Map?

jovial jay
oblique pasture
#

Havent Solved Since Day3 Part2 πŸ’¦ I Should Do Something

earnest forge
#

Well those are some bugs I should fix

#

Python brute-forcer has a 35 minute head-start, who would win

modern terrace
#

leaderboard is already filled??

#

whew that was lengthy

earnest forge
#

Even if it finishes it won't help

#

🀦

pine tiger
#

πŸ’€

slate berry
#

Can anyone send the difficulty table

#

updated till yesterday maybe

flat sequoia
#

solved the aoc by hand

#

Lmfaoooo

flat sequoia
#

thanks

flat sequoia
#

If anyone is stuck try working through this simpler example by hand

broadcast -> a
%a -> b, e
%b -> c
%c -> d, e
%d -> e, e
&e -> a, b, output
#

i think this works??

cyan sleet
#

||what's updog?||

cyan sleet
#

aww, my joke doesn't work now

earnest forge
#

Lol

sharp tapir
#

hi team ive done upto 9, but have had to hand in a final project for my sql bootcamp last week so ive fallen by the way side. Would someone be able to tell me which days are the easiest from day 9?

velvet basalt
#

W

covert arrow
#

my opinion:
10 - p1 is alright, p2 is a bit tricky
11 - pretty straightforward
12 - very hard (arguably the hardest so far)
13 - medium
14 - medium-hard
15 - reading comprehension, otherwise relatively easy
16 - medium-hard
17 - hard
18 - hard
19 - medium-hard
20 - more reading comprehension, p1 is ok but p2 is hard

sharp tapir
#

10 i skipped

#

reading 11

noble skiff
#

i don't think 19 is hard though

covert arrow
#

on second thought, maybe

noble skiff
#

I would say 16 is hard; it only becomes reasonable if you know a certain formula that most people didn't think of themselves

#

a lot of people (self included) grinded out 16 by doing things like tracing paths across and tracking boundary crossing

covert arrow
#

there's a formula for 16?

noble skiff
#

which was mega painful

#

much more error prone than any code I had to write for 19

noble skiff
covert arrow
#

16 was the ||mirror|| one, no?

noble skiff
#

oh my bad

covert arrow
#

maybe you're talking about 18?

noble skiff
#

i'm thinking of 10

covert arrow
#

ah

#

I did ||bfs|| for that one

noble skiff
#

for 10p2?

covert arrow
#

yes

noble skiff
#

that's computing the enclosed area, how is that bfs

#

you mean ||flood fill|| ?}

covert arrow
#

yes

#

same thing πŸ™ƒ

noble skiff
#

even doing ||flood fill|| correctly is pretty obnoxious; there's no guarantee ||the interior is connected||

lime fulcrum
#

i did it by going row by row. meant ||18 didn't go as well||

noble skiff
#

So you have to somehow deal with that

covert arrow
noble skiff
covert arrow
#

the way I did p1 made it pretty trivial

noble skiff
#

idk, it tends to be a pain I find

sharp tapir
#

15 seems really easy

#

just need to figure out a way to parse

pine tiger
#

lmao i'm in 4th place

#

it's actually over

dim pivot
#

day 12 wasn't that hard I think

#

just lru cache surely

noble skiff
#

lru?

covert arrow
dim pivot
#

Hm

#

For me it was quite natural

#

I found stuff like day 10 much harder

#

For me the two longest days so far are day 10 and day 17

#

The rest are much shorter

covert arrow
#

I guess it depends on how familiar you are with concepts like ||dp||

ripe meteor
#

The instructions are getting too long πŸ’€

#

My smooth brain cant focus long enough to go through them

proven linden
hidden musk
#

wow C++ is annoying

minor cave
#

lmfao, I feel like roulette has just resulted in you and fenix really liking some functional languages and being unimpressed with the rest

hidden musk
#

i've only ever used C++ for cp but this is harder than any problem i've done in c++ lol

#

but yeah. the functional langs in the beginning were pretty fun

#

certainly a lot more fun than vb or like

#

fortran πŸ˜’

#

still haven't finished that day btw

jovial jay
# hidden musk wow C++ is annoying

i feel you. i only use it in case i want to contribute to open-source softwares that requires it. otherwise, i only go by interpretative languages

minor cave
#

Language Roulette: Day 21
The language is ... Java

covert arrow
#

GLHF

earnest forge
#

GLHF

naive stone
#

is the pool of languages in the roulette viewable somewhere? i'm curious what's in there

covert arrow
#

I saw it on the notion somewhere

hexed axle
earnest forge
naive stone
#

lol

shut trellisBOT
magic oxide
#

oh

hexed axle
magic oxide
#

i just woke up

#

pain

potent pumice
#

day 24 aoc should be holyc

covert arrow
#

part 2 is pain

earnest forge
woeful elbow
#

Umh

modern terrace
#

how to p2

covert arrow
#

||the borders might make it easier to calculate how far you can travel||

modern terrace
#

i think i figured oti out

naive stone
#

i can't believe you guys finished part 1 so quickly. I thought it'd be easy, but it seems to have a trick to it or something

#

things get real slow for me after just 12 steps. hell before that even

woven solar
#

make sure that you ||don't count cells twice, and get rid of the cells reachable at previous step.||

naive stone
#

hmm, yea good point

woven solar
#

it's pretty much ||bfs where you replace your population of cells (a set) with a new one each step||

#

for part2 though, ugh.

#

i'm currently thinking of ||memoizing what cells are reachable from this cell in 100 steps||, so that I can ||reduce the number of steps required by a factor of 100||. not sure it'll be enough, though.

fleet fox
#

how to part 2 πŸ’€

naive stone
#

alright well now my code finishes quickly, but gives me the wrong answer lol. still, progress i guess

earnest forge
#

def part_two(): return 0

woven solar
fleet fox
#

πŸ’€

#

(pls dont make me multiply my input and do threading and make my pc cry)

earnest forge
modern terrace
#

OH

jovial jay
#

Wow leaderboard ain't filled yet

modern terrace
#

I FOUND A FAST BRUTEFORCE

#

:D

earnest forge
#

WHAT HOW

modern terrace
#

now i just need to let it sit i guess

#

oh

#

wrong answer

#

;-;

earnest forge
#

Oh yeah that'll do it

fleet fox
#

πŸ’€

modern terrace
#

oh.

#

i see.

fleet fox
#

help πŸ’€

covert arrow
#

😩 why

flat mica
fleet fox
#

WhAT!!!

flat mica
devout tusk
#

considering there's no spoiler chat, p2 must be insane, ig

covert arrow
#

yup

modern terrace
#

nvm i didn't see.

devout tusk
fleet fox
devout tusk
fleet fox
covert arrow
modern terrace
#

I SEE WHAT WENT WRONG

#

but now my bruteforce is slow

#

:(

woven solar
#

there's ~n^2 positions within n steps, so you're looking at O(n^3) complexity if you keep track of them

devout tusk
covert arrow
#

?

modern terrace
#

found a faster bruteforce that goes like 15k per sec

#

that's still like half an hour

#

RIIC++ i guess

naive stone
#

finally read part 2. sigh

#

i can't believe the leaderboard still hasn't filled up

tall wasp
#

how does one even start with this πŸ₯²

devout tusk
# covert arrow ?

idk wym, solution can't|| exceed that value, actually lesser (considering the amount of #s||

tall wasp
woven solar
#

by their nature all(?) of the cells inside the covered area ||oscillate between being on and off with period 2||. so you can probably reduce a bruteforce solution to only considering ||the outgoing part of the wave, which scales with O(n), and then do some memoization on that||. sounds far too annoying to me, though, so I might ||have breakfast|| instead.

tall wasp
fleet fox
#

i was about to say that lmfao

tall wasp
#

gave me a good chuckle in between crying about the puzzle

earnest forge
#

I have an idea of a reasonable algorithm but there are so many edge cases

tall wasp
#

i have no reasonable ideas

dim jewel
#

real

mossy basin
#

i want yall to know that i initially tried to solve part one by taking matrix powers and numpy complained about initializing a 1.5gb array

dim jewel
#

@covert arrow what is the golf right now

tall wasp
#

today might be my first day i dont finish before work

#

which means ill have to finish it during work instead /s

devout tusk
mossy basin
#

my input looks like a diamond

fleet fox
#

same

#

looks very nice

tall wasp
#

yeah that makes sense

#

sadly isnt a perfect diamond tho

fleet fox
#

leaderboard still isnt filled

dim jewel
#

hes called golfing enthusiast after all

#

thought hed be good at it (jk

tropic wind
#

npc

dim jewel
#

real

dim pivot
#

is this the hardest aoc problem ever

#

One of my favourites too πŸ™‚ (3/47)

tall wasp
dim pivot
#

Yeah it's really hard

minor cave
#

I think an int code year problem is still classed as the hardest based on lb fill time

tall wasp
#

my part 1 code also just has zero scalability

dim pivot
#

I don't really want to help until the lb is filled tho

#

sorry

tall wasp
minor cave
#

ah yeah, 2019 d18p2 had a nearly 2 hour lb fill time

dim pivot
#

Well then 2019 day 22 would be harder

tall wasp
dim pivot
#

But I didn't find it very hard (as I am mainly a mathematician)

devout tusk
dim pivot
#

Compared to something like this year's day 17 - that was an implementation hell for me

hexed axle
marble summit
#

hello

minor cave
fleet fox
#

im gonna lose it

marble summit
#

can someone help me with day 5 pt 2 pls

#

i hard coded it and i pressed run like 10 minutes ago and nothing has popped up so i think im cooked

jovial jay
#

Lb still ain't filled? Wow, just wow.

jovial jay
hexed axle
#

80 minutes, oof that was a long one today

jovial jay
#

It's filled now?

hexed axle
#

Yup, just got there

minor cave
#

gooooodnight

pine tiger
#

great

#

as soon as i figure out the sol

#

lb is filled

jovial jay
#

I need to try this after I sleep

modern terrace
#

C++ bruteforcer started

woven solar
#

now that I think of it, it should be possible to ||essentially factorize the task into movements within a board and between boards||, by ||precalculating possible transition periods between boards||.

modern terrace
#

wait a minute i'm not thinking right with this am i

#

i should be calculating how far the thing should reach

#

.-.

#

aanyway

covert arrow
modern terrace
#

hoping one of my bruteforce approaches come back with good results

#

😬

#

wuh oh

#

OH THAT'S THE C++ BRUTEFORCER

#

???

earnest forge
#

Oh my god ||there aren't any obstacles in the same row as your start square||

#

This makes it so much easier

modern terrace
#

i don't think my C++ bruteforce works

lucid narwhal
#

p2 how?

modern terrace
#

grr

modern terrace
#

my python bruteforcer is too slow

#

what do i do now

covert arrow
earnest forge
# tall wasp why?

||add or sub multiples of grid size||, ||track your solution in terms of grids while you have enough area||

modern terrace
#

so it seems like there are 15604 reachable squares out of 17161 in my input

#

what do i do with that info

covert arrow
#

oh, it's my cake day today

modern terrace
#

how do i approach this-

woven solar
#

...okay, got it. I'm not sure I enjoy how many aoc days I solved by ||spotting a pattern in data without understanding what causes it||

tall wasp
#

alright, im off to work - maybe later today

earnest forge
#

My solution has been running for 18 minutes and I don't see why it's so slow

#

It's stuck in the 'explore trivially-explorable grids' step

#

oh that's still like 41 billion things though lol

thin blaze
#

I hate that day.

magic oxide
#

how difficult is yesterday and today?

#

uni offers just came out and I'm swamped with work, so I need a rough estimate of how much time I should dedicate

thin blaze
thin blaze
#

Part 2 is just pure hell.

#

This is the first day I failed though.

woven solar
#

yesterday wasn't very hard (hint: it's one of the "||probably near-impossible in the general case but all the inputs are such that it's pretty easy if you look at them||" days that are very common this year). today is... objectively harder given the leaderboard fill speed, but I solved it by ||finding a pattern in the answers||.

magic oxide
#

ok thx

#

gonna try and catch up before day 24

thin blaze
#

I still didn't understand most of people's solutions for Day 21/2.

wispy folio
#

For Day 18 (part 1), do we have to mind the subtleties of day 10 (cf. screenshot)

magic oxide
#

I believe so

hollow wharf
#

I=inside
O=outside

wispy folio
#

so same as day 10 damn

pine tiger
#

wait is there prize for pydis top finisher(s)

#

i might be hallucinating but i remember a discord role or something

minor cave
#

the Completionist role will return, yeah

simple raven
#

I can't believe the 2015 AoC had you mine bitcoin for the authors 🀦

pine tiger
#

any suggestions for what i should do a year of aoc in casually

#

i've tried rust, go, and haskell (unsuccessfully)

hearty harness
#

anyone keep a note of what algorithms or data structures worked best over the years of each day?

noble skiff
#

idk about "best" - do you mean most commonly?

pine tiger
#

πŸ’€

#

turns out my assumption last night doesn't even work

#

actually crinj

hearty harness
hidden musk
noble skiff
#

arrays, hash tables, sets, linear search, binary search, graph traversal, Djikstra's

hearty harness
#

yeah, this is where 'self-taught' and not seeing those in application at least for me hurts.

noble skiff
#

yeah, it's definitely much easier with a freshman DSA course under your belt

hearty harness
#

once we get into the pathfinding, searching etc. I start to lose it and need to start watching and reading what others are applying and I was trying to get an idea of what I should be reviewing.

noble skiff
#

i'd suggest just doing a few DSA classes on coursera

#

if what you want is to learn this stuff

hearty harness
#

yeah, I would like to expand my knowledge in those areas for sure. Then again, in my day to day I hardly ever encounter these types of problems or I am ignorant to the solution and shape of the problem that fit together. I will check out some of the DSA documentation.

pine tiger
#

bc i suck at it lol

hidden musk
#

just use the oop parts of ocaml :D

pine tiger
#

does it have for loops

hidden musk
#

they're "for loops"

#

not really what you'd find in an imperative language

pine tiger
#

i mean last time i tried haskell and i couldn't get past day 7 lol

#

granted it was 2019 but still

ripe meteor
#

+1 for ocaml or f#

pine tiger
#

no but seriously having worked with imperative for so long

#

i think i'm too dumb for functional lmfao

ripe meteor
#

both langs give you an "out" if you want to mutate stuff or iterate imperative style

agile silo
#

|| ```py
def sum_distances(gxs, rows, cols):
total=0
for (ga_x, ga_y), (gb_x,gb_y) in gxs:
dist=0
if ga_x < gb_x:
dif = gb_x - ga_x
for i in range(ga_x+1, gb_x):
if i in cols:
dif+=1
dist+=dif
else:
dif = ga_x - gb_x
for i in range(gb_x+1, ga_x):
if i in cols:
dif+=1
dist+=dif
if ga_y < gb_y:
dif = gb_y - ga_y
for i in range(ga_y+1, gb_y):
if i in rows:
dif+=1
dist+=dif
else:
dif = ga_y - gb_y
for i in range(gb_y+1, ga_y):
if i in rows:
dif+=1
dist+=dif
total+=dist
return total

#

i dont get what's wrong in my logic

#

i am getting in day11 part1 less than i should

#

I ||count empty cols x2 and same with rows||

simple raven
magic oxide
#

idk how i feel about day 20

magic oxide
#

oh wow

#

i did not expect that day 21 p2

simple raven
#

πŸ˜„

magic oxide
#

definitely a go to bed moment

#

have some ideas but i'm gonna need some sleep to solve this

simple raven
#

gn

agile silo
#

i was confusing x with y's

pine tiger
#

that's why i always use rows and columns to represent my points instead

ivory vigil
#

I always use complex values

#

set[complex]

dim pivot
#

I always use grid[y][x]

pine tiger
#

when 99% of the time in math you go (x, y)

#

arr[y][x] is very disorienting tbh

stark flume
#

its even more confusing when game libraries invert y...

rancid creek
pine tiger
#

i mean i feel like performance would take a pretty big hit

#

but that is a solution

rancid creek
#

also boundary checks are a lot easier.

pine tiger
#

oh yeah that is a valid point

#

but i myself have a neighbors4 function coded in lol

rancid creek
#

especially useful for any sort of problem where you want to exclude content or find a specific point.

gardens = { (i,j): cell for j,row in enumerate(aocdata) for i,cell in enumerate(row) if cell !='#'}
start = next((i,j) for i,j in gardens if gardens[i,j] == 'S')
sterile parcel
#

i feel dead. i just lost code that i spent 6 hours on

#

i dont know what to do

rancid creek
earnest forge
#

GLHF everyone

sharp panther
#

Language Roulette: Day 22
The language is ... Julia

modern terrace
#

3 days until the end

#

that was quick

#

best wishes to all, T-00:02:00

earnest forge
#

GLHF

#

Hopefully today isn't as crazy hard as 20 or 21 lol

covert arrow
#

GLHF

modern terrace
#

T-00:00:30

#

T-00:00:15

shut trellisBOT
magic oxide
#

o

#

just woke up

covert arrow
#

my code isnt working for some reason 😦

earnest forge
#

I'm getting the right answer for the sample and the wrong answer for my input

#

-_-

fleet fox
#

im gonna lose it

pine tiger
#

MY PLEASURE RECEPTORS

#

OH MY GOD

sharp panther
#

:ooo congratulations!

earnest forge
#

I'm losing it, why am I getting the wrong answer on the real input

#

What edge case am I missing lol

flat sequoia
flat sequoia
#

I had this issue

earnest forge
flat sequoia
#

Oop

earnest forge
#

You can see my code in the spoiler channel

pine tiger
#

haha i didn't even ||sort the bricks||

#

my solution was the worst you could ever think of

modern terrace
#

i sorted the bricks

#

what to do

#

uh

#

why part 2 wrong

#

why part 2 wrong ;-;

#

work for test input

#

not for real

#

:(

flat sequoia
#

Man I failed so hard today

#

First I failed at reading

#

And then I failed at writing

modern terrace
#

my part 2 no workkk

flat sequoia
#

And then I failed at reading again

#

Plane AoC is not it

pine tiger
#

how are you doing aoc on a plane

flat sequoia
pine tiger
#

what wifi

flat sequoia
#

I can’t believe I paid for the expensive ass $40 plane wifi only to get 6 points

#

It’s usually like 8 bucks

#

But on this flight it was 40 for some reason

modern terrace
#

how do part 2

pine tiger
#

imagine "failing" and still getting t100

flat sequoia
#

😧

#

You did so well!!!

modern terrace
#

coming from an average aoc participant

flat sequoia
#

I guess yeah

#

I’m just disappointed cuz I could’ve done so much better

modern terrace
#

anyways why does my part 2 not work

flat sequoia
#

Like yesterday and the day before I genuinely couldn’t solve part 2 in time at least

pine tiger
modern terrace
#

it ||accumulates the bricks that can fall and subtracts the bricks that can't fall from it||

flat sequoia
#

Todays was like supposed to be the type of problem I’m good at

#

Lolll

flat sequoia
#

And removing fallingones before checking next ones

modern terrace
flat sequoia
#

Oh wow you did this completely differently from me

pine tiger
#

yk speaking of plane aoc

#

i recall doing a day on bart

#

didn't think i even t1000'd that one

#

and it was an impl day asw

covert arrow
#

I finally did it

#

Spent too long debugging a completely fine part of the code

earnest forge
#

I'm really not seeing my bug, wtf

modern terrace
earnest forge
#

Same here LMAO

covert arrow
modern terrace
#

k i'll post it there wait

earnest forge
#

I'm the only one to post in the spoiler channel so far and it doesn't even work

covert arrow
#

I'm gonna go eat lunch first

#

Be back in 10min

pine tiger
#

what time zone ru in

covert arrow
#

utc+8

#

aoc opens at 1pm for me

pine tiger
#

what region of the world is that

covert arrow
#

china

pine tiger
#

oh nice

#

i have a friend over in shanghai rn

covert arrow
#

I'm also in shanghai ducky_concerned

pine tiger
#

massive

flat sequoia
#

Lowkey train is more rocky than plane

#

Head would hurt

#

Also it goes underground and u lose internet anguishe

#

Ayy I have landed sfo

devout tusk
covert arrow
#

shhhhhh

hollow wharf
#

Aoc's still going on?

molten fulcrum
real flare
#

Hello

lime fulcrum
#

hi

magic oxide
#

i am soooo glad i have a display_visited function leftover from last year's aoc

#

so nice

#

also nice to see ||my guess about day 21's assumption last night in bed was correct||

ripe meteor
#

21 part 2 was terrible and i kinda cheated but i dont care tbh

lime fulcrum
ripe meteor
#

I looked at solutions and hints

#

I never would have gotten it by myself

#

It didnt even occur to me to look at my input

#

Dw im not in the leaderboard

dim pivot
#

3 more days left....

lime fulcrum
#

I wouldn't say that is cheating. If I am completel stumped then I do that as well

dim pivot
#

How many do you think will be "hard"

#

I don't think there will be any more 3d processing thankfully

lime fulcrum
#

beacons?

tall wasp
#

25th is usually easier

sharp panther
#

usually i think difficulty peaks around 18-22?

tall wasp
sharp panther
#

yesterday was a pretty fast day, global lb finished in less than a half hour

sharp panther
#

compared to 21? yeah

tall wasp
#

oh youre a different timezone yesterday is 21 for me

#

i was gonna say lol

lime fulcrum
sharp panther
#

oh no you're right, 22 is today

lime fulcrum
#

still on 19 XD

sharp panther
#

but it was before i slept and thus i'm calling it yesterday

tall wasp
#

2022 beacons was a little more doable

tall wasp
lime fulcrum
#

but is a very cool problem, hard yes but very cool

tall wasp
#

yup

noble skiff
#

I feel like the trend of needing to "explore" the input and discovering its specific properties to solve it continues

#

day 20 and 21 were again super blatant in that regard

hidden musk
#

ya

#

not a fan tbh

noble skiff
#

it could just be my memory of course but I definitely do not remember ever feeling this way, to such a degree, in past years

magic oxide
#

yesterday reminded me of a 2021 day 24

noble skiff
#

like, I remember in past years there were things where you didn't need to use LCM because a bunch of numbers were co-prime... but LCM is like grade school arithmetic anyway

#

we've already have like, at least 3 days where the "full" solution would be crazy, but when you realize the specific properties of the input it's actually quite easy

#

so the main challenge is actually just verifying those properties

#

For day 20 part 2, as soon as I read the vaguest hint about it, I immediately understood where it was going, I made all the assumptions, and it worked

#

I'd be curious if this is an intentional change by the creator if they do not see it that way

rancid creek
pine tiger
mossy basin
#

i remember using cv2 for beacons

tall wasp
mossy basin
#

had a shapely solution

#

oh it was 2021 day 19, used cv2.estimateAffine3D

rancid creek
rancid creek
# mossy basin oh it was 2021 day 19, used cv2.estimateAffine3D

cheats. πŸ™‚
but cleaner than this mess:
||

psub=lambda p1,p2: (p1[0]-p2[0],p1[1]-p2[1],p1[2]-p2[2])
padd=lambda p1,p2: (p1[0]+p2[0],p1[1]+p2[1],p1[2]+p2[2])
rotate=lambda s,a,b,c,i,j,k: (a*s[i],b*s[j],c*s[k])
rotations=lambda scan: {r: {rotate(s,*r) for s in scan} for r in orientations}
mhd=lambda a,b: abs(a[0]-b[0])+abs(a[1]-b[1])+abs(a[2]-b[2])

||

mossy basin
#

yeah, i like when i can apply my esoteric cv2 knowledge

#

i had a fun day 5 solution

#

for 2021, where you had to do lines, but i got cv2 to do it

tall wasp
rancid creek
#

The only time knowledge of another library really helped me in aoc was the time I had just helped someone with a CRT question on learnpython and the next day was a CRT question on aoc.

'part 2:', sympy.ntheory.modular.crt(m,r)[0]
mossy basin
#

my utilities has crt in it now

rancid creek
mossy basin
#

but i did actually take number theory once upon a time and the only thing i remember is crt and quadratic reciprocity

#

i think we spent a week proving quadratic reciprocity like 4 ways

rancid creek
#

like almost all of the math I learned way back when has faded to fuzzy memory. as long as I can remember something loosely exists I can google it.

mossy basin
#

wait until we need to solve some quadratic equations modulo something and i'll flex on all these fast guys

#

or i won't because they know already

#

the math i use now is too specialized to do me any good in aoc

noble skiff
#

I remember a decent amount of math but none of it is relevant lol

#

it's all continuous stuff; tons of courses on calculus, analysis, etc

pine tiger
#

nothing discrete?

noble skiff
#

formally, no, except for some counting (i.e. in probability/physics classes)

#

it's mostly just pure math and CS people who do significant amounts of discrete math

#

outside of that most fields use a lot more continuous math

dim pivot
#

I hope there are more maths days but I know it's not coming

#

We already had quite a few earlier (18,20,21)

ripe meteor
#

The channel name clearly states advent of code

rancid creek
#

Waiting for something to hit my speciality and then realizing I might not have one it can hit. πŸ™‚

earnest forge
#

🀝

woven sable
#

i hard coded every possible orientation

#

and spent 6 hours figuring out why my code wouldnt work

#

then i j went to sleep and solved it in like 30 min the morning of

rancid creek
rancid creek
dim pivot
#

My fav days of all time are probably day 24 2021 (the one with reverse engineering) or day 22 2019 (the one with modlar inverse and geometric series)

pine tiger
#

yk i'm having kind of a hard time doing day 22 efficiently here

lime fulcrum
#

can someone help me debug something for 19 2? i'm going crazy here

zinc walrus
#

Hi, can somebody answer me a question for d14-1, please? First riddle is that I only pull on the north side and all round stones need to go as far up as possible?

zinc kindle
#

I'm going through old AoC problems and I'd like some clarification for 2018 day20 part2: ||does the number of rooms include rooms along a path, or just rooms at intersections/dead ends? e.g. if input was "N"*2000, would answer be 1001 or 1?||

zinc walrus
#

My rolling algo is a bit stupid, but what I noticed: when I replace the string values for numbers, I can actually exploit some calculations. But I have to go still through the matrix multiple times. Hmpf

zinc kindle
#

Alsp, part1 of 2018 day20 was a pain. wrote algorithm that looked plausibly correct, gave too high answer. Wrote a more precise algorithm, and it turns out that no, my original algorithm was correct, I just forgot to .strip() the trailing whitespace in the input.

cyan sleet
#

so 3 days left, predicting ||rust||, ||typescript|| and ||python|| for the roulette

zinc walrus
#

Is the answer for each puzzle btw coupled to the account? Or does everybody get the same solution for each day's parts?

minor cave
pine tiger
earnest forge
#

Today had better be nice and easy because I didn't get much sleep

covert arrow
#

GLHF

earnest forge
#

GLHF

#

no language roulette today? mods asleep??

hexed axle
#

We're here, the roulette ball just takes a bit of time to land

earnest forge
#

πŸ€”

#

Are the elves making you roll it 10 billion times or something

hexed axle
#

It was the easiest way I could think of to make Advent of code a bit more analog

earnest forge
#

GLHF everyone, 5s!

shut trellisBOT
modern terrace
#

pathfinding :(

covert arrow
#

^

hexed axle
#

Language Roulette: Day 23
The language is ... JavaScript/TypeScript

cyan sleet
#

1 prediction down

hexed axle
#

Your prediction power is impressive, use it wisely

pine tiger
#

YOOOOO

earnest forge
#

Nicely done

#

I can't quite get ||my heuristic for the path that will be the longest|| right

pine tiger
earnest forge
#

Bruh

modern terrace
#

WH

#

I WROTE A

#

:D

covert arrow
#

how long would a ||brute force for p2|| take?

earnest forge
#

More than 17 minutes

covert arrow
#

hmm

woven solar
#

today I decided to treat myself and write a nice solution with ||networkx||
part2: now solve an NP-complete problem

earnest forge
#

Lmao

covert arrow
#

Maybe you could ||collapse some of the paths|| and it would run faster?

pine tiger
earnest forge
#

I see how the input is structured but honestly I don't see how that would speed up my searcher

earnest forge
tall wasp
#

im getting wrong answer for some reason 😩

pine tiger
flat sequoia
#

I did that but

#

i keep getting 175 on the sample

#

for some reason

#

Lmaoooo

lucid narwhal
#

i got just 75 πŸ’€

flat sequoia
#

OH SHIT

#

No wonder

#

BRO WHAT

#

I thought I fixed the issue

#

but I'm still getting 175

#

oh

#

I just didn't fix it lmaooo

flat sequoia
#

Should I wait mine out

covert arrow
#

πŸ₯³

pine tiger
modern terrace
#

how do i do part 2

woven solar
#

pain and suffering

modern terrace
#

oh

woven solar
#

i ||simplified the graph by collapsing corridors|| and it still took me >10 minutes because networkx is slow as fuck. probably a handwritten bruteforce would be much better.

modern terrace
woven solar
#

it's such a shame that the premiere graph library for python with all the fancy algorithms is also pure-python.

covert arrow
modern terrace
covert arrow
#

I'd recommend ||converting the grid into a neighbor dict||

woven solar
#

(AFAIK there's no solutions other than bruteforce with various optimizations because this problem is NP-hard in general (though not sure if it's NP-hard on a grid, probably yes). some people used ||heuristics||, which makes it much faster but is hard to guess at.)

pine tiger
onyx knot
#

Advent of code is too hard

#

Im leaving

modern terrace
modern terrace
#

do i have to bruteforce this

modern terrace
#

oh

#

yea i did it :D

dim pivot
#

I don't see why collapsing corridoors is so effective but it worked for me...

#

Yes it's NP hard.

#

I'm really bad at such problems - I like knowing what I have to do

#

for part 1 I overkilled it using topological sorting so was not that fast

magic oxide
#

im so confused on day 22

#

my solution worked for p1, doesn't work for p2
and i just found a bug that means it shouldn't have worked for p1, so i just got lucky?

#

and it still doesn't work

#

just figured it out

#

somehow my two bugs just cancelled each other out and gave me the right p1?

noble skiff
#

Strange things can happen

magic oxide
#

truly wild

magic oxide
#

what's p2 of day 23 btw?

#

would like to do some sleep mulling

feral hazel
#

won't be able to make it today or tomorrow but it was fun while it lasted
see you all next year
(or in june if we're doing roc :)

feral hazel
pine tiger
#

any way for me to uh

#

have a type annotation that specifies

#

"you can index this and it should give a string as a result"

rapid wolf
pine tiger
#

oh speaking of typing

#

i remember hearing that that module was deprecated or smth?

rapid wolf
#

I don't believe it is, it has several crucial things that don't have an alternative

feral hazel
#

yeah
though iirc now the collections from collections.abc are preferred
eg collections.abc.Sequence

pine tiger
#

that name is so much longer tho 😭

feral hazel
#

from collections.abc import Sequence :D

hollow wharf
#
import collections.abc as typing
typing.Sequence[str]
``` g
noble skiff
#

The ironic thing is that by making list and dict more convenient built in type annotations

#

They discouraged indirectly using Sequence and Mapping

#

Which should be used a lot more often

hidden musk
#

so true

sleek cave
#

I SOLVED DAY 17 LETS GOOOOO

#

AFTER FIVE HOURS

#

and not understanding the solution

#

i made some sense of it

#

still need to figure out why this ||modified version of dijkstra|| works lmao

elfin sun
#

why are the days scrambled on the website

ripe meteor
#

Youre going up and down the islands

#

Theyre following you

pure dove
#

would anyone here be kind enough to help me out with day 21 part 2 😭 my thing works for all the test cases provided but not the right answer for my input and ive been at this for 2 days now and idk whats wrong

pine tiger
pure dove
pine tiger
#

idk i'm more acccustomed to speaking there so

cyan sleet
#

!d collections.abc.Callable

marsh currentBOT
#

class collections.abc.Callable```
ABC for classes that provide the [`__call__()`](https://docs.python.org/3/reference/datamodel.html#object.__call__) method.
pine tiger
#

why is it tho

#

if it's the same thing

sleek cave
#

day 23 ... definitely no time to solve this today, just caught up with day 17 as winter break is finally here
but first thoughts give me ||longest path in a DAG|| which should just convert to ||shortest path in the negated graph||? i think there might be something fishy with the slopes, though. and since ||the graph is unweighted|| there might be a much easier way

cyan sleet
#

in fact, it's an NP-hard problem https://en.wikipedia.org/wiki/Longest_path_problem

In graph theory and theoretical computer science, the longest path problem is the problem of finding a simple path of maximum length in a given graph. A path is called simple if it does not have any repeated vertices; the length of a path may either be measured by its number of edges, or (in weighted graphs) by the sum of the weights of its edge...

#

however in part 1 ||the directedness of parts of the graph makes things easier||

#

and even in part 2 ||you can reduce the problem to a pretty small graph where attacking the NP-hard problem is feasible||

sweet star
pine tiger
#

think it's just the texturing

modern terrace
pine tiger
#

no

#

it means "you can't solve this polynomial time"

cyan sleet
#

not necessarily "can't"

#

we don't know that

modern terrace
pine tiger
#

do you know what big o notation is

modern terrace
#

yep

#

a bit

pine tiger
cyan sleet
#

do you know what a polynomial is?

modern terrace
#

idk

pine tiger
#

any expression of the form a_nx^n + a_n-1x^n-1...a

#

or something like that

magic oxide
#

you need subscripts on those a's

pine tiger
#

basically it's not 2^x, x!

#

functions that grow stupid fast

magic oxide
#
def polynomial(x):
    coefficients: list[number]
    return sum(c * x ** n for n, c in enumerate(coefficients))

essentially

cyan sleet
#

so there is the class of problems called NP where we can verify a solution in O(polynomial(n))

modern terrace
#

like Ξ£_i=1^n aα΅’xα΅’^i?

magic oxide
#

i=0

pine tiger
#

yeah

#

but what stickie said

modern terrace
cyan sleet
#

P is a subset of NP

#

NP-hard means "this problem is as hard as any other problem in NP"

#

and longest path is one of those NP-hard problems

#

as hard as a bunch of other problems we also don't know how to solve efficiently

modern terrace
#

so basically it's just problems that take the most time to solve?

cyan sleet
#

NP-complete problems are problems where we know how to verify an answer efficiently, but we currently don't know if we can also solve them efficiently

pine tiger
#

thought that was np complete

#

i've been told the halting problem is np hard

cyan sleet
#

the open P=NP problem is asking whether all problems that can be verified efficiently can also be solved efficiently

cyan sleet
#

NP-complete is NP-hard + NP

pine tiger
#

but maybe one day the next turing will come along and prove it is

mossy basin
#

will prove that it's undecidable

pine tiger
#

πŸ’€

cyan sleet
#

annoyingly p != np is the annoying case to prove

pine tiger
#

"you can't solve this problem in polynomial time"

#

how do you even prove that

cyan sleet
#

NP as a term has fun history

#

non-deterministic polynomial

magic oxide
#

oh i can't read the time

#

thought day 24 starts in 6 mins

#

it's an hour and 6 mins

pine tiger
#

πŸ’€

magic oxide
#

welp

#

time to see if i can do the np hard problem in an hour then

cyan sleet
mossy basin
#

speaking of nondeterministic, i was think of trying non-deterministic solutions to yesterday

modern terrace
cyan sleet
#

P is a subset of NP

#

so the subset symbol would be relevant

#

which is kinda ≀

magic oxide
#

if you can solve a problem in polynomial time you can verify it in at least polynomial time by just solving it, so P <= NP

modern terrace
#

is there such a case that NP would take more time than P

#

or is it always that the time taken by NP is equal to and potentially less than P

cyan sleet
cyan sleet
#

like solving an NP-hard problem for tiny inputs, while solving a P problem for hugr inputs

magic oxide
#

day 23 is gonna be interesting to see the solutions for
i'm doing it now and i've become painfully aware how little graph theory i actually know

cyan sleet
#

asymptotics don't say much about absolute running times

cyan sleet
#

for sure the stuff you need you already know

magic oxide
#

rn i'm trying to conceptualize a ||longest path algorithm on the graph||

#

||does dp work?||

cyan sleet
#

what's the dumbest idea you can come up with?

magic oxide
#

oh

#

i see

earnest forge
#

(and can you implement it well)

#

((mine took 12 minutes but someone managed to get 23 seconds))

cyan sleet
#

mine runs in 0.6s, but that's after a bunch of improvements

modern terrace
#

my d23p2 takes a minute

#

or two

cyan sleet
#

my initial thing took like 2 minutes

sleek cave
earnest forge
#

||not for p2||

modern terrace
#

is day 25 always easy

sleek cave
#

i don't know

earnest forge
sleek cave
#

these are my first thoughts lol

cyan sleet
sleek cave
cyan sleet
magic oxide
#

my p1 gives 93 for the test input PensiveCat

cyan sleet
earnest forge
cyan sleet
magic oxide
#

an error in graph construction i think

#

so yeah

#

for the test input, it takes 15 steps to reach the first fork from the start right?

cyan sleet
#

or just doing the grid wrong?

magic oxide
#

oh i just wrote 0 instead of 1

earnest forge
#

Lmao

magic oxide
#

nice it worked

#

oh cmon i spent ages ||figuring out the slopes||

cyan sleet
#

lol

#

I did the reduction only after badly solved p1

#

but I also did the slope logic

#

it gets pretty intricate

magic oxide
#

removing the slope logic doesn't immediately get me the right answer

#

sadly

cyan sleet
#

which part fails? the "immediately" or the "right answer"? πŸ˜›

magic oxide
#

right answer

#

150 for the test case

earnest forge
#

Sounds like ||you're pruning too aggressively||

magic oxide
#

oh no my graph is just wrong

#

lemme clean up my code because i just have two duplicate blocks of code

#

p1 was actually harder than p2