#advent-of-code
1 messages ยท Page 30 of 1
there's 8 wires that need swapping, and ||3 of them are obviously wrong because the wrong type of gate is directly connected to the output||
you can also get pretty far by figuring out ||what the least significant bit with a wrong wire connected to it is||
if you set x to ||all 1 bits|| and toggle y between ||all 0s|| and ||all 0s except a 1 as the lsb|| then it's easy to see if addition is working for the N least significant bits
also it's helpful to know that ||there aren't any extra gates||
what is this even about
that @jagged widget
|| ๐ญ ||
.
this is not on topic for the channel
ok sorry
Hey sup
๐
Hi
@minor cave Is it too late to join the leaderboard for 2024?
hi
I'm not able to get the join code with the /aoc join command. I already completed the challenges, and wanted to add my self to the leaderboard for the role 
Tf
I needed to update the cookies which is why the command errord. Can you try again?
I don't remember if we kill the leaderboard join in December of January though
Ty! I think it worked!
woot woot got the flair!
Address Family, however, this is not the right channel, please read #โ๏ฝhow-to-get-help
@hot scarab^
How do I unlock the strings for my discord bot?
I need to unlock firewall as well, I use python on desktop
My firewall is corrupted
@long bear is this related to Advent of Code? if not, please ask in the general #python-discussion, or perhaps #discord-bots
Hullo! Channel is a lot more active in December during the event.
But feel free to ask about any of the puzzles anyway. ๐
Sorry I'm new to discord I'm learning a little python for programming
Cool. Doing adventofcode puzzles for fun/learning?
Yes
Some of them get impossibly hard for new coders, don't let that discourage you, it's ok to google how, or ask questions so that you can keep moving forward. Or just focus on the easier puzzles.
Tank you

hi im completely new to this and joind this server to find some help
idk if im in the right chat room for this message ether btw
how can you make your message appear like this in discord?
Use triple backticks (same key as ~) in either side of the pasted code and it will allow code formatting for multiple lines of text.
Is there a channel for GSoC 2025 contributer in python?
Does anyone contribute or interested in contributing to python this year?
What is that?
I mean, everyone in this server is already doing Python code
Google summer of code I presume
I think they mean contributing to actually updating the language itself in newer versions
<@&831776746206265384>
!cban 728561488536535102 Not fit for our community
:incoming_envelope: :ok_hand: applied ban to @zinc bane permanently.
I'm just looking into AOC. Do you do all the workings in your own IDE or on the website
Theres no way of solving the puzzles on the website itself
OK just the answer perfect thanks
And does the puzzle input always just strings ?
Like aoc2024-1
yes, it's always ASCII text.
Hmmm ok
no, some of them require a lot of thought
Nice
what am i doing wrong here: for AOC2024-1
answer: int
ab = input.replace(" ","")
ac = ",".join([ab[i:i+5] for i in range(0, len(ab), 5)])
x = ac.rsplit(",")
l1 = len(x)
l2 = int(l1 / 2)
ab1 = 0
ab2 = 1
for i in range(l2):
if int(x[ab1]) > int(x[ab2]):
higher = int(x[ab1])
lower = int(x[ab2])
else:
higher = int(x[ab2])
lower = int(x[ab1])
z = higher-lower
answer =+ z
ab1 += 2
ab2 += 2
print(answer)
a = input()
calc(a)
hhmm
Are you giving the input by pasting it in?
yeh im pasting in the massive string as 1 line,
this also doesnt work - give the incorrect numner:
answer = 0
ab = input.replace(" ","")
ac = ",".join([ab[i:i+5] for i in range(0, len(ab), 5)])
x = ac.rsplit(",")
l1 = len(x)
l2 = int(l1 / 2)
ab1 = 0
ab2 = 1
for i in range(l2):
if int(x[ab1]) > int(x[ab2]):
higher = int(x[ab1])
lower = int(x[ab2])
else:
higher = int(x[ab2])
lower = int(x[ab1])
z = int(higher-lower)
answer += z
ab1 += 2
ab2 += 2
print(answer)
a = input()
calc(a)
its working as far as, i can get the numbers seperated into a list, then i must be messing up somewhere calculation the difference of adding all the differeneces
holy shtit, im not doing it lowest to hightest
now i realised that my list is not all of the input... why would that be?
answer = 0
left = []
right = []
# Remove new lines
ab = input.replace("\n", "")
# Remove the spaces
ab = ab.replace(" ", "")
ac = ",".join([ab[i:i+5] for i in range(0, len(ab), 5)]) # add a comma between each number is the string
x = ac.split(",") #create new lsit with each number as seperate
#list = x.sort() # sorted list
print("Length of full list:", len(x))
print("First few elements:", x[:10])
print("Last few elements:", x[-10:])
ab1 = 0
for i in range(len(x)):
if ab1 % 2 != 0:
left.append(x[ab1])
else:
right.append(x[ab1])
ab1 += 1
print("Left length:", len(left))
print("Right length:", len(right))
return left, right
a = input()
calc(a)
ok and now in 5 hours i and realise that input has a max limit that im goingbeyond. wow
these are the fun mistakes that you will never do again
input doesn't have a max limit 
Yeh I'm guan look into that but I'm sure that will require a total restart on the code ha daym
Can anyone here help me with my code? I'm running into a problem where I don't know what to do, It's with lists and inputs and such and I can't seem to get it to work.
Please react with โ
to upload your file(s) to our paste bin, which is more accessible for some users.
Will a .txt file read like I pasted it?
this doesn't seem to be related to AoC. please see #โ๏ฝhow-to-get-help
!paste
@solar tinsel i did it! day 1 complete. after using the file and a few tweaks! onto the next!
Gl hf
Oossh number 2 is making me loopy
number 2 for days
does advent of code have a non-oauth option?
I donโt think so
unfortunate, github suspended my account ๐ฎโ๐จ
&aoc link zak799
You have linked your Discord ID to zak799.
Reddit accounts are generally easy to make
thanks
Hallo again people ๐
Hey everyone! Iโm Caleb. Iโll be doing Advent of Code in Python again this year (and maybe some TypeScript on the side).
As part of my own workflow, I put together a small CLI called "elf" that handles fetching inputs, caching them, submitting answers safely, and checking private leaderboards. Happy to share it in case it helps anyone.
GitHub: https://github.com/cak/elf
PyPI: https://pypi.org/project/elf/
Looking forward to hanging out here, comparing approaches, and seeing how everyone tackles the puzzles this year.
Happy coding and good luck on Day 1!
I'm super suprised that name wasn't already taken or reserved
elf on PyPI
In computing, the Executable and Linkable Format (ELF, formerly named Extensible Linking Format) is a common standard file format for executable files, object code, shared libraries, device drivers, and core dumps. First published in the specification for the application binary interface (ABI) of the Unix operating system version named System V ...
Oh, I'm new to python (and coming from AutoHotKey v2 after mastering it)
(that 0.1dev version looks like a project initialized from a template with zero changes though)
Yeah, @lusty rover and @terse comet it was! I had reached out the owner since it wasnโt being used since registered in 2014. Iโm glad to put it use, Advent of Code is much more fun than file formats, imho. ๐
So thanks to Solos for the great package name!
yes
:D** **
How hard is solving the problemas of the lats days?
I'm new in python, it's my first time in an advent-of-code, and I'm happy for finding it :)** **
they do get fairly tricky. Don't worry about whether or not you will be able to complete all of them, just see how far you can get
And also it's rare that a problem on one day is a prerequisite for a different day. Most of the time if you get stuck on e.g. day 7, you can still do days 8, 9 etc.
i will miss being able to do aoc as soon as it releases..
I don't think you generally need to be a genius to solve all of them, but I think it'll be tough if you're not pretty experienced.
But yeah, try your best anyway
See how much you can solve
๐ค ๐
last year I managed to get up to day 20 solving everything
after that I couldn't do the part 2s anymore
I completed two previous years, and I don't feel like any problems were super hard. They don't require super advanced or obscure algorithms. Stuff you'll learn in an intro to DSA at most.
And most aren't even on that level.
a good chunk is just knowing when to apply memoization/caching
Yeah
๐
in some years there were a few pretty bad ones
but yeah, give it a try and skip or stop if you must
(that post I linked is very old too)
Hm, whether they are bad or not seems to be debatable.
Some people in that thread complained about puzzles that take a lot of time, but I feel like it's kinda traditional to have one or two days like that.
Some people also don't seem to like it when you get a big advantage from manually looking at or preprocessing the input, which I feel is a little arbitrary.
I don't think there were any last year, but usually there's a day where part1 requires writing an emulator for a toy programming language (where the input is code in that language). part2 then tends to require studying the given code by hand and figuring out the algorithm. This gave me a lot of trouble my first few years.
beverage bandits was implementation pain
I see there are only 12 puzzles this year, is it just the first 12 days of December?
Yup
I've never tried advent of code seems fun
Hi
My 2-3 advent of code, never completed it though
I hope to complete it this year ๐
I will be boring and do it all in no-std Rust this time
im gonna do it in python because I don't know any other language ๐
I plan to do it in Haskell this year, but I reserve the right to retreat to Python if I'm having trouble and redo it in haskell later (probably. I remember one time I spent ages trying to parse an input in Rust, before giving up and just using Python's ast.literal_eval)
omg AoC today
im doing rust too but not no-std
i will use this as an opportunity to further my knowledge in rust :ferrisCat:
maybbe i could try no-std after i do the std solution
i will be competing with my friends afterall
||this was just a placeholder challenge to print double the value you read from a file||
so excited
advent of code in an hr 21m
Hullooooooo all.
1 hour remains
fun thing to experiment with then is seeing which new libraries will be helpful, if you don't know a lot of numpy aoc is a good place to practice.
got it
Same plan
glgl
oh god
I HAVE FOUND MY PEOPLE
im gonna speedsolve in python first
Doing them in Excel is fun
https://github.com/shenanigansd/scratchpad/blob/main/events/advent_of_code/2015/01/excel/excel_day01.xlsx
welp i guess i get to procrastinate setting up my repo another day
10 secs
<@&518565788744024082> Good morning! Day 1 is ready to be attempted. View it online now at https://adventofcode.com/2025/day/1. Good luck!
<@&518565788744024082>
how does one parse in microsoft excel
i misread the question already...
on it
im so cooked
Hmm
This is not a thing I know how to do well
Part 1 looks straightforwards, so I'm scared for the part 2 twist
aghghg I already got it wrong once
i did so bad on day 1 but it was fun ;;
twice
i've got the gist of it, i'm stuck on how to get the proper answer tho
AHH I SEE
Wait aoc day 1 is out?
Yep
yes
i really should sleep but this looks easy enough to try
Oh shi
it's harder than it looks i assume
Time to actually do it then I guess
yeah so am i ๐
It's always the worst when you get the correct answer from part one, but seem to be doing it completely wrong because the example makes 0 sense
doing this in excel isn't that bad actually
Oh you're already doing Excel lol
oh?
I'm getting so close to replicating the example
what is advent of code ?
Day 1 is dope. I can't find the document: I'm on phone. But just 6 hours ago I finished making a Python-like document parser in C that advances line by line, so if the document has multiple lines I just need to read the first byte and from there it's easy.
Time to figure out how to access the document on mobile
Fun.
lol the sponsor I got is my new vendor at work
ok for some reason it's giving me the correct answer for the test data but not the actual data?
Edge cases!
yeah that's what im tryna figure out
wow only 4 ppl so far
i'm beginning to give up this is actually pretty difficult
i got part 1 but part 2 is uuuogh
i'm stuck on part one due to the edge cases
there are edge cases on p1?
or im just stupid
goddamn it
my code works on the example, but not on the actual data
I NEED A HINTTTT
you can post your solution (with spoiler tags) in #aoc-solution-hints and ask for hints from there
Hey, question, doesn't going from 0 to 95(L5)
gives us a point?
like the lock does point to zero since it is circular, right?
you're starting at 0 and turning left 5. You don't count 0 twice
aaah
that makes sense
me realising my solution was low, now handling the edge case, it is even lower
same
idk how I'm getting my ass handed to me so hard checked addition shouldn't be this hard ๐ญ
[day 1 part 2]||```py
n = 50
zeros = 0
for i in ndata:
for j in range(abs(i)):
if i < 0:
k = -1
else:
k = 1
n += k
n %= 100
if n == 0:
zeros += 1
we don't need efficiency where we're going!||
||Yeah, I ended up resorting to that after struggling with modular arithmetics for way too long.||
||I had a solution that used modulo that ended up being off from the correct answer by only a little, so I assume I somehow failed to account for some obscure special case.||
||ย i also just did the "stupid" way and looped one by one, brain wasnt braining for figuring out the actual math ||
||did the manual simulation to get the star, then figured out the modular stuff at leisure||
new spoiler channel
true
update: I had a single off by one error. Thankfully valgrind exists
Hello everyone
I got it right on the first try ๐
First day, first part, and it's already not easy ๐
If it's 50, and them goes "R50", it stops in 0, right?
yep
it might help drawing the dial if you can't visualize it
I felt like part 1 was somewhat easy. Part 2 I am still thinking about right now
?
I do think that this year's day 1 is a bit harder than in previous years. Maybe it's because there are fewer days, so each one is a bit more involved.
its exactly because of that
if you wanna, post the solution!
where?
in spoilers ig
kk
altho really just make a public repo?
can we post it there from other langs than python?
ok fine i didnt make a public repo either
but its cuz its easier to just commit everything in my workspace which includes inputs and some throwaway files
doubt it
do the repo thing then
kk
you can post stuff in languages other than python in our AoC channels
ah ok
as long as you're not spoiling people outside the spoiler channels, of course
just rememnber to not include the question, or input
I'm trying it in haskell and have absolutly no idea what i'm doing ๐
Average Haskell moment
Yeah i'm getting type errors but idk why
I had the acc and the input the wrong way round ๐ฉ
Why?
Going through an AoC in a new language is a good way to warm up
Eric Wastl requests people to not reupload puzzle text or full inputs
Ah
AoC in prolog...
I decided to do it all in no_std Rust by just interfacing with libc. It turned out to be just enough new stuff and just enough old stuff
turns out the rust compiler is very fast if you don't make it compile millions of lines of code
I got to play with errno and segmentation faults and then add enough rustisms on top of that such that my solution code doesn't have any unsafe
Does someone wants to Group up for Advent of code?
AoC is not a group activity
But it can be to brain storm
crust
nah, I'm not doing crust
I'm just building safe abstractions myself
(as the language was intended to be used)
part 2 man
checking for double counting while not having any visible way to track my mistakes on the 4k line test cases is rly sth
im doing this in c++ too
Am i the only 1 who created 2 func rotate left and right and incremented it by 1๐ญ
How did u manage to write 4k lines it's like 7
not write, i mean the input.txt is 4k lines long
Oh kk
if its a public repo, the puzzle inputs or texts shud not be included
but for private repos it shudnt be a problem
how do i apply for the advent of code and see the challenge?
click [ Log In ] and log in using one of the providers
awesome thank you
Completed Day 1
that glowing star on your screen is motivating me to complete day 1
I have a few
WOO!!
have you solved the problem, got the star?
you take your input, write code according to the problem statement, feed your input into your code, then type the answer into the website. which will tell you if you got it right or not.
ah is that literally it
could i just make my own github repo to share my solutions or is that not allowed?
Yep, you can. Just make that clear and don't share stuff like the puzzle text or the inputs since you can't redistribute that.
By puzzle text, you mean like the description of the task?
And my inputs are like, the one that the document contains
Yes.
okay got it thank you
Also, for folks interested in Language Roulette, because there are much fewer days this year I'd like to prioritize languages people are interested in trying. So feel free to post requests here!
can i get help with my code for the challenge or not?
also i need to know how i download this file lol
yes, you can ask in #aoc-solution-hints
please use spoiler tags appropriately!
right click > Save as should work I guess
its the one with all the L, R stuff on it
from the website
yeah, right click on the "get your input" (etc) link and choose Save As
alternatively just select all and copy-paste it into a file in your editor
awesome thank you
i also have a question about git
if my file structure is
aoc-2025
- Day 1
- input.txt
- .gitignore
if i put input.txt in .gitignore
when i push, will it be ignored even though they're not in the same directory
it will be ignored yeah
awesome
Hm, don't you need to specify the path?
Maybe not
nope
my gitignore for AoC is just
__pycache__/
*.py[cdo]
input
small*input*
others/
Seems like there's special handling for filenames without leading paths
i just added input.txt to mine
also TIL (based)pyright treats module resolution differently based on whether you're in a git repo or not
also, does the dial always start at 50?
yes
okay cool
Today's pt2 stressed me out to no end
i just gave up and decided to do the bruteforce and it annoys me i couldn't figure out a cleaner way it would always be off by like 30
I just did it the very dumb way
I kinda ended up feeling like the brute force was the cleaner way
I'm trying it in a new language and i'm not sure if my logic is wrong i'm just not used to how this works ๐
||divmod|| is the 'secret' to doing it the cleaner way. My comp solve also did it the brute force way lol
a lot of times the brute force is the more... I'm not sure, naturalistic? skeuomorphic? way
||I mean, the code for the naive approach is easier to read than even nicely written non-naive solutions. And in this case it doesn't need to be optimized at all.||
Also I assume everyone noticed that [not solution related] ||the password method we used is the 'CLICK' method||
can anyone help me lol im having problems with types
I mean that it closely follows whatever real-world object we're trying to represent
and in that sense it feels more elegant than a clever shortcut to sidestep the real-world
Indeed, though the point of a lot of AoC problems is that you have to be more clever than that. ||Not this one though.||
||Not this one though.||
I mean, typical of D1
As usual, it's quicker if you just ask.
i put it in solution hints :)
I suppose
Awesome! You should!
&aoc link aocleaderboardnamegoeshere
You have linked your Discord ID to aocleaderboardnamegoeshere.
&aoc link OneidaGui
Your linked account has been changed to OneidaGui.
imo it's a bit sad when there is a lesson to be learned that gets missed because brute force is feasible
Well, it's also nice that AoC is accessible.
There's pros and cons.
I just hope we get a good handful of problems to silence the "I kept brute forcing and it kept working" crowd
we'll get punishing inputs eventually I'm sure
There usually are.
inb4 ||recursion stones||
I really enjoyed that one last year
which one was that?
2024 day 11
ooh, dlang
I recall that one being fine
iirc the main insight was just that things are order independent and that you should handle things in bulk
https://adventofcode.com/2021/day/6 was a good early one to mess with people
https://adventofcode.com/2019/day/22 is probably my favorite in that regard
Wohooo
just finished day 1
btw @minor cave is it 12 stars for @Advent Of Code Completionist role?
I'm re-reading my solution to that one and I don't get it, lol.
Would be 24
so both parts everyday?
Yes, previously it's been 50*
basically work with counts per timer stage rather than a huge list
And tbf it is called 'completionist'
completionisht
Yeah, I know that part.
I just don't understand the way I'm calculating the counts.
now I'm curious
fn evolve(data: &Vec<i128>, max_gen: usize) -> i128 {
let mut data = data.clone();
for i in 0..max_gen {
data[(i + 7) % 9] += data[i % 9];
}
data.iter().sum()
}
Ah, hmm
I guess (i + 7) % 9 represents that which will be 8 on the next day on day i
And i % 9 is 0 on day i
or something like that
I dunno man
This looks like a DP solution to me
Speaking of solutions that don't correspond to the natural representation of the problem...
here is the relevant part of my code
for _ in 0..256 {
let zeroes = counts[0];
counts[0] = counts[1];
counts[1] = counts[2];
counts[2] = counts[3];
counts[3] = counts[4];
counts[4] = counts[5];
counts[5] = counts[6];
counts[6] = counts[7] + zeroes;
counts[7] = counts[8];
counts[8] = zeroes;
}
you just make use of things being cyclic
That's what everyone says
(btw, you should almost never take &Vec as a parameter, it's better to take &[i128])
I haven't written a line of Rust since AoC 2021
Oh wait no this is actually really simple you're just doing the whole 'shift everything down' but you're rolling around the array without actually shifting the elements. Your array has 9 places, which i cycles around, and then i+7 is to reset the timer on the current slot, which has effectively been replaced by its children. It's actually a super clever optimisation, but yeah rather inscrutable unless you really think about it
so yeah, you are adding the counter 6 fish, the the value at i%9 automagically becomes the next 8 counter
it's clever
Yes. I am clever. Or well, past me anyway. Not current me.
In this context I can see why, .clone() is more obvious than .to_owned() if you're not too familiar with the language and you can't .clone() a &[T] to get anything useful
slices have .to_vec() I believe
This is how I feel when looking at my overall trend on global AoC leaderboards (until this year...)
I wonder how I came up with this, tbh.
They do indeed. Definitely did not remember that and that kinda helps my point tbh
I did it in Rust to learn the language, so I definitely fall in the "not too familiar with the language" category.
I mean it's a reasonably logical combination of a circular array data structure and the counter-based method of solving the problem, it's just not immediately obvious to make that optimisation
(sorry if I'm being pedantic, I thought you were doing AoC in Rust this year so that might have been relevant informaiton)
Oh yeah, actually, if you compare your solution with mine, it's pretty easy to see that they're equivalent.
It's ok to be pedantic, it's a programming education server after all.
to be pedantic, I wasn't being pedantic, rather I was providing unsolicited advice
well now I am being pedantic
I wasn't asking!
๐
soul staring smiley ๐
I mean in fairness it is one of the things that cargo clippy -W clippy::pedantic would tell you about :P
I think perhaps I did something like what @cyan sleet did initially and then collapsed it into the above.
That seems likely, I can't imagine anyone would think of the circular array thing first lol
I was focusing on learning rust that year
(and the solution was so fast that I didn't revisit it to optimize)
is somebody able to come to #aoc-solution-hints to help me with my problem?
next AoC challenge soon
is this how i link my acc for the aoc completionist role too
#aoc-faq message
/aoc join
oh its aoc link
gonna fall asleep before todays problem
SLACKER
ok this time for today's puzzle I'm going to reread it 10 times

yippee day 2
<@&518565788744024082> Good morning! Day 2 is ready to be attempted. View it online now at https://adventofcode.com/2025/day/2. Good luck!
oh this ones a good one
a really easy but slow way to do this would be in o of n squared time
time for the yearly lurk on the python discord server until AOC
no because the pattern has to be repeated twice and only twice
so for 1111 - 2222 it would ofc be 1111 and 2222 or 1919 or 1818 or 1717 or 1616 or 1515 or 1414 and so on
this is a tougher one due to the ambiguity of the combos
wow part 2 really stumped me @~@
clojure is not bad 
Okay parentheses man
ah i see a pattern now
It can get pretty terse
You probably love that you math guy
But I just can't read it
regex ftw
aww damn it part 2 actually kinda has me stumped rn
can you tell me the changes?
what is advent of code ._.
Check #aoc-faq
That felt easier than d1
is someone done with part 1 and part 2
there are plenty of people done in the spoiler thread
i dont want to spoil it for myself, but id like your input and outputs for this personal leaderboard im hosting for my hostel mates
Yes
i mean i can post my input but its kinda pointless without the outputs heh
and i need to solve it
i like the stories
does anybody else enjoy reading the stories
nope, you're the only one
but its so cute
i documented 2015's
https://github.com/blankRiot96/aoc15/blob/main/story.md
i stopped documenting after day 14 but i did read the rest too
so uhm, any takers
stupid elf kid
why would you let your elf child go on the shop computer
i just had to filter out invalid ids using python
No. Eric explicitly asked that people not make public collections of inputs.
But you can just go to https://adventofcode.com/2025/events to see all of the things (apart from the part twos)
what would u even do with inputs
lmao
and outputs
its for my leaderboard
i think that's for public stuff right
Do u have more than 200 ppl doing it?
well, if you dont trust me thats fine, but i could have shared my own to the public if i wanted to heh
How exactly does input+output get used for a leaderboard?
evaluation
every year there is an advent of code because santa and his team are way too incompetent
last year he was mining "advent coins"?? are you serious???
and now this year there's a child with unrestricted access to the gift shop computers
uh just my hostel mates unfortunately
Use the private lbs then
Eh? Are you trying to clone the website?
its based on runtime
Ah
i mean, if you like, you could generate your own inputs and outputs
but that's another problem
Use your own input ๐
how would i check against the output ๐
but fine, ill just solve it myself then
they'll just have to wait
I mean if nobody else in your group has solved it what's the rush, can't you just take the input and output pair from the first one?
Then ask them
im the slow one
i cant have them printing the output and cheezing the leaderboard :ferrisClueless:
well, the one who has solved it wouldnt do that tbh
cant say the same for the others
ill do that ig
but i was hoping to find a fren here who would help me maintain the added fairness
๐ Why would it matter if you get the solution from one of us vs one of them? And/or what's the rush if it's based on runtimes. Just solve it.
theres no rush, id like to offer the lb faster for them is all
so they can compare
an anonymous person who shall not be named has helped me
thank you!! โค๏ธ
2 hours wasted
how you guys solve the part 2 of the day 1
go to #aoc-solution-hints for hints, #1047673173447020564 for complete answers
Whats the expected complexity for day 2 part 1?
time complexity?
or to solve?
mine was just O(N) where N = number of ranges x average span of each range
but apparently ||generating the repeats|| can be faster? salt-die did something like that
Interesting.
Thanks
[part 2] can I reasonably ||store all invalid IDs that have been added to the sum?||
||yeah there's <1000 of them||
oh wait I can just make a set and sum at the end
||or do you mean if the sum itself will fit in an int/long/etc? Python ints shouldn't be a problem, but I'll say my sum was 11 digits||
||why though? you just need the sum itself||
||making it a set might cause problems if the ranges overlap anywhere (haven't checked if they have)||
||```py
ids = set()
for i in invalids2(max_id):
if check_id(i):
ids.add(i)
print(sum(ids))
worked for me||
||i personally feel like eric would've made the inputs not overlap
They've even checked most of the product ID ranges already; they only have a few product ID ranges (your puzzle input) that you'll need to check.
wouldn't make much sense in the lore if they overlapped||
same
I tried joining inputs, some do overlap
joining inputs?
i.e. folding adjacent/overlapping ranges into one
I deleted the code tho because I am given 33 ranges and I have cycles to spare
interesting
mine didn't have overlap, and i think ||a lot of solutions just sum over invalid ids in each range||, so must be rare
I consider adjacent ranges as overlapping
do you guys make a repo with your solutions? 
Wait people actually solved this by... iterating through all numbers and checking if they repeat?
what the hell
do you mean something like [a, b] and [b+1, c]? or wdym by adjacent
exactly
the ranges aren't that big
||adding to a set or just summing wouldn't change anything for those tho||
โจefficiencyโจ
||but storing it in a set would be less efficient?||
||hash retrieve sum is worse than sum as you go since you don't have repeats||
yes
cracked part 1 but with an O(n^2) solution
well that's better cus my solution on the day 1 part 2 involved consecutive adding/subtracting 1 ._.
is there others there also feel the part 2 is really hard ( think I have used almost 1ยฝ hour and cant wrap my head around a solution atm )?
Where part 1 was really easy for me
And no I'm not looking for a solution at lest yet which is why I won't go into the hints chat and spoilers chat
just curious if others also find it hard
i accidentally did part 2 in part 1 :D i misread the instructions
cpp returning 100 when computing 1+pow(10, 2) made solving this problem so much slower
and it printing 101 when doing cout << 1+pow(10, 2) << endl; made it even worse
i did a more or less naive implementation because the ranges combined only cover around 1e6 integers
s = '...' # input
arr = s.split(',')
x = 0
for i in arr:
a, b = i.split('-')
x += (int(b)-int(a))
# x = 1949801
not sure if its hints for it but remember this channel are not for hints or spoilers for the AOC
hihi nice ๐ well done
how did you solve it?
because for me part 2 only required me to change a few lines from part 1
yeah p2 is entirely different from p1 for me and idk how to start implementing at all
i did p1 in the mathy way, i cant see how p2 can be done like this
Yeah for me I did pat 1 in a non math way though still wont directly work for part 2
Wee finally got the part 2 done even that I don't like my solution
Yo folks. I don't understand this.
How can those be invalid IDs?
Where are 99 and 1010 coming from? ๐ค
yeah part 2 made me rewrite whole thing, but i glad that it can be heavy optimized by math knowledge
invalid IDs by looking for any ID which is made only of some sequence of digits repeated twice
they're ranges.
it states in the question that it's a range
Oh good Lord.
Ah thats the part
I understand now.
It's more tedious.
Thanks guys. I'll go grind the question again.
I'm still in doubt: does the sequence have to be repeated exactly twice? For example, would the number 1010610 be an invalid sequence? And should it "occupy" the full number string? What I mean is: should the repeated sequence be exactly half the amount of digits of the whole invalid number? If so, 10106 would be valid (not to be considered), but something like 101101 shall be added.
I believe it's this way, right?
For part 1 its exactly twice
Like you split it in the middle and left and right are equal
What new math facts did you learn
asking because for me I just abused itertools did the easy thing
ill write in hints channel
as you should
how long does yall's code take
for both parts
i just ran mine and its not good
lemme time it
0.15s for p2
my first go at p2 was just ||checking each number in range||, which took ~3s
a while ago I tried ||generating all possible invalid IDs for a given number of digits and checking in the range|| which brought it down
INTERESTING
~0.3-0.4ms for d2p2
my core logic is just:
which does take a bit time to run
well
not the function itself
but so much looping
i have ~5.2 seconds for both parts
5.3 more like
p1 is like <1 sec apparently
can't deny, that is elegant
p2 is the excessive looping
โฏ ./run.sh 2 2
Running days.day2.star2()...
Time taken: 0.0004239 s
yeah not fast tho lol
ill throw the whole solution onto spoilers just for tradition's sake (throw them on the subreddit anyway)
Uhm.
Is it safe to make the assumption the number of digits of the upper boundary is equal to the amount of digits of the lower one?
I don't think it's written anywhere, but I wouldn't know, for now, how to include the problem of different amount of digits in my code.
nope, they are very often different
ARGH
||
for(ll i=a; i<=b; i++) {
string ts = to_string(i);
ll ls = ts.length(); // length of s
for(int j=1; j<ls; j++) {
if(ls%j!=0) continue;
ll div = 0;
for(int k=0; k<ls/j; k++) {
div += pten(j*k);
}
if(i%div==0) {
sol2 += i;
break;
}
}
}
||
Save me, someone. ๐
unreadable fr
its from itertools
oh ill look it up
def batched(iterable, n, *, strict=False):
# batched('ABCDEFG', 2) โ AB CD EF G
if n < 1:
raise ValueError('n must be at least one')
iterator = iter(iterable)
while batch := tuple(islice(iterator, n)):
if strict and len(batch) != n:
raise ValueError('batched(): incomplete batch')
yield batch
use of ll
for long long
are you by chance competitive programmer
havent touched it in a long time
but i still use the same template and writing ll doesnt make it less readable than using long long
fair
hey, anyone know if there is a forum where we can create threads for aoc? I want to generate some images in the style of the story following the storyline of the puzzles and compile them in a thread
Haha shit just looked at day2 and got that dunder Mifflin effect or whatever it is
Yesterday was ezpz
Feel free to pop it in #1444747649084424202
are these designed to be done without any extra modules?
No, use whatever you need
you decide, it can be solved with almost any programming language and with as little or as much libraries for your chosen language as you want as long as you can solve the puzzle
panicked python user noises
anyway no you just need the answer
found this which is amazing
yeah true, doesn't really matter what language you use to get it, as long as you get it
you only need to produce the correct answer in any way you like
by hand with pen and paper is probably a little bit extreme though and tedious with such large inputs though ๐
people literally do it in assembly so
2023 day 5 vibes
i was guna say that, day2 seems like it would be a lot easier just writting it out on paper
or smth along that lines
I did it on my school whiteboard when i had frees
thousands of entries
or tens of thousands
for the idea for the code
then I spent like an hour coding because Im not the best at it
no it doesnt
this is my invalid list
i really dont know how i would do this, i think regex but ill need to do some research
got part 1?
i diud day 1 was pretty easy, but no i havent really started day2 yet. Just going over it in my head how i should do it but i dont know how to do the part where your looking for a pattern lol
you know, the main part that ya need to do
I'm the stuckest person in this challenge.
I can't beat challenge 2 part 1.
Got my 170 lines of code (half of which are comments so I can track what I'm doing), but God knows why I get a wrong result.
At this point I might generate random numbers for ever until I get the answer right.
Are you passing with the example input and example answer?
If you're still stuck after the examples, feel free to make a thread in #aoc-solution-hints and people can help get you un-stuck
No.
The whole building is a mess.
Well, very interesting.....
hello
my ternimal is running for like a minute just to try get the lists of numbers between the start id and l;ast id lol, i think im doing something wrong
maybe, the largest gap I get between the start and end ids is in the order of hundreds of thousands, and it shouldn't take that long to iterate through all of them
yeh i think its the printing to console thats taking so lojg
now i have my gigantic lists of numbers, but i dunno how to looks for that pattern
yeh its the printing, the itarating takes 1 sec
LOL
Could you instead check each value as you iterate instead of adding them to an ever-growing list? Would also save you from having to re-iterate over that list after it is made
yeh, but im still very stuck how to check for that pattern
Which pattern? Part 1 or 2
So you need a sequence to be repeated twice
yeh totally stuck on that
Is there any symmetry to that
Also, probably better to be discussed in #aoc-solution-hints
ohhh it has to use the entire number. that changes it. i was thinking th pattern could be like 568121285 ( that has repeating "12"s in it ) and i was like HTF can i ever figure that out
helo
i just had s doubt can anyone solve it for me
like on day 2 puzzle how do i store that input like do i need to give it in a scan function or i can take it as a string with that input ?
save it as a txt file
oo so i have it as a txt file and then scan character by character to get the number values in a way ?
The provided values are comma separated start and stop points for a range of numbers
11-22 means a range of numbers starting at 11 and ending at 22
e. g. 11-22,95-115,998-1012 are three different ranges
Generally, saving the full input as a text file and then reading it in is a good way to handle the full inputs. The example inputs are usually short enough to keep as a multiline or single line string
Done
i see
thank you for the explanation
Seperate them onto seperate lines then for can do line by line
will give it a try now
since i don't know python completely
imma use c
What determines the total score?
From the faq: #aoc-faq message
day1 part1 for me so far
day 1 made me give up 
There's no time limit. You can come back to it later and try again.
just frustrating lol i couldnt figure out my type problems
I often just shelve something when it gets frustrating and do something else, then come back to it later when I feel more motivated.
I feel like I often get insights about the problem when I'm not actively working on it.
like in the shower or something
โ Measure-Command { py .\solve.py }
Days : 0
Hours : 0
Minutes : 0
Seconds : 21
Milliseconds : 524
Ticks : 215240285
TotalDays : 0.000249120700231481
TotalHours : 0.00597889680555556
TotalMinutes : 0.358733808333333
TotalSeconds : 21.5240285
TotalMilliseconds : 21524.0285
I do not care AoC a star is a star
seconds: 21 
I,m feeling badly, I can't share in advent of code due to I,m beginner ๐ฉ
enjoy my friends
You could have a go at day 1 part 1 even as a beginner
YEH im a begineer and day1pt was fun!
can anybody help with day 1 pt 2?
Chat whats more important?
Sleep, or AoC?
Why not both? I dream about lanternfish after all
dont tell me you stay up for aoc shen
AOC def
you have all day
I do stay up
Till 1 am
For it
Atleast thatโs what it took at max to solve all the problems
I can stay longer
๐ซก
I do
Opens at 11, generally in bed by 12:30, hopefully asleep by 1
Then get yelled at to get my ass up at 5:00 for work
What timezone is that
You are 1 hr ahead of est
I do actually prioritise sleep - puzzles open 5am for me and no way am I waking up for that
Texas
Itโs midnight UTC-5
Iโm UTC-6
Behind*
Sorry behind
Or you can sleep early
In the spirit of xmas they should move the opening time to like 10am UTC
๐
Think about it
Well that just screws the other half of the people
When you open your gifts you dont do it at 00:01 xmas day
You do it when you naturally wake up
And i naturally wake up at 10
I kinda wish the opening hours would change every day before
Why so late??
You see thatโs normal human behaviour
But we are programmers
We donโt do normal
But since thereโs no global leaderboard I care less
Sleep is good shen, i like sleep
Get a new GF
๐ญ ๐ญ ๐ญ ๐ญ
But all the time i invested in this one
Okay you have a hard choice now
Gf or AOC
gf lmao you nerds
yeah no leaderboard has been nice
i'm surprised i'm actually not stressing myself to do it on time
Stressing oneself out over Advent of Code seems like the opposite effect of what the author wanted
And yet I have done that myself on occasion
You gotta be new to humanity to not see whats going to happen
AoC gang I'm a completionist โ๏ธ๐ฅบ
๐
I was thinking pinging you right now ngl
And you replied
great minds think alike
๐ฟ
Did you do the day 2
yeah I finally got my part 2 parsing working, it's not working completely for a certain number ๐
Debug time ๐
nvm it's missing like 4 values
Who is Uncle Albertโs older brother anyway ๐ค
i have no idea ๐
I wish your display name was a reference to the British show โOnly Fools and Horsesโ - that show has an Uncle Albert
But itโs just referring to Einstein isnโt it
yeah
can someone help me in #aoc-solution-hints? I genuinely have no idea what's wrong
Did you got it
Part 2
YEAHHH
Yoooooo
I solved this one entirely by myself with some hints
I used a big brain technique to just turn the lists into sets and union both of them ๐ ( #1445278429372219422 )
1 min
Tick... tock...
<@&518565788744024082> Good morning! Day 3 is ready to be attempted. View it online now at https://adventofcode.com/2025/day/3. Good luck!
this one's weird lemme reread it
Alright
oh my god what the HELL is the input ๐
โ
That was fun
That was cool
Now I need to figure out what I did ๐
ggs
lol
I give up
tfw the brute force approach wont work for part 2
this one was actually pretty easy for part 1
i really wanted to know the global rank for this one
wdym i gotta write actually good code
whats your time
4, 8
Won't work for pt2
I gave it a solid 6 minutes
i dont feel like writing actual logic rn
yeah lmao
i was prepared to even gave it half an hour if needed
but its not even doing a single line
theres prolly a way to make more optimised brute forcing tho
Just notice this. Can I start from day 1?
do we think ||recursion|| sounds stupid
i think it could work
or at least a loop calling a function over and over again
Tsk!
length of input makes it extremely difficult to do this easily
no?
it seems efficient enough
im writing a prototype for example lets see if it works there first
oh wait for which part
yeah
pretty quick debug lmfao
yeah i think this is gonna work
ill tidy up code later lemme just find the answer first
it works
part 1 is so easy bro
but
part 2..
fucking hell
had to literally spend an hour LMAO
it was reallyyyy fun tho
5 some minutes lol
i was eating while doing it
mightve gotten it done before otherwise
lol
lmao
what did you do
i was eating tangerines lmao
damn it part 1's already stumping me because I have no idea what method can actually do this
explain your problem in #aoc-solution-hints maybe we can give you an idea.
me when aoc is leetcode: ||https://leetcode.com/problems/remove-k-digits/description/||
just did
don't know why I'm struggling on something so easy ๐
I guess this is a new type of challenge (that I haven't done before)
...i spent half of an hour assuming the actual input was the same length as the example before i read my input file ๐คก
lessons learned from the past: the input can be important.
i'll take it as a sign to stop attempting AoC at midnight
dang i forgot about aoc
hm
fucked up timing i think
ok much more believable
yeah ok the other one is more shit
good to know
Bruh I still can't solve the day 2 part 2 maybe I'll just brute force it
i brute forced it, took me about six seconds of runtime ๐
I kinda got into the habit of always taking a look at the real input and checking if there's some kind of significant difference from the samples
after making my code work with all the samples
i check actual input almost immediately after reading instructions
maybe after getting parsing to work
how did you do that
Yeah, sometimes I do as well.
In order to grasp the full extent and intention of the puzzle.
And identify any potential traps.
ask in a spoiler channel
you can ask in the spoiler channel
the first thing i do is run my little script to download the inputs, the size in bytes also gives me some idea of what to expect compared to the example input when i go read the problem ๐
My part 2 for today
Execution time: 0.003069162368774414 seconds
all relavant parts or just the core business logic?
its the timing for my main()
also i use just pythons time, so it might not be super accurate
fair, i just time the time for everthing, starting the interpreter included
perf_counter is fairly ok
what command to use to time the literal python command? for unix
python3 2.py input.txt 0.01s user 0.01s system 64% cpu 0.040 total
TIL: about the time command 
its pretty nice to know about
There's also more dedicated benchmarking tools that do multiple runs similar to timeit
i downloaded hyperfine jusdt now, looks cool
Yeah similar to time it benchmarks CLI commands, but doing multiple runs with support for stuff like warmups, and setup/cleanup steps. (For example if you are benchmarking builds you could add the cache cleanup as a setup command)
โฏ hyperfine --warmup 3 'uv run day3.py'
Benchmark 1: uv run day3.py
Time (mean ยฑ ฯ): 26.0 ms ยฑ 1.0 ms [User: 18.3 ms, System: 7.5 ms]
Range (min โฆ max): 24.2 ms โฆ 30.5 ms 108 runs
running it with uv has an huge improvement over just running the python interpreter normally
how come?
Are they using the same python version?
yes
but really... I have to ask... was the description of the part 1 problem enough to understand the example 818181911112111 -> 92 ?
I had more problems cracking the hidden rules than the actual problem.. (problem is actually trivial)
