#AdVENt of Code

1 messages Β· Page 5 of 1

real hinge
#

it will be pure pain

steady fog
#

it looks fun

proper totem
#

do try assembly

real hinge
#

it looks fun when you are not doing it

#

after trying and not even figuring out how to read a file

steady fog
#

@real hinge

real hinge
#

you will suffer

proper totem
#

it is also fun when you're doing it :3

hazy sinew
#

override fun solvePart2(input: File): Any { val l = input.rl().map { it.substringAfter(": ").split(" | ").map { s -> s.split(" ").filterNot { it.isBlank() } } }; val cards = List(input.rl().size) { 1 }.toMutableList(); for (i in l.indices) { val matches = (l[i][0].size + l[i][1].size) - l[i][0].union(l[i][1]).size; for (j in 1..matches) { if (i + j >= cards.size) continue; cards[i + j] += cards[i] } }; return cards.sum() }

#

happy now?

teal mountain
#

assembly without c stdlib yummylips

hazy sinew
#

that doesnt count tho

glacial abyss
proper totem
steady fog
#

@real hinge hi

teal mountain
#

dang

real hinge
#

hi

steady fog
#

@real hinge did you do part 2

real hinge
#

yes

teal mountain
#

i had an assembly course earlier this year, was a surprising amount of fun

steady fog
#

I'll do part 2 tomorrow

real hinge
#

nop

#

DO NOW

steady fog
#

but I'm in bed

teal mountain
real hinge
#

get out

steady fog
#

never

proper totem
#

it is definitely a lot of fun yeah, i really like how you have to think about things different

teal mountain
#

this just uses sprintf and the c bindings for raylib obviously (but i had to / those would replace the mode 13h interrupt without c interop)

real hinge
#

is printing in assembly even that hard

steady fog
#

I love risc

proper totem
#

dang, that's definitely more complex than anything I've done in asm

harsh marsh
#

sorry for missing your ping i locked myself out of my dorm and it took half an hour to get back in KEKW

real hinge
#

how did you get back in

hazy sinew
#

override fun solvePart2(input: File) = MutableList(input.rl().size) { 1 }.also { cards -> input.rl().map { it.substringAfter(": ").split(" | ").map { s -> s.split(" ").filterNot { it.isBlank() } } }.forEachIndexed { i, l -> (l[0].size + l[1].size - l[0].union(l[1]).size).let { matches -> (1..matches).filter { i + it < cards.size }.forEach { cards[i + it] += cards[i] } } } }.sum()

#

done

real hinge
#

insanee

harsh marsh
#

maybe your intersect relies on the inputs being sorted?

real hinge
#

but also isnt .let .also kinda cheating

teal mountain
harsh marsh
#

oh

harsh marsh
#

you figured it out

hazy sinew
#

otherwise its gonna be insanely impractical

real hinge
#

you literally get one extrra line

#

python people somehow do without those

#

I wonder if theres single one that done today in single line

steady fog
harsh marsh
#

with walrus operators you can do most things in python single line

hazy sinew
#

it already runs in 8ms in kotlin

#

chill

steady fog
#

FASTER

#

you need microseconds

#

@real hinge I should make kotlin compiler plugin

hazy sinew
#

no ty

real hinge
#

it seems powerful but you dont really get one extra line

steady fog
#

okay

harsh marsh
#

i mean do you count comprehension with walrus assignment as one line or not

#

because if you do you can do basically anything

steady fog
#

@real hinge is a walrus

hazy sinew
#

i think this is the shortest it can get
override fun solvePart2(input: File) = MutableList(input.rl().size) { 1 }.apply { input.rl().map { it.substringAfter(": ").split(" | ").map { s -> s.split(" ").filterNot { it.isBlank() } } }.forEachIndexed { i, l -> (1..l[0].intersect(l[1].toSet()).size).filter { i + it < size }.forEach { this[i + it] += this[i] } } }.sum()

real hinge
#

I can make it shorter with python

steady fog
#

also

#

in filterNot you can use a function reference

real hinge
#

print("Part 1: 18519, Part 2: 11787590")

#

one line

harsh marsh
#

sum((m:=len(set((s:=l.split())[2:12])&set(s[13:])))and 1<<(m-1)for l in open(0)) part 1 is pretty straightforward

harsh marsh
#

python

harsh marsh
#

comprehensions + walrus πŸ˜„

solemn python
#

I haven't done python in ages but I do remember how amazing list comprehension was

harsh marsh
#

i miss list/dictionary comprehension so much when coding in js/ts

#

Object.fromEntries(Object.entries(obj).map(([k,v]) => [k, v])) just is just so gross

#

compared to {k: v for k, v in d.items()}

teal mountain
#

list comprehensions are just [].map right?

#

mapping objects sucks though yeah

harsh marsh
#

map and filter combined

#

and efficiently because you only do one pass

teal mountain
#

ah

harsh marsh
#

[<expr> for <var> in <iter> if <expr>]

#

and they turn into generators

#

with lazy evaluation

hazy sinew
harsh marsh
#

how about part 2?

proper totem
tranquil vapor
#

it already had

real hinge
#

So bad

#

I was suprized to see cargo existed

#

Thought it was preinstalled

tranquil vapor
#

aoc sweats are insane

tranquil vapor
steady fog
#

@tranquil vapor

#

sleepp

real hinge
#

Ven is unsaveable

tranquil vapor
real hinge
#

Sleep again

#

You dirty r*st user

tranquil vapor
#

I DONT USE RUST

#

rini and fawn held me at gunpoint forcing me to install rust

delicate crane
#

Vee, Are we getting a leaderboard for aoc

tranquil vapor
#

wdym

#

it's pinned here

delicate crane
#

Like a channel

#

There was one last year

tranquil vapor
#

uh

#

I can bring it back but this being a thread makes it hard

delicate crane
#

Ah

tranquil vapor
#

cause where would I put the channel

delicate crane
#

Someone smarter than me can find a good solution

hazy sinew
#

i this english

delicate crane
tranquil vapor
harsh marsh
#

@hazy sinew this is the best I could do in python sum(d.append(((t:=sum(c for c,x in d if i<x)+1),1+i+len(set((s:=l.split())[2:12])&set(s[13:]))))or t for d in([],)for i,l in enumerate(open(0)))

#

actually my strategy here probably sucks

#

144 bytes hmm

#

for d in([],) is cheating really hard

#

or it should be for d in[[]]

hazy sinew
#

wait what i thought my numbers were on the left

#

bruh

#

i mean its irrelevant

#

but if i did it with a loop i wouldve failed

tranquil vapor
#

i love how i already solved 3 days in ruby yet my repo still has more rust even though i used rust only for one single day last year

hazy sinew
#

i was wondering why the winning numbers were more than my numbers

#

was that day 17

tranquil vapor
hazy sinew
#

i wouldnt know

hazy sinew
#

i wasnt very good at kotlin or puzzles when i did that

native pewter
hazy sinew
#

16 for loops just for day 11

#

lmao

#

16 if checks

native pewter
#

monkeyactivity

hazy sinew
#

i remember day 11 took me like a week to solve

#

and i gave up after that till november

tranquil vapor
#

wtf

hazy sinew
#

i was moduloing by different numbers for a while afaik

tranquil vapor
#

i forgot / lost motivation after day 11

tranquil vapor
#

my swift solution was very compact

hazy sinew
#

day 15 with kotlin is a lucky roll

#

python day 14 is very unlucky

glacial abyss
#

advent of call of duty

hazy sinew
#

why tf 24 in php

tranquil vapor
#

oh the remaining languages were in no paticular order

hazy sinew
#

did u just pick the best one for the day

real hinge
real hinge
#

Last year I needed to do path finding algorithm

#

Gave up immediatly

hazy sinew
#

if its path finding its an easy day

high lintel
#

the wording today confused me so much

hazy sinew
#

the hard days are the unique ones

#

like day 17

#

or day 18

#

or day 20

#

or day 21

real hinge
#

I gave up after doing 14

#

Idk those

hazy sinew
#

or day 22 (its pathfinding but you have to fold a cube)

#

the rest are easy

tranquil vapor
#

@real hinge remember when you wrote a C++ solution and forgot to initialise array so it was using random bytes

#

and you got a different solution each time u ran

native pewter
#

lmao

hazy sinew
#

i hope theres a lot of puzzles like day 12 this year

real hinge
#

I was going insane

hazy sinew
#

just a standard bfs

real hinge
#

Everytime I run I get different answer

#

I think you found the problem somehow

native pewter
#

i mean impressive it worked at all

real hinge
#

With weird gcc args

tranquil vapor
#

when even address sanitiser can't help

#

I wonder why not

#

since you're technically reading random memory

#

i think i didnt initialise my array either but I always wrote before reading so it didn't cause problems

real hinge
#

Probably

real hinge
#

Adding another uninitialized array to top of it was fixing the problem

tranquil vapor
#

HAHAHAH

real hinge
#

That was what driving me insane

tranquil vapor
sullen fiber
#

WHEN DID THEY DO THIS

#

WHY

#

IN FAVOR OF WHAT

tranquil vapor
proper totem
#

that seems like it'd be a correct interpretation

proper totem
#

it's be amazing if js had list comprehensions

#

es 7 where did you go wrong

tranquil vapor
#

fire

#

need that back

native pewter
#

is that pointers in js...

proper totem
#

yummy circular references

#

object.parent function.caller and the comprehensions I think are the biggest losses

#

especially the comprehensions

real hinge
#

Are those Firefox only or globally

#

Also wasnt javascript backwards compatible

#

Do they remove features

harsh marsh
#

the # means something different now

tranquil vapor
#

but only if removing them has small impact

#

there are many deprecated features that are still used heavily so they won't remove them

#

vencord uses multiple deprecated features

real hinge
#

var is also depraced for long time right

tranquil vapor
#

no

real hinge
#

How

#

I thought it was replaced with let

harsh marsh
#

let has way more sensible semantics but iirc there are occasional times when you want things to be hoisted to fix module circular dependency issues

#

also like transpiler/minifier pipelines only output var so almost every page uses it extensively in their bundle

#

let/const are still mostly seen on dev side instead of in browser runtime

sullen fiber
#

@warped dust

#

image encoding decoding and discplaying on temrnial

warped dust
#

horor

native pewter
#

yoooooo

tranquil vapor
#

xbox looking ass graphic

high lintel
#

xbox 360 rgh aurora dashboard

tranquil vapor
#

she advent on my code

weary carbon
#

im behind a day now and day 3 is kicking my ass

#

😭

tranquil vapor
#

is there a way to fetch the example?

#

like this

#

but for the example instead of input

#

i dont wanna have to scrape

native pewter
#

i doubt, since sometimes its different examples

tranquil vapor
#

i just want to automate the boilerplate creation >.<

harsh marsh
#

the examples are always in a pre > code

#

so if you can parse HTML you can get it

#

the python aocd helper package has it implemented

#

i don't really use it though lol

#

the format changes sometimes and its hard to fetch the answers though

tranquil vapor
#

god part 2 description is horrible

#

so confusing

#

ruby is so fucking goofy i swear

#

normal languages: arr.includes(thing)
fucking ruby: arr.include? thing

harsh marsh
#

is ruby popular still

#

my only experience with it is using it for aoc once years ago

#

2015 and 2016 had a few that required md5sum but the maker stays away from that kinda standard library check these days

tranquil vapor
#

ayy done

hazy sinew
daring marlinBOT
tranquil vapor
#

i love rubys syntax

#

funny

#

nop

hazy sinew
#

why is it the absolute value of n

tranquil vapor
#

thesre are so easy

#

24 lines of code for both parts...

hazy sinew
tranquil vapor
#

ok nerd

real hinge
tranquil vapor
#
File.foreach(file).with_index do |line, idx|
end
#

this syntax is kinda cursed

#
File.foreach(file).with_index
#

its cool tho

real hinge
#

Ven add ventracker here when

tranquil vapor
#

it attaches indexes to the iterator

hazy sinew
#

its similar in kotlin

#

File.forEachIndexed { file -> /* stuff */ }
or
File.forEachIndexed { it.doStuff() }

#

or for (i in File.readLines().withIndex())

tranquil vapor
#

yeah but

#

.foreach().with_index

real hinge
#
include_str!("input.txt").to_string().lines().for_each( |らさあ | {stuff})
#

@tranquil vapor WHY HUSK

tranquil vapor
#

|らさあ |

real hinge
#

Accidently switched to japanese keyboard

solemn python
high lintel
real hinge
#

I can no longer use a language that doesnt have unwrap

real hinge
#

I am addicted to unwrap

#

I want to use unwrap everywhere

real hinge
high lintel
#

(unwrap is actually bad and you shouldn't use it in a real program)

solemn python
solemn python
high lintel
#

yop

solemn python
#

Do not fall to the dark side

#

Unwrap is great for AoC but literally nowhere else

real hinge
#

I was sitting today

#

And said

#

What if I unwrapped myself

#

Wouldnt it be unwrapping cool

solemn python
#

Sounds painful

real hinge
solemn python
real hinge
#

Guh but everything returns option

#

Even though I know its not null

solemn python
#

But it could be

real hinge
solemn python
#

Rust has results and options to try and force you to error handle everything

#

Obviously some of those are never going to happen in your situation

real hinge
#

Also dont you have to use unwrap eitherway

#

After checking option.is_none

solemn python
#

But it's still better to have at least an error message that isn't a panic unwind

solemn python
#

Or if let

#

Or let Some(_) = ... else {}

real hinge
#

Can you use option in match

#

Didnt know that

solemn python
#

Of course you can

#

Its an enum

#

Any enum can be used

real hinge
#

Yeah but it returns "Some"

solemn python
#

It returns Option::Some(T)

#

An enum variant with one field

real hinge
solemn python
#

And match blocks let you extract the fields inside of enums

real hinge
#

Dont you need to unpsck it again

#

Oh

#

Okay good

solemn python
#

love automod

#

But yeah match patterns are very flexible it's pretty cool

#

There are so many safe ways to unwrap a result or option

#

That aren't ".unwrap() and hope it doesn't panic"

harsh marsh
#

have you seen Gleam before

real hinge
#

Now I am even more confused why rusher hates golang

#

Yeah you dont do if err every second but you do something similar to it

tranquil vapor
#

SO BAD

real hinge
#

Die

solemn python
real hinge
solemn python
#

Why is rust lang dot org malware

real hinge
#

Lmao

#

Epic

tranquil vapor
solemn python
sullen fiber
#

@warped dust RUST HAS SPREAD OPERATOR?!?!

warped dust
#

vap discovers pattern matching

native pewter
real hinge
#

in that case I wouldnt able to unwrap myself

tranquil vapor
#

vapper

#

that screenshot is so unreadable

steady fog
#

@real hinge hi

real hinge
#

hello

real hinge
#

why husk

#

well not hello then

hazy sinew
hazy sinew
tranquil vapor
hazy sinew
#

yeah and iterator.indices sounds much better than iterator.indexes

real hinge
#

(jk just my profile photo)

tranquil vapor
hazy sinew
tranquil vapor
#

lmao 😭

steady fog
#

@real hinge help me get rust set up

real hinge
steady fog
#

single file

real hinge
#

Idk if that is possible

steady fog
#

wrong

#

its working now

#

@real hinge ```rust
//bin/true; rustc -o "/tmp/$0.bin" 1>&2 "$0" && "/tmp/$0.bin" "$@"; exit $?

use std::fs::read_to_string;

fn main() {
let m = read_to_string("./input/day-07.txt").unwrap();

println!("{}", m);

}

real hinge
#

congrats

steady fog
#

i will unwrap you

#

@real hinge i got a bunch of days ready

#

C++, Rust, Julia, JS

#

reading the file, running it works

#

@real hinge i did part 2 from last night

#

do you love

real hinge
#

yopp

sullen fiber
#

@warped dust help

native pewter
#

death from uiua

tranquil vapor
#

rust users when i unwrap my presents (they might panic) screams

steady fog
#

parents

#

ven what does that mean

real hinge
#

I found microsoft launcher

#

soon I will go full microsoft on my phone

native pewter
#

@sullen fiber when you gonna do aoc in malbolge

native pewter
proper totem
#

assembly users when I call printf (terminated by signal SIGSEGV (Address boundary error))

native pewter
proper totem
#

I use gcc to link the binary and one function from the c standard library to print the results but otherwise it's all just raw assembly

#

my entire build process

native pewter
#

damn even file reading?

proper totem
#

I cheat and embed the input into the executable

native pewter
#

ah thats true

tranquil vapor
#

qhar

#

what's that even supposed to mean

#

false

#

ruby is very fun to use

proper totem
#

ruby kinda nice it's just a little weird sometimes

#

would rather use ruby than python blobcatcozystars

tranquil vapor
#

yeah

#

ruby more like cozy

#

they're not comparable

#

but it's obviously
typescript > ruby > kotlin > java > rust

native pewter
native pewter
tranquil vapor
#

isn't julia jvm based or smth

#

or am i thinking of smth else

native pewter
#

no,,,

tranquil vapor
#

do aoc in groovy

native pewter
tranquil vapor
#

:/ sry im not gonna touch a programming language for straights

native pewter
tranquil vapor
#

julia looks cool

#

i will use

#

but tomorrow is crystal meth day so can't use julia

native pewter
#

multiple dispatch is so cool

#

maybe ill watch their talk on it later

native pewter
#

oh crystal?

#

oh sure ill do tomorrow :3

tranquil vapor
#

yeah I'll try crystal tmrw

delicate crane
tranquil vapor
#

no

#

you would need to scrape it probably

#

i checked and the examples don't have any html classes unfortunately

real hinge
#
import requests
import bs4


text = requests.get('https://adventofcode.com/2023/day/4')

soup = bs4.BeautifulSoup(text.text, 'html.parser')

for i,code in enumerate(soup.select("body > main > article > pre > code")):
    with open(f"example-{i}.txt","w") as file:
        file.write(code.text)
#

there

solemn python
real hinge
solemn python
#

I think the best method is finding all code > em

delicate crane
solemn python
#

Then taking the last if there are multiple

solemn python
#

I don't see why the answer wouldn't be the last one on the page

delicate crane
#
const examples = articles.map((index, article) => doc(article).find('pre > code').first().text())
const exampleAnswers = articles.map((index, article) => doc(article).find('p > code > em').last().text())
solemn python
real hinge
#

IT DOES

solemn python
#

Not the example text

#

Is what I meant

real hinge
#

how would you even get answers

solemn python
#

code > em

#

Take last

#

That works for days 1-4 at least

real hinge
#

would that be reliable

delicate crane
real hinge
#

fair

solemn python
#

Day 4 has a bunch of emphasized code blocks but they all lead up to the final one which is the answer

delicate crane
#

can someone find any examples where any of the following assumptions isn't true

  1. there are 1 or 2 articles on the page, corresponding to the text for part one and two
  2. the contents of the first pre > code in each article is the example input for that part
  3. the contents of the last p > code > em in each article is the example output for that part
native pewter
#

why would you bother scraping the output

#

you need to put it in your specific lang file anyways

#

or are you guys doing a single language πŸ™„

delicate crane
#

I haven't solved that one, so I don't have it's part two

#

but part one I got
15.ex.json

{
  "partOne": {
    "input": "Sensor at x=2, y=18: closest beacon is at x=-2, y=15\nSensor at x=9, y=16: closest beacon is at x=10, y=16\nSensor at x=13, y=2: closest beacon is at x=15, y=3\nSensor at x=12, y=14: closest beacon is at x=10, y=16\nSensor at x=10, y=20: closest beacon is at x=10, y=16\nSensor at x=14, y=17: closest beacon is at x=10, y=16\nSensor at x=8, y=7: closest beacon is at x=2, y=10\nSensor at x=2, y=0: closest beacon is at x=2, y=10\nSensor at x=0, y=11: closest beacon is at x=2, y=10\nSensor at x=20, y=14: closest beacon is at x=25, y=17\nSensor at x=17, y=20: closest beacon is at x=21, y=22\nSensor at x=16, y=7: closest beacon is at x=15, y=3\nSensor at x=14, y=3: closest beacon is at x=15, y=3\nSensor at x=20, y=1: closest beacon is at x=15, y=3",
    "output": "26"
  }
}
real hinge
#

.split("\\n") trolldayruined

delicate crane
#

pretty sure .split("\n") would work fine

real hinge
#

yes it would but

#

eeeeeeeeeeeeeeeeeeeeh

#

I would rather be able to do string.lines()

tranquil vapor
#

i will split mantika

delicate crane
real hinge
delicate crane
#

if string.lines() doesn't work on a string with \n newlines, then that is string.lines() problem

real hinge
delicate crane
#

how

warped dust
#

manti are you braindead

#

JSON

delicate crane
#

because it literally contains \n not \\n

warped dust
#

ITS JSON

#

JSON ESCAPES

#

THEY GET PARSED

real hinge
#

okay then

warped dust
#

BRAINDEAD

real hinge
warped dust
#

NO

delicate crane
#

r7 76 gmftfuyghkjjhuigjk,lg vkl,fy6ky

real hinge
native pewter
#

are you being stupit on purpose

solemn python
#

Just added example scraping and a command to view it

#

Now just to use it to test stuff automatically

real hinge
#

On json yes it indeed converts \n into newline

#

But doesnt on regular file

#

Void broke my heart by calling me stupit

native pewter
#

you have "\n" in the file not '\n'

real hinge
native pewter
#

whatever

real hinge
#

Whats the difference

native pewter
#

" is a 2 len string and ' is a char

real hinge
#

Doesnt matter on python

native pewter
#

youre missing the point

#

i give up

real hinge
#

Horr

#

Anyway I eep

#

Night night

#

Windows 10

native pewter
#

gn!

#

i will put w11 while youre asleep

warped dust
#

most fuckin stupid aoc setup

#

you need to read the problem

delicate crane
#

we do read the problem

#

its just a very quick way to check if our answers are correct against a free test case

warped dust
#

takes two seconds to copy paste it

solemn python
delicate crane
solemn python
#

ill probably delete that subcommand soon, I was just bored lol and wanted it to be fancy

tranquil vapor
#

someone should get ai to summarise the AOC assignments

#

cause got damn those are some essays

#

aint reading allat 😭

solemn python
#

so true

tranquil vapor
#

am i the only one who skips the first few paragraphs

solemn python
#

I try to read it but inevitably end up skipping it

tranquil vapor
#

i appreciate the effort the creator put in but at the same time i kinda just want the exercise

warped dust
#

i start reading the last few paragraphs and then go up

solemn python
#

10pm isn't too late for me but still my brain is not comprehending that stuff when I just want to solve the puzzle and go to bed

warped dust
#

im pretty sure the reason they're making the prompts insane now is to distrupt ai

solemn python
#

good

tranquil vapor
warped dust
#

real

tranquil vapor
#

i hate ai so much

warped dust
#

wtf is a gondola

tranquil vapor
#

ruining everything

tranquil vapor
#

The gondola (English: , Italian: [ˈɑondola]; Venetian: gΓ³ndoΕ‚a [ˈɑoΕ‹doΙ°a]) is a traditional, flat-bottomed Venetian rowing boat, well suited to the conditions of the Venetian lagoon. It is typically propelled by a gondolier, who uses a rowing oar, which is not fastened to the hull, in a sculling manner, and also acts as the rudder. The uniquenes...

warped dust
#

YOU CALL THESE GONDOLAS??

tranquil vapor
#

YEAH

#

WHAT ELSE BITCH

#

if you're gonna say canoe or smth I will eat your liver

warped dust
tranquil vapor
#

can i get an uber

warped dust
#

A gondola lift is a means of cable transport and type of aerial lift which is supported and propelled by cables from above. It consists of a loop of steel wire rope that is strung between two stations, sometimes over intermediate supporting towers. The cable is driven by a bullwheel in a terminal, which is typically connected to an engine or ele...

tranquil vapor
#

among us??

warped dust
#

we call them telefΓ©ricos

#

i thought in enligsh its just cable car

solemn python
#

I did not know a gondola was a boat

#

all I knew was the lift

warped dust
#

the direct translation is telpher apparently

#

brb lemme get on this telpher

#

who up telphering

delicate crane
solemn python
delicate crane
# delicate crane

Currently it only updates xx.ex.json when the start script is ran. But once I integrate a submission bind, it will automatically update it when I successfully submit part 1

delicate crane
#

I have added race mode to my script.
It waits until the next day unlocks, and immediately

  1. opens the problem in the browser
  2. creates and opens a file to create the solution in
  3. downloads the input
  4. parses the problem page to get a test input/output for part one
warped dust
#

loser

native pewter
#

lmao

warped dust
#

who actually cares about doing it fast

#

u suck

native pewter
#

be nice bitch

warped dust
#

fucking have fun with things

delicate crane
#

I care about doing it fast because my brain is highly suseptible to wanting to maximize meaningless internet points

solemn python
#

I'd like to do it fast but I'm never going to be zoomy enough to get any significant reward from it so who cares

#

If I do make fancy setup stuff it's for convenience or because I'm bored, not because I actually care about speed

native pewter
#

id love to compete but what is that time man its horrible

#

my ass is not coding at 6am

solemn python
#

Just get a better timezone

#

It's 10pm for me

proper totem
#

8pm blobcatcozystars

delicate crane
#

Advent of code favors people outside america

warped dust
#

yes americans are the only people with conflicting timezones

proper totem
#

timezones in red are disadvantaged due to sleep and timezones in orange are disadvantaged due to traditional work hours

#

ironically the US/Canada still has a lot of advantage all things considered

harsh marsh
#

west coast US is particularly good

#

east coast is fine for me, 12 am is my normal brain active hours

#

and doesn't conflict with school, work or clubs

sullen fiber
#

NOT A GONDOLA FAKE FAKE FAKE

sullen fiber
#

FAKE FAN

#

Can't believe you're not immersed

#

@warped dust rate my day 4

steady fog
#

i beg of you

sullen fiber
#

sor y:////

steady fog
#

delete cause ulgy

solemn python
steady fog
#

@warped dust GET READY

#

RINIINININININI

warped dust
#

im about to sleep

steady fog
#

no

solemn python
#

soon

steady fog
#

youre gonna do aoc

solemn python
#

go

#

now

#

solve

steady fog
#

okay

solemn python
#

holy text wall

sullen fiber
#

aw poor guy was so busy

steady fog
#

i dont even read the prompt i just start writing parsing

sullen fiber
#

getting food

real hinge
steady fog
#

@real hinge hi

real hinge
#

Hi

#

Todays problem long

#

Zt solve

steady fog
#

soon

#

@real hinge i hear minky

#

he is making noises

real hinge
#

Kill

steady fog
#

why isnt crystal vscode plugin working

#

guh

real hinge
#

Part2 doesnt look good

steady fog
#

did you already do part 1

real hinge
#

38 people

real hinge
solemn python
#

fear my data structures

steady fog
real hinge
#

Cant code

steady fog
#

can

real hinge
#

Unneccesaryli painful

#

I would rather wait until I get my pc

#

Anyway it looks like we just need to convert numbers to each other billion times

#

Guhhh @steady fog fix rust analyzer on vens vps

steady fog
#

how

real hinge
#

Idk

steady fog
#

String@real hinge

real hinge
#

Yes

steady fog
#

evil

real hinge
#

Look

steady fog
#

insanity

real hinge
#

They are Very funny

steady fog
#

nop

real hinge
#

Yop

steady fog
#

NOP

real hinge
#

Zt looks at google play store memes everyday

steady fog
#

wrong

#

In day-05-crystal.cr:15:23

15 | p! seed_to_soil_index + 1
^
Error: undefined method '+' for Nil (compile-time type is (Int32 | Nil))

#

whar

#

oh ok

#

its like java

#

have to assert that its not nil

#

@real hinge do aoc

real hinge
#

PHONE

steady fog
#

doesnt matter

#

beautiful

#

@real hinge boo

real hinge
#

I dont think you are supposed to do that

solemn python
#

part 1 done

proper totem
#

part two is meaaaaaan

real hinge
#

Part2 will never get finished

proper totem
#

best rank i think i've ever gotten

sullen fiber
#

oh god

#

part two

#

the naive method is obviously not gonna work

#

i dont wanna do this in uiua

#

this might be where i start doing them in typescript

#

yea ts it is

real hinge
#

why does vps not have glibc

sullen fiber
#

they prob have musl

steady fog
real hinge
#

horror

#

STILL SAME ERROR

#

oh my god

#

it requires libgc 29

#

BUT DNF DOESNT HAVE THAT

#

it has 28

#

how did it end up like that

harsh marsh
#

whew I am a clown

#

how did I make so many mistakes doing that

solemn python
#

For the memes

#

You can't stop me

#

Hehhehehehehhe

#

Rust go brrrrrrr

sullen fiber
#

fak

#

e

proper totem
#

I know there's probably a better way to do it

#

but

solemn python
#

It's going rn

proper totem
#

oh well! I am alright with my six minute solution

solemn python
#

73% of seed group 2

harsh marsh
#

ur insane

sullen fiber
#

explode

solemn python
#

I know

#

This is literally a crypto miner and it's hilarious

#

Wonder how long it'll take

harsh marsh
#

I know there's this one package I used once for dealing with range overlaps quickly

#

probably should have spent the timing remembering what that package instead of doing it manually

solemn python
#

Aaaaand finished

#

the power of rust knows no bounds

sullen fiber
#

JESUS CRIST

harsh marsh
#

oh damn it worked

#

im surprised the input wasn't big enough to rule out brute force solutions

sullen fiber
#

rust too powerful

solemn python
#

and overall it checked 2,549,759,327 seeds

sullen fiber
#

i wish typescript had range type

#

im so sad

hazy sinew
#

bro can topaz stop trying to throw off llms and make the early days easier

#

22 minutes for top 100 is too long for day 5

steady fog
solemn python
#

I will eventually

#

I want to figure out the real solution not the dumb one at some point

hazy sinew
#

i tried doing that in kotlin, it didnt even finish the first range after 15 minutes

#

but i think the real solution is a oneliner

solemn python
#

Well yeah I don't think you are going to get very far on anything that doesn't use native executables

hazy sinew
#

i think my only chance of getting global is if its a late day and i already have a utils function for the solution

#

maybe like day 18

#

of 2022

#

with a 3d grid and u have to count something

#

ppl will be implementing 3d arrays from scratch and still getting global

hazy sinew
proper totem
solemn python
proper totem
#

yop

solemn python
#

Guess I'm just bad

#

No clue how but guess I am

proper totem
#

it could be we have wildly different numbers of seeds

solemn python
#

True

proper totem
steady fog
#

ok so

#

make aoc in a bootable efi

#

@proper totem

#

have fun

proper totem
#

that would be cool! unfortunately: i have finals next week and don't have time to make asm aoc solutions for two weeks ;w;

steady fog
#

one day I will do

#

low level coding is so cool

proper totem
#

could do a bootloader instead

#

er

#

I guess you need the larger numbers from 32 bit protected mode

#

so efi would be easier yea

steady fog
solemn python
#

And I'm not waiting for it to finish so idk who cares, I got the solution

proper totem
#

makes sense

#

a little over half would put our solutions at roughly the same speed then maybe

solemn python
#

Is your computer decent

proper totem
#

pretty decent yeah

#

newer laptop

solemn python
#

Mines a pretty generic Lenovo laptop from years ago

#

Anyways I should sleep

steady fog
#

same

#

goodnight tyminky

sullen fiber
#

AAAAAAAAA

#

part 2 is wrong

delicate crane
#

my shit keeps stopping randomly before it finishes

sullen fiber
#

i th ink my math is right but

delicate crane
#

no errors

sullen fiber
#

fake

#

TF

#

virus

delicate crane
#

it just fucking stops

#

literally says OK im tired now

#

and dies

solemn python
#

Is it OOM'd?

delicate crane
#

no, it would say OOM if it was OOM

solemn python
#

idk

delicate crane
#

I fixed my OOM error by chunking seeds into arrays of 65536 size

solemn python
#

I just never generate the list of seeds but ok

#

Iterators are my friend

#

But no clue why yours would just die that makes 0 sense

delicate crane
#

yea

#

I increased my chunking size and it made it further, its still going

#

range 3/10 16%

solemn python
#

Glad to see at least 2 others followed me to the dark side

delicate crane
#

dark side?

solemn python
#

This horrible solution of brute forcing it

delicate crane
#

I can't think of anything better

sullen fiber
#

WHY DOES MY CODE WORK ON EXMA_PLE

#

BUT GIVES WRONG NUMBER ON UINPUT

#

I WILL KILL EVERYONE

solemn python
#

I can think of a way I just didn't feel like it

#

I'll solve it correctly eventually

proper totem
#

we will use multithreading

#

this is definitely the intended solution

solemn python
#

That too

delicate crane
#

I would, but I hate threading in js

sullen fiber
#

wait

#

i had the right answer the whole time

#

WTF DID I SUBMIT

#

?!#@$r%tyr^u&%#$r

#

that is so stupid

#

typescript so good

#

assembly level speed

proper totem
#

i will inspect how the speedy solution is supposed to work

solemn python
#

I have a plan that I might try tomorrow

proper totem
#

πŸ” πŸ‘οΈ

delicate crane
proper totem
#

oh that speedy solution makes sense i guess

delicate crane
#

where is the speedy solution?

proper totem
#

vap's repo

#

it kinda bothers me that the speedy solution is one that doesn't feel elegant at all

#

it makes sense why it works and how but it doesn't feel nice, at least to me

sullen fiber
#

ngl i think its only unelegant because ||ts/js doesnt have range as a stdlib type||

#

||it would prob be good in a langauge there is a nice range type, idk any tho||

delicate crane
#

It took my js 23.3 minutes to brute-force it

sullen fiber
#

||toMap in Mapping::mapRange would easily just be range.intersect(source), and before / after would be a disjoint range.subtract(source)||

harsh marsh
#

I didn't know there were languages with that in their stdlib

#

my python solution gets 50.6 ms for part 2 but theres a lot of inefficiency

#

got it down to 2.47 ms by adding a couple of break statements KEKW

real hinge
#

wait

#

wth is the second part

#

need a nasa computer

#

oh my god

#

I need to remake my entire solution

#

I was storing them in arrays and do entire step at once

real hinge
#

I ran out of battery

#

this will take forever

proper totem
#

are you printing progress on every seed

#

if you are then most of your processing time is probably taken up by i/o and not actually calculating the solution

real hinge
proper totem
#

o

#

i wasn't sure because of the 33 at the end

teal mountain
#

this years aoc SUCKS

#

why are we getting optimization problems so early already

#

i started a bruteforce but it finished (10 mins or so) before i was done with the optimized version

native pewter
#

tf is today

native pewter
real hinge
native pewter
#

thanks manti.

real hinge
#

Np void

hazy sinew
#

how am i gonna put this on 1 line

native pewter
#

also please spoiler your stuff sillycat still havent had time to do it

hazy sinew
#

but sure

hazy sinew
native pewter
#

crystal actually looks mad cool but :( concurrent but not parallel

native pewter
#

google

sullen fiber
#

@warped dust uiua might actually be bad for my brain

#

i spent like a minute wondering how tf to reshape an array in ts

warped dust
#

uiua brainrot

hazy sinew
#

this is almost 1 line (if i use .let and .also everywhere and inline seeds and mapping)

sullen fiber
#

YOU KNOW WHAT

#

||the mappings are bijective, i will just binary search the maps backwards for uiua||

hazy sinew
#

instead of val result = hashMapOf<LongRange, Boolean>()
hashMapOf<LongRange, Boolean>().let { result ->
everything else
}

sullen fiber
#

its so good

#

js needs reshape

#

its so perfect and good and holy

warped dust
#

.flat().chunks(5)

sullen fiber
#

FR

#

NEED

#

it doesnt even need to be multidimensional really

#

if i could do it all 2D it woudl eb eoucpic

warped dust
#

deshapes vap

#

deshaping for real

#

dumping your elements onto the stack

#

directly

sullen fiber
#

[/id]

#

wait

warped dust
#

WTF

sullen fiber
#

no the oppisite

#

/id

warped dust
#

inv

sullen fiber
#

i think

#

reduce alr operates on an array idk why i rearrayed it

warped dust
#

/id takes 0 arrays

sullen fiber
#

thats getting deprecated

#

not / but like dumping onto the stack arbitrarily

#

also inv -> un

#

and unbox -> un box

warped dust
#

unbox deprecated ??

sullen fiber
#

true

#

they say stuff like that

#

and im like "!?!?!? in favor of what???

#

and theyre like oh sike its being renamed

warped dust
#

uiua devs on fuckinb crack

sullen fiber
#

i need some of that

#

the uiua site is all in rust

#

its kinda wacky

warped dust
#

wrong

#

theyre hiding the js

#

websys tries so hard

sullen fiber
#

it looks cool but, there was like no debug information in the errors 😭

warped dust
#

making you write the worrst js

sullen fiber
#

dude it looked so bad esp making callback closures

warped dust
#

because youre awkwardly using generated bindings for each call

#

so baad

sullen fiber
#

.unwrap().dyn_into::<ArrayBuffer>().unwrap()

warped dust
#

lmaoaoa

#

unchecked ref tbh

real hinge
#

les goo

#

2 minutes and 46 seconds

#

single thread tho

#

I wonder how low I can go if I multithread

#

but doing mt in rust is dread

sullen fiber
#

people using spoilers like they're censoring a govt document is kinda funny to read

real hinge
#

@sullen fiber what is this

sullen fiber
#

part 1 in uiua

real hinge
#

wth is that

sullen fiber
#

stack oriented array language

real hinge
sullen fiber
#

i wanna think of a way to do part 2 easy so bad

#

ok copilot

tranquil vapor
#

WHAT IS THAT

warped dust
#

copilot writing your emotions for you

sullen fiber
#

@warped dust uiua bytecode is actualyl really cool

#

stuff like fork both bracket gets inlined

#

and temporal execution limit is built into the interpreter

#

also shout out to NumProcs

warped dust
#

not as COOL as THe BEAM

solemn python
real hinge
#

what the

sullen fiber
#

ISJNANE

#

INSANE

solemn python
#

I was curious so I went on the reddit thread

real hinge
#

wait is fast solution || just mapping the ranges instead of 600 million numbers ||

sullen fiber
#

||yea thats what i did||

real hinge
#

makes sense

sullen fiber
#

||the pain is that a single mapping can split one range into 3 at most||

real hinge
#

but that would probably take me more than 2 minutes to implement

sullen fiber
#

teru

#

true

real hinge
#

holy shit

sullen fiber
#

||yea i was gonna linear search the reverse map but i was scared of how long it'd take in uiua||

#

||lemme actually try it rq||

solemn python
# real hinge

I'm surprised how many people went brute force on this one

real hinge
#

it is the easiest one ig

#

|| both reverse scanning and range matching is a bit horror||

solemn python
#

It's funny but also they could have just made the numbers a few digits bigger and this problem would have been solved

real hinge
#

||tho reverse search would probably be easy to implement (but also I think thats a gamble too if they made smallest number something like 18284718 it would take forever again) ||

#

@tranquil vapor your solution soon

solemn python
#

@real hinge do you love

real hinge
#

there is a chance

#

wth is that

#

that isnt rust

warped dust
#

its rust

#

welcome to macros

real hinge
#

what the hell

#

I am never looking at aoc subreddit again

#

even devilbro cant get this worse

solemn python
#

Someone visualized their input

sullen fiber
#

i was doing the same thing

#

imma not do that anymore cus it sucked

#

thats so sick

#

aoc hash function

#

i was gonna do it in desmos instead of svg but svg is a lot saner

sullen fiber
#

@solemn python can i tell you a way to optimize your bruteforce, i wanna see how fast it runs in rust

real hinge
#

MINE RUNS IN RUST TOO

#

but I am lazy watever

tranquil vapor
#

okk aoc timee

sullen fiber
tranquil vapor
#

CRYSTAL IS SO BAD

sullen fiber
#

maybe i'll try my optimization idea on urs and see if it makes it fast

real hinge
#

do

solemn python
#

When I have time

sullen fiber
#

no worries no worries imma try it on manti's

tranquil vapor
#

DESCRIPTION SO CONFUSING AGAIn