#advent-of-code

1 messages Β· Page 40 of 1

woven oriole
#

lmfao

mystic plover
#

bruh

woven oriole
#

[redacted]

mystic plover
#

hm

woven oriole
#

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

pearl needle
#

the inputs are structured such that you will always end up with one number remaining

woven oriole
void ocean
#

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?

velvet stag
woven oriole
#

by die you mean removed

velvet stag
#

how can the last one not survive

woven oriole
#

thats what killed the time

velvet stag
#

ah, because the second part removes majority

void ocean
#

what are you guys talking about?

woven oriole
#

my first algorithm was not to create an individual list and cleanup

#

rather directly make a new binary by the most count (for oxygen)

velvet stag
#

that can't work

woven oriole
velvet stag
#

i know it's not that channel

mystic plover
#

@woven oriole i figured it out xd

past kite
#

LMAOOO I WAS STUCK AF

#

part 2 stumped me

woven oriole
#

took some debugging

past kite
#

i took a whole one and a half hour just for debugging

woven oriole
#

for sorting out the one binary

#

🚯

past kite
#

yea lol filtering out the list is just so confusing

mystic plover
mystic plover
#

i sorted the wrong list xd

floral lark
#

.aoc about

hidden copperBOT
#
What is Advent of Code?

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.

How do I sign up?

Sign up with one of these services:

Auth Services

GitHub
Google
Twitter
Reddit

How does scoring work?

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.

Join our private leaderboard!

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.

acoustic sparrow
#

.aoc join

mystic plover
#

.aoc join

#

shjit no

#

theres a bot channel

#

oops

sinful pawn
#

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

trim rain
#

who is pinging me here and deleting message after that

#

this is the 3rd time

trim rain
#

ah wait lol

warm grail
#

Nothing in the message logs (although there would be no way of knowing if the ping was in the form of a reply)

trim rain
#

i didn't realize my bad

#

:x

warm grail
steady berry
pure saddle
#

no ctrl i on phone :/

trim rain
#

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

sinful pawn
#

o_o I somehow got the right answer and my code was way off what I meant to do

twilit gorge
trim rain
#

i fixed it right after tho

sinful pawn
#

nvm. my mistake was actually... correct

trim rain
#

oh mine wasn't xD

sinful pawn
#

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

mossy basin
#

i don't have any visualization ideas

sinful pawn
#

Man, it's always so satisfying when somehow my solution is correct

naive lily
#

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

merry ocean
#

!aoc unsubscribe

#

Oops

lament stirrup
#

I tried to solve it through recursion but ended up using a whole loop instead

merry ocean
#

.aoc unsubscribe

hidden copperBOT
#

Okay! You have been unsubscribed from notifications about new Advent of Code tasks.

steady berry
#

like making Electrocardiography (google translated, blame google if its wrong)

mossy basin
#

i mean for the puzzle

#

day 3

steady berry
mossy basin
#

i don't know how to connect it to electrocardiography

steady berry
#

same Β―_(ツ)_/Β―

wary wigeon
#

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

sinful pawn
#

I'm so confused with Day 3 part 2

wary wigeon
#

it wasn't confusing imo

summer kraken
#

Can anyone suggest me ways to make efficient and shorter code

wary wigeon
#

my code is bullshit without refactoring

#

and i'm not even gonna refactor it lemon_smug

summer kraken
wary wigeon
#

lol

#

n2 prolly

final eagle
final ocean
#

advent of cod hmm i ssee. i havent done the second and third day uwu

sinful pawn
final ocean
final eagle
sinful pawn
final ocean
#

qaq?

#

gago?

final eagle
final ocean
#

hmmmm

sinful pawn
#

my brain is going to explode

#

what on Earth, man

hazy pendant
jade atlas
wary wigeon
#

i was doing it as quick as possible

sinful pawn
#

time to start over -_-

#

I've been working on this for at least an hour, surely

final eagle
#

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

jade atlas
sinful pawn
#

I understand it, but... coding it...

#

my braincells cannot compute

#

but I think I have an idea

jade atlas
sinful pawn
#

oh god

#

things aren't going as expected

wary wigeon
#

uh oh

sinful pawn
#

my brain is literally melting

wary wigeon
sinful pawn
#

nooo

#

I must solve this on my own

wary wigeon
#

why

#

just wanna see what youre doing

pale heath
#

3 was kinda hard

#

I mean, until you understood it

mint hornet
#

Finally.
My code is a lil bit of a spaghetti tho, but it works shipit

wary wigeon
#

Nice

sinful pawn
#

omg

mint hornet
sinful pawn
hollow wharf
#

My solution for today was... a thing... that exists

#

jesus christ the code I wrote was abominable

mint hornet
sinful pawn
hollow wharf
#

only good part about my code for today is that it came out to 69 lines 😎

mint hornet
#

Can we get to see your code tho?

sinful pawn
hollow wharf
#

mine should be a lot shorter

#

I've duplicated so much code

mint hornet
floral lark
#

Woops sorry lemon_sweat

sinful pawn
hollow wharf
#

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

wary wigeon
#

mine is 41 lines

#

for part 2

#

kinda can make it 22 lines

sinful pawn
#

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"""
wary wigeon
#

what lang?

#

i'm not sure what this is

#

can't be rust, js, python, c/c++ c#

#

oh wait is it nim?

sinful pawn
wary wigeon
#

whyd u choose nim

sinful pawn
wary wigeon
#

ok

digital ember
#

ah yeah

#

nice

#

looks really similar to python

sinful pawn
digital ember
#

like? πŸ‘€

sinful pawn
#
nim> "Hello, ".echo "world!"
Hello, world!

even

digital ember
#

hmm hows that useful, there are f-strings?

iron reef
#

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

sinful pawn
#

there's "fmt" strings and... whatever "&" strings are

digital ember
#

i meant how is that .echo() useful, f-strings do the same job

rocky oar
#

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

digital ember
#

If 0 and 1 are equal...

rocky oar
#

Cheers

bright spindle
digital ember
#

i was just what was told in the problem though...

bright spindle
digital ember
#

right πŸ‘

sinful pawn
pure saddle
#

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

digital ember
#

Added option to wait until problem arrives, made submit function autodetect day and year, and added isort :D on my AoC helper

sonic silo
#

thats happened way too many times

frosty bronze
#

Who keeps pinging me in this channel

quick glacier
#

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?

digital ember
quick glacier
digital ember
#

higure you forgot to on the ping

sinful agate
#

RIP, had exam today and I am also not well

frosty bronze
#

Looks like someone pinged and deleted cuz I couldn't find it in search

#

But ok

frosty bronze
sinful agate
frosty bronze
sinful agate
#

not on phone client tho

frosty bronze
#

Ah I see

quick glacier
frosty bronze
#

Anyways let's move on

quick glacier
#

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?

digital ember
#

skimming πŸ™ƒ

quick glacier
#

That's stupid fast. 28 seconds on problem 1. Sure, with aoc_helper a lot of boilerplate time is gone, but still.

hollow wharf
#

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

quick glacier
#

Fetches input data, submits answers, has boilerplate templates.

digital ember
desert berry
#

Are we allowed to discuss how to solve the questions here?

#

Without posting code

minor cave
#

We won't be doing this

balmy dome
#

I have coded by 30 sec

brittle mauve
#

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

bright spindle
desert berry
#

Alright

bright spindle
#

Previous day discussions can be elsewhere, but must be marked with spoilertags.

signal grotto
sinful pawn
#

Does anyone know the different responses you get when you submit answers?

#

I gotta think of how to setup a submit function

sleek cave
#

OMG THIS IS THE FIRST TIME MY MIND FLEW TO ZIP

#

I WOULD'VE NEVER THOUGHT OF THIS BEFORE AOC

#

AOC = pure amazing

limber tundra
#

ok that was tough

#

took me like 1 hour to do part 2 lol

hidden musk
limber tundra
#

Not the shortest code but couldn't do it better

#

ah sorry

lunar cloak
#

maybe im just stupid but the instructions are kinda hard to follow on part 2

delicate plank
#

How do I convert a bunch of numbers into a list?

#

wc

#

ok maybe correct chat

brittle mauve
#

Wdym

delicate plank
#

Like

brittle mauve
#

Like numbers into a list

delicate plank
#

Yes, all the numbers from aoc

brittle mauve
#

An integer list?

delicate plank
#

that I receieved

#

yes

#

integer

brittle mauve
#

Ok

#

I can help

sinful pawn
#

Could someone perhaps tell me what the website says if you submit an answer incorrectly

brittle mauve
#
integer_list = [int(d) for d in input_data.split('\n')]
#

Use this

brittle mauve
#

Its all on line btw

#

The input data would be your variable

delicate plank
#

kk

#

ty

brittle mauve
#

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

brittle mauve
#

Yw

velvet stag
#

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)

short lava
#

anyone else completely misunderstood the second part of day 1?

velvet stag
#

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

pale wind
#

pls helpp

hazy pendant
#

what's this? lemon_eyes

pale wind
#

infix to postfix expression

hazy pendant
#

huh

pale wind
#

its a python code need to display the correct postfix

topaz summit
#

is that an advent of code problem?

pale wind
#

yes

quick glacier
#

For today's problems?

pale wind
#

i need to show the correct postfix

#

yes

quick glacier
mint hornet
#

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

topaz summit
#

please don't discuss the current problems outside of the spoiler channel

hidden musk
#

isn't that a problem from last year?

pale wind
#

its not a advent code sorry

topaz summit
#

then it doesn't belong here at all

pale wind
#

ohh sorry

topaz summit
mint hornet
pale wind
#

what line should i put ?

placid lake
#

hello, would you two move to a help channel?

mint hornet
placid lake
#

this doesn't have anything to do with advent of code

mint hornet
#

yea, we should move to a help channel, ban.

pale wind
#

ok

#

thanks

full raft
#

does anyone know why in day 3 task 1 in the last binary number in the data file is : 000...

velvet stag
#

wait why not

#

there should be multiple, why not also last

full raft
#

but it is not binary

#

i dont understand

velvet stag
#

that's what binary looks like

#

unless it's literally three dots

#

it shouldn't have three dots no

full raft
#

so in the code input i just do three zeros?

#

data*

velvet stag
#

no it's bugged

#

try ctrl-shift-r

full raft
#

ok let me try

minor cave
#

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…

β–Ά Play video
full raft
#

thx in worked

fathom lichen
#

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.

velvet stag
#

especially important if you can't type fast 😒

#

i'm so insecure about that

bright spindle
#

That way I can calmly iterate on solutions and compare mine with other people's.

fast harbor
#

.aoc join

lunar cloak
#

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

iron reef
#

my chances were shot day 1 when I started near the end of the day

lunar cloak
#

yeah, if you aren't counting down the timer you literally have zero chance of finishing top 100

quasi shell
#

.aoc join

brittle mauve
#

Man today is difficult i dont even know where to start

hollow wharf
lunar cloak
#

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

bright spindle
lunar cloak
#

most definitely

bright spindle
#

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.

lunar cloak
#

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

runic basin
#

.aoc join

rotund rapids
bright spindle
pulsar hollow
#

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

tacit moss
#

They still work πŸ™‚

pulsar hollow
#

cool

minor cave
#

Once the problems are available, you can solve them and submit answers whenever

pulsar hollow
#

oh i thought the timer meant you wont be submit them anymore

tacit moss
#

Timer is just until the next one opens

clear cairn
#

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 ||
pulsar hollow
#

so i can chill i guess. and focus on my exams and do problems when i am tired

clear cairn
#

part 1 took me maybe 10 minutes, part 2 was over an hour XD

tacit moss
#

I'm still working on part 2

pulsar hollow
#

took me 2 hours and a help channel to get through the second part

tacit moss
#

I have most of the pieces done, now I just need to glue it all together

pulsar hollow
#

idk i just start coding and work it from there.

#

if it gets too messy i start again from another file

tacit moss
#

just from scratch?

#

this is no good, start anew?

pulsar hollow
#

like the first try the code went upto 100 lines and wasnt no where near a solution so i just scraped it

clear cairn
#

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

pulsar hollow
#

imo its much harder to fix a unplanned and buggy as hell script to work then starting over

tacit moss
#

yea

#

I've been trying to plan a bit more

pulsar hollow
#

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

tacit moss
#

list comps are awesome

pulsar hollow
#

although my script size increased from 40 to 58 when i started using list comp

#

40 line was the scraped file btw

jade atlas
fallen wadi
#

.aoc join

sleek cave
#

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

minor cave
#

spoilers channel please.

sleek cave
#

ugh i don't know how to get my desired version of bitwise not

sleek cave
sleek cave
#

THAT MAKES SO MUCH SENSE

#

woohoo

pure saddle
#

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?

bleak sable
trail flare
#

response.text.strip() @pure saddle will strip whitespace from the beginning and end

pure saddle
#

ah .text returns a continuous string? didnt know that, though it was strings seperated by \n

#

thanks!

bleak sable
sleek cave
unique osprey
#

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
sleek cave
#

i didn't know they had this

#

is it gonna lock me out forever?

minor cave
#

Nah, it will slowly creep up to prevent people from just iterating with guessing. I know it can get to at least 1 hour

topaz summit
#

try the test case first

deep epoch
#

probably not I think the timeout is just so that people don't try to brute force it?

sleek cave
humble escarp
#

(I imagine)

sinful pawn
#

Working on prettying up my AoC helper πŸ‘€

raven rivet
#

I don't know what to do

#

Actually, never mind. I'll try to figure out

#

I didn't even try myself firstπŸ˜‚

steep shard
#

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

sinful pawn
#

I do wonder if there's a tag for that

timid mantle
livid hound
#

oh i like that, not convinced it would have me rushing to ditch pandas for these problems tbh

steep shard
#

thank you for telling me thats a stupid way to do it

junior hinge
#

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 πŸ˜„

potent pumice
#

deepcopy does not seem the best in this case

steep shard
#

yay i finally did it thanks for nothing school

jovial totem
#

can I ask someone if I got the right numbers for day 3, and if i'm only converting them wrongly?

proud cosmos
#

Check the test case

#

Everyone has different input so it'll be hard

jovial totem
#

oh

steep shard
#

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
sinful pawn
#

I think I've finally finished my submission helper

steep shard
#

why tho

sinful pawn
#

why wot

steep shard
#

hmm

#

makes sense

minor cave
sinful pawn
minor cave
sinful pawn
#

despite me using Nim, I couldn't live without rich

jovial totem
sinful pawn
#
let console: PyObject = py_import("rich.console").Console()

lol

sinful pawn
steep shard
#

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

jovial totem
#

ok

mighty goblet
#

I forgot about the advent of code

sleek cave
#

wait, how do you get the AOC daily statistics?

#

.aoc

winged trellis
#

#aoc-bot-commands

sleek cave
winged trellis
#

nothing to be sorry about, you can see examples of how to do this in the channel i meantioned

winged trellis
#

.aoc stats

hidden copperBOT
#
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 leaderboard is refreshed every 30 minutes.

Number of Participants

842

Full Leaderboard
winged trellis
#

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

woven sable
#

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

patent blade
#

Yeah, I think half of the reason it was harder is that the instructions were kind of confusing

sleek cave
patent blade
#

I was working on them before work whilst still a little sleepy, skimmed part two, and just said "nope not now"

woven sable
sleek cave
#

there's one that goes like this:```
day 3, part 2 in a nutshell:
[meme of winnie the pooh saying "Reading is hard"]

sleek cave
woven sable
loud yew
#

WOHOO I FINISHED IT

last egret
#

I've not done part2 yet... whats the issue to watch for - I've probably misinterpreted

woven solar
#
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

velvet stag
#

but like it's hard to choose one of 4 ways to tiebreak

#

in a hurry

last egret
#

comprehension issue that is... I don't think I have any ties

velvet stag
#

||and i suppose you can miss the part where you need to stop the process early for the second part of the second part||

last egret
#

I did attempt it a couple ways earlier, was getting the same values but deemed incorrect... probably a different slipup somewhere here

woven solar
#

does anyone feel like year 2019's day 3 is, like

#

the first part kicked my ass quite a bit, and now it's worse

unique remnant
civic schooner
#

Can some one help?

unique remnant
#

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

unique remnant
#

Oh wait zack that was not for your question

#

1sec

civic schooner
#

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

unique remnant
#

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

solar schooner
#

Might be the indent before the decorator

civic schooner
#

ok

#

thanks

solar schooner
#

But yeah use another chat

low condor
#

I feel like 2019 and earlier was harder than 2020, and so far, 2021

low condor
#

looking back at my solution for 2019 day 3; it's much more complex then what I wrote today for 2021 πŸ˜‚

woven solar
#

that feels like a day 15-30 task from 2020

unique remnant
#

What did you do?

unique remnant
woven solar
#

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

unique remnant
#

I mean numpy arrays are used for images too and those have millions of pixels but yeah

#

I guess that's wasteful

woven solar
unique remnant
#

Also it's probably not efficient either lol

velvet stag
#

it was my first, I loved how I can't solve anything. every star a victory ☺️

#

then 2020 was a siappointment

#

tru story

low condor
#

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

unique remnant
#

Yeah that's way better than my first idea.

woven solar
#

huh, every point?

#

I'm surprised that fits

low condor
#

every point of each wire

woven solar
#

well, I guess it's <100k elements per wire, decent enough

low condor
#

let me see how long a wire was

unique remnant
#

But yeah you could even improve that by counting each segment as, maybe, a tuple of start and end positions

low condor
#

yeah each one was roughly 150k long

#

well, I wanted to know the exact positions

woven solar
#

I used, well

low condor
#

for part 2

woven solar
#

πŸ₯΄

low condor
#

I never commited my 2019 repo for some reason, and my code doesn't fit into one comment

sleek cave
#

wowowowow long solution

low condor
#

yeah I'm wordy haha

woven solar
#

I won't commit mine because it's horrifying

low condor
#

let me use the paste

sleek cave
#

lmao

#

this year's difficulty curve is just right imo

woven solar
#

nice

candid berry
#

at least, I'm pretty sure that's our policy πŸ™‚

low condor
#

ah my bad, thought older years wouldn't matter, my bad

west fern
#

feels good to solve all the AOCs for once

#

my brain is simply
E X P A N D I N G

low condor
#

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

west fern
#

no hints yet, but I entirely expect to ask one soon-ish

#

oh, and plenty of googling

low condor
#

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

west fern
#

oh yeah, 100%
that just ruins the fun

#

nobody should; it's thinking time after all

low condor
#

mhmm indeed

hollow wharf
#

Is it me or is day 3 alot harder than 1 and 2

#

Thought it would be abit easier πŸ˜₯

west fern
#

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 agony

dense solstice
#

Today's problem is probably gonna be harder

#

πŸ˜”

low condor
#

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 πŸ™‚

west fern
#

you say that, right flushball

potent pumice
west fern
#

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.

dense solstice
#

Day 5: Create a program to spawn energy out of thin air

signal grotto
dense solstice
#

Thin water

#

πŸ‘οΈ πŸ‘„ πŸ‘οΈ

dense solstice
#

You're just breathing and suddenly your lungs collapse from breathing in to much thick air

woven sable
#

up*

#

It's probably gonna take me a while so I won't reap the benefits of staying up

dense solstice
#

Imagine waking up the next day, solving the problem and then getting 600th something out of 842

woven sable
#

or close to that

loud yew
dense solstice
#

Used to the sleep deprivation

#

πŸ˜”

woven sable
woven sable
loud yew
woven sable
#

that probably explains why haha

woven sable
#

someone completed it in 4 minutes yesterday

dense solstice
#

Which part

woven sable
#

Both

dense solstice
#

Diff breed

#

πŸ‘€

loud yew
woven sable
#

how do people comprehend so fast

#

I spent that much time reading lmfao

#

Part 2 stumped me

dense solstice
#

Inb4 GitHub copilot but it's on 5 stimulants at the same time

loud yew
woven sable
#

That visualization was amazing for the terminal

woven sable
#

because so many people have public repos for it

loud yew
#

ive made some things for doing terminal video and stuff, but ive never made a visulaization like that, also windows powershell scares me

loud yew
dense solstice
#

Then again these guys have specs and servers that could probably survive a bomb

woven sable
#

Ah true

#

anyways I'm excited for D4

#

but honestly I feel like I'm gonna get stumped

loud yew
dense solstice
#

What

loud yew
#

r tea x 5 0 9:00 0

#

(rtx 5090)

dense solstice
#

Ohh lmao

unique remnant
#

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.
iron reef
#

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

low condor
#

You could always beat them if you choose a random number each time and get each guess right first time πŸ™‚

unique remnant
#

I mean, today's answer was like 12 digits

#

but that seems more probable than beating a comp coder

hollow wharf
#

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

low condor
#

Can you discuss hints in this channel, if it's spoiler tagged? Or should it go straight to the spoilers channel?

hollow wharf
#

because i mean i'm pretty sure i did what it said

dense solstice
#

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

hollow wharf
#

but i guess it was wrong somehow

dense solstice
low condor
#

Got my pytest going and everything

hollow wharf
#
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

dense solstice
#

I think I'll try doing the test inputs first then using the actual input, probably better workflow instead of just guessing

hollow wharf
#

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

hollow wharf
#

but like i dunno

woven sable
hollow wharf
#

since i did the loops after to shrink the values and when i multiplied them they were incorrect

loud yew
hollow wharf
#

i can't really think of a way to get a different answer

loud yew
#

are there channels in the server for sharing projects you have made?

low condor
dense solstice
#

Before I was just making the function, and hoping it is right lmao

loud yew
low condor
#

can you strikethrough a spoilered comment or am I just playing with fire if I try it

bright haven
hollow wharf
#

that's what the else does

#

is it not

low condor
hollow wharf
#

you easily can

#

||strikethrough||

#

btw

low condor
#

cool cool

dense solstice
hidden musk
#

no

hollow wharf
#

so uh...

hollow wharf
low condor
#

If I knew what was wrong, sure πŸ™‚

#

Let me compare with what I have

bright haven
low condor
hidden musk
#

||12 is the number of binary digits||

woven sable
#

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

tidal locust
#

I don't know how close am I

hollow wharf
hollow wharf
low condor
#

test input has 5

hollow wharf
#

i got 257244

#

and it said i was too low

#

lol

dense solstice
#

Unlike inputs its not on a different path, you'd probably need to scrape for it

hollow wharf
#

weird

#

my numbers it gave me to multiply to that were

#

3315 and 776

#

Β―_(ツ)_/Β―

#

i dunno

#

im lost

low condor
hollow wharf
#

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

low condor
#

oh lol

hollow wharf
#

yeahhhh

last egret
#

need to recalculate per index

hollow wharf
#

ill dm it but i don't wanna post it

#

xD

#

if thats ok

#

@low condor

low condor
#

I don't like DMs lol XD

#

Maybe just do it in a paste and share the link?

#

!paste

marsh currentBOT
#

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.

candid berry
hollow wharf
#

oh

#

uh

hidden musk
woven sable
hollow wharf
#

i know people would click it

dense solstice
woven sable
#

which is where the test input is shown

hollow wharf
#

it's ok if not i just know i'm gonna get made fun of for it

#

lol

woven sable
low condor
#

I don't think anyone would make fun other than just light jokes πŸ™‚

hollow wharf
#

ahaha-

#

there ya go then ig-

#

lol

#

i did the stupidest method possible too-

#

since my brain got stuck

hollow wharf
#

hmmmmmmmmm

dense solstice
#

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

woven sable
#

Oh god

#

I might try it out but I really wish there was a path for test input

dense solstice
#

Ig, but there is filler mixed in so you'd need to actually read that yourself to understand whatever the hell is going on

low condor
hollow wharf
#

yeahhhh uh

topaz summit
hollow wharf
#

i dunno what i did wrong tho cause i used the most common and least common stuff exactly

#

which i know were correct

#

Β―_(ツ)_/Β―

low condor
hollow wharf
#

uh...

#

oh-

low condor
hollow wharf
#

was i supposed to recount them on the new list that was generated?

hollow wharf
#

hecc i didn't realize-

hazy pendant
#

yeah

hollow wharf
#

this is the thing i suck at reading

#

lol

hazy pendant
#

i didn't realize too

low condor
#

Test input is useful here

hollow wharf
#

i would've been much closer

low condor
#

This is why I pytest everything πŸ™‚

hollow wharf
#

if i could heccin

#

read

#

lol

tidal locust
#

010010
^ is this the first bit?

low condor
#

nah I think they are going left to right

velvet stag
#

left to right

tidal locust
#

Ok thx

violet raft
#

i did it!!!

#

took me 100 lines of code though

low condor
#

If you did it you did it

#

I used 105 lines Β―_(ツ)_/Β―

violet raft
#

that's true lol

floral lark
#

for what day?

hazy pendant
violet raft
floral lark
#

oh only did pt1

#

imma do the pt2 tmr

#

or I mean today

#

but after I sleep

woven sable
hollow wharf
#

i can't solve day 3 p2 like actually i'm stuck-

#

lol

low condor
hollow wharf
#

nah it helped it just added to the thing i was trying to avoid earlier

#

lol

low condor
#

what were you trying to avoid?

hollow wharf
#

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

dense solstice
#

||You can use a for-loop||

hollow wharf
#

but then

#

how do i access

#

the previous var

woven sable
#

part 2 and part 1 use the same input always

#

so I don't need to worry about filler text for the test input

dense solstice
hollow wharf
#

huh

#

overwrite it?

narrow crown
#

i cant do aoc today cuz school lemon_angrysad

narrow crown
hollow wharf
#

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

low condor
hollow wharf
#

i did not

low condor
#

no but that's how to do it

#

then you can use ||a loop||

hollow wharf
#

if i re uh

#

hec

#

data is the input stuff tho-

low condor
#

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

hollow wharf
#

is this getting closer..?

dense solstice
low condor
#

probably we should continue in the spoiler channel if you will post code πŸ™‚

hollow wharf
#

oh-

#

didn't realize-

signal grotto
#

hiya everyone excited for day 4?

tidal locust
#

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

woven sable
#

now it's just a matter of getting the expected output

low condor
#

also, sharing the inputs is not recommended

hollow wharf
#

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

woven sable
#

@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

hollow wharf
#

the first one does what it's told

#

well

#

what i want it to do

#

the rest dont

woven sable
#

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

low condor
hollow wharf
#

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

topaz summit
woven sable
hollow wharf
#

solved it

#

that took so much longer than i wanted it to

low condor
#

who cares about timings - not like there's a leaderboard or anything πŸ˜›

hollow wharf
#

crossed out my deadname

#

im 2 behind peter lol

#

:3

low condor
#

The fact you got it is most important

hollow wharf
#

ima beat him once midnight happens-

#

lol

#

that's the goal

#

since he'll be asleep >:3

hollow wharf
hazy pendant
#

hope you get enough sleep!

#

also i'm planning to solve day1 part2 in a game

hollow wharf
#

?

#

in a game?

low condor
#

That's a big no no in general

bronze vault
#

oh shit is day 4 out

dense solstice
#

Not till 12 UTC -5

bronze vault
low condor
bronze vault
#

πŸ‘€

digital ember
#

the only pre block without em is the input

#

and the only pre block with one em and code is the answer

#

ig

hollow wharf
#

For day 1, does anyone have a list of the depths without the stupid indentation so i can just paste it into my code?

hidden musk
#

what indentation?

hollow wharf
#

Well, the stuff when i copy it is like this
1
2
3
4

low condor
#

you mean it's on separate lines?

hollow wharf
#

Yes sorry its like 2am and im tired

low condor
#

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

woven sable
digital ember
#
    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

potent pumice
#

an automatically testing feature

#

which: gets and caches the test information

woven sable
#

that would be cool ngl

sleek cave
#

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

woven sable
#

You staying up?

sleek cave
#

it's 9:36 pm for me

woven sable
digital ember
#

god damn it

#

there is no pattern

#

some cases the answer is given in code.em

#

in some it is given in em.code

hollow wharf
merry flax
#

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

topaz summit
#

binary is base 2

woven sable
#

the base would be 2

digital ember
woven sable
merry flax
#

oh.. in that case I got 1337 which is wrong.. back to the drawing board

woven sable
#

When I get home I'm gonna test it out and see what I get

woven sable
#

or did you mix other years

digital ember
#

2021

woven sable
#

Ahh

digital ember
#

day 1 one is em.code

#

day 2 is code.em

#

atleast i found the input lol

#

that works for all

woven sable
#

isn't it the same thing for both?

digital ember
#

huh?

woven sable
#

<em><code>

digital ember
woven sable
#

oh

digital ember
#

ok even the test input getter doesn't work on a few dys

#

days it worked on

#

works on all 2021 till now

tidal locust
#

so you can get all the inputs?

tiny pumice
digital ember
#

void king its in the environment variables

#

i load it through os.environ

digital ember
#

and i didn't solve some of the days

#

tldr; it works

woven sable
digital ember
#

nice, show :D

woven sable
#
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

digital ember
#

works on all days?

woven sable
#

i've only tested 1 and 2 so far

#

let me test last year

digital ember
#

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

woven sable
#

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

digital ember
#

:D if you would like to PR to my repo you can or i would just add it once i am free

woven sable
#

i thought i did but it was only 104

#

1-4

woven sable
#

i apparently only tested 5 days

sleek cave
woven sable
#

then

#

do ctrl + shift + i (developer console)

sleek cave
#

basically, developer window on a day -> network tab -> reload page -> click on first thingy you see -> cookies tab within network tab -> see session

woven sable
#

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

austere orchid
#

m e o w

brazen goblet
#

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)

sleek cave
# tiny pumice ty

you're welcome :) also check fronto's response for a more detailed answer

signal grotto
#

idk if anyone else has said this yet, but this is definitely an ocean with some sand sloping down from the right

sleek cave
brazen goblet
sleek cave
woven sable
#

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

digital ember
earnest forge
potent pumice
digital ember
#

oops sorry for the pings

merry ocean
#

Rust or Cpp? Which one should I go with? I like Rust more while C++ seems easier πŸ€·β€β™‚οΈ

sharp panther
#

Go with whichever language you want, doesn't really matter

earnest forge
potent pumice
#

ah

earnest forge
#

(also how sure are we that that works for all problems?)

potent pumice
#

use watchdog and a listener to constantly run the file with that input, until the method returns the correct result

digital ember
#

πŸ‘€ that's exactly what i am doing lol, --watch not complete but coming along

earnest forge
#

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

digital ember
#

basically, its like the rustlings thing

woven sable
#

you don't really need any of the other file features anyways

#

besides being able to read it

earnest forge
#

it's 4 AM I genuinely don't see what you mean

woven sable
# earnest forge ~~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()

earnest forge
#

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