Compare commits

..

37 Commits

Author SHA1 Message Date
Bram e92c773b17 Add day 2 solutions 2025-12-04 18:05:23 +01:00
Bram bd8a50df82 Add day 1 solutions 2025-12-03 22:06:20 +01:00
Bram 65efdbd0bd Add benchmarks for Bob, Bram, Brechtje & Vicky on day 2 2025-12-03 19:58:29 +01:00
Bram af6536cd94 Merge Brechtje's branch into benchmark branch 2025-12-03 18:21:03 +01:00
Bram 9eff6e92d4 Merge Vicky's branch into benchmark branch 2025-12-03 18:20:16 +01:00
Bram 08f116ec57 Merge Bob's branch into benchmark branch 2025-12-03 18:19:26 +01:00
Bram 85972ec4bf Merge Bram's branch into benchmark branch 2025-12-03 18:18:35 +01:00
Vicky cb21b0e323 Upload dec2 code. 2025-12-03 07:04:05 +00:00
Vicky b42c2a8852 Add executable file. 2025-12-03 06:51:45 +00:00
Vicky 0f45ec9393 Upload dec1 code
Part 1 only!
2025-12-03 06:46:38 +00:00
Bram d01764721a Optimize & simplify day 1 2025-12-02 16:31:07 +01:00
Bob 8a21b6b78a day02 2025-12-02 13:17:40 +01:00
Bram 5c55c53f41 Visualize day 1 benchmarks 2025-12-02 11:21:37 +01:00
Bram a278f98f4b Add day 2 (rough version) 2025-12-02 09:20:53 +01:00
Bram 500c885da6 Add Sander's day 1 benchmarks 2025-12-02 00:37:58 +01:00
Bram 9139bf11fc Merge Sander's branch into benchmark branch 2025-12-02 00:20:52 +01:00
Bram 203ed61e24 Add Haskell & Ruby to .gitignore 2025-12-02 00:01:27 +01:00
Bram fa3893e372 Add Brechtje's day 1 benchmarks 2025-12-01 23:56:07 +01:00
Bram 6a253d294c Merge Brechtje's branch into benchmark branch 2025-12-01 23:43:42 +01:00
Bram a5f45c2230 Add Bob's day 1 benchmarks 2025-12-01 23:31:31 +01:00
Bram 992268ab47 Merge Bob's branch into benchmark branch 2025-12-01 23:23:38 +01:00
Sander 35243b8b50 Update sander/AoC 2025 2025-12-01 22:19:39 +00:00
Sander a2fe8b86ee Update sander/AoC 2025 2025-12-01 21:51:57 +00:00
Bram e35bb1b68e Add Bram's day 1 benchmarks 2025-12-01 17:30:38 +01:00
Bram 32bacbeb1d Add args to Rust program to run individual days 2025-12-01 17:13:18 +01:00
Bob 9aa6a02fdf day01 2025-12-01 16:40:04 +01:00
Bram 64ba806ee0 Prepare day 2 2025-12-01 11:43:13 +01:00
Bram ca7f0d2d28 Refactor day 1 & remove compiler warnings 2025-12-01 09:55:51 +01:00
Bram 5ea66062ee Add day 1 (rough version) 2025-12-01 09:27:00 +01:00
Bob 43246bbe76 Simple README 2025-11-27 18:07:00 +01:00
Bram 590cfd770b Add basic Rust setup 2025-11-26 14:36:53 +01:00
Vicky dd73313655 Add vicky/README.md 2025-11-26 08:49:40 +00:00
Sander 01a11ad970 initial setup 2025-11-25 18:46:53 +00:00
Sander 0c3541d98a Update sander/AoC 2025 2025-11-25 18:23:13 +00:00
Sander 68d43244fd Update sander/day1 2025-11-25 17:32:48 +00:00
Sander 35df161c0c Update day1 2025-11-25 17:32:38 +00:00
Sander d5b48edffb sander 2025-11-25 16:02:23 +00:00
81 changed files with 22503 additions and 192 deletions

84
.gitignore vendored
View File

@ -58,6 +58,31 @@ elm-stuff
# elm-repl generated files # elm-repl generated files
repl-temp-* repl-temp-*
# ---> Haskell
dist
dist-*
cabal-dev
*.o
*.hi
*.hie
*.chi
*.chs.h
*.dyn_o
*.dyn_hi
.hpc
.hsenv
.cabal-sandbox/
cabal.sandbox.config
*.prof
*.aux
*.hp
*.eventlog
.stack-work/
cabal.project.local
cabal.project.local~
.HTF/
.ghc.environment.*
# ---> MATLAB # ---> MATLAB
# Windows default autosave extension # Windows default autosave extension
*.asv *.asv
@ -253,6 +278,64 @@ cython_debug/
# option (not recommended) you can uncomment the following to ignore the entire idea folder. # option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/ #.idea/
# ---> Ruby
*.gem
*.rbc
/.config
/coverage/
/InstalledFiles
/pkg/
/spec/reports/
/spec/examples.txt
/test/tmp/
/test/version_tmp/
/tmp/
# Used by dotenv library to load environment variables.
# .env
# Ignore Byebug command history file.
.byebug_history
## Specific to RubyMotion:
.dat*
.repl_history
build/
*.bridgesupport
build-iPhoneOS/
build-iPhoneSimulator/
## Specific to RubyMotion (use of CocoaPods):
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
# vendor/Pods/
## Documentation cache and generated files:
/.yardoc/
/_yardoc/
/doc/
/rdoc/
## Environment normalization:
/.bundle/
/vendor/bundle
/lib/bundler/man/
# for a library or gem, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# Gemfile.lock
# .ruby-version
# .ruby-gemset
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
.rvmrc
# Used by RuboCop. Remote config files pulled in from inherit_from directive.
# .rubocop-https?--*
# ---> Rust # ---> Rust
# Generated by Cargo # Generated by Cargo
# will have compiled files and executables # will have compiled files and executables
@ -270,6 +353,7 @@ Cargo.lock
*.pdb *.pdb
# ---> Custom files # ---> Custom files
bram/benchmarks/sander_hs/bin
brechtje/**/*.txt brechtje/**/*.txt
# If your structure requires you to ignore certain files or folders, # If your structure requires you to ignore certain files or folders,

3
bob/README.md Normal file
View File

@ -0,0 +1,3 @@
# AOC 2025
This folder hosts the code written by Bob

36
bob/day01/day01-p1.py Normal file
View File

@ -0,0 +1,36 @@
def dial(action, position):
if action[0] == "R":
position += action[1]
else:
position -= action[1]
position = position % 100
return position
def read_input(filename):
actions = []
for line in open(filename):
line = line.strip()
direction = line[:1]
steps = int(line[1:])
actions.append((direction,steps))
return actions
# filename = "day01/my_example_input"
# filename = "day01/example_input" # Output is 3
filename = "day01/input" # Output is 992
actions = read_input(filename)
position = 50
password = 0
for action in actions:
position = dial(action, position)
if position == 0:
password += 1
print(f"Password is {password}")

44
bob/day01/day01-p2.py Normal file
View File

@ -0,0 +1,44 @@
def dial(action, start_position):
if action[0] == "R":
position = start_position + action[1]
else:
position = start_position - action[1]
# Count rotations over "0" (multiples of 100)
zeros = int(abs(position) / 100)
# Negative position, or exactly "0", caused one extra "0" hit
# Except when starting at 0!
if position <= 0 and start_position != 0:
zeros += 1
position = position % 100
return position, zeros
def read_input(filename):
actions = []
for line in open(filename):
line = line.strip()
direction = line[:1]
steps = int(line[1:])
actions.append((direction,steps))
return actions
# filename = "day01/my_example_input"
# filename = "day01/example_input" # Output is 6
filename = "day01/input" # Output is 6133
actions = read_input(filename)
position = 50
password = 0
for action in actions:
position, zeros = dial(action, position)
password += zeros
print(f"Password is {password}")

10
bob/day01/example_input Normal file
View File

@ -0,0 +1,10 @@
L68
L30
R48
L5
R60
L55
L1
L99
R14
L82

4232
bob/day01/input Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,2 @@
L50
L5

41
bob/day02/day02-p1.py Normal file
View File

@ -0,0 +1,41 @@
def check_id(start, end):
false_ids = []
for id in range(int(start), int(end)+1):
id_str = str(id)
id_str_len = len(id_str)
if id_str_len % 2 == 0:
h1 = id_str[:id_str_len//2]
h2 = id_str[id_str_len//2:]
if h1 == h2:
false_ids.append(id)
return false_ids
def read_input(filename):
id_ranges = []
for line in open(filename).read().splitlines():
for id_range in line.split(","):
start = id_range.split("-")[0]
end = id_range.split("-")[1]
id_ranges.append((start,end))
return id_ranges
# filename = "day02/example_input" # 1227775554
filename = "day02/input" # 23560874270
id_ranges = read_input(filename)
adding = 0
for id_range in id_ranges:
for false_id in check_id(id_range[0], id_range[1]):
adding += false_id
print(f"Added total of false IDs: {adding}")

61
bob/day02/day02-p2.py Normal file
View File

@ -0,0 +1,61 @@
def check_id(start_id, end_id):
false_ids = []
for id in range(int(start_id), int(end_id)+1):
id_str = str(id)
id_str_len = len(id_str)
for substr_len in range(1,(id_str_len//2)+1):
if id_str_len % substr_len > 0:
# Substring being checked must fit a whole number of times
continue
dup = False
# Substring position is determined by the amount of times the substring fits in the string
# That makes up the range to be checked (as multipliet with the substring length)
for substr_pos in range(1, id_str_len // substr_len):
h1 = id_str[:substr_len]
# Get the substring at right position, and only with size of substring
h2 = id_str[substr_len*substr_pos:][:substr_len]
if h1 != h2:
dup = False
break
else:
dup = True
if dup:
false_ids.append(id)
break
return false_ids
def read_input(filename):
id_ranges = []
for line in open(filename).read().splitlines():
for id_range in line.split(","):
start = id_range.split("-")[0]
end = id_range.split("-")[1]
id_ranges.append((start,end))
return id_ranges
# filename = "day02/my_example_input" #
# filename = "day02/example_input" # 4174379265
filename = "day02/input" # 44143124633
id_ranges = read_input(filename)
adding = 0
for id_range in id_ranges:
for false_id in check_id(id_range[0], id_range[1]):
adding += false_id
print(f"Added total of false IDs: {adding}")

1
bob/day02/example_input Normal file
View File

@ -0,0 +1 @@
11-22,95-115,998-1012,1188511880-1188511890,222220-222224,1698522-1698528,446443-446449,38593856-38593862,565653-565659,824824821-824824827,2121212118-2121212124

1
bob/day02/input Normal file
View File

@ -0,0 +1 @@
990244-1009337,5518069-5608946,34273134-34397466,3636295061-3636388848,8613701-8663602,573252-688417,472288-533253,960590-988421,7373678538-7373794411,178-266,63577667-63679502,70-132,487-1146,666631751-666711926,5896-10827,30288-52204,21847924-21889141,69684057-69706531,97142181-97271487,538561-555085,286637-467444,93452333-93519874,69247-119122,8955190262-8955353747,883317-948391,8282803943-8282844514,214125-236989,2518-4693,586540593-586645823,137643-211684,33-47,16210-28409,748488-837584,1381-2281,1-19

View File

@ -0,0 +1 @@
12345678-12345679

File diff suppressed because one or more lines are too long

45
bram/benchmarks/README.md Normal file
View File

@ -0,0 +1,45 @@
# Benchmarking setup
In this folder, I run some benchmarks on everyone's code.
## How to benchmark
1. Make sure you have the appropriate software installed. You can do so by
activating the Nix shell as defined in `shell.nix`, or you can view everyone's
installation requirements in the
[software requirements](#Software-requirements) section.
2. Run benchmarks by executing the respective scripts. For example, if you
wish to benchmark Bram's code, you may run `bram.sh` in your terminal. All data
will be collected in the `data/` folder.
3. Once you have collected all the data you wanted to collect, you can open the
Jupyter Notebook by typing `jupyter notebook Benchmarks.ipynb` in the terminal.
4. In the Jupyter Notebook, evaluate all cells and gain the graphs you want.
Graphs are also stored in the `img/` folder.
## Software requirements
To create the measurements, this benchmarking setup uses
[hyperfine](https://github.com/sharkdp/hyperfine). To build the visualization,
this setup uses [Jupyter Notebooks](https://jupyter.org/) - but you can install
the dependencies listed in `requirements.txt` to get all necessary packages
installed.
Bob uses [Python](https://www.python.org/).
Bram uses [Rust](https://rust-lang.org/) at version 1.86.0.
Brechtje uses [Python](https://www.python.org/).
Sander uses [GHCup](https://www.haskell.org/ghcup/) at version 9.6.7. Haskell
typically opens as a REPL from which functions can be evaluated, so some
liberties are taken here. The script is reformatted in the `sander_hs/` folder
and compiled to a binary in order to approximate performance.
Vicky uses [Jupyter Notebook](https://jupyter.org/). A Notebook is difficult
to benchmark and the `*.py` exported files cannot compute properly due to
wrong ordering of function definitions and scripts. The exported script is
reformatted in the `vicky_py/` folder and run as an ordinary Python script
in order to approximate performance.

15
bram/benchmarks/bob.sh Normal file
View File

@ -0,0 +1,15 @@
cd ../../bob
# Benchmark day 1
hyperfine --warmup 5 --export-json ../bram/benchmarks/data/bob-d01-p1.json \
--runs 100 "python day01/day01-p1.py"
hyperfine --warmup 5 --export-json ../bram/benchmarks/data/bob-d01-p2.json \
--runs 100 "python day01/day01-p2.py"
# Benchmark day 2
hyperfine --warmup 5 --export-json ../bram/benchmarks/data/bob-d02-p1.json \
--runs 100 "python day02/day02-p1.py"
hyperfine --warmup 5 --export-json ../bram/benchmarks/data/bob-d02-p2.json \
--runs 100 "python day02/day02-p2.py"
cd ../bram/benchmarks

15
bram/benchmarks/bram.sh Normal file
View File

@ -0,0 +1,15 @@
# Move to the appropriate folder
cd ../rust
# Build binary
cargo build --release
# Benchmark day 1
hyperfine --warmup 5 --export-json ../benchmarks/data/bram-d01-100.json \
--runs 100 "for run in {1..100}; do target/release/aoc2025 1; done"
# Benchmark day 2
hyperfine --warmup 5 --export-json ../benchmarks/data/bram-d02.json \
--runs 100 "target/release/aoc2025 2"
cd ../benchmarks

View File

@ -0,0 +1,23 @@
cd ../../brechtje
# Benchmark day 1
cd 1/
hyperfine --warmup 5 \
--export-json ../../bram/benchmarks/data/brechtje-d01-p1.json \
--runs 100 "python 1-1.py"
hyperfine --warmup 5 \
--export-json ../../bram/benchmarks/data/brechtje-d01-p2.json \
--runs 100 "python 1-2.py"
cd ../
# Benchmark day 2
cd 2/
hyperfine --warmup 5 \
--export-json ../../bram/benchmarks/data/brechtje-d02-p1.json \
--runs 100 "python 2-1.py"
# hyperfine --warmup 5 \
# --export-json ../../bram/benchmarks/data/brechtje-d02-p2.json \
# --runs 100 "python 2-2.py"
cd ../
cd ../bram/benchmarks

View File

@ -0,0 +1,29 @@
import json
DIRECTORY = []
with open("data/all.json", "r") as fp:
DIRECTORY = json.load(fp)
def generate_datafile(obj):
path = "data/" + obj["name"]
with open(path, 'r') as fp:
benchmark = json.load(fp)
for time in benchmark["results"][0]["times"]:
yield {
"author": obj["author"],
"lang": obj["lang"],
"time": time / obj["runs"],
}
def generate_day(day : int):
for part in [ 1, 2 ]:
for measurement in generate_puzzle(f"{day}-{part}"):
measurement["part"] = part
yield measurement
def generate_puzzle(puzzle : str):
for obj in DIRECTORY:
if puzzle in obj["puzzles"]:
yield from generate_datafile(obj)

View File

@ -0,0 +1,121 @@
[
{
"name": "bob-d01-p1.json",
"author": "Bob",
"lang": "Python",
"puzzles": [
"1-1"
],
"runs": 1
},
{
"name": "bob-d01-p2.json",
"author": "Bob",
"lang": "Python",
"puzzles": [
"1-2"
],
"runs": 1
},
{
"name": "bob-d02-p1.json",
"author": "Bob",
"lang": "Python",
"puzzles": [
"2-1"
],
"runs": 1
},
{
"name": "bob-d02-p2.json",
"author": "Bob",
"lang": "Python",
"puzzles": [
"2-2"
],
"runs": 1
},
{
"name": "bram-d01-100.json",
"author": "Bram",
"lang": "Rust",
"puzzles": [
"1-1",
"1-2"
],
"runs": 100
},
{
"name": "bram-d02.json",
"author": "Bram",
"lang": "Rust",
"puzzles": [
"2-1",
"2-2"
],
"runs": 1
},
{
"name": "brechtje-d01-p1.json",
"author": "Brechtje",
"lang": "Python",
"puzzles": [
"1-1"
],
"runs": 1
},
{
"name": "brechtje-d01-p2.json",
"author": "Brechtje",
"lang": "Python",
"puzzles": [
"1-2"
],
"runs": 1
},
{
"name": "brechtje-d02-p1.json",
"author": "Brechtje",
"lang": "Python",
"puzzles": [
"2-1"
],
"runs": 1
},
{
"name": "sander-d01-p1.json",
"author": "Sander",
"lang": "Haskell",
"puzzles": [
"1-1"
],
"runs": 1
},
{
"name": "vicky-d01-p1.json",
"author": "Vicky",
"lang": "Python",
"puzzles": [
"1-1"
],
"runs": 1
},
{
"name": "vicky-d02-p1.json",
"author": "Vicky",
"lang": "Python",
"puzzles": [
"2-1"
],
"runs": 1
},
{
"name": "vicky-d02-p2.json",
"author": "Vicky",
"lang": "Python",
"puzzles": [
"2-2"
],
"runs": 1
}
]

View File

@ -0,0 +1,218 @@
{
"results": [
{
"command": "python day01/day01-p1.py",
"mean": 0.018280616970000003,
"stddev": 0.0006054695984127279,
"median": 0.018186844940000002,
"user": 0.01483600999999999,
"system": 0.0033221896000000008,
"min": 0.017335730940000002,
"max": 0.020703820940000003,
"times": [
0.01807126494,
0.01766033694,
0.01770073494,
0.02004624194,
0.018178473940000002,
0.018417852940000003,
0.01812796494,
0.017955673940000003,
0.018379266940000003,
0.01809406594,
0.018453467940000003,
0.01802611594,
0.018267693940000003,
0.01793643794,
0.01828018094,
0.018444996940000003,
0.018143806940000003,
0.019526113940000003,
0.01844583894,
0.019931652940000003,
0.018626267940000003,
0.018122100940000004,
0.018915561940000002,
0.018065865940000002,
0.018375352940000002,
0.019079646940000004,
0.020026991940000002,
0.01761536094,
0.020703820940000003,
0.01825914994,
0.01748083594,
0.01893691494,
0.01743567994,
0.018392330940000003,
0.018382992940000002,
0.018990103940000003,
0.018086712940000003,
0.01733794194,
0.018799991940000003,
0.01816632794,
0.01769464394,
0.01754049594,
0.018241162940000003,
0.017692110940000002,
0.018402830940000003,
0.01799481994,
0.018223985940000003,
0.01759861894,
0.018958858940000003,
0.01837748394,
0.01904514494,
0.01809492294,
0.018427259940000003,
0.01818821094,
0.01813986894,
0.017615985940000002,
0.01796003594,
0.017505334940000002,
0.017965291940000003,
0.017791317940000002,
0.01812525794,
0.01798888094,
0.017678036940000003,
0.01851067694,
0.01800311694,
0.01808681394,
0.018373394940000003,
0.017636636940000002,
0.01763808194,
0.018445332940000003,
0.018159857940000003,
0.017980174940000003,
0.018537869940000003,
0.01955623394,
0.01860408494,
0.018257304940000003,
0.01800734094,
0.018969050940000003,
0.01744151794,
0.01839679694,
0.01871990494,
0.01770890894,
0.01807889994,
0.018185478940000003,
0.01817902994,
0.01770351694,
0.017856927940000003,
0.018366142940000003,
0.017762881940000003,
0.01861377394,
0.018307835940000003,
0.01844301694,
0.017335730940000002,
0.01826272194,
0.018238106940000002,
0.01845287894,
0.01923389294,
0.019019420940000004,
0.01755005494,
0.01829958194
],
"exit_codes": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
}
]
}

View File

@ -0,0 +1,218 @@
{
"results": [
{
"command": "python day01/day01-p2.py",
"mean": 0.020615625919999995,
"stddev": 0.0008088849992798855,
"median": 0.02046746494,
"user": 0.017299320000000003,
"system": 0.0031129196,
"min": 0.019567234939999997,
"max": 0.02628018894,
"times": [
0.02120531594,
0.020777152939999998,
0.02165869094,
0.020604701939999998,
0.02084050594,
0.02121598294,
0.02162024094,
0.021570440939999998,
0.02122411594,
0.02059801294,
0.02178862094,
0.02069527294,
0.02011315294,
0.02125525994,
0.02096512494,
0.02085369194,
0.020566496939999998,
0.020334108939999998,
0.020670181939999997,
0.02072439694,
0.02028807694,
0.02055907894,
0.02050522594,
0.02092301294,
0.02069373694,
0.02047648894,
0.019976937939999998,
0.019910852939999998,
0.020397030939999998,
0.020378081939999997,
0.02104977694,
0.02029634894,
0.02018755294,
0.02131716194,
0.019567234939999997,
0.02075919594,
0.01991730294,
0.02038686994,
0.02033121294,
0.01992772394,
0.020304039939999997,
0.01986143994,
0.020572858939999997,
0.020734446939999998,
0.019846204939999997,
0.02002030594,
0.019718745939999997,
0.02024268194,
0.02153054794,
0.02041505394,
0.02017235094,
0.02079594794,
0.01996096494,
0.020180008939999997,
0.02079084694,
0.021043737939999998,
0.019837977939999998,
0.02061569094,
0.02031442194,
0.02030791894,
0.019852781939999998,
0.020351002939999998,
0.020259908939999998,
0.02053684794,
0.02018773594,
0.01992955094,
0.02045844094,
0.01992390594,
0.020803037939999998,
0.02061347694,
0.02014947494,
0.020152006939999998,
0.02034143394,
0.01983471794,
0.020450447939999998,
0.022272646939999998,
0.02044323294,
0.020688650939999997,
0.020061243939999997,
0.020233437939999998,
0.020981132939999998,
0.019957915939999998,
0.02051775194,
0.01970484894,
0.02035442294,
0.019966405939999998,
0.02193963894,
0.02078478494,
0.02628018894,
0.02180391294,
0.020251498939999998,
0.02187088094,
0.020118542939999998,
0.021709151939999997,
0.02086194094,
0.01997328994,
0.020484386939999998,
0.021529263939999998,
0.019873743939999997,
0.02065833294
],
"exit_codes": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
}
]
}

View File

@ -0,0 +1,218 @@
{
"results": [
{
"command": "python day02/day02-p1.py",
"mean": 0.6765645741299999,
"stddev": 0.013047081521433405,
"median": 0.6763296411999999,
"user": 0.6704550699999997,
"system": 0.0033457500000000006,
"min": 0.6559922267,
"max": 0.7329195817,
"times": [
0.6721216407,
0.6837450707,
0.6612521137,
0.7061815837000001,
0.6782755407,
0.6756507177,
0.6763355687,
0.6747942667,
0.6742392807,
0.6697994717,
0.6772529837,
0.6791377247,
0.6907288917,
0.6806539377,
0.6746299437,
0.6630597017,
0.6833341667,
0.6586809947,
0.6780386567,
0.6665040597,
0.6790600897,
0.6725939877,
0.6836183607,
0.6667784267,
0.6881150217,
0.6633574487,
0.6789564937,
0.6613500027,
0.6788042957,
0.6559922267,
0.6847969757,
0.6627792757,
0.6782401647,
0.6743326107000001,
0.6649894047,
0.6789302837,
0.6733824407,
0.6910859527,
0.6631805447,
0.6774636637,
0.6636205517,
0.6766484967,
0.6645901637,
0.6870083157,
0.6716324417,
0.6737801617,
0.6596793037,
0.6751984447,
0.6685770937,
0.7028166087,
0.6623790377,
0.7329195817,
0.6604573647,
0.6654454177,
0.6786648997,
0.6839100787,
0.6742385397,
0.6809124307,
0.6721741527,
0.6876361547000001,
0.6739140267,
0.6897047877,
0.6610092357,
0.6812850487,
0.6618630357,
0.6984109777,
0.6843995077,
0.6831293417000001,
0.6755151757,
0.6954556917,
0.6838049437,
0.6854161367,
0.6644793797,
0.6815224767,
0.6598976727,
0.6771346357,
0.6650421847,
0.6763237137,
0.6841810567,
0.6584676787,
0.6775632687,
0.6646109447,
0.6766417327,
0.6934756047,
0.6619941597,
0.7224684777,
0.6683667787,
0.6757852777,
0.6846177207,
0.6634212887000001,
0.6667221867,
0.6629606137,
0.6946760817000001,
0.6825597837,
0.6883855197000001,
0.6802924857,
0.6920363677,
0.6617500997,
0.6885187957,
0.6641402897
],
"exit_codes": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
}
]
}

View File

@ -0,0 +1,218 @@
{
"results": [
{
"command": "python day02/day02-p2.py",
"mean": 3.1411235393800023,
"stddev": 0.09010917592789626,
"median": 3.1516303696400003,
"user": 3.12365489,
"system": 0.0037003824,
"min": 2.9177929816400003,
"max": 3.3309852776400004,
"times": [
2.9652076266400003,
2.94590746764,
2.98981463564,
2.9729601746400003,
3.00578729364,
2.99013505564,
2.95797140864,
2.9177929816400003,
3.01275715464,
2.96446652464,
2.9992746066400002,
3.0681215826400003,
2.9994085316400003,
3.05605645264,
3.0923019056400003,
2.9927535396400002,
3.16385909764,
3.05204224764,
3.0858553146400003,
3.13455088764,
3.00870479064,
3.15192396764,
3.13008368764,
3.02525549964,
3.1751920726400003,
3.05271520864,
3.1651680526400003,
3.08022751464,
3.06994534964,
3.1041971736400003,
3.09049831064,
3.11271712564,
3.14065801364,
3.17754279864,
3.1740638966400003,
3.11830439464,
3.1824652826400004,
3.20768418464,
3.18065167664,
3.14985830764,
3.19244600764,
3.12618327164,
3.15278101564,
3.13079327164,
3.21233919964,
3.22450479464,
3.22261788564,
3.1617373696400004,
3.15098288864,
3.2985043156400002,
3.16874892464,
3.2594790126400004,
3.2451113896400003,
3.1363089956400003,
3.22750851964,
3.1238160186400004,
3.21266349964,
3.19715920764,
3.1400409646400003,
3.22091029564,
3.0808952896400004,
3.17721545864,
3.16580803764,
3.17711754864,
3.22028719564,
3.07481461464,
3.19479676664,
3.06944805064,
3.20435482264,
3.25197998764,
3.1704874646400003,
3.0864505126400004,
3.16557759864,
3.0916870816400004,
3.1974675986400003,
3.10256814464,
3.1972331736400004,
3.10812775564,
3.2413019226400004,
3.1177898556400003,
3.2214804696400003,
3.2363775076400003,
3.18994465864,
3.3309852776400004,
3.10970241464,
3.21878945164,
3.27304197564,
3.12559536564,
3.20429148464,
3.2695753186400003,
3.1288451576400003,
3.1550812336400003,
3.2790448636400003,
3.25666697264,
3.2653465116400002,
3.2582973886400004,
3.15133677164,
3.30450361964,
3.2227860506400003,
3.14573391564
],
"exit_codes": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
}
]
}

View File

@ -0,0 +1,218 @@
{
"results": [
{
"command": "for run in {1..100}; do target/release/aoc2025 1; done",
"mean": 0.21164170808000005,
"stddev": 0.056955047683642006,
"median": 0.24140312996000002,
"user": 0.08617460999999998,
"system": 0.12323376000000001,
"min": 0.09427125596000001,
"max": 0.29016765496,
"times": [
0.09427125596000001,
0.12272227296000002,
0.10814566496000001,
0.10705469596000002,
0.10612934196000001,
0.10502282896000001,
0.11451358096000001,
0.13781039596000003,
0.14639948396000002,
0.14775158996,
0.14817557096,
0.14604463696000003,
0.14846508596000002,
0.15151252196,
0.16783332096,
0.16853679196000002,
0.16997342296,
0.16844706396,
0.16908728596000003,
0.16891443496000003,
0.16828961096000003,
0.16992359796,
0.17080439496000002,
0.19855591796000002,
0.20074445296,
0.21440801796000003,
0.24350181396000004,
0.24561736796000003,
0.24196612596000003,
0.24360409496000002,
0.24331767996000003,
0.24652441296000002,
0.24279184496000003,
0.24485893696000002,
0.24116745896000003,
0.24598800796000003,
0.24296923896000003,
0.24656006396000002,
0.24561899196000003,
0.24682820696000002,
0.24173350996,
0.24652734996000003,
0.24163880096,
0.24588214996000002,
0.24245050996000003,
0.24488809296000003,
0.24555391596000004,
0.24579904396000002,
0.24346369196000003,
0.24628135196000003,
0.24546565196000003,
0.24388913296000003,
0.24583599996000002,
0.24499407696000003,
0.24350880296000002,
0.24843729096000003,
0.24303126896000002,
0.20900605496000002,
0.11419109996000001,
0.11346394096000001,
0.13605218496000002,
0.14135073496000003,
0.14054553696000002,
0.14170314596000003,
0.14030605696,
0.14126451896000003,
0.16392311396,
0.18885592696000003,
0.18878119396,
0.18838356896000003,
0.18918338996000003,
0.18812068296,
0.19095238196000003,
0.19126939996000003,
0.18889649096000002,
0.18961129496,
0.18977580196000002,
0.18796707096,
0.22432580396000001,
0.22725841896,
0.24249487096000003,
0.28284325996,
0.28933039296,
0.28381035196,
0.28812964996,
0.28587865196,
0.28771304996,
0.28530770596,
0.28554755196,
0.28769848096,
0.28434687996,
0.28651199196,
0.28607062296,
0.28923057896,
0.28878584896,
0.28557950296,
0.29016765496,
0.28701344896,
0.28762125696,
0.28466910996
],
"exit_codes": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
}
]
}

View File

@ -0,0 +1,218 @@
{
"results": [
{
"command": "target/release/aoc2025 2",
"mean": 0.95519874726,
"stddev": 0.044124744291853195,
"median": 0.9539973693000001,
"user": 0.9509290699999997,
"system": 0.0004994800000000004,
"min": 0.9081787933000001,
"max": 1.3391311813,
"times": [
0.9081787933000001,
0.9308759813000002,
0.9142113613000001,
0.9193022683000001,
0.9168911283000001,
0.9253488913000001,
0.9312279043000001,
0.9356256283000001,
0.9492816713000001,
0.9366174083000001,
0.9250868713000001,
0.9360851383000001,
0.9296086603000001,
0.9412757703000001,
0.9305709973000001,
0.9433563383000001,
0.9328483643000001,
0.9234778363000001,
0.9411994823000001,
0.9501147403000001,
0.9559593323000001,
0.9364716953000001,
0.9493212363000001,
0.9406622733000001,
0.9539723113000002,
0.9497769683000001,
0.9555531353000001,
0.9487832943000001,
0.9615137793000001,
0.9561215063000001,
0.9718753403000001,
0.9563764693000001,
0.9643665283000001,
0.9637328313000001,
0.9707989003000002,
0.9186347943000001,
0.9741552383000001,
0.9165410013000002,
0.9262016423000001,
0.9540224273000001,
0.9277363903000001,
0.9548339213000001,
0.9273572813000001,
0.9300478423000001,
0.9528168093000001,
0.9275888603000001,
0.9552747403000001,
0.9330515603000001,
0.9566409853000001,
0.9312747113000001,
0.9553285483000001,
0.9258871153000001,
0.9735189993000001,
0.9729769113000001,
0.9651232503000001,
0.9375781063000002,
0.9767990263000002,
0.9542527273000001,
0.9342905783000001,
0.9631512283000001,
0.9617953713000001,
0.9813052893000002,
0.9570536853000001,
0.9289222813000001,
0.9927794953000001,
0.9329621083000001,
1.3391311813,
0.9325888323000001,
0.9621946303000001,
0.9333018313000001,
0.9646547103,
0.9413923583000001,
0.9640935883000001,
0.9897789913000001,
0.9324330013000001,
0.9643400343000001,
0.9848533673000001,
0.9647858223000001,
0.9767217923000001,
0.9635894333000001,
0.9659293263000001,
0.9638130933000001,
0.9872895043000001,
0.9596654163000001,
0.9833496003000001,
0.9814118083000001,
0.9748250483,
0.9946907663000001,
0.9336311843000001,
0.9904872243000001,
0.9579200363000001,
0.9371263093000001,
0.9715577773000001,
0.9408078893000001,
1.0061055943000001,
0.9466207803000001,
0.9793392493000002,
0.9678916383000001,
0.9669369003000001,
0.9402422413000001
],
"exit_codes": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
}
]
}

View File

@ -0,0 +1,218 @@
{
"results": [
{
"command": "python 1-1.py",
"mean": 0.01843302404,
"stddev": 0.0012657147339510022,
"median": 0.017979195580000003,
"user": 0.015601169999999998,
"system": 0.002655909,
"min": 0.01719525558,
"max": 0.024262817580000005,
"times": [
0.021940215580000005,
0.02037590558,
0.01956901858,
0.01847677558,
0.017818465580000005,
0.017927290580000005,
0.01987165758,
0.017643502580000005,
0.01889718958,
0.017678766580000005,
0.01798546058,
0.01796282558,
0.018096614580000003,
0.019076076580000004,
0.017984125580000003,
0.01791695258,
0.01766349558,
0.02018217858,
0.01855690058,
0.01782171658,
0.018275047580000002,
0.01793372058,
0.018170532580000003,
0.017849274580000005,
0.01762079558,
0.01847150358,
0.017508063580000004,
0.017649895580000005,
0.01746609658,
0.017974265580000003,
0.01829079258,
0.01731760458,
0.01785077358,
0.01721457758,
0.01787336758,
0.018715130580000003,
0.017604400580000006,
0.01719525558,
0.01837595358,
0.019775062580000002,
0.017288543580000003,
0.017996394580000005,
0.017708625580000005,
0.01723078058,
0.01859565758,
0.017730976580000002,
0.017462975580000005,
0.017829121580000003,
0.01851731458,
0.01785272158,
0.01804898958,
0.017888834580000006,
0.01731304058,
0.017909111580000005,
0.018421691580000003,
0.017520087580000003,
0.01780653158,
0.017915070580000005,
0.01786583858,
0.017567218580000002,
0.018018454580000003,
0.01769244358,
0.018978892580000004,
0.01816111358,
0.017368446580000002,
0.017602324580000002,
0.01786462758,
0.01852068958,
0.018079517580000003,
0.01744804658,
0.017847348580000005,
0.01761715958,
0.01768220458,
0.017716536580000004,
0.017590534580000004,
0.01916825858,
0.01837094258,
0.024262817580000005,
0.023162718580000005,
0.02013178158,
0.022817841580000005,
0.019455812580000002,
0.018663137580000003,
0.020078744580000002,
0.018950286580000003,
0.022046223580000003,
0.01906816058,
0.01824326458,
0.01871615058,
0.01788724858,
0.018833006580000006,
0.01850424658,
0.020043292580000004,
0.01800679058,
0.01962254158,
0.017958190580000005,
0.018563434580000003,
0.01756514958,
0.017695261580000003,
0.018251983580000006
],
"exit_codes": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
}
]
}

View File

@ -0,0 +1,218 @@
{
"results": [
{
"command": "python 1-2.py",
"mean": 0.10065511542000002,
"stddev": 0.005070299601528213,
"median": 0.10021386182000001,
"user": 0.09656875,
"system": 0.003348090000000002,
"min": 0.08970616732000002,
"max": 0.12020687432000002,
"times": [
0.09720221832,
0.09865108932000001,
0.09526603432000001,
0.10220708232000002,
0.10600740832000001,
0.09565718732000002,
0.09584613332000001,
0.10399513632000001,
0.10715478232000002,
0.10124971932000001,
0.10037107232000002,
0.10223235032000001,
0.09968424232,
0.09940458732000002,
0.09930831532,
0.09532145232000001,
0.08970616732000002,
0.09986469332000002,
0.09213563732,
0.09521426632,
0.10171789432000002,
0.09781683532000002,
0.10088793532000001,
0.10186061832000001,
0.09871522032,
0.10478594232,
0.09268426532000001,
0.11021149432,
0.10253815832000002,
0.09696197432,
0.09825557732000001,
0.10135564132000001,
0.10723291232000001,
0.09486173832000001,
0.12020687432000002,
0.10346667332000001,
0.09620447132000001,
0.10211980332000001,
0.10263448232000001,
0.09739181032000001,
0.10659001632000001,
0.09343680432000001,
0.10017148632000002,
0.09568633732000001,
0.10377575732000001,
0.10569169432000002,
0.09891529332000001,
0.09706895132000001,
0.10359639532,
0.11909498532000001,
0.10124096632000001,
0.10726747332000001,
0.09666090032,
0.10025623732000001,
0.09513318232000001,
0.10827525632000001,
0.10478741132000001,
0.09365811832000001,
0.09568155632000001,
0.10111659732000002,
0.10849375632000001,
0.10122607432000001,
0.09808621332000002,
0.10768904532000001,
0.09773930432000001,
0.10163057132000002,
0.09868030232000001,
0.10004012732,
0.09432664032000002,
0.09809490532000001,
0.09813455632000001,
0.10013154632000001,
0.10039868432000001,
0.09614563532,
0.09835838332,
0.09961064332000001,
0.10083732132,
0.10392489432000002,
0.10173207032,
0.09681472732000002,
0.09998077132000001,
0.10510356132000001,
0.10299731132,
0.09985206932000001,
0.10440825632000002,
0.10392704632000001,
0.10417230732000002,
0.10073995232,
0.10120393632000001,
0.10234714332000001,
0.09503944032000002,
0.09673561932000001,
0.10741705832000001,
0.11105290632,
0.09754221632000001,
0.10467473532000002,
0.09256150232000002,
0.09705440132000001,
0.10414729132000002,
0.09596329532000002
],
"exit_codes": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
}
]
}

View File

@ -0,0 +1,218 @@
{
"results": [
{
"command": "python 2-1.py",
"mean": 1.5766493539500004,
"stddev": 0.0455222865695424,
"median": 1.5766019187999998,
"user": 1.5664454400000007,
"system": 0.00335977,
"min": 1.4803841823,
"max": 1.6721914603,
"times": [
1.5272328693000001,
1.4921730793,
1.5905018103,
1.4803841823,
1.5308374893,
1.5602105813,
1.5190082873,
1.5376498373,
1.5758360573,
1.4973574432999999,
1.5077385823,
1.5211455033,
1.5376435323,
1.4908944122999999,
1.5514813263,
1.5867757103,
1.5959099863000001,
1.6113877113,
1.5681910803,
1.6264837603,
1.5657511333,
1.5962727323,
1.5743556022999998,
1.4852742363,
1.5863668273,
1.5993799273,
1.6150561123,
1.5037628413,
1.6125845143,
1.5888177133,
1.5342755693,
1.5932445243,
1.5069206643,
1.5635267083,
1.5118950973,
1.5228677273,
1.5397949743,
1.5938155213,
1.5315042873,
1.5977120243,
1.6180576373,
1.5185230233,
1.6455592843,
1.5585295342999999,
1.5982096653,
1.5727382893000001,
1.6029695213,
1.5676065853,
1.6314337483,
1.5089946653,
1.5408961823,
1.6555851813,
1.5751253693,
1.5789429713,
1.6113100123000001,
1.5792668893,
1.5691780553,
1.5274483612999998,
1.6164811452999999,
1.5324931943,
1.6186490903,
1.5466038762999998,
1.6704481293,
1.6247100733,
1.5427539253,
1.6168075493,
1.6188093963,
1.6029602562999998,
1.5761420792999998,
1.5433073123,
1.6179796743,
1.6175545353,
1.6318414422999998,
1.5538511703,
1.5957183363,
1.5548314073,
1.5846359743,
1.6423108263000001,
1.5467988902999998,
1.5631220852999999,
1.5742669633,
1.5770932183,
1.6208351293,
1.5558609233,
1.6271851523,
1.6104170183,
1.6231884473,
1.5770617583,
1.5504421173,
1.6021042633,
1.6312162983,
1.6721914603,
1.5393533342999999,
1.6380897473,
1.6382059013,
1.6621236303,
1.5422585533,
1.6554498563,
1.5422890693,
1.6140952273
],
"exit_codes": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
}
]
}

View File

@ -0,0 +1,218 @@
{
"results": [
{
"command": "sander_hs/bin/d01-p1",
"mean": 0.022359646950000003,
"stddev": 0.003947930999644063,
"median": 0.0221566094,
"user": 0.011003309999999999,
"system": 0.0036034243999999997,
"min": 0.011151118400000002,
"max": 0.0418797714,
"times": [
0.021608108400000003,
0.0216550764,
0.0214301634,
0.0217091644,
0.021845091400000002,
0.0218199154,
0.0219022274,
0.0222604954,
0.0221990744,
0.0221290354,
0.022109658400000003,
0.0221543054,
0.0220385414,
0.0221145864,
0.0222324194,
0.0222197784,
0.022081751400000002,
0.0221985664,
0.0221589134,
0.022402793400000003,
0.022002303400000003,
0.022110325400000002,
0.0219013264,
0.022116461400000002,
0.021828275400000003,
0.021764728400000002,
0.0218213174,
0.011151118400000002,
0.021338464400000003,
0.0224858174,
0.04095669340000001,
0.023139116400000003,
0.022919120400000003,
0.0401848994,
0.023492082400000003,
0.0235819404,
0.0233865764,
0.023311378400000003,
0.0237322984,
0.023424249400000003,
0.023000724400000002,
0.0230065454,
0.0218798444,
0.0218653774,
0.021647235400000003,
0.022240412400000003,
0.0224920394,
0.0223583574,
0.0223172124,
0.0220545844,
0.011460039400000002,
0.012014767400000001,
0.011425214400000001,
0.022288648400000003,
0.0214406644,
0.021533019400000002,
0.022723869400000003,
0.0418797714,
0.023123074400000002,
0.022699171400000002,
0.022425212400000002,
0.0225628434,
0.0217416164,
0.021699208400000003,
0.0221595004,
0.022477877400000002,
0.0222780814,
0.0225413564,
0.0223755154,
0.021824677400000003,
0.021797454400000003,
0.021913774400000002,
0.0218400794,
0.022196666400000002,
0.022422626400000003,
0.0221716494,
0.022310612400000002,
0.022924382400000002,
0.023227522400000002,
0.022039313400000003,
0.021584635400000003,
0.0217211544,
0.021672446400000003,
0.0218050724,
0.0217344044,
0.0223603214,
0.0224140354,
0.0225898824,
0.022544186400000003,
0.022495991400000002,
0.022461002400000003,
0.022642661400000003,
0.0216293234,
0.021656978400000002,
0.0217763664,
0.021687655400000002,
0.0218970694,
0.021596916400000003,
0.0222494804,
0.0221464094
],
"exit_codes": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
}
]
}

View File

@ -0,0 +1,218 @@
{
"results": [
{
"command": "python vicky_py/d01p1.py",
"mean": 0.015132811449999992,
"stddev": 0.0007816237374053428,
"median": 0.01486825428,
"user": 0.01270832,
"system": 0.0024101320000000006,
"min": 0.01436241278,
"max": 0.01817732678,
"times": [
0.015518389779999999,
0.01813885378,
0.01605782678,
0.015091580779999999,
0.01528983678,
0.01696367778,
0.01786692578,
0.01604522378,
0.01791159778,
0.01666651378,
0.01663513578,
0.01817732678,
0.01534427378,
0.015055749779999999,
0.014746743779999998,
0.01504438278,
0.014920876779999998,
0.01509644178,
0.01491007578,
0.01587278678,
0.01463246978,
0.015096525779999998,
0.01599748078,
0.01464660278,
0.01487039578,
0.014966278779999998,
0.01553397178,
0.01450562678,
0.01472500278,
0.01479079878,
0.014613496779999999,
0.015052138779999998,
0.015068220779999999,
0.01485035878,
0.01612641578,
0.014659551779999998,
0.014462230779999998,
0.014704591779999998,
0.01579260378,
0.01493656178,
0.014439517780000001,
0.01479319778,
0.01484612778,
0.01487984078,
0.015270242779999998,
0.01478750878,
0.01454116578,
0.01481142378,
0.01486611278,
0.01459962078,
0.015146284779999998,
0.01513184078,
0.014671047779999998,
0.01490411278,
0.01516517878,
0.014547937779999999,
0.01611687378,
0.01479300478,
0.014642981780000001,
0.014990844779999998,
0.01469972478,
0.01436241278,
0.01498505578,
0.015351252780000001,
0.01476563778,
0.01467167778,
0.014857947779999998,
0.014770485779999998,
0.01495125478,
0.014514572779999999,
0.014705532779999999,
0.01481573278,
0.015126245779999999,
0.01509372078,
0.014702891780000001,
0.01464654378,
0.01560098478,
0.01631168578,
0.014627815780000001,
0.01476084078,
0.01483350478,
0.01441758378,
0.01484819678,
0.01461456078,
0.01516131078,
0.01521244678,
0.014570058779999999,
0.01467177078,
0.014837039779999998,
0.014570898780000001,
0.014939095779999998,
0.014654438780000001,
0.014765305779999998,
0.01481357178,
0.01483872578,
0.014888913779999999,
0.014661001779999999,
0.014468301779999998,
0.01495531478,
0.01490667378
],
"exit_codes": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
}
]
}

View File

@ -0,0 +1,218 @@
{
"results": [
{
"command": "python vicky_py/d02p1.py",
"mean": 0.77773528433,
"stddev": 0.013976194777421366,
"median": 0.7759338516400001,
"user": 0.7699287800000004,
"system": 0.004225879999999999,
"min": 0.7490998936400001,
"max": 0.8399190376400001,
"times": [
0.75979596264,
0.7661285686400001,
0.7791226626400001,
0.7490998936400001,
0.7736369176400001,
0.7641418486400001,
0.7793006606400001,
0.76434331064,
0.7799637526400001,
0.7607602726400001,
0.7741888416400001,
0.7949796806400001,
0.77305558764,
0.8012396196400001,
0.77498808364,
0.7862997626400001,
0.7847444226400001,
0.7619847626400001,
0.7837266866400001,
0.7846942496400001,
0.7856272536400001,
0.76538022664,
0.78913555164,
0.7838882036400001,
0.7873134206400001,
0.7824590946400001,
0.7804697756400001,
0.8059732046400001,
0.7866213446400001,
0.7741237476400001,
0.7890587036400001,
0.7789373526400001,
0.7876874266400001,
0.7739823786400001,
0.7752962816400001,
0.7718479856400001,
0.7743720316400001,
0.7731203976400001,
0.7877970456400001,
0.7777499686400001,
0.7680522996400001,
0.7730276016400001,
0.7765714216400001,
0.8324236546400001,
0.7672744766400001,
0.78282582864,
0.7674357836400001,
0.7732558296400001,
0.7678108906400001,
0.77327789964,
0.7674461176400001,
0.7695352836400001,
0.76425323864,
0.7801603266400001,
0.7820577376400001,
0.7893313496400001,
0.7787597436400001,
0.7805181096400001,
0.7672512906400001,
0.7734224456400001,
0.7776302256400001,
0.7647321746400001,
0.7856538736400001,
0.77927853564,
0.8056057246400001,
0.7644001326400001,
0.7673602426400001,
0.7926977196400001,
0.78798424064,
0.76219117564,
0.7637820096400001,
0.7819979216400001,
0.7680101816400001,
0.79594539764,
0.76706916164,
0.7856222366400001,
0.7865205376400001,
0.7643969076400001,
0.7915279496400001,
0.76369593564,
0.7808402326400001,
0.7636531946400001,
0.7681546326400001,
0.7705579516400001,
0.7829478466400001,
0.7934510776400001,
0.76480994964,
0.7774967666400001,
0.7612722326400001,
0.7751671836400001,
0.7646966886400001,
0.7931756816400001,
0.7779745056400001,
0.7818194916400001,
0.7597408616400001,
0.8020904466400001,
0.7604263216400001,
0.8399190376400001,
0.7654483126400001,
0.7720554586400001
],
"exit_codes": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
}
]
}

View File

@ -0,0 +1,218 @@
{
"results": [
{
"command": "python vicky_py/d02p2.py",
"mean": 8.94538261009,
"stddev": 0.2509496444217131,
"median": 9.049778934679999,
"user": 8.905039219999999,
"system": 0.004360440000000002,
"min": 8.43330605468,
"max": 9.28971549368,
"times": [
8.88167304868,
8.46350218868,
8.67955974168,
9.20559683968,
9.04275455968,
8.53011481668,
9.113910668679999,
8.67396180568,
8.98211474468,
9.13243384468,
8.54408974368,
9.16571656168,
9.07330562868,
9.04507466068,
9.12033452368,
8.50616699068,
9.23906340268,
9.12349666168,
8.96128319468,
9.22774800968,
8.95911522268,
9.09715083468,
8.99449587868,
9.12981722168,
9.16881575368,
9.10937898368,
8.59131431268,
9.149065372679999,
9.11519702468,
8.97529310268,
9.11304015268,
8.57284944868,
9.05109928568,
9.11348437868,
9.24477652068,
9.13321668068,
9.08530538368,
9.10167634968,
8.96956938268,
9.03289946468,
9.11982480368,
9.10569408068,
9.03393993968,
9.14796976468,
9.10120584068,
8.91329725468,
8.98842096568,
9.08925683468,
9.01037838268,
8.97055297668,
9.12851075668,
8.76169907768,
8.61325028268,
9.25796331068,
8.65943359468,
9.09327849968,
8.50863367768,
9.08476618868,
8.54501605568,
9.22169484968,
9.12108713468,
8.63231732268,
9.17397773768,
9.20391244368,
8.55778174668,
8.68909028968,
9.18076122568,
9.11404111068,
8.65173546368,
9.27378586668,
8.65780827568,
9.14613413768,
8.67141103168,
9.21394277068,
9.20651857668,
8.55610273368,
8.68119686368,
9.15976400568,
8.57780606068,
9.21236916268,
9.09689742368,
8.59434178568,
9.20229382068,
8.71541957368,
8.58779979768,
9.04920293768,
8.58982091168,
9.28971549368,
8.52752932968,
9.08155105168,
9.05035493168,
8.59374959768,
8.58687716468,
9.02231053868,
9.12043051868,
8.49205575768,
9.05606913268,
8.96841341868,
9.02432827768,
8.43330605468
],
"exit_codes": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

View File

@ -0,0 +1,16 @@
backports.tarfile==1.2.0
chardet==5.2.0
fqdn==1.5.1
html5lib==1.1
importlib-metadata==8.0.0
isoduration==20.11.0
jaraco.collections==5.1.0
jsonpointer==3.0.0
notebook==7.4.1
pip-chill==1.0.2
seaborn==0.13.2
tinycss2==1.4.0
toml==0.10.2
tomli==2.0.1
uri-template==1.3.0
webcolors==24.11.1

View File

@ -0,0 +1,7 @@
# Build binaries
ghc -O2 sander_hs/d01p1.hs -o sander_hs/bin/d01-p1
# Benchmark day 1
hyperfine --warmup 5 --export-json data/sander-d01-p1.json --runs 100 \
"sander_hs/bin/d01-p1"

View File

@ -0,0 +1,40 @@
import System.IO
import Control.Monad
main :: IO()
main = do handle <- openFile "../rust/inputs/01.txt" ReadMode
contents <- hGetContents handle
print (doday1_1 contents)
hClose handle
-- Day 1: ...
-- Part One (correct)
doday1_1 :: String -> String
doday1_1 input = show (countZeroRotations (words input) 50)
countZeroRotations :: [String] -> Int -> Int
countZeroRotations [] _ = 0
countZeroRotations (x : xs) pos = countZeroRotations xs (fst (rotateDial x pos)) + snd (rotateDial x pos)
rotateDial :: String -> Int -> (Int, Int)
rotateDial (direction : r) pos
| direction == 'L' && newposl == 0 = (normalizeHundred newposl, 1)
| direction == 'L' = (normalizeHundred newposl, 0)
| direction == 'R' && newposr == 0 = (normalizeHundred newposr, 1)
| direction == 'R' = (normalizeHundred newposr, 0)
where newposl = normalizeHundred (pos - (read r))
newposr = normalizeHundred (pos + (read r))
normalizeHundred :: Int -> Int
normalizeHundred x
| x >= 0 && x < 100 = x
| x >= 100 = normalizeHundred (x - 100)
| x < 0 = normalizeHundred (x + 100)
| True = x
-- Part Two
doday1_2 :: String -> String
doday1_2 input = undefined

30
bram/benchmarks/shell.nix Normal file
View File

@ -0,0 +1,30 @@
let
pkgs = import <nixpkgs> {};
in pkgs.mkShell {
packages = with pkgs; [
# Benchmarking tool
hyperfine
# Haskell
haskell.compiler.native-bignum.ghc967
# Jupyter notebook
(python312.withPackages
(py-pkgs: with py-pkgs; [
matplotlib
notebook
pandas
pip-chill
seaborn
])
)
];
# Rust installation
nativeBuildInputs = with pkgs; [ rustc cargo gcc rustfmt clippy valgrind ];
# Certain Rust tools won't work without this
# This can also be fixed by using oxalica/rust-overlay and specifying the rust-src extension
# See https://discourse.nixos.org/t/rust-src-not-found-and-other-misadventures-of-developing-rust-on-nixos/11570/3?u=samuela. for more details.
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
}

11
bram/benchmarks/vicky.sh Normal file
View File

@ -0,0 +1,11 @@
# Benchmark day 1
hyperfine --warmup 5 --export-json data/vicky-d01-p1.json --runs 100 \
"python vicky_py/d01p1.py"
# hyperfine --warmup 5 --export-json data/vicky-d01-p2.json --runs 100 \
# "python vicky_py/d01p2.py"
# Benchmark day 2
hyperfine --warmup 5 --export-json data/vicky-d02-p1.json --runs 100 \
"python vicky_py/d02p1.py"
hyperfine --warmup 5 --export-json data/vicky-d02-p2.json --runs 100 \
"python vicky_py/d02p2.py"

View File

@ -0,0 +1,47 @@
#!/usr/bin/env python
# coding: utf-8
# # Puzzle 1 of AoC 2025
# Author: Victoria Ramírez López
#
# Date: December 1, 2025
# In[89]:
def rotate_dial(instruction = '', dial_position=50):
# This function rotates the dial based on the input from the set of instructions
# input: instruction = String
# output: dial_position
# Split the instruction into "direction" and "distance"
direction = instruction[0]
distance = int(instruction[1:])
# Calculate final position of the dial
if direction == 'R':
dial_position = (dial_position + distance) % 100
elif direction == 'L':
dial_position = (dial_position - distance) % 100
return dial_position
# In[97]:
# Import instruction file
instructions = open('vicky_py/input01.txt','r')
# In[98]:
# Calculate passcode
dial_position = 50
passcode = 0
for instruction in instructions:
dial_position = rotate_dial(instruction, dial_position)
if dial_position == 0:
passcode = passcode + 1
print(passcode)

View File

@ -0,0 +1,133 @@
#!/usr/bin/env python
# coding: utf-8
# # Puzzle 2 of AoC 2025
# Author: Victoria Ramírez López
#
# Date: Dec 2, 2025
# In[18]:
def find_invalid_ids(id_range=''):
# This function finds the invalid ids within the specified range (part 1)
# input: id_range = String
# output: invalid_ids = int []
invalid_ids = []
invalid_id = []
# Extract the upper and lower bounds of the range
lb = int(id_range.split('-')[0])
ub = int(id_range.split('-')[1]) + 1
# Generate the series of product ids withing the range
product_ids = range(lb,ub)
# Find invalid ids
for id in product_ids:
id_string = str(id) # Convert each product id to string
if len(id_string) % 2 == 0:
middle_point = len(id_string) // 2 # Find where to split the product id in 2
# Compare the two halves of the id to determine if the id is invalid
first_half = id_string[0:middle_point]
second_half = id_string[middle_point:]
if first_half == second_half: # If the two halves are equal, the id is invalid
invalid_id = int(id_string)
invalid_ids.append(invalid_id)
return invalid_ids
# In[33]:
def chop_product_id(id):
# This function chops a product id into chunks of equal sizes
# input: id = int
# output: chopped_id = [[]]
id_string = str(id)
chunks = []
chopped_id = []
# Find divisors to split the id into equal-sized chunks
# (aka: how many ways to split the id into equal-sized chunks are there?)
for divisor in range(2,len(id_string) + 1):
if len(id_string) % divisor == 0:
chunks = []
chunk_size = len(id_string) // divisor # Determine how big a chunk would be
for i in range(1,len(id_string)+1,chunk_size): # Chop the id
chunk = id_string[i-1:(i-1 + chunk_size)]
chunks.append(chunk)
chopped_id.append(chunks)
return chopped_id
# In[49]:
# Read product ID ranges file
import csv
input_file = open('../rust/inputs/02.txt', mode ='r') # Open in 'read only' mode
id_ranges_csv = csv.reader(input_file)
id_ranges_list = list(id_ranges_csv)
# In[51]:
def find_all_invalid_ids(id_range=''):
# This function finds all the invalid ids within the specified range (part 2)
# input: id_range = String
# output: invalid_ids = int [[]]
invalid_ids = []
invalid_id = []
# Extract the upper and lower bounds of the range
lb = int(id_range.split('-')[0])
ub = int(id_range.split('-')[1]) + 1
# Generate the series of product ids withing the range
product_ids = range(lb,ub)
# Find invalid ids
for id in product_ids:
id_string = str(id) # Convert each product id to string
chopped_ids = chop_product_id(id) # Chop each product id into equal-sized pieces
# Identify ids with a repeating pattern
for list in chopped_ids:
chunks_set = set(list) # Convert each group of equal-sized chunks into a set
if len(chunks_set) == 1: # If the resulting set has only 1 element, the id is invalid
invalid_id = int(id_string)
invalid_ids.append(invalid_id)
break
return(invalid_ids)
# In[52]:
# Get invalid ids and calculate answer
invalid_ids = []
id_ranges = []
for id_range in id_ranges_list[0]:
invalid_ids_range = find_invalid_ids(id_range) # For part 1 answer
# invalid_ids_range = find_all_invalid_ids(id_range) # For part 2 answer
invalid_ids.append(invalid_ids_range[:])
sum_invalid_ids = sum(sum(invalid_ids,[]))
# print(invalid_ids)
print(sum_invalid_ids)

View File

@ -0,0 +1,133 @@
#!/usr/bin/env python
# coding: utf-8
# # Puzzle 2 of AoC 2025
# Author: Victoria Ramírez López
#
# Date: Dec 2, 2025
# In[18]:
def find_invalid_ids(id_range=''):
# This function finds the invalid ids within the specified range (part 1)
# input: id_range = String
# output: invalid_ids = int []
invalid_ids = []
invalid_id = []
# Extract the upper and lower bounds of the range
lb = int(id_range.split('-')[0])
ub = int(id_range.split('-')[1]) + 1
# Generate the series of product ids withing the range
product_ids = range(lb,ub)
# Find invalid ids
for id in product_ids:
id_string = str(id) # Convert each product id to string
if len(id_string) % 2 == 0:
middle_point = len(id_string) // 2 # Find where to split the product id in 2
# Compare the two halves of the id to determine if the id is invalid
first_half = id_string[0:middle_point]
second_half = id_string[middle_point:]
if first_half == second_half: # If the two halves are equal, the id is invalid
invalid_id = int(id_string)
invalid_ids.append(invalid_id)
return invalid_ids
# In[33]:
def chop_product_id(id):
# This function chops a product id into chunks of equal sizes
# input: id = int
# output: chopped_id = [[]]
id_string = str(id)
chunks = []
chopped_id = []
# Find divisors to split the id into equal-sized chunks
# (aka: how many ways to split the id into equal-sized chunks are there?)
for divisor in range(2,len(id_string) + 1):
if len(id_string) % divisor == 0:
chunks = []
chunk_size = len(id_string) // divisor # Determine how big a chunk would be
for i in range(1,len(id_string)+1,chunk_size): # Chop the id
chunk = id_string[i-1:(i-1 + chunk_size)]
chunks.append(chunk)
chopped_id.append(chunks)
return chopped_id
# In[49]:
# Read product ID ranges file
import csv
input_file = open('../rust/inputs/02.txt', mode ='r') # Open in 'read only' mode
id_ranges_csv = csv.reader(input_file)
id_ranges_list = list(id_ranges_csv)
# In[51]:
def find_all_invalid_ids(id_range=''):
# This function finds all the invalid ids within the specified range (part 2)
# input: id_range = String
# output: invalid_ids = int [[]]
invalid_ids = []
invalid_id = []
# Extract the upper and lower bounds of the range
lb = int(id_range.split('-')[0])
ub = int(id_range.split('-')[1]) + 1
# Generate the series of product ids withing the range
product_ids = range(lb,ub)
# Find invalid ids
for id in product_ids:
id_string = str(id) # Convert each product id to string
chopped_ids = chop_product_id(id) # Chop each product id into equal-sized pieces
# Identify ids with a repeating pattern
for list in chopped_ids:
chunks_set = set(list) # Convert each group of equal-sized chunks into a set
if len(chunks_set) == 1: # If the resulting set has only 1 element, the id is invalid
invalid_id = int(id_string)
invalid_ids.append(invalid_id)
break
return(invalid_ids)
# In[52]:
# Get invalid ids and calculate answer
invalid_ids = []
id_ranges = []
for id_range in id_ranges_list[0]:
# invalid_ids_range = find_invalid_ids(id_range) # For part 1 answer
invalid_ids_range = find_all_invalid_ids(id_range) # For part 2 answer
invalid_ids.append(invalid_ids_range[:])
sum_invalid_ids = sum(sum(invalid_ids,[]))
# print(invalid_ids)
print(sum_invalid_ids)

File diff suppressed because it is too large Load Diff

1
bram/rust/.envrc Normal file
View File

@ -0,0 +1 @@
use nix

8
bram/rust/Cargo.toml Normal file
View File

@ -0,0 +1,8 @@
[package]
name = "aoc2025"
version = "0.1.0"
edition = "2024"
[dependencies]
colored = "3.0.0"
regex = "1.12.2"

4543
bram/rust/inputs/01.txt Normal file

File diff suppressed because it is too large Load Diff

2
bram/rust/inputs/02.txt Normal file
View File

@ -0,0 +1,2 @@
8123221734-8123333968,2665-4538,189952-274622,4975-9031,24163352-24202932,1233-1772,9898889349-9899037441,2-15,2147801-2281579,296141-327417,8989846734-8989940664,31172-42921,593312-632035,862987-983007,613600462-613621897,81807088-81833878,13258610-13489867,643517-782886,986483-1022745,113493-167913,10677-16867,372-518,3489007333-3489264175,1858-2534,18547-26982,16-29,247-366,55547-103861,57-74,30-56,1670594-1765773,76-129,134085905-134182567,441436-566415,7539123416-7539252430,668-1146,581563513-581619699

0
bram/rust/inputs/03.txt Normal file
View File

0
bram/rust/inputs/04.txt Normal file
View File

0
bram/rust/inputs/05.txt Normal file
View File

0
bram/rust/inputs/06.txt Normal file
View File

0
bram/rust/inputs/07.txt Normal file
View File

0
bram/rust/inputs/08.txt Normal file
View File

0
bram/rust/inputs/09.txt Normal file
View File

0
bram/rust/inputs/10.txt Normal file
View File

0
bram/rust/inputs/11.txt Normal file
View File

0
bram/rust/inputs/12.txt Normal file
View File

9
bram/rust/shell.nix Normal file
View File

@ -0,0 +1,9 @@
{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
nativeBuildInputs = with pkgs; [ rustc cargo gcc rustfmt clippy valgrind ];
# Certain Rust tools won't work without this
# This can also be fixed by using oxalica/rust-overlay and specifying the rust-src extension
# See https://discourse.nixos.org/t/rust-src-not-found-and-other-misadventures-of-developing-rust-on-nixos/11570/3?u=samuela. for more details.
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
}

View File

@ -0,0 +1,53 @@
use crate::utils;
pub fn answer(text : String) ->( u16, u16 ) {
let mut old : i16 = 50;
let mut clicks : u16 = 0;
let mut passing_clicks : u16 = 0;
for d in text.split("\n").filter_map(str_to_dir) {
let new : i16 = old + d;
// Part 1 clicks
if new % 100 == 0 {
clicks += 1;
}
// Part 2 clicks
if d > 0 {
passing_clicks += (
new.div_euclid(100) - old.div_euclid(100)
) as u16
} else {
passing_clicks += (
(old - 1).div_euclid(100) - (new - 1).div_euclid(100)
) as u16
}
old = new;
}
( clicks, passing_clicks )
}
fn count_passing_clicks(old : i16, new : i16) -> u16 {
if old < new {
(new.div_euclid(100) - old.div_euclid(100)).abs() as u16
} else {
((new - 1).div_euclid(100) - (old - 1).div_euclid(100)).abs() as u16
}
}
fn str_to_dir(s : &str) -> Option<i16> {
if s.len() < 2 {
return None;
}
let (dir, l) : (&str, &str) = s.split_at(1);
match dir {
"L" => Some(-1 * utils::str_to_i16(l)?),
"R" => utils::str_to_i16(l),
_ => None,
}
}

View File

@ -0,0 +1,50 @@
use crate::utils;
use std::ops::RangeInclusive;
pub fn answer(text : String) -> ( u64, u64 ) {
( text.split(",").flat_map(to_range).filter(|x| is_invalid_by(x, 2)).sum()
, text.split(",").flat_map(to_range).filter(is_invalid).sum()
)
}
fn is_invalid(n : &u64) -> bool {
for b in 2..=10 {
if is_invalid_by(n, b) {
return true;
}
}
false
}
fn is_invalid_by(n : &u64, by : usize) -> bool {
let s : String = n.to_string();
let size : usize = s.len() / by;
if s.len() % by == 0 {
for i in 1..by {
if s[0..size] != s[i * size..(i + 1) * size] {
return false;
}
}
true
} else {
false
}
}
fn to_range(s : &str) -> RangeInclusive<u64> {
let empty = 1..=0;
if let Some((low, high)) = s.split_once("-") {
match ( utils::str_to_u64(low), utils::str_to_u64(high) ) {
( Some(l), Some(h) ) =>
l..=h,
_ =>
// Empty iterator
empty,
}
} else {
empty
}
}

90
bram/rust/src/lib.rs Normal file
View File

@ -0,0 +1,90 @@
mod day_01;
mod day_02;
// mod day_03;
// mod day_04;
// mod day_05;
// mod day_06;
// mod day_07;
// mod day_08;
// mod day_09;
// mod day_10;
// mod day_11;
mod utils;
use std::time::Duration;
use crate::utils::read_from_file;
use crate::utils::diagnostics;
pub type DailyOutput = ( u128, u128, Duration );
pub use crate::utils::diagnostics::AdventOfCode;
pub fn day_01() -> DailyOutput {
let s : String = read_from_file("inputs/01.txt");
let ( p1, p2, d ) = diagnostics::benchmark(s, day_01::answer);
( p1 as u128, p2 as u128, d )
}
pub fn day_02() -> DailyOutput {
let s : String = read_from_file("inputs/02.txt");
let (p1, p2, d) = diagnostics::benchmark(s, day_02::answer);
( p1 as u128, p2 as u128, d )
}
// pub fn day_03() -> DailyOutput {
// let s : String = read_from_file("inputs/03.txt");
// let (p1, p2, d) = diagnostics::benchmark(s, day_03::answer);
// ( p1 as u128, p2 as u128, d )
// }
// pub fn day_04() -> DailyOutput {
// let s : String = read_from_file("inputs/04.txt");
// let (p1, p2, d) = diagnostics::benchmark(s, day_04::answer);
// ( p1 as u128, p2 as u128, d )
// }
// pub fn day_05() -> DailyOutput {
// let s : String = read_from_file("inputs/05.txt");
// let (p1, p2, d) = diagnostics::benchmark(s, day_05::answer);
// ( p1 as u128, p2 as u128, d )
// }
// pub fn day_07() -> DailyOutput {
// let s : String = read_from_file("inputs/07.txt");
// let (p1, p2, d) = diagnostics::benchmark(s, day_07::answer);
// ( p1 as u128, p2 as u128, d )
// }
// pub fn day_08() -> DailyOutput {
// let s : String = read_from_file("inputs/08.txt");
// let (p1, p2, d) = diagnostics::benchmark(s, day_08::answer);
// ( p1 as u128, p2 as u128, d )
// }
// pub fn day_09() -> DailyOutput {
// let s : String = read_from_file("inputs/09.txt");
// let (p1, p2, d) = diagnostics::benchmark(s, day_09::answer);
// ( p1 as u128, p2 as u128, d )
// }
// pub fn day_10() -> DailyOutput {
// let s : String = read_from_file("inputs/10.txt");
// let (p1, p2, d) = diagnostics::benchmark(s, day_10::answer);
// ( p1 as u128, p2 as u128, d )
// }
// pub fn day_11() -> DailyOutput {
// let s : String = read_from_file("inputs/11.txt");
// let (p1, p2, d) = diagnostics::benchmark(s, day_11::answer);
// ( p1 as u128, p2 as u128, d )
// }

52
bram/rust/src/main.rs Normal file
View File

@ -0,0 +1,52 @@
fn main() {
let args: Vec<String> = std::env::args().collect();
if args.len() > 1 {
let day : Option<u8> = args[1].parse().ok();
match day {
Some(1) => run_day(aoc2025::day_01),
// Some(2) => run_day(aoc2025::day_02),
// Some(3) => run_day(aoc2025::day_03),
// Some(4) => run_day(aoc2025::day_04),
// Some(5) => run_day(aoc2025::day_05),
// Some(6) => run_day(aoc2025::day_06),
// Some(7) => run_day(aoc2025::day_07),
// Some(8) => run_day(aoc2025::day_08),
// Some(9) => run_day(aoc2025::day_09),
// Some(10) => run_day(aoc2025::day_10),
// Some(11) => run_day(aoc2025::day_11),
// Some(12) => run_day(aoc2025::day_12),
Some(_) => run_all_days(),
None => run_all_days(),
}
} else {
run_all_days();
}
}
fn run_all_days() {
let mut aoc = aoc2025::AdventOfCode::new();
aoc.insert(1, aoc2025::day_01());
aoc.insert(2, aoc2025::day_02());
// aoc.insert(3, aoc2025::day_03());
// aoc.insert(4, aoc2025::day_04());
// aoc.insert(5, aoc2025::day_05());
// aoc.insert(6, aoc2025::day_06());
// aoc.insert(7, aoc2025::day_07());
// aoc.insert(8, aoc2025::day_08());
// aoc.insert(9, aoc2025::day_09());
// aoc.insert(10, aoc2025::day_10());
// aoc.insert(11, aoc2025::day_11());
// aoc.insert(12, aoc2025::day_12());
aoc.show_diagnostics();
}
fn run_day(day : fn() -> aoc2025::DailyOutput) {
let (p1, p2, _) = day();
println!("Part 1: {}", p1);
println!("Part 2: {}", p2);
}

View File

@ -0,0 +1,100 @@
use colored::Colorize;
use std::time::{Duration, Instant};
const MAX_MS_ON_SCREEN : u128 = 100;
const BAR_WIDTH_UNIT : f32 = 10.0;
pub struct AdventOfCode {
days : [ Option<DayResults>; 12 ],
}
impl AdventOfCode {
pub fn insert(&mut self, i : usize, (p1, p2, d ) : ( u128, u128, Duration )) {
self.days[i - 1] = Some(
DayResults{ part_1 : p1, part_2 : p2, duration : d }
);
}
pub fn new() -> AdventOfCode {
AdventOfCode{
// If I don't do it like this, the compiler wants me to define
// the Copy trait for the DayResults struct.
days : [
None, None, None, None,
None, None, None, None,
None, None, None, None,
]
}
}
pub fn show_diagnostics(&self) {
println!("| | {: ^15} | {: ^15} | Duration |",
"Part 1", "Part 2"
);
let total : u128 = self.days
.iter()
.enumerate()
.map(|(day, result)| {
match result {
Some(r) => {
println!("{}", r.to_string(day + 1, MAX_MS_ON_SCREEN));
r.duration.as_millis()
},
None => {
println!("{}", empty_diagnostic(day + 1));
0
},
}
})
.sum();
println!("");
println!("Total duration: {total} ms");
}
}
struct DayResults {
part_1 : u128,
part_2 : u128,
duration : Duration,
}
impl DayResults {
fn to_string(&self, day : usize, max_duration : u128) -> String {
let duration = self.duration.as_millis();
let fraction = duration as f32 / max_duration as f32;
let g = horizontal_bar('#', ' ', 4.0 * BAR_WIDTH_UNIT * fraction, 2.0 * BAR_WIDTH_UNIT);
let o = horizontal_bar('#', ' ', 4.0 * BAR_WIDTH_UNIT * (fraction - 0.50), BAR_WIDTH_UNIT);
let r = horizontal_bar('#', ' ', 4.0 * BAR_WIDTH_UNIT * (fraction - 0.75), BAR_WIDTH_UNIT);
format!(
"| Day {: >2} | {: >15} | {: >15} | {: >6}ms | [{: <}{: <6}{: <6}",
day, self.part_1, self.part_2, self.duration.as_millis(),
g.as_str().green(), o.as_str().yellow(), r.as_str().red()
)
}
}
pub fn benchmark<A,B>(s : String, f : fn(String) -> ( A, B )) -> ( A, B, Duration ) {
let now = Instant::now();
let ( a, b ) = f(s);
( a, b, now.elapsed() )
}
fn empty_diagnostic(day : usize) -> String {
format!("| Day {: >2} | {:->15} | {:->15} | {:->8} | [", day, "", "", "")
}
fn horizontal_bar(full : char, empty : char, width : f32, max_width : f32) -> String {
(0..(max_width.floor() as u32))
.map(|w| {
if (w as f32) < width {
full
} else {
empty
}
})
.collect()
}

View File

@ -0,0 +1,41 @@
use std::fs;
pub mod diagnostics;
// pub fn char_to_u64(s : char) -> Option<u64> {
// s.to_string().parse::<u64>().ok()
// }
pub fn read_from_file(name : &str) -> String {
match fs::read_to_string(name) {
Err(error) => {
println!("Failed to read file {name}: {error}");
String::new()
},
Ok(s) => s,
}
}
pub fn str_to_i16(s : &str) -> Option<i16> {
s.trim().to_string().parse::<i16>().ok()
}
// pub fn str_to_i32(s : &str) -> Option<i32> {
// s.trim().to_string().parse::<i32>().ok()
// }
// pub fn str_to_u8(s : &str) -> Option<u8> {
// s.trim().to_string().parse::<u8>().ok()
// }
// pub fn str_to_u16(s : &str) -> Option<u16> {
// s.trim().to_string().parse::<u16>().ok()
// }
// pub fn str_to_u32(s : &str) -> Option<u32> {
// s.trim().to_string().parse::<u32>().ok()
// }
pub fn str_to_u64(s : &str) -> Option<u64> {
s.trim().to_string().parse::<u64>().ok()
}

View File

@ -1,27 +0,0 @@
input = open("input.txt").read().splitlines()
# line = current line that is being searched
# start = at what index to start searching
# for the first digit: 0
# for the second digit: right after the index of the first digit
# is_first_digit = boolean, True if first digit is being found, False if second digit is being found
# num_to_find = (next) number to search for in the string (line), starts at 9 decreases when not found
def find_biggest_num_index(line, start, is_first_digit):
index = -1
num_to_find = 9
while True:
index = line.find(str(num_to_find), start)
# decrease num_to_find if number is not found
# OR we are currently searching for the first digit and the number found is the last char in the string
if index == -1 or (is_first_digit and index == len(line) - 1):
num_to_find -= 1
else:
return index
answer = 0
for line in input:
first_digit_index = find_biggest_num_index(line, 0, True)
second_digit_index = find_biggest_num_index(line, first_digit_index + 1, False)
answer += int(line[first_digit_index] + line[second_digit_index])
print(answer)

View File

@ -1,34 +0,0 @@
input = open('input.txt', 'r').read().splitlines()
surrounding_spaces = [
{'x': -1, 'y': -1},
{'x': 0, 'y': -1},
{'x': 1, 'y': -1},
{'x': -1, 'y': 0},
{'x': 1, 'y': 0},
{'x': -1, 'y': 1},
{'x': 0, 'y': 1},
{'x': 1, 'y': 1}
]
answer = 0
x_max = len(input[0]) - 1
y_max = len(input) - 1
for y, line in enumerate(input):
for x, char in enumerate(line):
if char == "@":
rolls = 0
for space in surrounding_spaces:
current_x = x + space['x']
current_y = y + space['y']
if current_x < 0 or current_y < 0 or current_x > x_max or current_y > y_max:
continue
elif input[current_y][current_x] == "@":
rolls += 1
if rolls > 3:
break
if rolls < 4:
answer += 1
print(answer)

View File

@ -1,45 +0,0 @@
raw_input = open('input.txt', 'r').read().splitlines()
input = []
for line in raw_input:
input.append(list(line))
surrounding_spaces = [
{'x': -1, 'y': -1},
{'x': 0, 'y': -1},
{'x': 1, 'y': -1},
{'x': -1, 'y': 0},
{'x': 1, 'y': 0},
{'x': -1, 'y': 1},
{'x': 0, 'y': 1},
{'x': 1, 'y': 1}
]
prev_answer = 0
answer = 0
x_max = len(input[0]) - 1
y_max = len(input) - 1
while True:
for y, line in enumerate(input):
for x, char in enumerate(line):
if char == "@":
rolls = 0
for space in surrounding_spaces:
current_x = x + space['x']
current_y = y + space['y']
if current_x < 0 or current_y < 0 or current_x > x_max or current_y > y_max:
continue
elif input[current_y][current_x] == "@":
rolls += 1
if rolls > 3:
break
if rolls < 4:
answer += 1
input[y][x] = "."
if answer == prev_answer:
break
prev_answer = answer
print(answer)

View File

@ -1,19 +0,0 @@
input = open('input.txt', 'r').read().splitlines()
ranges = []
food = []
answer = 0
for line in input:
if '-' in line:
ranges.append(list(map(int, line.split('-'))))
elif line != '':
food.append(int(line))
for item in food:
for range in ranges:
if range[0] <= item <= range[1]:
answer += 1
break
print(answer)

View File

@ -1,45 +0,0 @@
input = open('input.txt', 'r').read().splitlines()
nums = []
current_num = ''
for line in input:
if current_num != '':
if column_index > len(nums) - 1:
nums.append([current_num])
else:
nums[column_index].append(current_num)
current_num = ''
column_index = 0
for char in line:
if char == ' ':
if current_num != '':
if column_index > len(nums) - 1:
nums.append([current_num])
column_index += 1
else:
nums[column_index].append(current_num)
column_index += 1
current_num = ''
else:
current_num += char
answer = 0
for column in nums:
column_combo = 0
if column[-1] == '+':
for num in column[:-1]:
column_combo += int(num)
answer += column_combo
elif column[-1] == '*':
for num in column[:-1]:
if column_combo == 0:
column_combo += int(num)
else:
column_combo *= int(num)
answer += column_combo
print(answer)

View File

@ -1,22 +0,0 @@
raw_input = open("input.txt", "r").read().splitlines()
input = []
for line in raw_input:
input.append(list(line))
input[1][input[0].index('S')] = '|'
answer = 0
for y, line in enumerate(input):
for x, char in enumerate(line):
if y != len(input) - 1:
if char == '|' and input[y + 1][x] != '^':
input[y + 1][x] = '|'
elif char == '|' and input[y + 1][x] == '^':
answer += 1
input[y + 1][x - 1] = '|'
input[y + 1][x + 1] = '|'
print(''.join(line))
print(answer)

51
sander/AoC 2025 Normal file
View File

@ -0,0 +1,51 @@
-- AOC 2025 - Sander
-- so for those wondering about how I run this Haskell code, here's the setup:
-- 1) install GHCup as instructed from https://www.haskell.org/ghcup/
-- 2) save this haskell file and your AOC input file in some directory on your computer
-- 3) rewrite the "main" function with the location of your AOC input file
-- 4) rewrite "print contents" in the "main" function to use the function(s) you've made to process the input file ("contents") from that day correctly
-- 5) run Command Prompt, go to the directory of your files (with "cd" command) and run the command "ghci AOC2025.hs"
-- 6) run command "main"
-- 7) if your functions are correct, you'll get the correct answer!
import System.IO
import Control.Monad
main :: IO()
main = do handle <- openFile "C:/Users/[your directory here]/d1.txt" ReadMode
contents <- hGetContents handle
print (doday1_1 contents)
hClose handle
-- Day 1: ...
-- Part One (correct)
doday1_1 :: String -> String
doday1_1 input = show (countZeroRotations (words input) 50)
countZeroRotations :: [String] -> Int -> Int
countZeroRotations [] _ = 0
countZeroRotations (x : xs) pos = countZeroRotations xs (fst (rotateDial x pos)) + snd (rotateDial x pos)
rotateDial :: String -> Int -> (Int, Int)
rotateDial (direction : r) pos
| direction == 'L' && newposl == 0 = (normalizeHundred newposl, 1)
| direction == 'L' = (normalizeHundred newposl, 0)
| direction == 'R' && newposr == 0 = (normalizeHundred newposr, 1)
| direction == 'R' = (normalizeHundred newposr, 0)
where newposl = normalizeHundred (pos - (read r))
newposr = normalizeHundred (pos + (read r))
normalizeHundred :: Int -> Int
normalizeHundred x
| x >= 0 && x < 100 = x
| x >= 100 = normalizeHundred (x - 100)
| x < 0 = normalizeHundred (x + 100)
| True = x
-- Part Two
doday1_2 :: String -> String
doday1_2 input = undefined

2
vicky/README.md Normal file
View File

@ -0,0 +1,2 @@
# Vicky's AoC folder
Welcome to my branch! :D

99
vicky/dec1/dec1.ipynb Normal file
View File

@ -0,0 +1,99 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "40aac862-406a-498f-8138-a93a3eca5aa8",
"metadata": {},
"source": [
"# Puzzle 1 of AoC 2025\n",
"Author: Victoria Ramírez López \n",
"\n",
"Date: December 1, 2025"
]
},
{
"cell_type": "code",
"execution_count": 97,
"id": "7545bee7-c72d-4755-a191-b0803ca31c11",
"metadata": {},
"outputs": [],
"source": [
"# Import instruction file\n",
"instructions = open('dummy_input.txt','r')"
]
},
{
"cell_type": "code",
"execution_count": 98,
"id": "87fab12e-84fd-4949-a914-ed722bd28737",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"3\n"
]
}
],
"source": [
"# Calculate passcode\n",
"dial_position = 50\n",
"passcode = 0\n",
"\n",
"for instruction in instructions:\n",
" dial_position = rotate_dial(instruction, dial_position)\n",
" if dial_position == 0:\n",
" passcode = passcode + 1\n",
"\n",
"print(passcode)"
]
},
{
"cell_type": "code",
"execution_count": 89,
"id": "7689f8ae-6d8a-4116-8188-7678bfac793d",
"metadata": {},
"outputs": [],
"source": [
"def rotate_dial(instruction = '', dial_position=50):\n",
" # This function rotates the dial based on the input from the set of instructions\n",
" # input: instruction = String\n",
" # output: dial_position\n",
"\n",
" # Split the instruction into \"direction\" and \"distance\"\n",
" direction = instruction[0]\n",
" distance = int(instruction[1:])\n",
"\n",
" # Calculate final position of the dial\n",
" if direction == 'R':\n",
" dial_position = (dial_position + distance) % 100\n",
" elif direction == 'L':\n",
" dial_position = (dial_position - distance) % 100\n",
"\n",
" return dial_position"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

50
vicky/dec1/dec1.py Normal file
View File

@ -0,0 +1,50 @@
#!/usr/bin/env python
# coding: utf-8
# # Puzzle 1 of AoC 2025
# Author: Victoria Ramírez López
#
# Date: December 1, 2025
# In[97]:
# Import instruction file
instructions = open('dummy_input.txt','r')
# In[98]:
# Calculate passcode
dial_position = 50
passcode = 0
for instruction in instructions:
dial_position = rotate_dial(instruction, dial_position)
if dial_position == 0:
passcode = passcode + 1
print(passcode)
# In[89]:
def rotate_dial(instruction = '', dial_position=50):
# This function rotates the dial based on the input from the set of instructions
# input: instruction = String
# output: dial_position
# Split the instruction into "direction" and "distance"
direction = instruction[0]
distance = int(instruction[1:])
# Calculate final position of the dial
if direction == 'R':
dial_position = (dial_position + distance) % 100
elif direction == 'L':
dial_position = (dial_position - distance) % 100
return dial_position

View File

@ -0,0 +1,10 @@
L68
L30
R48
L5
R60
L55
L1
L99
R14
L82

4387
vicky/dec1/input_dec1.txt Normal file

File diff suppressed because it is too large Load Diff

194
vicky/dec2/dec2.ipynb Normal file

File diff suppressed because one or more lines are too long

136
vicky/dec2/dec2.py Normal file
View File

@ -0,0 +1,136 @@
#!/usr/bin/env python
# coding: utf-8
# # Puzzle 2 of AoC 2025
# Author: Victoria Ramírez López
#
# Date: Dec 2, 2025
# In[49]:
# Read product ID ranges file
import csv
input_file = open('product_id_ranges.txt', mode ='r') # Open in 'read only' mode
id_ranges_csv = csv.reader(input_file)
id_ranges_list = list(id_ranges_csv)
# In[52]:
# Get invalid ids and calculate answer
invalid_ids = []
id_ranges = []
for id_range in id_ranges_list[0]:
# invalid_ids_range = find_invalid_ids(id_range) # For part 1 answer
invalid_ids_range = find_all_invalid_ids(id_range) # For part 2 answer
invalid_ids.append(invalid_ids_range[:])
sum_invalid_ids = sum(sum(invalid_ids,[]))
# print(invalid_ids)
print(sum_invalid_ids)
# In[18]:
def find_invalid_ids(id_range=''):
# This function finds the invalid ids within the specified range (part 1)
# input: id_range = String
# output: invalid_ids = int []
invalid_ids = []
invalid_id = []
# Extract the upper and lower bounds of the range
lb = int(id_range.split('-')[0])
ub = int(id_range.split('-')[1]) + 1
# Generate the series of product ids withing the range
product_ids = range(lb,ub)
# Find invalid ids
for id in product_ids:
id_string = str(id) # Convert each product id to string
if len(id_string) % 2 == 0:
middle_point = len(id_string) // 2 # Find where to split the product id in 2
# Compare the two halves of the id to determine if the id is invalid
first_half = id_string[0:middle_point]
second_half = id_string[middle_point:]
if first_half == second_half: # If the two halves are equal, the id is invalid
invalid_id = int(id_string)
invalid_ids.append(invalid_id)
return invalid_ids
# In[51]:
def find_all_invalid_ids(id_range=''):
# This function finds all the invalid ids within the specified range (part 2)
# input: id_range = String
# output: invalid_ids = int [[]]
invalid_ids = []
invalid_id = []
# Extract the upper and lower bounds of the range
lb = int(id_range.split('-')[0])
ub = int(id_range.split('-')[1]) + 1
# Generate the series of product ids withing the range
product_ids = range(lb,ub)
# Find invalid ids
for id in product_ids:
id_string = str(id) # Convert each product id to string
chopped_ids = chop_product_id(id) # Chop each product id into equal-sized pieces
# Identify ids with a repeating pattern
for list in chopped_ids:
chunks_set = set(list) # Convert each group of equal-sized chunks into a set
if len(chunks_set) == 1: # If the resulting set has only 1 element, the id is invalid
invalid_id = int(id_string)
invalid_ids.append(invalid_id)
break
return(invalid_ids)
# In[33]:
def chop_product_id(id):
# This function chops a product id into chunks of equal sizes
# input: id = int
# output: chopped_id = [[]]
id_string = str(id)
chunks = []
chopped_id = []
# Find divisors to split the id into equal-sized chunks
# (aka: how many ways to split the id into equal-sized chunks are there?)
for divisor in range(2,len(id_string) + 1):
if len(id_string) % divisor == 0:
chunks = []
chunk_size = len(id_string) // divisor # Determine how big a chunk would be
for i in range(1,len(id_string)+1,chunk_size): # Chop the id
chunk = id_string[i-1:(i-1 + chunk_size)]
chunks.append(chunk)
chopped_id.append(chunks)
return chopped_id

View File

@ -0,0 +1 @@
11-22,95-115,998-1012,1188511880-1188511890,222220-222224,1698522-1698528,446443-446449,38593856-38593862,565653-565659,824824821-824824827,2121212118-2121212124

View File

@ -0,0 +1 @@
959516-995437,389276443-389465477,683-1336,15687-26722,91613-136893,4-18,6736-12582,92850684-93066214,65-101,6868676926-6868700146,535033-570760,826141-957696,365650-534331,1502-2812,309789-352254,79110404-79172400,18286593-18485520,34376-65398,26-63,3333208697-3333457635,202007-307147,1859689-1936942,9959142-10053234,2318919-2420944,5142771457-5142940464,1036065-1206184,46314118-46413048,3367-6093,237-481,591751-793578