#advent-of-code

1 messages · Page 12 of 1

near parrot
#

that took way long, but finally got it

#

i should have practiced more 😅

somber trench
#

how do you accept and read multiple lines in a input?

stray raft
#

first 4 minutes it was full

random flower
somber trench
#

python

stray raft
iron olive
#

FUCK YES FIXED

#

HAAA

stray raft
near parrot
#

i took user input

stray raft
#

oh okay

near parrot
#

though i had to put an end keyword because there is no limit

iron olive
#

and it compiled
good

near parrot
#

it is better to use a file

random flower
somber trench
stray raft
#

but i dont know how to use it

somber trench
candid berry
#

I eventually wound up with a solution where I ||reversed the strings, and also reversed all the digit words in my regex. s/eno/1 and s/owt/2||

iron olive
#

I'm a moron.

candid berry
#

absolutely horrific

iron olive
#

I could've || just added it to a .txt instead of scraping it. I went it the hard way. ||

near parrot
stray raft
#

something sad is tomorrow gets much harder than today

near parrot
candid berry
#

I think this input was particularly evil, honestly

#

I've rarely seen input this deliberately difficult to interpret

candid berry
#

allowing the digit words ||to overlap|| is just cruel

real pine
jagged hare
rancid creek
mellow girder
#

help i cant do part 1 lmAO

stray raft
#

can you already read the inputs?

rancid creek
mellow girder
#

heres code
||```py
out = 0

for line in data.splitlines():
first = 0
last = 0
for char in line:
if first == 0 and char.isdigit():
first = int(char)
elif char.isdigit():
last = int(char)

out += (first + last)

print(out)```|| but wrong outptu

stray raft
#

you forgot to use a break

#

ah

#

no

stray raft
#

strings

mellow girder
#

huh sample inpouts arent working

stray raft
#

so

"9" + "7" = 97

jagged hare
#

&aoc leaderboard

shut trellisBOT
#
Wrong Channel

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

mellow girder
candid berry
somber trench
rancid creek
near parrot
#

many people have different approaches. test around and figure out what you like

stray raft
#

regex give me anxiety

candid berry
mellow girder
#

andd its still wrong :(

somber trench
mellow girder
#

maybe im just dumb

near parrot
#

wow people used ||regex, i spliced every 5 positions and checked if it had the word and just break'ed the loop (i know pretty inefficient but oh well)||

stray raft
rancid creek
mellow girder
#

||```py
out = 0

for line in data.splitlines():
first = ""
last = ""
for char in line:
if first == "" and char.isdigit():
first = char
elif char.isdigit():
last = char

out += int(first + last)

print(out)```|| why isnt my thing working part 2

candid berry
remote patio
#

anybody doing it in Haskell ?

stray raft
#

ohh

near parrot
candid berry
mellow girder
#

part 1

candid berry
#

oh

mellow girder
#

lmao

candid berry
#

you said "part 2" and that threw me

candid berry
mellow girder
#

:P

mellow girder
candid berry
#

in other words ||the first digit is the last digit on some||

late oracle
#

part 2 is tripping me up D:

livid gull
#

i was thinking p1 if theres only 1 then skip 😦

#

shouldve read better

#

massive time loss

stray raft
candid berry
#

evil.

stray raft
#

eivl

jagged hare
#

it's the first entry that has items with characters that overlap
I didn't notice earlier, but line 4 and 6 do as well.
In any case, that's the one I focused on when I couldn't figure out why my simple replaces were not producing the correct checksum

candid berry
#

I'm big mad about this input, heh

scarlet wasp
#

was that an unusually difficult day 1, or is it just me 😄

earnest forge
#

Yes

rancid creek
rancid creek
candid berry
#

they don't illustrate the rule that ||twone counts as 21 instead of as 2 and some non-digit junk||

mellow girder
#

SIXTEEN IS A DIGIT?

keen trout
#

nope 🙂

mellow girder
#

wait

keen trout
#

but it contains one

earnest forge
rancid creek
jagged hare
earnest forge
mellow girder
#

oh im dum

iron olive
#

huh...

iron olive
#

My answer is too low despite being astronomically high.

earnest forge
rancid creek
iron olive
#

Also, question
If there's no second number, last number is the first or is None?

#

That seems like a very important detail

iron olive
#

Oh.
I can't read.

#

That totally flew over my head

#

Now I know what's wrong

earnest forge
rancid creek
keen trout
#

yeah, figuring out the correct overlap semantics is definitely what threw me for a bit

jagged hare
candid berry
mellow girder
#

oh no

rancid creek
iron olive
#

Answer is still too low...
The hell.

#

It's something to do with my logic.

rancid creek
earnest forge
iron olive
#

I'm at 10k range

#

I can get that up with some thinking

earnest forge
#

I actually implemented special handling for that and everything lol

iron olive
#

and some testing, actually.
I should do that.

rancid creek
candid berry
keen trout
mellow girder
#

no shit

earnest forge
#

((also you can do smarter replacements and still do fine))

rancid creek
jagged hare
earnest forge
mellow girder
#

lol

iron olive
#

My logic isn't incorrect apparently

rancid creek
candid berry
iron olive
#

Yeah, it's fine

candid berry
#

I'm gonna be mad about this input for days

magic scaffold
#

damm hardest day 1 yet

mellow girder
#

wait a second

rancid creek
#

I was originally just replacing them in order, but eightwo become eigh2.
made me rewrite my code. could have shaved 10 minutes off the time.

mellow girder
#

:O

tip ||re.findall has an overlapped parameter||

keen trout
#

I'm still quite sure that sixteen is supposed to be interpreted as just 6. The first paragraph of the part 2 description is pretty explicit about what counts as a digit.

late oracle
candid berry
#

but not how spoilers work 😛

rancid creek
magic scaffold
late oracle
iron olive
#

I'm actually clueless at this point.

magic scaffold
mellow girder
#

i wanna do aoc so badb ut i gtg class cya

unique osprey
iron olive
#

Many.

#

I mean, not really

#

But I'm not entirely sure of what is causing the wrong output

unique osprey
#

How's it look with the example input?

iron olive
#

I'll debug and hope for the best

#

It looks fine

unique osprey
#

Even the part 2 example?

keen trout
#

maybe investigate what you get for ||eightwo|| and what you really want for that

late oracle
# mellow girder \:O tip ||re.findall has an overlapped parameter||

I don't see this in the docs. The docs state: ||re.findall(): Return all non-overlapping matches of pattern in string, as a list of strings or tuples|| and there's no ||re flag that does this||. I think you have to use ||lookahead in the regular expression itself, right?||

Wait... are you using python? lol

iron olive
#

Not reading spoilers btw

unique osprey
#

That wasn't really a spoiler imo

keen trout
#

ok, maybe think really carefully about overlaps then.

candid berry
late oracle
candid berry
#

another option is ||scanning the string twice, once forwards and once backwards (and reversing the patterns in the backwards case)||

late oracle
placid lake
iron olive
#

Oh.
I found my error.

late oracle
iron olive
#

I'm just fucking stupid and don't know how to read

#

Lemme fix it

late oracle
kind rapids
candid berry
naive stone
#

well i choked hard

magic scaffold
#

we all did

placid lake
#

fisk!!!

naive stone
#

dennis! ma boyy

placid lake
#

every single year we meet once more during AoC

magic scaffold
#

now time to look on yt for fast solves and contemplate is anything even worth it

tacit viper
viscid elbow
#

maybe the hardest day 1 ever?

placid lake
#

yeah, probably

naive stone
#

i was thinking the same yea, at least part 2

tacit viper
#

i hate this

#

part 1 was straight forward

shadow musk
#

I solved use regex I wanna kms

shadow musk
#

😭

tacit viper
shadow musk
#

twone

tacit viper
#

does that count as 21

#

or just 2

viscid elbow
#

eightwo

tacit viper
#

oh wait

#

its in the question

shadow musk
tacit viper
#

i didnt see that

shadow musk
naive stone
shadow musk
rancid creek
#

is there no aoc spoilers channel? or do we just use this one with spoiler tags?

naive stone
#

there is one

placid lake
naive stone
#

you will likely see people spoiler tagging things in here anyway though

rancid creek
#

aha, I was searching for advent.

autumn dawn
#

where did 77 come from?

naive stone
#

|| 7 is both the first and last number in that line||

formal fjord
#

I'm new to Advent of coding. Where do I find today's challenge?

autumn dawn
#

you can search adventofcode 2023

shadow musk
#

@minor cave did you pass first try

minor cave
#

I haven't even read the puzzle, I was watching a movie

shadow musk
#

oh lol it is annoying

minor cave
#

I'll probably attempt it Saturday

shadow musk
#

gl

#

the edge cases are hard

#

imo

formal fjord
spice hemlock
#

Fish

modern terrace
#

what do you have to say against that?

keen trout
#

small hint: if you're doing ||replacements in your string||, you're probably not going to get the correct answer 🙂

#

hmm, TIL spoilers don't copy and paste

#

There are of course ways to do it, the straight forward one is not it. :/

empty eagle
#

definitely the hardest day one

#

i missed ||the last example|| on part 1 which took me quite a while to get the edge case ||couldnt figure out whether to leave single digits or add them as it is||

brave igloo
#

@mossy basin I'm trying to use your lube but I can't get it working

#

that sounds wrong

#

oh I see

#

never mind I got it to work

mossy basin
#

oh, yeah it's just a python function not a cli

#

or module

earnest forge
dusk wraith
#

Good morning

#

Wish everybody a happy AOC, i am hyped as ....

mossy basin
earnest forge
#

Ah are you a xonsh user too then

mossy basin
#

python console is my shell

#

i don't know what that is, a kind of rock?

earnest forge
molten fulcrum
#

Is anyone trying this out in Groovy? I can't get this to even set the puzzle input to a variable ```groovy
import groovy.transform.Field

@Field String puzzleInput;

public class Day1 {
public static void main(args) {
String fileContents = new File('input_1.txt').text;
puzzleInput = fileContents;
}
}

This simply gives me `Apparent variable 'puzzleInput' was found in a static scope but doesn't refer to a local variable, static field or class.`
earnest forge
#

My guess is that @Field is non-static?

#

Try @Field static String ... @molten fulcrum

molten fulcrum
#

Hmmm

molten fulcrum
lusty rover
#

I completed it in Groovy
I didn't make any classes

earnest forge
#

Also from looking at the groovy docs I don't think you need classes/main functions

molten fulcrum
#

Oh, maybe I tunnelvisioned on it being like Java

#

I'll try without classes, thanks!

gusty fiber
#

how can i fix that?;(

covert arrow
wicked elm
#

is this the year I finally solve all days KokoroThink

sour trout
#

The first problems seems very simple

#

Im so excited i just wanna come home and solve it

#

I will also make a repo about the 2023 aoc

lime fulcrum
molten fulcrum
lime fulcrum
#

yeah still working on it. its kind of tricky

molten fulcrum
#

Unless there’s some nice stdlib library for it, it seems like some monster ||unreadable regex|| will be needed

late portal
#

guys i am new to aoc, i not able to understand how to solve the puzzle, what do i need to do?

magic oxide
#

||no regex for current golf||

#

the ||regex approach I used wasn't that bad either||

#

||just used lookahead to replace the empty space before a digit name with the digit||

viscid elbow
silver wyvern
#

Is it just me or is this way harder than usual day 1?

peak dock
#

agree

silver wyvern
#

I guess trying to prevent Ai ?

acoustic dock
#

where can I ask for feedback on my code for day one?

peak dock
magic oxide
#

I feel like the question just wasn't very clear from the outset

#

||the testcase should've included something like oneight but the eight is relevant||

peak dock
#

how does the scoring on private leaderboards work again

mellow girder
#

osmenoe help with aoc p2
||```py

a = {"one": 1, "two": 2, "three": 3, "four": 4, "five": 5,
"six": 6, "seven": 7, "eight": 8, "nine": 9, "zero": 0}

out = 0

for line in data.splitlines():
first = ""
last = ""
nearestdist = 9999
lastdist = 0
for i in a.items():
x = line.replace(i[0], str(i[1]))

    for char in x:
        if char.isdigit() and x.index(char) < nearestdist:
            first = char
            nearestdist = x.index(char)
        if char.isdigit() and x.index(char) > lastdist:
            last = char
            lastdist = x.index(char)

out += int(first + last)

print(out)```||

peak dock
#

does it take into account the number of attempts pithink

mellow girder
#

why dis no workie

covert arrow
peak dock
covert arrow
peak dock
mellow girder
#

they got it at the same second

covert arrow
peak dock
#

oh

#

i see

mellow girder
#

anyway help ls

peak dock
mellow girder
#

huh?

peak dock
#

!d str.rindex

marsh currentBOT
#

str.rindex(sub[, start[, end]])```
Like [`rfind()`](https://docs.python.org/3/library/stdtypes.html#str.rfind) but raises [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) when the substring *sub* is not found.
covert arrow
mellow girder
peak dock
mellow girder
#

ok

wicked elm
#

I read the task twice wrong, +15min of time

mellow girder
#

idk how to make thred

wicked elm
#

solved but I think the first day should be trivial, this isn't as trivial as in the past years

#

did they up the difficulty a bit due to people cheating and stuff

silver wyvern
#

This will put people off for sure

#

I rallied a few people at work to take part this year and I doubt many of them will attempt day 2 as a result

nocturne blaze
low condor
#

I have words to say about today's problem

silver wyvern
edgy hearth
#

ive been on #1 right now for a solid ~30 mins

#

but I doubt they increased based on chatgpt

#

not sure why my code isn't working can I paste it here by chance or in help?

wicked elm
#

take a look at day 1 from previous years

wicked elm
edgy hearth
#

I'm not able to solve it using insert / append and casting int

#

im using two pointers first and last and while loop while first <= last

#

not sure but a brute force is usually my preference to start off with

broken bloom
#

Am I in the wrong place? I cannot view problem one

wicked elm
#

to see your input you also need to login

broken bloom
#

Thank you

#

I have logged in

#

For some reason I was just stuck in the calendar

sour trout
white laurel
#

part2 is little bit hard :\

wicked elm
#

what is the recommended time to upload solutions to Github?

#

e.g. to prevent cheating etc

edgy hearth
#

a couple hours should be enough no?

#

If you want to be safe just upload the day after?

viscid elbow
#

you can't prevent anything

wicked elm
edgy hearth
#

ya if someone really wanted to can just gpt4 it no?\

wicked elm
edgy hearth
#

I still havent submitted its been over 7 hours chill dawg

#

I tried two pointer method didnt work cuz its skipping lines with one number

#

also if you cheat you cheat yourself 🤷

wicked elm
#

is the AoC leaderboard of this server purely virtual?

white laurel
#

in the puzzle if there is one number only in the line, what should we do !

low condor
edgy hearth
#

ok heres a huge hint that actually helpeed me a lot

low condor
#

this case is in there

edgy hearth
#

create a new input case where you only have this

#

test against this

tmmnhlxzpj1eightldxhjnone97
9fivekfpl855mjmfdqzvbn
two29eighteight1
4md```
#

the first 4 lines, its hard to debug when the input is huge****

#

I just figured it out but even if I give you psueduo code or more hints it will ruin it

low condor
#

^ note that the puzzle itself gives you a cut down input

#

and the answers to go with it

hidden musk
#

huh. that's so mild. I was expecting something truly despicable for day 1

edgy hearth
white laurel
white laurel
#

but for my puzzle input its too low !

silver wyvern
white laurel
#

huh

low condor
edgy hearth
covert arrow
edgy hearth
#

I did last years q 1-4 last week with ease

silver wyvern
cyan sleet
hidden musk
#

oh. I hadn't considered that

edgy hearth
#

surprised my solution isn't working for the full output rn and but it works for 4 lines rip

silver wyvern
edgy hearth
#

can I link you my code in dm?

silver wyvern
#

00:02:24 2023 day 1 vs 00:00:53 2022 day 1

edgy hearth
#

dont answer just say if im way off

#

still rather figure it out

silver wyvern
covert arrow
edgy hearth
#

ok I put it in that thing with a / spoiler

brave igloo
#

good lord I tried solving the example input using apl

#

Imma just nope out of that one

covert arrow
#

I might give part 1 a go in bf

#

or maybe I could try piet again

hidden musk
#

well, first step out of the way, i managed to fix my java environment when installing groovy

rapid wolf
brave igloo
#

I've seen some videos on APL, first time trying it out. Got as far as creating an array with every line

bitter osprey
#

ive made a code that i belive should work for part 2, and when I test it with the example given: ```
two1nine
eightwothree
abcone2threexyz
xtwone3four
4nineeightseven2
zoneight234
7pqrstsixteen

i get the correct answer of 281, but when i test with my own input file, they say its wrong
magic oxide
bitter osprey
magic oxide
bitter osprey
#

what

#

kk

#

ty

white laurel
#

😂

hidden musk
#
$ groovy Main.groovy
Yo
``` 😎
bitter osprey
#

Me and my friend have two different accounts, but we still got the same exact input file

low condor
#

Input files aren’t completely unique

magic oxide
#

they draw from a pool

low condor
#

There’s a bunch of different ones but not one per person

hollow wharf
#

How to participate

covert arrow
hollow wharf
#

Is it like a coding competition?

edgy hearth
#

kinda not really

covert arrow
#

just a handful of coding puzzles ;)

#

you can compete for solving them quickly if you want to

edgy hearth
#

part 2 is way harder damn

hollow wharf
#

Ok

hollow wharf
edgy hearth
#

ya click events and select 2023

#

the submission box at bottom, make sure to signin to your github

#

use the example for input at first it makes life easier and read the output of the example it wasted a solid 2 hours of my time not reading

hollow wharf
#

Okay

#

Sounds good

#

Thx

viscid elbow
# wicked elm recommended*

ok well my suggestion is that you can push it to Github once there are 100 users on the global leaderboard

edgy hearth
#

u guys used regex for p2 or what?

earnest forge
minor ivy
#

nah this is confusing

#

i hate this bum shit story they make it always confuses me

#

I dont know what the valuable information is except for the 50 stars

low condor
minor ivy
#

Yo can someone help

#

whats the 50 stars thing

#

and the question have in common

earnest forge
#

2 parts * 25 days

minor ivy
#

Oh so the stars are useless

#

Ok

edgy hearth
#

yes each day has a question with two parts, each part gives you one star

earnest forge
rapid wolf
#

It is a challenge of reading comprehension as much as it is a challenge of programming

#

especially later on

edgy hearth
#

if I get all 50 does it go on my github?

peak dock
#

wdym

minor ivy
#

the only thing I can think of about the question is that you take the first occurence of a number in a string and the last occurence of a number, combione them and when you have multiple of these you find the sum of them??

#

combine*

minor ivy
rapid wolf
mossy basin
#

one day my visualization post will beat a "funny" post

minor ivy
#

Ok so is my thought process correct?

rapid wolf
minor ivy
#

No way it wants us to have a preset file??

earnest forge
#

It gives you your input file

minor ivy
#

No it doesn't you have to manually make one

edgy hearth
#

dude

minor ivy
#

Holy shit

#

this is the first day?!

edgy hearth
#

its in green get your puzzle input

minor ivy
#

Where

#

I dont see that

rapid wolf
#

did you login?

minor ivy
#

which channel

edgy hearth
#

at the bottom near where you submit

rapid wolf
#

if not, you have to login to get your puzzle input

edgy hearth
#

it looks like this

minor ivy
#

yea I see it

#

Ohhhh

#

This is so easy then >:)

#

No one told me about this

edgy hearth
#

ya you just open filename and readline thats it

minor ivy
#

ez lets fuckin go

edgy hearth
#

jeez mood swing lol

#

glad you are hyped up now! go get it champ

minor ivy
#

So in my IDE do I make a file with the input it gave me??

edgy hearth
#

ya make a input.txt file

#

here let me give you a template

minor ivy
#

i use pycharm

edgy hearth
#
def trebuchet(filename):
    with open(filename, "r") as f:
        treb = f.readlines()
        
trebuchet("/Users/PATH//puzzle.txt")
edgy hearth
minor ivy
#

I know how to open the files from the time I made a web scraper let me send you mine

edgy hearth
#

Have it like this

minor ivy
#
def stars(file):
    total = 0
    open(file.txt, 'r').read()```
#

thats mine

edgy hearth
#

wait what webscrapping?

#

just download the text file and put it in ur folder

minor ivy
#

Oh ok

#

Where do I download it

edgy hearth
#

control save it and move to your pycharm then find path with right clicjk

minor ivy
#

I'm mac

#

its fine it's CMD S

#

one ec

#

Ok I made the file

minor ivy
#

Never seen this before

covert arrow
#

!with

marsh currentBOT
#
The `with` keyword

The with keyword triggers a context manager. Context managers automatically set up and take down data connections, or any other kind of object that implements the magic methods __enter__ and __exit__.

with open("test.txt", "r") as file:
    do_things(file)

The above code automatically closes file when the with block exits, so you never have to manually do a file.close(). Most connection types, including file readers and database connections, support this.

For more information, read the official docs, watch Corey Schafer's context manager video, or see PEP 343.

minor ivy
#

that seems useless

#

I just did ```py
def trebuchet(file):
total = 0
open(file.txt, 'r').read()

trebuchet()

#

thats mine

covert arrow
#

well, it can't hurt to ensure that your file is always closed

minor ivy
#

I dont even know what with does, those python explanations are confusing.

#

it's better when someone explains it themselves

covert arrow
# marsh current

The above code automatically closes file when the with block exits, so you never have to manually do a file.close(). Most connection types, including file readers and database connections, support this.

minor ivy
#
def trebuchet(file):
    total = 0
    with open(file.txt, 'r').read():
        for number in file.txt```
#

this good?

covert arrow
#

you would normally use it like this: ```py
with open(...) as file:
data = file.read()

minor ivy
#

what is as file?

covert arrow
#

open(...) as file is like doing file = open(...)

minor ivy
#

so is mine correct

viscid elbow
#

no

minor ivy
#

fuck

#

this is bullshit

oblique pasture
#

Even If It Was Correct, Where Is Data Stored?

minor ivy
#

in a txt file

oblique pasture
#

Yeah, But You Cant Have . In Variable Name

covert arrow
#

well file could be an object with a txt attribute

minor ivy
#

file.txt?

edgy hearth
#

brother what are you doing

#

just listen to what I said initially

#

thats it

minor ivy
#

Dude they're confusing me

oblique pasture
#

But If You Could First Argument Of open Needs To Be String.
Anyway The Syntax Is with open("filename") as file_variable_name:

minor ivy
#

"I cant have a . in vairbale name"

viscid elbow
#
file = open('...')
for line in file:
   ...
file.close()

when using with :

with open('...') as file:
  for line in file:
    ...
covert arrow
#

my preferred method of input for aoc is open(0) and piping input from a file

#

fwiw

oblique pasture
#

stdin?

covert arrow
#

yeah

oblique pasture
#

Smort 😮
Didnt Know That D:

covert arrow
#

mostly because that's what we do in the golf solutions

edgy hearth
#

its this that is it

def trebuchet(filename):
    with open(filename, "r") as f:
        treb = f.readlines()

trebuchet("/Users/PATH//puzzle.txt")
#

then you loop through lines

minor ivy
#

I dont know how to open a file in python, I don't

edgy hearth
#

the name you are giving the file

#

import it as f

oblique pasture
minor ivy
#

so I named the file and I'm renaming it to f???

#

That's pointless

edgy hearth
#

ya you can name it wtv you want

#

that way you easily access ity

minor ivy
#

Oh wait do you name it "as f" because you can thave . in vairbale names?

#

cant have*

edgy hearth
#

just copy and don't be so contrarian lol

oblique pasture
edgy hearth
#

as a junior dev you are way too combative no offnese

covert arrow
oblique pasture
#

Idk He/She Mentioned It Would Be Stored In That Variable, Did I Understand Incorrectly?

covert arrow
#

yeah, iirc it's roughly equivalent to: ```py
f = open(filename).enter()
try:
...
finally:
f.exit()

edgy hearth
#

guys should I relearn regex for part 2 or just do it using index -1 /+1 etc

minor ivy
covert arrow
minor ivy
edgy hearth
#

you need the as f to reference the file @minor ivy

oblique pasture
edgy hearth
#

yes the verbose version is what Code put opposed to with open

minor ivy
oblique pasture
#

I Used re.search, But It Only Finds 1 Match. So Ended Up With re.finditer

edgy hearth
covert arrow
#

re.findall?

oblique pasture
#

How Do You Know If Its First Last or Whatever

covert arrow
#

findall just returns all the matches in a list

#

which you can index like normal

minor ivy
oblique pasture
#

For 2nd Part You Can Get Away That Easily Tho

sharp crown
#

I'd like to ask a quick conformation question. In case that theres only one number given in a line, you are supposed to double it? ```1abc2
pqr3stu8vwx
a1b2c3d4e5f
treb7uchet
In this example, the calibration values of these four lines are 12, 38, 15, and 77. Adding these together produces 142.

minor ivy
#

Idk the 2nd part

earnest forge
#

The first digit is the same as the last digit

minor ivy
#

Ima just read automate the boring stuff to learn this file read shit.

oblique pasture
#

Did You Try The Link I Pasted?

minor ivy
covert arrow
minor ivy
#

let me see that

#

am I using "r" in this problem?? or is there other ones like x,a,t??

edgy hearth
#

r is for reading

covert arrow
#

you're reading the file for input, so yes

edgy hearth
#

open file, read it, traverse line by lline thats it

minor ivy
edgy hearth
#

ya your outer loop will iterate over lines, then you need inner to go through characters

minor ivy
#

Yea

#

oh wait this file opening stuff seems pretty simple

signal vine
#

For part two, would twone be counted as 2 or 21? I thought the former, but now I’m thinking it has to be the latter

earnest forge
#

It's the latter

signal vine
#

Thx

edgy hearth
#

22 no?

earnest forge
#

(no)

edgy hearth
#

if two exists, how can you use the o in two for a second word?

earnest forge
#

One also exists

#

(so 'how can you use the o in one for a second word')

#

(the answer is they share)

tepid cairn
#

I need to wait till I get home from school to do the puzzle 😔

snow nebula
#

holy shit i forgot about aoc

earnest forge
#

Rip

tepid cairn
#

what was the rolled language today?

earnest forge
#

Groovy

tepid cairn
#

gotcha, thanks

wicked elm
#

rolled language? people just randomly choose lang to solve it with?

earnest forge
#

About 10 minutes before puzzle unlock, someone on one of the staff teams picked a random language (idk the specifics) and it was Groovy

wicked elm
#

huh

hardy zenith
#

omg part 2 today

wicked elm
#

interesting

earnest forge
#

In this channel

wicked elm
#

alr

earnest forge
wicked elm
#

hmm at first it sounded as a good idea but I think it would only bring me pain

dense osprey
#

you have to donate every year to get aoc++???

earnest forge
#

AoC++ is only for the year you donate, correct

hardy zenith
#

but what about aoc#

earnest forge
#

IIRC it stays on that year's leaderboard permanently

hardy zenith
#

side-note, I hate part 2 today

earnest forge
#

🤝

hardy zenith
#

I didn't think I'd need to pull out nom on day 1

sleek cave
#

oh hell yeah

#

ive missed this

dense osprey
#

then ill have to donate 2$ again

hollow wharf
#

Hey, is it fine to use libarys like re to solve the AoC Puzzels?

shy tulip
#

We're not going to punish you

hardy zenith
hollow wharf
#

Okay thx

ruby pumice
#

Hey, quick question. If I miss a day for some reason, can I do the puzzles next day?

cinder tree
#

you can do them whenever you want, only thing thats affected is your position on the leaderboard

sleek remnant
#

Why is there the introduction text with the „Trebuchet“ puzzle and within that text is the „Not Quite Lisp“ puzzle linked and both say day 1?

earnest forge
#

Day 1 2015?

ruby pumice
earnest forge
#

It's a reference to past events, Eric puts those in sometimes 🙃

sleek remnant
#

So the not quite a lisp was from 2015 and trebuchet is today?

earnest forge
#

Yes

sleek remnant
#

I see, ty

#

So you can still do the previous years?

earnest forge
#

Yep

#

Once a puzzle is released, you can solve it at any time you choose

#

It's only if you want leaderboard spots that you have to be around for unlock

sleek remnant
#

Alright Ty

odd wigeon
#

I can't believe this caused me issues. 'eightnineseventwo1seven' 81

oblique pasture
#

Mine Was 5seven5

minor ivy
#

Hi

odd wigeon
#

It was finding the first seven and not the last one

glad wigeon
#

What is the code to join this discords leaderboard for AoC?

lime steeple
#

0

minor cave
somber trench
#

part 2 is gonna be the death of me, just completed part 1

ripe scroll
somber trench
ripe scroll
lime fulcrum
rugged wraith
#

Hello all - I’ve done a visualisation of the day 1 solution. Is that safe to post here? No code or anything really.

peak dock
#

yes for sure

rugged wraith
naive stone
#

that is very very cool

minor cave
#

Fuck, I knew I was forgetting a thread

west fern
rugged wraith
restive imp
#

Omg, that took way too long for day 1

minor ivy
#

guys i need some help

#

So I did a for loop and then another one inside that one to first get every line then the elements inside of every line.

#
def treb(file):
    total = 0
    with open("file.txt", 'r') as aoc:
        readcontent = aoc.readlines()

    for line in readcontent:
        first_number = 0
        current_line = []
        for index in range(len(line)):
            if line[index].isdigit():
                current_line.append(line[index])
                first_number = index
                break
            for i in range(len(line)-1, first_number, -1):
                if line[index].isdigit():
                    current_line.append(line[i])
                elif line[index] == first_number:
                    current_line.append(line[i])






#

How will I make it where it'll combine the 2 elements in the list

#

Like I have [1,3,4,5,8,7,9,0] for example

#

and I want to make it combine 1 and 3 which will be 13, 4 and 5 which will be 45 and so on because the rest of the code should work and bring in all the numbers from every line (the first and last occurence of one)

low condor
#

You probably want to do a more simple approach than a nested for loop

minor ivy
#

the nested for loop is like the easiest way to approach it I dont see any easier way

low condor
minor ivy
#

the first one is for the lines and the 2nd is for the actual elements in every line.

#

Ok

short karma
#

Meanwhile I’m making a cluttered blasphemous mess of Palpatinian proportions

#

lmao

lime steeple
#

I am pretty sure my solution is way more complicated than it needs to be

worthy horizon
#

anyone else had this when logging in through github?

#

I pressed F5 a bunch of times and it worked, but that sounds like a bad solution

naive stone
#

there seem to be a few posts on the subreddit about it, so you're definitely not the only one

robust dragon
#

let me see

#

works for me

sinful pewter
scarlet wasp
naive stone
sinful pewter
#

Got it, sounds good

sharp tapir
#

bros

#

damn

#

i felt so good finishing the first task

#

who is the absolute CHAD that made this?!?!?

#

these are like leetcode questions

#

but like a little bit more invovled / requires opening and reading file and stuf

naive stone
#

the year 2019 is his masterpiece in my opinion

sharp tapir
#

ok

#

can we @ him

#

and give him our thanks

#

eric wastl

#

pls

naive stone
#

i don't think he's in this discord, some of his mods are though i think

sharp tapir
#

im doing the second exercise rn

#

ok

#

i just appreciate him

naive stone
#

you could donate, or write him an email

earnest forge
#

If yes then I totally agree

naive stone
#

indeed it was

thorn inlet
#

i made a small cli for myself :d

placid lake
sleek remnant
#

Do you have to include „zero“ in the second part of today?

hardy zenith
#

wow, fewer than half of people have solved part 2 today

#

starting very hard

low condor
#

Is that true? I see 83k with both stars and 40k with only one star

#

That seems more like a third

hardy zenith
#

oh I read them in reverse derp

#

so 1/3 of people haven't gotten it

#

still. very difficult day 1. I can't remember an AOC that I spent this much time on

low condor
#

Be interesting to see if that holds through the weekend

hardy zenith
#

I thought it wasn't counted past day 1

low condor
#

Hardest day 1 by far

hardy zenith
#

or is that just leaderboards

low condor
hardy zenith
# low condor Hardest day 1 by far

I keep thinking I have eureka moments and realize my solution won't work 😦 I'm trying to figure out how to apply my nom parsers and not having any luck with the arbitrary bytes

low condor
hardy zenith
low condor
#

Ah gotcha

#

Oh yeah the username gives it away lol

#

I did consider Rust but I don’t have the time for it this year

#

Don’t have time to fight with the borrow checker lol

hardy zenith
#

I'm on vacation most of this month, so I've got some extra time to dedicate. not enough to compete at midnight when they drop because who can think at that hour lol

low condor
#

For me they drop at 5am so I definitely don’t compete lol

#

Personal Leaderboard is 0 across the board lmao

hardy zenith
#

I did a few in the past few years where I got some points

#

it's wild to me that some people cleared part two in under 5 minutes, like a whole 30 of them

#

suuuuus

#

both jane street sponsors lol

low condor
#

People who go for the top times have a lot of prep for this. They have prepared functions for all the things they think might come up, plus they practice a lot at this kind of stuff too

hardy zenith
#

oh I get it. It's just interesting to see two coworkers complete at the same second

#

what solutions did others use for part 2 today?

#

I was considering ||.translate() until I realized there was text overlap for the word numbers||

low condor
hardy zenith
#

what's the point of this channel then?

low condor
#

General non-spoiler discussion

hardy zenith
#

blech. found a solution that works on the sample code but not on my actual set

hardy zenith
#

p2

low condor
#

Ah

sharp tapir
#

yo

#

fairly sure this isnt the place to put code

#

can you pls adhere to guidance

#

it literally says no spoilers

#

just finished both

#

feel so accomplished

#

:))

hollow summit
#

i hate part 2

#

oh nevermind

#

wait no fuck part 2

kind oasis
hollow summit
#

i really thought that 9 .replace calls could solve it

lime finch
#

I spent 2 hours

#

😭

hollow summit
lapis pilot
#

part 2 was fucked uppppp 😅

#

i literally did a happy dance when i got it

#

not feeling good about the next 23 days lol

hollow summit
#

in cases like eightwothree i don't think it can work because of the chaining

cyan sleet
#

I can't say much more without being overly spoilery

cyan sleet
#

but there are for sure ways of doing this, there are many solutions like it

cunning scarab
cyan sleet
#

(e.g. mine)

cunning scarab
hidden musk
#

||💉|| 👀

cyan sleet
#

positively groovy

cunning scarab
#

Oh god, that too much ||spoil??||

cyan sleet
#

no

cunning scarab
cyan sleet
lapis pilot
#

does anyone else look at their code an hour after doing these and think... how in the absolute fuck did i come up with that solution?

cyan sleet
hollow summit
#

i severely underestimated the difficulty of aoc

royal gull
#

Ok, now I'll visit. Part 2 took me longer than expected. Challenge level: SQL.

hollow summit
royal gull
#

Yah... "extended" SQL (duckdb)

lapis pilot
remote beacon
#

anyone still on part 2

hardy zenith
#

I normally start feeling fatigue around days 12-15 to complete part 2 of the puzzles

odd wigeon
#

Finally a channel for talking about Alexandria Ocasio-Cortez

hollow summit
#

i thought it was about the AOC monitors?

covert arrow
cyan sleet
#

let's wait a few days 😛

hidden musk
#

it is a weekend to be fair

timber glacier
#

I'm so confused why mine doesn't work for p2 lol

#

it looks like it passes the edge cases

#

but it somehow gets a too high num

timber glacier
#

I did...

magic oxide
#

inb4 day 2 is a dp problem and this year is going to be inordinately difficult

broken bloom
#

Ohh noo, not dynamic programming!!!

tepid cairn
hidden musk
#

part 2 day 25 is the halting problem

modern terrace
#

or did i read the wikipedia page wrong

hidden musk
#

that's not how the halting problem is specified though

modern terrace
#

anyway

hidden musk
#

the halting problem is about turing machines, that's it. no celestial bodies, cosmic events, etc

tepid cairn
#

dude

#

what if the universe is a turing machine

hidden musk
#

🙄

hollow summit
#

that implies God is alan turing?

magic oxide
#

halting problem honestly seems fine

#

because we'd just get a predetermined input

#

we don't need to solve it for every general case for aoc

#

it's just like an exec

tepid cairn
#

our input would be a program that constantly gives us an unlimited amount of random undeterministic inputs

modern terrace
#

what if the input activates another input, terminates, and that input eventually re-activates the first input

magic oxide
hidden musk
#

and actually, for aoc2019, i believe we had to find an input that would cause our interpreter to halt. or something like that

tepid cairn
#

oh huh

hidden musk
#

wdym "activates an input"

torpid karma
#

I feel like this was a hard day 1. Is that just me or is this a general consensus?

hidden musk
#

the latter

hollow summit
#

thank god everyone else thinks day 1 is hard

#

this was the first aoc i've joined

warm gazelle
#

part 2 is insane for day 1

hollow summit
#

yeah part 1 was pretty easy

#

nobody liked part 2

sharp panther
#

I don't think part 2 was honestly that bad to solve, it just had an edge case most didn't anticipate

hollow summit
#

solving that edge case was the hard part

sharp panther
#

depends on how hacky you were willing to be :)

minor cave
#

&aoc c

shut trellisBOT
#

Day 2 starts <t:1701493200:R>.

torpid karma
#

I tried to do it in Excel but gave up. I thought I was better at Excel than I am. I think the main problem was the need for recursion

lusty rover
#

Why do you need recursion?

torpid karma
#

Might not have needed it but it was the easiest way I could think of. Can't give spoilers in this chat tho

lusty rover
#

I've been meaning to get around to trying it

royal gull
hallow birch
#

I hope today was just a fluke and it'll be much easier tomorrow, otherwise I don't stand a chance to make it past 2 weeks lol

minor cave
#

I hope today is as fast as yesterday or faster, I have a monster headache tonight 😔

sharp panther
#

I'm sure someone else can do it for you if you need it

lusty rover
#

@ keith wekup

sharp panther
#

heck, i'll be around and i think i have the permissions if necessary

royal gull
cyan sleet
#

I'm more asking if there is ambiguity that isn't disambiguated by the sample

cyan sleet
placid lake
#

i think i'll have to reach my ballmer peak tonight

modern terrace
#

33 minutes

#

27 minutes

hallow birch
covert arrow
#

&aoc countdown

shut trellisBOT
#

Day 2 starts <t:1701493200:R>.

hallow birch
tepid cairn
modern terrace
#

watch the amount of people still in aoc decrease every day

hallow birch
#

It will lol

#

I bet people are already scared away by day 1

placid lake
modern terrace
#

i probably should get an automation tool

tepid cairn
#

aoc-lube!

hallow birch
#

I tried aoc lube but couldnt setup dir

minor cave
earnest forge
#

aoc_helper 🙃

tepid cairn
earnest forge
#

(aoc_helper[full] for CLI)

hallow birch
tepid cairn
#

ah

#

hm

hallow birch
#

Aoc-kit works alright but I have to set it up each day

earnest forge
#

(I don't know if you like fluent style, but aoc_helper has that for lists and iterators)

#

Does aoc-kit even have auto-submission? @hallow birch Doesn't look like it does from its readme

hallow birch
#

Idts

#

Mostly just a get_data

earnest forge
#

Fair enough

#

I think aoc_helper might be the only library that attempts parsing the sample cases lol

#

probably because it's quite hard LOL

modern terrace
hallow birch
#

;-; python3 -m aoc_lube.setup_dir
/home/me/.local/share/virtualenvs/Advent-Of-Code-eZ_HZCZt/bin/python3: No module named aoc_lube.setup_dir

earnest forge
#

I'm gonna shill for aoc_helper some more

#

aoc template 2-25 🙃

modern terrace
#

less than 14 minutes

earnest forge
#

GL everyone!

modern terrace
#

best wishes

mossy basin
magic oxide
#

can't make it to day 2 at the start today

mossy basin
#
import aoc_lube
aoc_lube.setup_dir(2023)
earnest forge
#

I still think that's a poor design choice

mossy basin
#

well, i didn't write aoc_lube for you

earnest forge
#

(also does that not allow for partial directory init?)

mossy basin
#

i don't know what that means

earnest forge
#

aoc template 2-25

#

If someone already has some days completed (without the library) they may want to init only the days they haven't already got

mossy basin
#

it already skips over files if they exist

earnest forge
#

Ah fair enough

cyan sleet
#

where language?

#

(why am I awake)

hexed axle
earnest forge
#

So I'm guessing 2 minutes into the future

cyan sleet
earnest forge
#

shut up

cyan sleet
#

aww

#

I kinda enjoyed the time travel implications

earnest forge
#

I mean we'll see tomorrow if I was right

#

then again I kinda violated causality so who knows

hexed axle
#

Language Roulette: Day 2
The language is ... Ocaml

leaden tartan
cyan sleet
#

oh god

sharp panther
#

Language Roulette Leaderboard
A leaderboard for those participating in the Language Roulette Challenge. See #announcements message for information on the challenge. To join, enter this code on the Private Leaderboard page: 3276417-ec19f3e3

peak dock
leaden tartan
peak dock
#

same tbh

leaden tartan
#

I starated trying to learn about a month ago now and this day 1 part 2 challenge nearly killed me

earnest forge
#

To be fair day 1 was harder than day 1 has ever been before lol

cyan sleet
#

I have an ocaml hello world working

#

tiny steps

leaden tartan
#

Hopefully thats the challenge

cyan sleet
#

I need stdin 🥴

earnest forge
#

call_python();;

empty eagle
#

If they continue to increase difficulty taking day 1 as base idts imma complete this year also lol

simple bison
#

one minute!

earnest forge
#

GLHF everyone!!

leaden tartan
#

Do people usualkly save their code or how does this work?

hallow birch
#

Day 25 is gonna be rocket science

earnest forge
leaden tartan
peak dock
#

trebuchet into space

hallow birch
magic oxide
#

I could probably do it in #bot-commands

#

oh I'd leak my puzzle input tho

hallow birch
#

Alr gl all

shut trellisBOT
leaden tartan
magic oxide
#

oh nice

#

p1 looks immediately one line-able

cyan sleet
#

string parsing huh

magic oxide
#

could someone share p2?

#

just so I have something to mull over

compact wasp
magic oxide
#

god tier

magic oxide
compact wasp
magic oxide
#

ah

#

nothing too bad then

sharp panther
#

leaderboard is full

#

that was fast

sweet star
#

im still on #1 part 2

hexed axle
#

Have fun all! 😄

sweet star
#

nedbat's iteration speach helped with my thought process

earnest forge
#

112/170 :)

covert arrow
#

198/223 😔

compact wasp
#

unfort

covert arrow
#

not bad considering i'm not at home tbh

compact wasp
#

ah

humble copper
#

i got my first points on the global leaderboard ever!

magic oxide
covert arrow
#

yeah

magic oxide
#

ic

#

I'm just on mobile so PensiveCat

modern terrace
#

NO

#

I FORGOT

#

D:

covert arrow
#

I'm doing this as I'm running a stall at a charity fair

magic oxide
#

shit