#advent of code 2025
1 messages · Page 2 of 1
instead of realizing that i went on to ||"at least 2 equal parts but they dont have to be all equal"||
my utils came in very handy but sadly im stupid
Is it grid based 
mine runs in 400ms
buT
I have op cpu
so idk urs might be better
its probably not
what is iT
||```kt
part2 {
var x = 0L
ranges.forEach { range ->
for (id in range) {
val idStr = id.toString()
val len = idStr.length
for (i in 1..<idStr.length) {
if (len % i != 0) continue
val pattern = idStr.take(i)
if (pattern.repeat(len / i) == idStr) {
x += id
break
}
}
}
}
x
}
||bruteforce basically||
i just did ||.chunked(i).isAllEqual()||
womp womp
my utils are foss so theyre not utIlhs
anyone could have used my util for it 😄
switched to your solution and it jumped to 13s
I wonder if you can do aoc in typst, given its turing complete
yesterday's was done in just typescript types
Oops looks like I made an assumption that really isn't guaranteed to hold
But works on my input so whatever
ok time to solve d2 in elle
my solution is soooo cursed mao
i got both parts in like 25 mins but it was kinda slow so i redid the slow parts without string operations
@terse edge isnt it beautiful
what do we think
100ms on real input for both parts
languages that dont use parens are so beautiful
this is why rust is so beautiful?
now do it without string operations
kotlin is so awesome i just wish it wasnt built for the jvm
this is very bad looking rust idk why
but as you can see there are a lot of parens
what does that mean
i can do ur *10 %10 thingy i think i did that for snafu 2022 d25 but string ops are easier and more readable
i mean theyre easier but also like, slower
im using kotlin i dont give a shit about speed
i guess actually the slice part was the slow part not the digit counter
yeah but it matters for me i guess lol
the string op sol took like 5s this sol takes 100ms
big difference
prob like 2s compared to this
well there are some parts that make it slow for sure
i dont understand any of this
only thing i understand is why the for loop is there
@terse edge is this good
dont usg vscode
use zed
for kotlin u have to use intellij
@native maple all microsoft products are made for people too lazy to configure shit
bloatware @terse edge
didn't say it wasn't
Cursor
but its the only thing that has a good kotlin lsp
IntelliSlop
||
is_twice checks for ABAB, so 44 -> true, 123123 -> true, 4343 -> true, 431 -> false
- count the digits
- if digit count is odd they cant possibly be the same
- build
p = 10^(d / 2) - split the number into
x / pandx % p
this is the same theoretically as turning it into a string and splitting it in the middle and then checking whether the left and right match
is_repeat checks for whether a number is made up of k-digit blocks repeated 2 times or more
- count the digits
- try every
ksuch thatk * 2 <= d&&d % k == 0 - for every valid
k, buildp = 10^k - start from the right and check that every block going from right to left is the same as this block
- if all blocks match, it is a "repeated" number, otherwise try another
k
||
yea ik the concept behind it but itd take me at least an hour to implement it
also there is a lb for the ppl that used to be an global lb more or less
well it was open to everyone (now its full i didnt get in) in the aoc discord
oh that wasnt a question
but jonathan, kroppeb, nimka, etc are there
nop
oh
is neil doing it this year?
i didnt see any videos
neil wu?
thistlewistle
yea me neither
use rust
vban @terse edge
wait now i cannot figure out a solution
@terse edge what if ||i divided the ID by length then length-- and divide and again and again until i inevitably get x identical sections||
okay i just misunderstood
i just have to check if it repeats twice 😭
Are you using kotlin
if so theres ||string.chunked(n)||
for p2
lol
@vague knoll i will keep doing p1 and p2 in a single function to piss off @fallen lily
I almost always do that
i also do that
okay so satan is just insane
it seems like ai is not good at writing assembly
so i guess it's a pretty good option if you want a job

(I was curious how well chatgpt would do with the same challenge)
try Claude Code
i did it
isnt it beautiful @terse edge
i think i can post without spoiler because i dont think this can help anybody ever
wait im so dumb i missed this part about p1:
you can find the invalid IDs by looking for any ID which is made only of some sequence of digits repeated twice.
this makes things so much easier 
should i refer you to my therapist
"isn't it beautiful"
"i think i can post without spoiler because i dont think this can help anybody ever"
okay apparently i accidentally did p2 too 
exactly
😭
dam it
d2 is so much easier
not seen yet, but d2p1 is nice
spinning the wheel for tomorrow
THANK GOD
wait oh my god all schools in my town are temporarily closed for the next few weeks which means… i will be free in the morning and can do aoc in the first hour (if i come up with the solution quick enough ofc)!!!!
today was so easy what
now do it in the typescript type system
no, i'm actually trying to find the exact stuff to only get good results
but currently i'm too low so it mean i'm probably off in my math
yep so that's the issue
yeah
oh this would be way faster working with numbers yeah
is my solution smart
https://github.com/ficcialfaint/advent-of-code/blob/master/2025/02/02.dart
fixed
yeah the github link is better
i'm really starting to like OCaml
my solution is really slow though
justfile spotted??
and i curse those people
look inside for a cursed preprocessor
well actually cppo is the cursed preprocessor
i’ve been tryna set up makefile for my aoc solutions repo so i don’t need to remember whatever compile command is for each day but it didn’t work so i switched to justfile and… it didn’t work either
bbbut windows users won’t be able to use it!
okay tbf they wouldn’t be able to use makefiles either
they would thanks to WSL
so this is my p1
i think i have to use a brand new strategy for p2
why did you jsdoc everything
NOOOOOOOOOOOOOOOOOOOOOOOO
i love reading code in pages
because it makes vscode slightly smarter
tf
is the inference not very good?
it's fine, but adding the jsdoc takes nearly no time and makes it better
the diff isn't big, but enough to make tab suggestions better
reupload in spoilers cause yeah
i've never seen that many vscode extensions holy hell
you could just use/.... typescript............
please censor t*pescript
anyways i cant figure out why even my obligatory assembly rewrite doesnt work
i've been staring at this for half an hour
how many times will i have to say it
typescript doesn't run in the browser
the humble tsc..
what's ur cpu
my solution is way slower
my 0.37s solution
oh and this
yes it is
i just tried
way faster
switching to / 10 loop took 0.1s longer
maybe it's just crystal being slower
its like 60ms slower using log10 in elle
wait
yeah about 60ms slower
oh no it is slightly faster just the conditions have changed since this morning
i now also have minecraft open
its like 10ms faster
awesome
whats the memory management model of crystal?
garbage collected?
wait how is it faster for you, i have 7800x3d it should be way faster than m1
i ran your elle solution
yeah lol
i have no idea, is your cpu arm or amd/intel?
amd
also could just be things running in the background
performance is like very subjective
it could also be that qbe doesnt do vectorization so arm just happens to be slightly faster when neither are vectorized
i replaced the digit count with this
py??
oh no thats just a second benchmark lol
xD
i stole the makefile from my aoc 2024 when i compared the times
@native maple i can send my asm solution if you wanna benchmark
sure
imagine i somehow fitted an entire token stealer into 1kb
i have no idea how everyone started calling me a femboy
it's not even just twitter i just have that kinda aura i guess
i pushed the log10f solution, try that see if its faster
youll have to git pull && make install-std install-runtime in the main repo tho because log10f and floorf werent in the stdlib
btw idk what you're doing but why not just keep the lengths while parsing the numbers?
that's what im doing
hi @native maple
no way manti in 🅱️encord
I would beat you but I am in python
QWRONG
correct
tried adding cache but it just made it way slower lmao
YEAH
so weird
i mean you only cash the digit count
i cached everything

ig making a massive hashmap is slower than just doing the math
i wonder if a massive array would be faster
how slow is yours noob
oh you edited rosies code
test mine
p1,p2 = 0,0
import itertools
u = {0}
with open('input.txt') as f:
for r in f.read().strip().split(","):
s, sl, e, el = (v for i in r.split("-") for v in (int(i), len(i)))
for k in itertools.product("1234567890", repeat=int(len(str(e))/2)):
if k[0] == "0":
continue
n = int("".join(k) * 2)
if n >= s and n <= e:
p1+=n
for l in range(1,int(el/2) + 1):
for k in itertools.product("1234567890", repeat=int(l)):
if k[0] == "0":
continue
for f in range(max(sl,2),el + 1):
n = int("".join(k) * (f//l))
if n >= s and n <= e and n not in u:
p2+=n
u.add(n)
print(p1,p2)
you have 9800x3d
isnt that 300ms
USE PYPY
don't have pypy
Nobody should use python
INSTALL
So bad
lc.gemini how 2 install pypy explain to @lusty atlas
-# <:i:1263593669215256597> labsCore will be shutting down <t:1767265200:R> • Learn more
There are a few ways to install PyPy, a fast, alternative implementation of Python. The easiest method depends on your operating system.
💻 Recommended Installation Methods
The quickest and most common methods are using a package manager like Homebrew (macOS), or Conda (cross-platform), or simply downloading the pre-built binaries.
1. Using Homebrew (macOS)
If you're on macOS and have Homebrew installed, this is the simplest way:
- Open your terminal.
- Run the following command to install the latest Python 3 version of PyPy:
brew install pypy3
2. Using Conda (Cross-Platform)
If you use the Conda package manager (like with Anaconda or Miniconda), you can install PyPy into a new environment:
- Open your terminal/Anaconda Prompt.
- Create and activate a new environment with PyPy (e.g., using Python 3.9):
conda create -c conda-forge -n my_pypy_env pypy python=3.9 conda activate my_pypy_env
3. Using Linux Package Manager (Ubuntu/Debian)
Some Linux distributions offer PyPy through their package repositories. For Ubuntu/Debian, you can use the PyPy PPA:
- Add the PyPy PPA:
sudo add-apt-repository ppa:pypy/ppa sudo apt update - Install PyPy 3:
sudo apt install pypy3
📦 Direct Download (Manual Installation)
For Windows, or if you prefer a direct download for other systems, follow these steps:
- Download the Binary: Go to the official PyPy Download Page. Download the latest PyPy3 version for your specific operating system and architecture (e.g., Linux x86_64, Windows 64-bit).
- Extract the Files: Unzip or untar the downloaded file (e.g.,
pypy3-vX.Y.Z-OS.zipor.tar.bz2) to a simple, convenient location on your machine (e.g.,C:\pypyon Windows, or~/pypyon Linux/macOS). - Run PyPy: PyPy is ready to run right after extraction. Navigate to the extracted folder (specifically the
binsubdirectory on Linux/macOS) and run the executable.- Linux/macOS Example:
cd /path/to/extracted/pypy-folder ./bin/pypy3 - Windows Example:
\path\to\extracted\pypy-folder\pypy3.exe
- Linux/macOS Example:
Optional: Add to PATH
To run the pypy3 command from any directory, you should add the directory containing the pypy3 executable (usually the bin folder) to your system's PATH environment variable.
✅ Verifying the Installation
After installing, you can check that PyPy is working correctly by running the interpreter and checking its version:
pypy3 --version
You should see output indicating the PyPy version and the CPython version it is compatible with (e.g., PyPy 7.3.11 with GCC 11.2.0, based on Python 3.10.13).
Would you like to know how to install the pip package manager for your new PyPy installation so you can install third-party libraries?
here :)
p1,p2 = 0,0
import itertools
u = set()
with open('input.txt') as f:
for r in f.read().strip().split(","):
s, sl, e, el = (v for i in r.split("-") for v in (int(i), len(i)))
for l in range(1,int(el/2) + 1):
for k in itertools.product("1234567890", repeat=int(l)):
if k[0] == "0":
continue
for f in range(max(sl,2),el + 1):
n = int("".join(k) * (f//l))
if n >= s and n <= e:
if l == f/2:
p1+=n
if n not in u:
p2+=n
u.add(n)
print(p1,p2)
optimized
try now
creates all permutations of numbers
and checks if its in range
hmm smart
asked chatgpt to translate my code to go and it runs very fast
so yes it's crystal skill issue

nvm it translated wrong
let's ask claude
claude got it
optimised rust version is 100ms
go takes 150ms
my solution is insanely dumb brute force 
it checks every single number in range
i wonder why crystal is so much slower than rust though, they both use llvm backend and crystal gc shouldn't matter
wait since when are u here 
since hour aog
i made my solution 70ms faster by adding i64 suffix to every number
turns out otherwise it does a lot of implicit conversion
dumb that it's not smart enough to automatically do this at compile time
what’s ur algorithm
sed -e 's/,/lEx\n/g;s/-/ /g;s/^$/lEx/' test.txt | dc -e '[ddd10%s110/s2Z1-l1r:Cl2d0!=C]sC[Number: ]s"0sK[s>s<0scl"nl<n[ to ]nl>ps>[l<dlCxl<Zd2/sBsL0sI[1+]silBs(lB1+s)[0s{l(s}1sJ[l{l(+;Cs%l{;Cs&0l%l&=ilJ*sJl{1+s{l{l}>:]s:l:xlJlI+sIl(1+s(l(l)>;]s;lB2*lL=;[1sIl<lK+sK]s=lI0!==lclI+scl<1+s<l<1-l>>,]s,l,x[K=]nlKpsK]sE[?xlXx]sXlXx'
``` @lusty atlas
INSANE
@native maple i have an even more optimised digit count function than the log10
uiua2

def digit_count(x)
if x < 10i64
1i64
elsif x < 100i64
2i64
elsif x < 1_000i64
3i64
elsif x < 10_000i64
4i64
elsif x < 100_000i64
5i64
elsif x < 1_000_000i64
6i64
elsif x < 10_000_000i64
7i64
elsif x < 100_000_000i64
8i64
elsif x < 1_000_000_000i64
9i64
elsif x < 10_000_000_000i64
10i64
else
11i64
end
end
ok this reminds me of my solution in 2024 for a day
getting faster
STOP USING SECONDS TO MAKE IT LOOK FAST
USE MILLISECONDS
i prefer nicer to read number
hell yeah lmao
i did the bad one, then log10, then switched to this before committing because it was fastest
what is i
the whole point is to not turn it into a string at all
split("-")
oh well strings in elle are null terminated so its actually much slower to get the length of a string than to turn it into a number and use log10
elle soo bad
no for twice-checking i just multiply with 10*(len/2) + 1
that's why after seeing part 2 i was like "fuck ts in out"
test my solution too baka
i will beat you with a stick
WAIT it was fast all along i just had to enable optimisation @hoary mirage
bro
crystal doesn't optimise by default
48MS
HOW
GUHHH DONT MAKE ME OPTIMIZE MINE MORE
YOU WILL DIE
null terminated strings
💀
:)
rust dev hearing about "null terminated" strings
not even that
Null terminated strings suck, what else is new
it's just a bad idea cuz a lot of string ops require you to know the length
and also you gotta remember to add 1 to your allocations etc
string ops are in the stdlib you dont need to write it by hand
it's unoptimized tho
also dynamic linking ew
why tf is it 2x as fast as rust
is this not best optimisation @native maple
yeah its slow i just havent gotten around to using sized strings beause it would require changing quite a lot of c ffi stuff
silence java dev
guess i cant complain much cuz i still havent gotten a working compiler
anyways hello world in 78 bytes
@hoary mirage beat 42ms
i remember at 89 bytes being like "there is no way i can optimize this further"
@lusty atlas hop off ruby
DONT U DARE CHALLENGE ME
@lusty atlas
p1,p2 = 0,0
u = set()
with open('input.txt') as f:
for r in f.read().strip().split(","):
s, sl, e, el = (v for i in r.split("-") for v in (int(i), len(i)))
for l in range(1,int(el/2) + 1):
for k in range(10**(l-1),10**l):
for f in range(max(sl,2),el + 1):
n = int(str(k) * (f//l))
if n >= s and n <= e:
if l == f/2:
p1+=n
if n not in u:
p2+=n
u.add(n)
print(p1,p2)
try
GUHHH
NOOB
my brute force too naive i can't win
port to crystal / rust
and compare
neverr
the difference between pypy and python3 is funny
why don't they make pypy the official python version
probably compatibility blahblahgblahg
lmao i translated my solution to ruby and it still hasn't finished after 1 minute
slowest language award
run p2
those who believe
import math
p1,p2 = 0,0
u = set()
with open('input.txt') as f:
for r in f.read().strip().split(","):
s, sl, e, el = (v for i in r.split("-") for v in (int(i), len(i)))
for l in range(1,int(el/2) + 1):
for k in range(10**(l-1),10**l):
for f in range(max(sl,2),el + 1):
d = int(math.log10(k)) + 1
n = k * (10**(d * (f//l)) - 1) // (10**d - 1)
if n >= s and n <= e:
if l == f/2:
p1+=n
if n not in u:
p2+=n
u.add(n)
print(p1,p2)
@lusty atlas try
didn't change much only few ms but still

the fact that you managed to squeeze out 2 extra ms

write the same solutuion in rust or c
I would diee
try crystal then it's very easy
CLOCK_MONOTONIC_COARSE is so imprecise 😭😭😭
i'll ask claude to port your code to crystal
yop do
i guess my best bet is CLOCK_MONOTONIC still
legalized robbery
here's the crystal code
p1, p2 = 0_i64, 0_i64
u = Set(Int64).new
File.read("input.txt").strip.split(",").each do |r|
parts = r.split("-")
s, sl, e, el = parts.flat_map { |i| [i.to_i64, i.size] }
(1..(el//2)).each do |l|
(10_i64**(l - 1)...10_i64**l).each do |k|
(Math.max(sl, 2)..el).each do |f|
d = Math.log10(k).to_i + 1
n = k * (10_i64**(d * (f//l)) - 1) // (10_i64**d - 1)
if n >= s && n <= e
if l == f/2
p1 += n
end
if !u.includes?(n)
p2 += n
end
u.add(n)
end
end
end
end
end
puts "#{p1} #{p2}"
surprising that claude got it, crystal is very niche and most ai are terrible at it
n = k * (10**(d * (f//l)) - 1) // (10**d - 1)
``` this line is crazy ngl
I didnt write this part
Example: Say k = 123 (3 digits) and you want to repeat it 4 times to get 123123123123:
d = 3 (digits in k)
f//l = 4 (repetitions needed)
Formula: 123 * (10^(3*4) - 1) / (10^3 - 1)
= 123 * (10^12 - 1) / 999
= 123 * 999999999999 / 999
= 123 * 1001001001
= 123123123123
did you vibecode
this is more readable than your python version
mantı posts readable code for once and you immediately get sus for ai generated code
lmao
he meant crystal code
the one he generated
yeah lmao i asked him because he said he didn't write that part
who tf wrote it then

baby gronk
HELP
okay but look how similar this code looks to python @hoary mirage learn crystal when
wasnt there another guy here that wrote in assembly
@vague knoll hows it going
nixos mentioned lessgo
damn
brooo even discord doesnt have syntax highlihting
dw i mogged the competition anyway
vscode has extension
it's alright just slow
kind of like rust analyser
crystal lsp is twice as slow as rust lsp
vlang trauma
amazing
weird way to say vscope
nah v lsp is much worse lmao
it didnt even work
did V get better lsp yet i should revisit V
running rustup update stable && rustup default stable fixed it
vlang has unironically some nice features that no one gives a damn about because it's more fun to meme on it
rust analyser is weird let me see errors without saving 
no one gives a damn BECAUSE THEY DONT HAVE A WORKING LANGUAGE SERVER
do you need an lsp for assembly?
not really i think
yes
Simple, fast, safe, compiled language for developing maintainable software. Compiles itself in <1s with zero library dependencies. Supports automatic C => V translation. https://vlang...
never met this v person
vlang should make a linter called vlang-tidy
i hate the p2, bruteforced it with regex, not happy of myself, because backtracking in regex is a sin, because not finite automata, but fuck it, it was too annoying, i was starting to do smth that was generating functions and shit
V is funny because the way it compiles is that it translates V code to C code then compiles that code
and lsp server called vlangd
REGEX
lmao
tbh it's literally made to be bruteforced with regex
vinter would be funnier tbh
both p1 and p2 can be solved with the simplest regex ever
ah yes
do they still do that?
UB-maxxing
that's kind of cool though
because c has a lot of compilers
vlang deez nuts
yea it's UB-maxxing
undefined vendicated
why does vlang connect to discord
incrediblee
I will honestly stick to python this year ig
V is rust + go fusion
combines best of rust with best of go
i wonder if V still memory leaks
perfect lang
the nested loops 😭
2022 advent of code
@lusty atlas look into it expressions you'll like it
nvm
wait is v actually usable
insane
whatever it actually exists unlike jai 🙄
yeah it seems very usable so far the lsp is responsive and good
incredbile
bros made vlutter
god is dead
i kinda wanna beg the blowfish man for beta access but im too lazy to blow his ego up further
@terse edge rate p1
@vague knoll did you do d2
0/10, bruteforced
runs fast enough 
Even p2 run fast enough with regex bruteforce
But it's sadge
p1 can be done with smart algorithm to only find valid ids
if i wanted to write regex i would use javascript or c++
when i want to write regex for fun i do vencord dev 
But doing p2 while only finding valid ids and not bruteforcing is so pain i gave up
I'll do it another day
whats the non-bruteforce way
Gimme a sec
My solution there
Basically it rely on the fact the invalid numbers are numbernumber
So if you can find the range of number, you just iter on it
you mean invalid?
Yes
is your p1 not bruteforced
we basically did the same things
this is too confusing for my brain
Similar but not the same
Yours iter on all numbers in the range ans determine if they are valid
Mine determine the range of half numbers in the range then only iter on those which are the half of the invalid numbers
idgi
would the worse bruteforce just be converting it into a string instead of doing math
Mine will scale in O(invalid(n)) since it doesn't matter how big the range is, i never iter on the range directly, but on the number of invalid
yours is O(n) because you iterate on all numbers in the range to filter them
i get that part
i think i will just watch a youtube video later to find out how the non-bruteforce method works
Basically yours is linear with the total of numbers covered by the ranges
Mine is linear with the total number of invalid
I'll do my writeup if you want
nah, ill prob understand it after watching a video
Basically here's the example of how it'd work
||
So basically for 3 and 20
3 give 1 as half-bound directly compute from power of 10 cause odd
20 give 2 and 0 so 2 - 1 because 2 > 0 so 1
So the half-bounds range is {1, 1}
So when i iter on half-bounds, it generate 1 1 so 11
And indeed 11 is the only number between 3 and 20
If we take 12 and 45 by example
12 give 1 and 2 so 1 + 1 because 2 > 1 so 2
45 give 4 and 5 so 4 because 4 < 5
So half-bounds range is {2, 4}
So the numbers are 22, 33, 44
||
not converting the number into a string
Basically 1212 is 101 * 12
@frigid socket my p1
you dont need bigint
you can use long
gu
It would be funni
because so many langs have that as the limit where numbers are sane
They should have at max uint256_t
Dam you might have nerd sniped me
I want to do it the pure math way now
does long have kotlin range stuff
vai
Yes, Kotlin supports ranges for Long values. You can create a LongRange using the .. operator, and also use functions like downTo and step to define progressions. These are handled by LongRange and LongProgression types.
-# Response generated by gemini-2.5-flash. AI may be incorrect or misleading.
Basically the pure math way is like this
Just look at my solution
Uses all that
That makes a bit more sense in my head
Yeah that's one step above the hybrid math string way
The math string way is more of my inner dev soul
And the pure math way is my math soul
And i stopped doing math
i told zooter to join
Bilboofan
vai what is the equlivient of LongRange from kotlin in rust
In Rust, the equivalent of Kotlin's LongRange (which represents an inclusive range of Long values) is typically achieved using the inclusive range syntax start..=end with the i64 integer type.
Here's how they compare:
- Kotlin:
val myRange: LongRange = 1L..100L - Rust:
let my_range = 1i64..=100i64;
In Rust, i64 is the signed 64-bit integer type, similar to Kotlin's Long. The ..= operator creates an inclusive range, meaning both the start and end values are included in the range. These ranges can often be iterated over.
-# Response generated by gemini-2.5-flash. AI may be incorrect or misleading.
vai what is the name of the type in rust
In Rust, the type created by 1i64..=100i64 is std::ops::RangeInclusive<i64>.
-# Response generated by gemini-2.5-flash. AI may be incorrect or misleading.
why not just tias
just what?
try it and see
guhhh
does rust not have assignment expressions
vai does rust have assignment expressions
Rust does not have assignment expressions in the way many other languages do. In Rust, variable assignment using the = operator is a statement, which means it does not return a value.
While Rust is an expression-oriented language where most constructs evaluate to a value, assignment specifically returns the unit type () (an empty tuple), and thus cannot be used for chaining assignments or within contexts expecting a meaningful return value. This design choice helps prevent common bugs where = might be accidentally used instead of == for comparison.
-# Response generated by gemini-2.5-flash. AI may be incorrect or misleading.
evil
guhhhh
you cant flatten ranges in rust
dum
vai what is the equivalent of std::iota from c++ in rust
In Rust, the equivalent of std::iota from C++ can be achieved using range iterators. You can create a sequence of numbers and then collect them into a vector or other collection.
For example, to fill a Vec with numbers from 0 up to (but not including) 10, you can use:
let my_vec: Vec<i32> = (0..10).collect();
// my_vec will be [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
If you want an inclusive range (0 to 10, including 10), you would use:
let my_vec: Vec<i32> = (0..=10).collect();
// my_vec will be [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
These range syntax (a..b for exclusive end, a..=b for inclusive end) create an iterator that yields sequential numbers, which can then be used with methods like collect() to form a collection.
-# Response generated by gemini-2.5-flash. AI may be incorrect or misleading.
Tbh I didn't consider turning it into a string before I wrote that
Doing it that way is faster anyway
Did I get ghost pinged @vestal owl
EVIL
@vestal owl youuuuu
what should i do day 3 with
Cpp
excel?
boring 😭
maybe scrath again hehe
@native maple ||I tried dp before realizing dp is too slow and its just a greedy solve||
ran into some small issues on p2 but my thought process was correct out the gate
integer overflow on a long
how
actuAlly I dont parse the input as numbers
i parse as list long
Also insane API from rust
kotlin does first maximum
i count under 100ms as a win
What's so bad about c
not bad but it will definitely be harder to do aoc in c rather than like python. at least for me. it doesn’t have lists or like literally anything else
and i don’t want to nor do i know how to manage memory in c
For this you don't have to
Just malloc and don't worry about free
You know malloc, calloc, realloc, right
yeah
That's enough
You can use xxd to embed your input as a header file so you don't worry about file system
i mean i don’t think there could be any issues with fs or could there?
it sounds straightforward is it not
i think he means if you just don't know how
It's easier tbh
You just get a char array
You don't have to worry about reading it
Yes
@verbal parrot if you have a compiler that supports c23, you can use #embed
gcc 15 should have it
Clang 19 has it as well
uhh idk i’m just using whatever gcc was in xcode
Isn't xcode like 99999 versions behind
most likely yes
Check with -version
If not, find a way to use an up to date toolchain
( or just use xxd)
i’ll do in five mins i’m kinda stuck in bathroom
Insave
why specially xxd tho? will just cat not work?
Hop do people use their phones in the bathroom
with one hand
xxd -i file.txt https://tryitands.ee
i hate how bathroom in english can refer to both shitting and showering
i meant the first when i said im in bathroom
No
yeah
If you say you're in the bathroom that could mean anything from cleaning yourself up to number one or number two or showering or anything. It just means you're in the room
If you say you're using the bathroom then that means you're doing number one or number two
ohh
That's how I view it at least
here we just say “i’m in toilet” but i think in english toilet is like 🚽
This makes no sense in English
yeah that’s why it’s so confusing to me
ohh thats so cool
gcc is actually clang 
faint so smart
idgi
whats todays problem
i think i know how to solve p2 too
even p1 took like 10 seeconds 😭
i hate how slow scratch is
your answer is too high
hell nah
oh nvm I copy pasted işnput 2 times
🥀
p2 is little tricky hm
too late lmao
Today's turned out pretty nice, 145 bytes ||```py
n=[0,0]
for L in open(0):
for M in 2,12:i=-1;n[M>6]+=int(''.join(L[i:=max(range(i+1,len(L)-M+k),key=lambda i:L[i])]for k in range(M)))
print(n)
I had an idea: orthodox kotlin
basically kotlin with only java class library
(I will probably try this, also maybe trying to build kotlin with a makefile)
WHYS IT CORRECT ON EXAMPLE
true
broooo kys
@vestal owl tell me the solution
i saw something about dp from eagely
spoiler
YOU CANT EVEN UNDERSTAND THE CODE ANYWAY
MY VARIALBE NAMES ARE HORRIBLE
whatever change in tactics
this code only works on example
so useless
nvm
@hoary mirage mantikabubu
@frigid socket how u ain’t done d1p2 yet
i see the problem
do you know swift
read the spoiler text i sent in the other discord
not really why
@hoary mirage
my solution is in swift
tay
show
you did NOT have to use regex for that 😭
sure but in this case it’s literally either the first char is L and everything else is the number or the first char is R and everything else is the number
i am learning GoLang while doing d3 @vague knoll
@frigid socket are u picking languages randomly or are these the ones u chose by yourself
every day i decide a language
rust when??
rust when ?? hello guys ??? anyone using rust ??? nobody ???
what languages are u planning to do
yall heard of this niche language ‘rust’??
best language evet btw
(right after brainfuck)
how is this ERROR
anyways i wanna use lolcode next
i decide like the day before or same day
swift moment
go 😭
it maeks sure you dont put unneccesary variables and bloat ur code
go sooooo good
unless swift also uses the pen island operator
didnt you say swift
duh
his day 1 solution was swift
this has to be one of the worst language design decisions ever
generally by the time you're running the code you've actually used the variable so i don't find it too annoying
rgbcube alt
does go just not do any warnings in the compiler? and leaves that up to linting tools?
the problem with warnings being emitted as a side effect of compilation is you need to edit the code again to see them 
but maybe there shouldn't be any unused errors? just leave that up to go vet or whatever?
is it false tho
TRUE
“error: you didn’t use return value from a function call” cuz i don’t need it????
why does it need to be an error
that does make sense for heap objects tho at least
honestly it is kind of good to explicitly ignore return values
unused variables is just fucking stupid
I've got annoyed with [[maybe_unused]] spam in C++
**I mean [[nodiscard]] spam
so nodiscard should probably be the default
¯_(ツ)_/¯
though realistically you don't need to spam it on getters like I've seen people doing
(just prefix your getters with get, oh I forget C++ devs are insane)
idk both unused variable and unused return sounds dumb to me
[].map()
vai golang map
In Go, a map is a built-in data structure that stores elements as unordered key-value pairs, similar to hash tables or dictionaries in other languages. Each key within a map is unique and maps to a specific value.
Declaration and Initialization
You can declare a map using the map[KeyType]ValueType syntax.
-
Declaration only:
var myMap map[string]intA newly declared map without initialization will be
niland cannot have elements added to it until it's initialized. -
Initialization with
make(): Themakefunction allocates and initializes a map, making it ready for use.myMap = make(map[string]int) // Or declare and initialize in one line anotherMap := make(map[string]string) -
Initialization with a literal:
scores := map[string]int{"Alice": 90, "Bob": 85}
Working with Maps
-
Adding or Updating elements: Use the
map[key] = valuesyntax.myMap["key1"] = 10 scores["Alice"] = 95 // Updates Alice's score
-# Response generated by gemini-2.5-flash. AI may be incorrect or misleading.
not this dumb fuck
there are libraries you can use for that
iirc method chaning doesn't work very well in go due to automatic semicolon insertion
hello
.method()
will become
hello;
.method()

yeah i found https://pkg.go.dev/github.com/samber/lo@v1.52.0
though ig you can do
hello.
method
and that's fine
lodash style 😭
@frigid socket https://pkg.go.dev/github.com/peterje/labubu
thankks to asi you can do this
Yes
ran for my bus, missed it, went to a shop, collapsed due to running too fast for too long
now i'm on the next bus i can do aoc
you're missing the riveting jolt calculation
golang is cool
cc @lusty atlas
vban
whyy
golang? to lang is not a verb smh
@hoary mirage That's the right answer! You are one gold star closer to decorating the North Pole. [Continue to Part Two]
BOOOOOOOOOO
NixOs tag you can't be talking
ARE YOU OKAY ROSIE
DID YOUR BLOOD SUGAR DROP
weird way to say PeakOS
most fit programmer btw
fittest
english is hard
how tf do u do aoc in a bus
laptop?
i can’t even use my phone in a bus how do u use a laptop
girl?????????
just collapsed and still thinking about aoc
😭
skill issue
no it’s not there isn’t a single empty space in buses most of the time
SIX SEVENNNNNNNN
FranzJ
nino are you tapped in??
did you do p2 @verbal parrot
today?
yeah
yeah
true
what happened rosie
WHO PINGED ME
wtf thats so expensive
how
fres
altho its rural village
eagely is twelve
lmao
@terse edge i did this for p1
||```rs
fn solve(string[] lines) {
total := 0;
for line in lines {
if line.is_empty() or line.len() < 2 {
continue;
}
max_prefix := line[0];
best := 0;
for j := 1; j < line.len(); j += 1 {
cand := (max_prefix - '0') * 10 + (line[j] - '0');
if cand > best { best = cand; }
if line[j] > max_prefix {
max_prefix = line[j];
}
}
total += best;
}
return total;
}
but i wrote a generic fn after that ||handles both 2 and 12||
user states their age in this message
when i was in moscow i had to pay like $8 for a 10-15min ride
ok thats moscow
not muhosransk
@terse edge did you do something similar
https://github.com/acquitelol/aoc2025/blob/mistress/solutions/03/solution.le
working with numbers aain
this is optimized solution
original sol had for loop instead of recursion
and its generic for both parts
thats so short wtf
@native maple im not gay but i will be gaY for 3blue1bRown
Im gonna buy his merch
will I gain aura if i wear this in a university
no
only if you wear the 6 7 shirt
stop sending it without spoilers 😡😡😡😡😡😡😡😡😡😡
SPOILER
did you do p2 @hoary mirage
Brooo not like yall can understand my code
Yes
girl this code is readable
@hoary mirage more readable than my solution from yesterday
WHAT IS THAT
Ig true this was readable
You still need to look at it for some time
have you not seen my assembly solution
for the life of me i cannot figure out p2
@hoary mirage you should take a look
it works for p1
my solution in the typescript type system
Very easy once you figure out
||
package main
import (
"fmt"
"os"
"strconv"
"strings"
"github.com/samber/lo"
)
func check(e error) {
if e != nil {
panic(e)
}
}
func getTotalJoltage(pack []int, digits int) int {
lockedIndex := 0
working := ""
for i := 0; i < digits; i++ {
highestValue := 0
upperLimit := 0
if i == digits - 1 {
upperLimit = 0
} else {
upperLimit = 1
}
lowerLimit := 0
if i == 0 {
lowerLimit = 0
} else {
lowerLimit = 1
}
println("We are at", i + 1, "looking from", lockedIndex + lowerLimit, "to", len(pack) - upperLimit)
for ii, battery := range pack[lockedIndex + lowerLimit:len(pack) - upperLimit] {
if battery > highestValue {
highestValue = battery
lockedIndex = ii
}
}
working += fmt.Sprint(highestValue)
}
finalValue, err := strconv.Atoi(working)
check(err)
return finalValue
}
func solve(path string) (int, int) {
data, error := os.ReadFile(path)
check(error)
input := string(data)
batteryPacks := lo.Map(strings.Split(input, "\n"), func(item string, _ int) []int {
return []int(lo.Map(strings.Split(item, ""), func(vlt string, _ int) int {
value, error := strconv.Atoi(vlt)
check(error)
return value
}))
})
joltages1 := []int{}
joltages2 := []int{}
for _, pack := range batteryPacks {
joltages1 = append(joltages1, getTotalJoltage(pack, 2))
joltages2 = append(joltages2, getTotalJoltage(pack, 12))
}
part1Sum := 0
for _, jolt := range joltages1 {
part1Sum += jolt
}
part2Sum := 0
for _, jolt := range joltages2 {
part2Sum += jolt
}
return part1Sum, part2Sum
}
func main() {
exampleSolve1, exampleSolve2 := solve("example.txt")
realSolve1, realSolve2 := solve("input.txt")
fmt.Printf("EX1: %d, EX2: %d, R1: %d, R2: %d\n", exampleSolve1, exampleSolve2, realSolve1, realSolve2)
}
||
DONT USE 12 FOR LOOPS



