#advent-of-code
1 messages Β· Page 40 of 1
bruh
[redacted]
hm
you will not be left with more than 1 number ,
infact if you didn't put a while condition , you will end up with an empty list lmao
the inputs are structured such that you will always end up with one number remaining
ok time to shift #advent-of-code-spoilers-archive
This one was fun!
I think I took 10 minutes on the first one and then 20 minutes on the second one
Sad that personal stats don't show time relative to when you started
I started around 2:50?
it's true but i don't get how does everyone die
by die you mean removed
how can the last one not survive
thats what killed the time
ah, because the second part removes majority
what are you guys talking about?
my first algorithm was not to create an individual list and cleanup
rather directly make a new binary by the most count (for oxygen)
that can't work
i know it's not that channel
@woven oriole i figured it out xd
lol
took some debugging
i took a whole one and a half hour just for debugging
list cleaning was the part where i messed
for sorting out the one binary
π―
yea lol filtering out the list is just so confusing
same
.aoc about
Advent of Code (AoC) is a series of small programming puzzles for a variety of skill levels, run every year during the month of December.
They are self-contained and are just as appropriate for an expert who wants to stay sharp as they are for a beginner who is just learning to code. Each puzzle calls upon different skills and has two parts that build on a theme.
Sign up with one of these services:
GitHub
Google
Twitter
Reddit
For the global leaderboard, the first person to get a star first gets 100 points, the second person gets 99 points, and so on down to 1 point at 100th place.
For private leaderboards, the first person to get a star gets N points, where N is the number of people on the leaderboard. The second person to get the star gets N-1 points and so on and so forth.
Come join the Python Discord private leaderboard and compete against other people in the community! Get the join code using .aoc join and visit the private leaderboard page to join our leaderboard.
.aoc join
Y'all ever just... copy your own code wrongly
I really should assign things to variables more often
I used an index of i+1 instead of like an i+2 like I intended, and I never noticed unless I tried replicating the examples exactly
could it be #advent-of-code message ?
ah wait lol
Nothing in the message logs (although there would be no way of knowing if the ping was in the form of a reply)

you can find who pinged you with ctrl + i btw
no ctrl i on phone :/
ye but for some reason that doesn't show the bot's mentions
and the bot's mentions aren't even animating for me so i honestly didn't even consider it a mention but just formatted text
lol
sAD
o_o I somehow got the right answer and my code was way off what I meant to do
sem. I couldnt solve part 2 then I took a break watched venom. Solved it just now after 3.5 hrsπΉ
that happened to me on day 1
i fixed it right after tho
nvm. my mistake was actually... correct
oh mine wasn't xD
it's like
the prompt didn't know what I expected it to
and I didn't do what I expected to
so... my wrong code was actually the right code
i don't have any visualization ideas
Man, it's always so satisfying when somehow my solution is correct
I feel like thereβs a way to do part 2 of day 3 in recursion and I will figure it ou t
Like if there was a time recursion could be cool itβs this problem
I tried to solve it through recursion but ended up using a whole loop instead
.aoc unsubscribe
Okay! You have been unsubscribed from notifications about new Advent of Code tasks.
perhaps take hospital as sample
like making Electrocardiography (google translated, blame google if its wrong)
i know
i don't know how to connect it to electrocardiography
same Β―_(γ)_/Β―
took me 2 hours to solve the part 2 one
pfft
one typo, can take you 1.5 hours :/
i just missed a fucking a in the variable name
and something stupid were happening over and over again
I'm so confused with Day 3 part 2
it wasn't confusing imo
Can anyone suggest me ways to make efficient and shorter code
In 2015, my day 6 code took 10 minutes to successfully execute.
which part
advent of cod hmm i ssee. i havent done the second and third day uwu
which part of what
??
which part of part 2 are u confused with qaq
um... nothing short of all of it
qaq
hmmmm
inside the submarine
pro tip: use large variable names... this_variable_supposed_to_do_this=8
i was doing it as quick as possible
do u need me to explain part 2
maybe u missed out a few keywords like me
i skimmed over the "remaining numbers" part π€¦ββοΈ and was so frustrated
And the small demo won't raise this error
I understand it, but... coding it...
my braincells cannot compute
but I think I have an idea
Decompose the problem into smaller parts.. like finding value that has maximum frequency in a given array.. then u can reuse it
uh oh
my brain is literally melting
put your current code in #advent-of-code-spoilers-archive
Finally.
My code is a lil bit of a spaghetti tho, but it works 
Nice
Good job! π
same to you \π©
My solution for today was... a thing... that exists
jesus christ the code I wrote was abominable
I think most of the people here can relate with that.
The same is true for me
only good part about my code for today is that it came out to 69 lines π
Can we get to see your code tho?
mine came out to about double that
Took me 106 lines with quite some whitespaces , wbu?
It's simple and clean, but you should take solutions to #advent-of-code-spoilers-archive btw.
Woops sorry 
I'm doing a quick refactor
mine is 69 lines and 54 loc
I think I could get it down to 35 or so if I eliminated all my duplicate crap
Okay, so my actual solution takes up 31 lines
Including sample strings, imports, and my own boiler plate, it's 75 lines
by "my own boiler plate", this is what I mean:
import ../utils/aoc
import std/os
import std/strutils
import std/strformat
import std/enumerate
import std/math
import std/sequtils
const YEAR = 2021
const DAY = 3
const INPUT_FILE = "Day 3/input.txt"
if not file_exists(INPUT_FILE):
write_file(INPUT_FILE, get_input(YEAR, DAY))
let input = read_file(INPUT_FILE).strip().split_lines()
let sample = """you get the picture... I've chosen to omit the rest of this"""
what lang?
i'm not sure what this is
can't be rust, js, python, c/c++ c#
oh wait is it nim?
it is Nim, yes
whyd u choose nim
cause Nim seems like a cool language, and I wanted the opportunity to learn more of it
ok
nim?
ah yeah
nice
looks really similar to python
Indeed, but it has a lot of... almost cursed kind of stuff that I find really neat
like? π
stuff like
"Hello, ".echo("world!")
nim> "Hello, ".echo "world!"
Hello, world!
even
hmm hows that useful, there are f-strings?
The first time I heard of nim, it was when I was modifying my text editor's parser and saw that nim was sharing python's symbol list
There is, but they're not called f-strings
there's "fmt" strings and... whatever "&" strings are
i meant how is that .echo() useful, f-strings do the same job
||Im having a bit of trouble with day 3 task 2. On my fifth iteration, i have an equal number of 1s and 0s but i cant see where it says what to do in this scenario. Any ideas? And thanks in advance||
read the problem again, in case oxy and equal number you choose 1 and in case of co2 you choose 0
here
If 0 and 1 are equal...
Cheers
Please take discussions of the current day's puzzles to #advent-of-code-spoilers-archive
^
i was just what was told in the problem though...
Interpreting the problem description is part of the challenge
right π
it's not. It's just a side effect with how Nim works
its crazy how taking a break can help solve a problem, i couldnt solve part2 for 40 mins and just left it, now i was able to solve it in 15 mins on sitting down again
Added option to wait until problem arrives, made submit function autodetect day and year, and added isort :D on my AoC helper
yeah
thats happened way too many times
Who keeps pinging me in this channel
Looking at the global leaderboards, how in the blazes does someone solve, say, both tasks on day 1 in just over a minute from publication?
not me
Me neither.
higure you forgot to on the ping
RIP, had exam today and I am also not well
Wait how do u know?
it shows @ before name in reply
Ah gotcha
not on phone client tho
Ah I see
Mhm
Anyways let's move on
Back to my question: How can someone have the time to read problem and code solution for, say, all of day one in 1 minute 7 seconds?
skimming π
That's stupid fast. 28 seconds on problem 1. Sure, with aoc_helper a lot of boilerplate time is gone, but still.
What is aoc helper?
Also I don't think my code has any boilerplate
You just put the input into the data variable and the script starts crunching numbers
Fetches input data, submits answers, has boilerplate templates.
I was referring to https://github.com/Shivansh-007/aoc-py in my messageoops, you meant that for higure
We won't be doing this
i would go to #advent-of-code-spoilers-archive
I have coded by 30 sec
Dang it this days problem uses bit wise operators which is the one thing i didnt read over and learn about in my python course
Ill prob still try it tho
But bit wise operators are confusing as heck
Current day discussions must go in #advent-of-code-spoilers-archive
Alright
Previous day discussions can be elsewhere, but must be marked with spoilertags.
Also keep in mind part 2 for each day should only go in spoilers too since it's locked until part 1 is done and could change the interpretation of part 1
Does anyone know the different responses you get when you submit answers?
I gotta think of how to setup a submit function
OMG THIS IS THE FIRST TIME MY MIND FLEW TO ZIP
I WOULD'VE NEVER THOUGHT OF THIS BEFORE AOC
AOC = pure amazing
nice!
maybe im just stupid but the instructions are kinda hard to follow on part 2
Wdym
Like
Like numbers into a list
Yes, all the numbers from aoc
An integer list?
Could someone perhaps tell me what the website says if you submit an answer incorrectly
thanks
And what you do is make a variable called that then put three " and then copy paste it and close off the string
I needed it for day 1
Thats how i know it
ty
Yw
with automation it's reading time plus typing time, 20 seconds to read then 10 seconds to type makes sense
or some other proportion
according to betaveros, this is what you type for part 1 in 2019```py
s = 0
for line in input_lines:
s += int(line) // 3 - 2
submit(1, s)
anyone else completely misunderstood the second part of day 1?
and if 400 people do it and 350 stumble on any part there are still 50 people who are lucky to get everything right at once
pls helpp
what's this? 
infix to postfix expression
huh
its a python code need to display the correct postfix
is that an advent of code problem?
yes
For today's problems?
Please go to #advent-of-code-spoilers-archive for that .
I didn't read the entire thing but as a tip you can write
"".join([chr(x) for x in range(ord("a"), ord("z") + 1)])
Instead of doing abcd...xyz
Hold up, where did the original message go
@pale wind
here
please don't discuss the current problems outside of the spoiler channel
isn't that a problem from last year?
its not a advent code sorry
then it doesn't belong here at all
ohh sorry
this can be done for upper case letters as well, also to get punctuations use Strings inbuilt library @pale wind
what line should i put ?
hello, would you two move to a help channel?
It should be something like this
>>>import string
>>>string.punctuation
!"#$%&'()*+, -./:;<=>?@[\]^_`{|}~
this doesn't have anything to do with advent of code
yea, we should move to a help channel, ban.
does anyone know why in day 3 task 1 in the last binary number in the data file is : 000...
that's what binary looks like
unless it's literally three dots
it shouldn't have three dots no
ok let me try
For anyone who wants to hear the creator of Advent of Code speak a bit more about what the Behind the Scenes looks like, this is a great talk to watch! https://vimeo.com/372351782
It touches when Advent of Code was first released and how the popularity of it grew
Advent of Code is an Advent calendar of small programming puzzles for a variety of skill sets and skill levels that can be solved in any programming language youβ¦
thx in worked
I'm going to take a different approach with the next challenge. Instead of trying to solve it as quickly as possible with messy code, I'm going to take some time to really think it thru before I start. It took me way too long to solve part two because I got hung up on solving it using the first method that came to mind, which was flawed.
I find AoC much more enjoyable when I have a goal besides trying to place well on the leaderboard, such as, learning or practicing a different programming language.
That way I can calmly iterate on solutions and compare mine with other people's.
.aoc join
I have accepted the fact I am not gonna be on the leaderboard so my only goal is to finish it
top guy has 561 points rn, averages a top 7 finish
my chances were shot day 1 when I started near the end of the day
yeah, if you aren't counting down the timer you literally have zero chance of finishing top 100
.aoc join
Man today is difficult i dont even know where to start
One of the top guys on the leaderboard is a teacher at my school. Man is insane
yeah, he must be
I feel like d3p2 has easily been the most difficult so far so I feel like most experienced devs would be able to score pretty decent if they started right at the timer
The harder the problem, the more of an advantage you get when you're more experienced, it becomes less about logistics and more about problem-solving.
most definitely
I started late every day and I took roughly the same time to solve most problems (since I'm working with Rust which I'm pretty unfamiliar with, so I struggle a bit with the syntactic basics), but I placed way way better on d3p2 than any of the others.
im still struggling at picking how I am going to tackle part 2
I have an idea but I think its a very bad way of doing it
.aoc join
True, altho I like having an alternate goal of seeing how far I can get instead of how fast I get there. Sputtered out last year at 30 stars
This channel is for discussing the Advent of Code event, if you need general Python help please check out #βο½how-to-get-help.
can you still submit answers late i have exams this month i dont think i would be able to spend 2-3 hours each day for solving problems
yup!
I was doing the 2015 problems last month
They still work π
cool
Once the problems are available, you can solve them and submit answers whenever
oh i thought the timer meant you wont be submit them anymore
Timer is just until the next one opens
lessons (re?)learned today:
||- read the damn prompt and don't assume you won't hit edge case (had a case in part 2 where 0 and 1 were equally frequent)
- python will happily let you test the equality of a str and int LOL ||
so i can chill i guess. and focus on my exams and do problems when i am tired
part 1 took me maybe 10 minutes, part 2 was over an hour XD
I'm still working on part 2
took me 2 hours and a help channel to get through the second part
I have most of the pieces done, now I just need to glue it all together
idk i just start coding and work it from there.
if it gets too messy i start again from another file
like the first try the code went upto 100 lines and wasnt no where near a solution so i just scraped it
haha yeah I'm the same way, if things get too weird I'll just fully start over. I will copy/paste stuff that I know works. That means if my new idea fails I can always go back to troubleshooting the other attempt in place
imo its much harder to fix a unplanned and buggy as hell script to work then starting over
well i ended up learning list comprehensions today and how to use debugger on vscode just basics but usable i guess like i now know how to use break points. although not in detail
like editing the settings of break point
also other stuff but just seeing the variables is alot of help
list comps are awesome
although my script size increased from 40 to 58 when i started using list comp
40 line was the scraped file btw
creating the first solution so it becomes reusable for part-2 problems is the hard way I learnt why reusability in code is important.
.aoc join
hm, TIL that bitwise inversion doesn't work like i thought it did```py
~22 # instead of giving me 9 because 10110 => 01001, it gives
-23
spoilers channel please.
my bad. i forgot about that.
ugh i don't know how to get my desired version of bitwise not
||xor, ^||
hm, i'll definitely try to think about it, tysm!
OMG OMG OMG OMG THANK THANK THANK
THAT MAKES SO MUCH SENSE
woohoo
when i do file.write(response.text) for a aoc helper im writing, my input file that gets saved always contains an empty line at the last of the file
how do i remove that blank line?
it's 0...10110, so it gives you 1...01001. first bit is a sign bit https://en.wikipedia.org/wiki/Two's_complement
but because python's ints are unbound, the binary doesn't really have a good representation - that's why e.g. bin(-23) will show it as -0b10111 - being literally '-' and bin(23)
response.text.strip() @pure saddle will strip whitespace from the beginning and end
ah .text returns a continuous string? didnt know that, though it was strings seperated by \n
thanks!
POSIX requires empty line at the end of the file. some POSIX tools will even skip the last line when displaying stuff
wow, i knew it was going to be something related to two's complement lmao
thank you so much, that clears it up. kat hinted at the desired bitwise inversion using xor, and i solved it. thanks!
fwiw, you can use c-like int sizes with numpy
>>> a = np.uint8(0b1001)
>>> print(~a)
246
246 being unsigned 0b11110110
>>> print(bin(~a))
0b11110110
Nah, it will slowly creep up to prevent people from just iterating with guessing. I know it can get to at least 1 hour
try the test case first
probably not I think the timeout is just so that people don't try to brute force it?
oh yes, i didn't think of that
i think so too
and also it's a competition, loosing 1 minute because of wrong result is good to give more points for those who were quick and correct
(I imagine)
Working on prettying up my AoC helper π
I don't know what to do
Actually, never mind. I'll try to figure out
I didn't even try myself firstπ
im trying to do the second part of the third day but for some reason python wont remove some of the list entries that have a 0 at the start and idk why
If you're removing them from the list as you iterate over it, then that's your problem
I do wonder if there's a tag for that
Yeah, some people like to do:
for item in mylist[:]:
But I prefer this, mainly because it's a lot easier to spot 6 months later:
from copy import deepcopy
for item in deepcopy(mylist):
oh i like that, not convinced it would have me rushing to ditch pandas for these problems tbh
sorry, thats just how my school taught me how to do things
thank you for telling me thats a stupid way to do it
I DID IT π
it was a rollercoaster of emotions but i f.... did it -_-
part 1 i did in a blink of an eye but i got stuck on part 2. had to make dinner and take a little break after getting stuck. came back full power and attacked it with new energy π the code looks like a club toilet on a saturday morning, but who cares it works π
ehhhh
deepcopy does not seem the best in this case
yay i finally did it thanks for nothing school
can I ask someone if I got the right numbers for day 3, and if i'm only converting them wrongly?
oh
yeah its easiest if you just use the example input instead of your own input at the start
kuz then u know when ur right and which steps ur messing up
- u dont need to wait for the cooldown if u try and check if ur right
I think I've finally finished my submission helper
why tho
why wot
Is the star emoji straight from the website response or something you added in?
Something I added in, I use rich to format this
it's super cute, I like the addition of it
despite me using Nim, I couldn't live without rich
but the numbers of my input are 12 digits long
let console: PyObject = py_import("rich.console").Console()
lol
Yeah, I might even try to add more color to it... but as a proof of concept, I'd say I've done well
i just did this to get the right columns and row values
for i in long_text:
rows += 1
for i in long_text[0]:
columns += 1
depending on how u set it up it wont be the exact same but i just did that since i didnt wanna count anything
and length doesnt change the logic at all
ok
I forgot about the advent of code
#aoc-bot-commands
sorry, was just checking where I can get daily stats
nothing to be sorry about, you can see examples of how to do this in the channel i meantioned
ah, okay. thanks!
.aoc stats
Day β ββ | %β %ββ
================================
1) 413 389 | 49.05% 46.20%
2) 371 362 | 44.06% 42.99%
3) 318 254 | 37.77% 30.17%
4) 0 0 | 0.00% 0.00%
5) 0 0 | 0.00% 0.00%
6) 0 0 | 0.00% 0.00%
7) 0 0 | 0.00% 0.00%
8) 0 0 | 0.00% 0.00%
9) 0 0 | 0.00% 0.00%
10) 0 0 | 0.00% 0.00%
11) 0 0 | 0.00% 0.00%
12) 0 0 | 0.00% 0.00%
13) 0 0 | 0.00% 0.00%
14) 0 0 | 0.00% 0.00%
15) 0 0 | 0.00% 0.00%
16) 0 0 | 0.00% 0.00%
17) 0 0 | 0.00% 0.00%
18) 0 0 | 0.00% 0.00%
19) 0 0 | 0.00% 0.00%
20) 0 0 | 0.00% 0.00%
21) 0 0 | 0.00% 0.00%
22) 0 0 | 0.00% 0.00%
23) 0 0 | 0.00% 0.00%
24) 0 0 | 0.00% 0.00%
25) 0 0 | 0.00% 0.00%
the bot command channel is just a more suited place to check all the aoc commands as they are pretty long and clutter up ongoing conversations
nice, thanks!
Oh wow, there's a dropoff on Day 3 Part 2
Looks like I wasn't the only one who found it a bit challenging
Yeah, I think half of the reason it was harder is that the instructions were kind of confusing
lmao, you should see all the memes on aoc reddit about the gap between part 1 and part 2
I was working on them before work whilst still a little sleepy, skimmed part two, and just said "nope not now"
wait.. there's an aoc reddit?!
there's one that goes like this:```
day 3, part 2 in a nutshell:
[meme of winnie the pooh saying "Reading is hard"]
yeah, r/adventofcode lmao
thank you, time to check out the memes
WOHOO I FINISHED IT
I've not done part2 yet... whats the issue to watch for - I've probably misinterpreted
numpy.core._exceptions.MemoryError: Unable to allocate 178. GiB for an array with shape (308873, 308873, 2) and data type uint8
solving past AoCs in numpy be like
i don't think there's an issue
but like it's hard to choose one of 4 ways to tiebreak
in a hurry
comprehension issue that is... I don't think I have any ties
||and i suppose you can miss the part where you need to stop the process early for the second part of the second part||
I did attempt it a couple ways earlier, was getting the same values but deemed incorrect... probably a different slipup somewhere here
does anyone feel like year 2019's day 3 is, like
incredibly hard for a day3?
https://adventofcode.com/2019/day/3
the first part kicked my ass quite a bit, and now it's worse
Yeah I stopped at it
Can some one help?
Giving it another look now, you could use a 2d array of 0's, iterate over each wire and mark its path with a number. Say 1 for the first wire, 2 for the second and so on. If a point is already marked it is an intersection and could be marked with an invalid number like -1. If it is marked by your number (say wire 2 crosses itself) leave it the same way. and from there it's looking for the closest -1
This may be wrong though. This is just my first instinct
Oh thanks
oh
i was like wth
@command.commands()
async def resume(self,ctx,url):
wait.ctx.voice_client.pause()
await ctx.send("Music resumedβΆοΈ")
async def resume(self,ctx,url):
IndentationError: unexpected unindent
Oh I'm sorry, I don't know enough python for that. I think you should try the support channels and not the AoC one
Might be the indent before the decorator
But yeah use another chat
I feel like 2019 and earlier was harder than 2020, and so far, 2021
looking back at my solution for 2019 day 3; it's much more complex then what I wrote today for 2021 π
okay, I managed it. But it did require me to implement segment intersection checking, with finding the intersection position, and carefully handle all segments in the right order π©
that feels like a day 15-30 task from 2020
What did you do?
and could this potentially work?
Hah, I tried that, actually
that was my first idea
only problem: the lines go so far, you need dozens of gigabytes of memory to fit all that into a numpy array (even at a byte per cell per wire)
so this approach doesn't work
I mean numpy arrays are used for images too and those have millions of pixels but yeah
I guess that's wasteful
And just like with images, a 30000x30000 image is heavy
Also it's probably not efficient either lol
it's more the year itself
it was my first, I loved how I can't solve anything. every star a victory βΊοΈ
then 2020 was a siappointment
tru story
For 2019 day 3 I basically just kept a list of coordinates for each wire
where where you start is 0, 0
the wire crossings are all the points that are common between the two lists
the one closest to the beginning is the one that has the smallest x + y
Yeah that's way better than my first idea.
every point of each wire
well, I guess it's <100k elements per wire, decent enough
let me see how long a wire was
But yeah you could even improve that by counting each segment as, maybe, a tuple of start and end positions
I used, well
for part 2
π₯΄
I never commited my 2019 repo for some reason, and my code doesn't fit into one comment
wowowowow long solution
yeah I'm wordy haha
I won't commit mine because it's horrifying
let me use the paste
nice
We'd rather you share solutions in the #advent-of-code-spoilers-archive channel, even for previous years
at least, I'm pretty sure that's our policy π
ah my bad, thought older years wouldn't matter, my bad
I did it last year, but I needed a hint from a work colleague for one part ;_;
I'm hoping this year I can do without any hints
I have a rule for myself that Googling is fine as long as I don't Google the solution deliberately
but I don't want to actually ask for a hint, if I can avoid it
mhmm indeed
It looked hard at first, but I had a mild brain blast that came after I took a power nap
probably still is just plain hard though 
Looking back at stats for 2019, more people got both stars on day 4 compared to day 3
so there's always hope for an easier problem π
you say that, right 
\!remind 6H this aged well.
Day 4:
The submarine explodes. You're stuck underwater, drowning. The only way to get out is to start your fancy-pancy spankin' new time-reversal kit! The only problem is that you left the code for it on your dresser.
You must program the kit to reverse time.
To begin, start crying.
:ohno:
Day 5: Create a program to spawn energy out of thin air
*thin water π
thick air
You're just breathing and suddenly your lungs collapse from breathing in to much thick air
Yeah, I'm wondering if I should even stay yo
up*
It's probably gonna take me a while so I won't reap the benefits of staying up
Imagine waking up the next day, solving the problem and then getting 600th something out of 842
me with day 1 haha
or close to that
ive kinda given up on getting points this year because school and also i dont want to be sleep deprived :|
sad EST time zone noises
yeah that's a good idea - better to have a nice sleep schedule than get some points
Don't you have like quite a bit of coffee
yeah, i probably wouldent get that many points anyway
that probably explains why haha
some people complete really fast ngl
someone completed it in 4 minutes yesterday
Which part
Both
holy [explicitive removed]
how do people comprehend so fast
I spent that much time reading lmfao
Part 2 stumped me
Inb4 GitHub copilot but it's on 5 stimulants at the same time
idk, you should probably ask salt-die tho. salt die made a VISUALIZATION for the thing in under a day
That visualization was amazing for the terminal
In all seriousness, does GitHub copilot learn in real time? You could probably just get the AOC solution in 15 minutes or 30 minutes with it then
because so many people have public repos for it
ive made some things for doing terminal video and stuff, but ive never made a visulaization like that, also windows powershell scares me
i dont think so, since it must take so much computer time to train
Then again these guys have specs and servers that could probably survive a bomb
π· π«β
β π 
What
Ohh lmao
Day6:
The coastguard has brought your sunken body to the ER and you have been pronounced dead. However, your credit card declined and the doctors are trying to bring you back to life to pay. To do so they have to pump out more water out of your lungs rhythmically. For example,
down 2
up 3``` would be pushing one unit down, 2 units down and letting your chest rise 3 units. Test each rhythm until you regain a pulse. You cannot die in debt, good luck.
my only chance at winning after having started day 1 very late is if everyone above me can't solve some stuff
but consistent 4 minute solvers are probably comp programmers who won't miss a day
best i can hope is i can beat them on an individual day if I get the chance to be at the computer on the reset time
You could always beat them if you choose a random number each time and get each guess right first time π
I mean, today's answer was like 12 digits
but that seems more probable than beating a comp coder
bleh
i couldn't get today's part 2 without just being extremely cheap and even then i still didn't get it
kinda stuck
Can you discuss hints in this channel, if it's spoiler tagged? Or should it go straight to the spoilers channel?
because i mean i'm pretty sure i did what it said
Do you guys use the test inputs they give to first create the function, which then you pass the input. Or do you guys just go straight to the input
but i guess it was wrong somehow
I've been doing the latter, and just thought the first would be probably better
the latter
I write full out unit tests π
Got my pytest going and everything
with open("03-01.txt") as f:
data = [x.strip() for x in f.readlines()]
columns = [[x[i] for x in data] for i in range(12)]
most_common = [0 if x.count("0") > x.count("1") else 1 for x in columns]
i had this-
and it seemed like it was what was needed for the first bit
I think I'll try doing the test inputs first then using the actual input, probably better workflow instead of just guessing
to get the most common stuff
least_common = [1 if x.count("1") < x.count("0") else 0 for x in columns]
and this was the bit for the least common stuff
Spoilered hints are fine
but like i dunno
Yeah - that's what I would do if I weren't trying to complete it fast
since i did the loops after to shrink the values and when i multiplied them they were incorrect
ive just been using the test input, because then you know the answer (and a lot of print statements) and then going to the real input
i can't really think of a way to get a different answer
are there channels in the server for sharing projects you have made?
||did you handle the case where they are exactly the same?||
Yea that is true, I'll try using test input today and see if I do the problems faster
Before I was just making the function, and hoping it is right lmao
yeah i did that the first time, but with the test input i found with the harder one it made it a lot easyer to check if it was right (and you dont get ratelimited for wrong answers)
can you strikethrough a spoilered comment or am I just playing with fire if I try it
i write tests, so I can get the code right before submitting wrong answers
yeah
that's what the else does
is it not
yup I saw, that's fine
cool cool
Are points deducted for wrong answers? And yea that sounds like an ideal workflow, will try for tonight's problem
no
so uh...
could i possibly get a diff hint?
no, points aren't deducted. But with tests you can see if it's wrong and debug what happened.
||are you using 12 because that's the number of numbers in the test input?||
||12 is the number of binary digits||
hmm, I might figure out a way to extract the test input/expected result with my helper CLI
maybe set up a better workflow
so I don't end up submitting and then being rate limited and having to wait
can someone check 2593275 for day 3 part 2 for this input : https://pastebin.com/WpLuU2UK
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
I don't know how close am I
the 12 is how many chars are in each binary thing, that never changes
somewhat close to what i'm getting, my result was also wrong
right I was looking at my test input to start with, not my real one
test input has 5
Is there even a way to
Unlike inputs its not on a different path, you'd probably need to scrape for it
weird
my numbers it gave me to multiply to that were
3315 and 776
Β―_(γ)_/Β―
i dunno
im lost
can you post your full solution and I'll have a look?
well uh
x3
you'll laugh at it
because it's bs-
xD
i got stuck so i brute forced it
by manually doing every bit
oh lol
yeahhhh
need to recalculate per index
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
||"binary digits" is commonly abbreviated to "bits"||
||π ||
I'd probably have to scrape from adventofcode.com/day/{day}
can i dm the link at least? x3
i know people would click it
Looking at each day though, you'd have to do a lot of manually parsing to actually get what you want which would be the raw numbers or stuff. A lot of other filler is mixed in
I think if I get the raw string I can differentiate code blocks
which is where the test input is shown
We won't make fun of it! AOC is a learning experience if anything π
I don't think anyone would make fun other than just light jokes π
ahaha-
there ya go then ig-
lol
i did the stupidest method possible too-
since my brain got stuck
hmmmmmmmmm
Ig you could regex the inline codeblocks, you would have the numbers but then you won't have the instructions for what to do with them
Ig, but there is filler mixed in so you'd need to actually read that yourself to understand whatever the hell is going on
It's all good - but yeah, it is hardcoded π Do try to do a more generic solution!
yeahhhh uh
i was thinking about that too, the real problem is the expected output
i dunno what i did wrong tho cause i used the most common and least common stuff exactly
which i know were correct
Β―_(γ)_/Β―
My thoughts, which someone else wrote above - ||did you recalculate counts each time||?
π
was i supposed to recount them on the new list that was generated?
||yes||
hecc i didn't realize-
yeah
i didn't realize too
Test input is useful here
i would've been much closer
This is why I pytest everything π
010010
^ is this the first bit?
nah I think they are going left to right
left to right
Ok thx
that's true lol
for what day?
congrats! 
3rd one part 2
They usually bold the answer, so it's just a matter of guessing?
Was the hint not able to help?
what were you trying to avoid?
i avoided that for the same reason i avoided this
g0 = [x for x in data if x[0] == "0"]
g1 = [x for x in g0 if x[1] == "0"]
g2 = [x for x in g1 if x[2] == "1"]
g3 = [x for x in g2 if x[3] == "1"]
g4 = [x for x in g3 if x[4] == "0"]
g5 = [x for x in g4 if x[5] == "0"]
g6 = [x for x in g5 if x[6] == "0"]
g7 = [x for x in g6 if x[7] == "0"]
g8 = [x for x in g7 if x[8] == "1"]
g9 = [x for x in g8 if x[9] == "0"]
well
i avoided the thing that made me do this
lol
finding a compact way to reuse the previous var
:3
||You can use a for-loop||
Wait I just realized, the sample input is always constant and is the first code block at the top
part 2 and part 1 use the same input always
so I don't need to worry about filler text for the test input
||Overwrite the the variable||
i figured that, but then how do i cut it down and use the next bit
huh
overwrite it?
i cant do aoc today cuz school 
I am assuming ```py
a = 1
a = 2 # overwrite
well yeah
but
for i in range(12):
g = [x for x in data if x[i] == "0"]
how the hecc would i make it access g and not data
was the problem i had
||if you reassigned to data, then you are overwriting it||
i did not
||you only need the original input because you generate two ratings - otherwise you don't need to keep it around||
||so you can generate a copy and then use the copy in your loop, overwriting it||
Hints are fine as long as they are in spoilers
is this getting closer..?
Does every question have a sample input formatted the same way?
probably we should continue in the spoiler channel if you will post code π
hiya everyone excited for day 4?
can someone help me?
this is the code : https://pastebin.com/Vjwh9t9N
this is the input :
this is the ouput :
o2 : 0110000 , co2 : 10110000
result : 30976
dm me if you can
or want to
Yep
now it's just a matter of getting the expected output
I might try to have a look at that, but in the meantime why not use sample input to test?
also, sharing the inputs is not recommended
uh
@low condor i don't think i got the bit where i recalculate the most common things right-
[0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1]
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
xD
@topaz summit I've found the pattern!
The first multiline code block is the sample input.
The second to last bold text is the answer
this is always constant because if you're accessing it with your cookie you'll only ever see Part 1's answer or Part 2's answer at the end
keep at it, but if really stuck, post in spoilers and maybe someone will help
ok
oh
i didn't convert properly-
['0', '0', '1', '1', '0', '0', '0', '0', '1', '0', '1', '1']
['0', '0', '1', '0', '0', '0', '1', '0', '1', '0', '1', '1']
['0', '0', '1', '1', '0', '1', '0', '0', '1', '0', '0', '1']
['0', '0', '1', '1', '0', '1', '0', '0', '1', '0', '1', '1']
['0', '0', '1', '1', '0', '1', '1', '1', '1', '0', '1', '1']
['0', '0', '1', '1', '0', '0', '0', '1', '1', '1', '1', '0']
['0', '0', '1', '1', '0', '0', '1', '1', '1', '1', '0', '0']
['0', '0', '1', '1', '0', '0', '1', '1', '1', '1', '0', '0']
['0', '0', '1', '1', '0', '0', '1', '1', '1', '0', '0', '0']
['0', '0', '1', '1', '0', '0', '1', '1', '1', '0', '0', '1']
['0', '0', '1', '1', '0', '0', '1', '1', '1', '0', '0', '1']
['0', '0', '1', '1', '0', '0', '1', '1', '1', '0', '0', '1']
looks more promising
this worked-
i think
what about the first bold text after the codeblock?
That wouldn't work with part 2
who cares about timings - not like there's a leaderboard or anything π
The fact you got it is most important
ima beat him once midnight happens-
lol
that's the goal
since he'll be asleep >:3
yeye-
|| line 85 to 87 - looks like you are popping from a list that you are iterating over ||
That's a big no no in general
oh shit is day 4 out
Not till 12 UTC -5
oh my bad. The sleep depravation is making my see things
Sleep is making you depraved now? π
π
pastebin it π
what pattern?
the only pre block without em is the input
and the only pre block with one em and code is the answer
ig
For day 1, does anyone have a list of the depths without the stupid indentation so i can just paste it into my code?
what indentation?
Well, the stuff when i copy it is like this
1
2
3
4
you mean it's on separate lines?
Yes sorry its like 2am and im tired
lol it's fine
but just save the file and open it in Python
then it's easy to turn into a list of strings from there
pattern for sample input and what not
problem = httpx.get(
f"https://adventofcode.com/{year}/day/{day}",
cookies={"session": AOC_SESSION_COOKIE},
)
message = bs4.BeautifulSoup(problem.text, "html.parser")
table = message.find("pre")
print(table.contents)
this seems to work
i didn't think it would
betterm switch that to table = message.find("pre").find(text=True)
ignore
hmmm, so aoc-helper needs a new feature :P
an automatically testing feature
which: gets and caches the test information
that would be cool ngl
day four bouta be amazingly fun
a weekend puzzle is harder, apparently
3.2 took me 90 minutes, so i'm a bit scared for 4.2 lmao
Same
You staying up?
Same here
god damn it
there is no pattern
some cases the answer is given in code.em
in some it is given in em.code
ye when u typed that it was 9:36 for me too
okay.......
I'm getting diff values when trying to convert my binary string to an int
its because I'm not sure what i should the base as...
binary is base 2
the base would be 2
how did you figure it out fronto
Oh I'm not home yet
oh.. in that case I got 1337 which is wrong.. back to the drawing board
When I get home I'm gonna test it out and see what I get
is this with 2021 only?
or did you mix other years
2021
Ahh
day 1 one is em.code
day 2 is code.em
atleast i found the input lol
that works for all
isn't it the same thing for both?
huh?
<em><code>
nope ^
oh
ok even the test input getter doesn't work on a few dys
days it worked on
works on all 2021 till now
so you can get all the inputs?
what is AOC session cookie? and how to get it?
thats test inputs, the examples eric gives on the puzzles
void king its in the environment variables
i load it through os.environ
oh lol because i was getting both part1 and part 2 text together
and i didn't solve some of the days
tldr; it works
I finished it just now
nice, show :D
resp = requests.get(url=self.url, cookies={"session": self.session})
soup = BeautifulSoup(resp.text, "lxml")
test_input = soup.pre.text
current_part = soup.find_all("article")[-1]
last_sentence = current_part.find_all("p")[-2]
answer = last_sentence.find_all("code")[-1]
if not answer.em:
answer = last_sentence.find_all("em")[-1]
answer = answer.text
ignore the wonky indentation
works on all days?
for i in {1..20}; do python -m aoc start -d "$i" -y 2020; done just do this with a time.sleep in between
change accordingly
gtg cya, gl with it
thanks! just tested it, it works with all days
now time to add the testing feature to it
@earnest forge oh, question, would you consider adding automatically testing sample input to aoc-helper?
i think you maintain it
:D if you would like to PR to my repo you can or i would just add it once i am free
wait, I didn't test with all days
i thought i did but it was only 104
1-4
hmm, i don't think i'll PR it yet because i'ts not fully tested and I don't wanna break anything
i apparently only tested 5 days
i had a conversation on it with salt-die and fronto on that topic in #advent-of-code-spoilers-archive, you can search us up and check
You would go to say an endpoint like https://adventofcode.com/2021/day/1
then
do ctrl + shift + i (developer console)
basically, developer window on a day -> network tab -> reload page -> click on first thingy you see -> cookies tab within network tab -> see session
head to Network, do ctrl + R
or ctrl + shift + R
click the first option that shows up in the request, so for the endpoint I gave, 1
then go to headers -> request headers -> cookie, and the string after session= is your session cookie
m e o w
ty
I'm currently doing the first part of the Advent of Code day 2 puzzle and I'm not sure where I'm going wrong, I'd really appreciate any help, I'm at #π€‘help-banana (I hope me saying this here is fine, please tell me if it isn't)
you're welcome :) also check fronto's response for a more detailed answer
idk if anyone else has said this yet, but this is definitely an ocean with some sand sloping down from the right
no no, it's perfectly fine, but we can't help you in this channel because it's spoiler-free. if you want a faster response than normal help channels, consider posting your problem in #advent-of-code-spoilers-archive. hope this helps :)
It helped a lot, ty! Someone has helped me already
yep, i saw, np
wooo! automatically testing input is done
except I got some text telling me to stop sending requests, so I'll hold off with things i've alreday solved
or directly go to applications -> cookies -> session
I've had that thought but I can't think of a good way to do it; pull requests are more than welcome though :P
@earnest forge this is the implementation
.bm
oops sorry for the pings
Rust or Cpp? Which one should I go with? I like Rust more while C++ seems easier π€·ββοΈ
Go with whichever language you want, doesn't really matter
Yeah but how do we run the file with that instead of the player's input - the architecture didn't really designed for that because it's optimised for submission speed
ah
(also how sure are we that that works for all problems?)
a seperate feature!
use watchdog and a listener to constantly run the file with that input, until the method returns the correct result
tests, run it for all previous problems, if it works, it works
π that's exactly what i am doing lol, --watch not complete but coming along
Basically I'm open to including it but I don't see a good way of implementing it because it doesn't really fit the architecture I've got - if you can think of a good way to implement it you can submit a PR :)
basically, its like the rustlings thing
what I did is I just read the file for both
you don't really need any of the other file features anyways
besides being able to read it
it's 4 AM I genuinely don't see what you mean
nah i wasn't very clear lol, sometimes i piece words together without making sure the general picture makes sense
basically for the player's input, I passed in
player_input_file.read().splitlines()
and then for the actual sample input text i passed in
sample_input.splitlines()
Yeah but we somehow need to signal that to both: fetch(), which needs to completely change its behaviour and lazy_submit(), which needs to completely change its behaviour
