Compare commits

...

31 Commits

Author SHA1 Message Date
Bram 3988ef426f Add benchmarks for Vicky on day 3 2025-12-04 17:58:25 +01:00
Bram c73a2ea9d6 Merge Vicky's branch into benchmark branch 2025-12-04 17:41:14 +01:00
Vicky c53aac4bd0 Upload dec3 code.
Part 1 only.
2025-12-04 10:56:39 +00:00
Bram 9d486ddccf Add benchmarks for Bob, Bram & Brechtje on day 3 2025-12-04 11:32:52 +01:00
Bram ba2815f1ff Merge Brechtje's branch into benchmark branch 2025-12-04 08:00:31 +01:00
Bram 84fe03a625 Merge Bob's branch into benchmark branch 2025-12-04 08:00:01 +01:00
Bram abe70e2c25 Merge Bram's branch into benchmark branch 2025-12-04 07:59:28 +01:00
Bram 32242a43b9 Major day 2 optimization 2025-12-03 23:59:56 +01:00
Brechtje van Gessel 94e87bdae1 clearer variable names, added comments 2025-12-03 23:53:42 +01:00
Brechtje van Gessel 561edcc1a5 day 3 part 1 solved! 2025-12-03 23:33:48 +01:00
Bob 4e84f8a876 day03 2025-12-03 22:43:16 +01:00
Bram 94201f6868 Prepare day 4 2025-12-03 22:14:38 +01:00
Bram 3be30b2a14 Add updated .gitignore + benchmarks to Bram's branch 2025-12-03 22:10:54 +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
Bram 3faee72c5d Optimize & simplify day 3 2025-12-03 10:56:33 +01:00
Bram 4ae1fea299 Fix compiler warnings 2025-12-03 09:17:36 +01:00
Bram 0fd6e45b5e Add day 3 (rough version) 2025-12-03 08:57:43 +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
Brechtje van Gessel a92e05928f first attempt at day 2 part 2 2025-12-02 21:01:09 +01:00
Brechtje van Gessel 5a814f6c47 day 2 part 1 solved! 2025-12-02 18:44:07 +01: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 a278f98f4b Add day 2 (rough version) 2025-12-02 09:20:53 +01:00
Bram 64ba806ee0 Prepare day 2 2025-12-01 11:43:13 +01:00
Vicky dd73313655 Add vicky/README.md 2025-11-26 08:49:40 +00:00
63 changed files with 14074 additions and 197 deletions

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

56
bob/day03/day03-p1.py Normal file
View File

@ -0,0 +1,56 @@
import re
class ExitFors(Exception):
pass
def get_battery(bank, max_jolt=9):
for max in range(max_jolt,0,-1):
for candidate in range(0, len(bank)):
if int(bank[candidate]) == max:
return candidate
def get_joltage(bank):
joltage = [" "] * len(bank)
# Get first battery
jolt_1 = get_battery(bank)
# Second battery is after the first, unless it was the last battery
if jolt_1 == len(bank) -1:
# Get battery from bank ...upto/before jolt_1
jolt_2 = get_battery(bank[:jolt_1])
else:
# Get battery from bank ...after jolt_1
jolt_2 = get_battery(bank[jolt_1+1:]) + jolt_1 + 1
joltage[jolt_1] = bank[jolt_1]
joltage[jolt_2] = bank[jolt_2]
joltage_str = "".join(joltage)
joltage_str = re.sub(" ", "", joltage_str)
return int(joltage_str)
def read_input(filename):
banks = []
for bank in open(filename).read().splitlines():
banks.append(bank)
return banks
# filename = "day03/example_input" # 357
filename = "day03/input" # 17092
banks = read_input(filename)
total_joltage = 0
for bank in banks:
total_joltage += get_joltage(bank)
print(f"Total joltage: {total_joltage}")

57
bob/day03/day03-p2.py Normal file
View File

@ -0,0 +1,57 @@
import re
def set_battery(bank, joltage, start_pos, end_pos, batteries=2):
if batteries == 0:
return 0
# Get high-low battery, starting from start_pos till end
for level in range(9,0,-1):
for pos in range(start_pos, end_pos+1):
if joltage[pos] != " ":
# Skip to next if this battery has been set
continue
if bank[pos] == str(level):
joltage[pos] = bank[pos]
batteries -= 1
batteries = set_battery(bank, joltage, pos+1, end_pos, batteries)
if batteries == 0:
return 0
# Nothing changed
return batteries
def get_joltage(bank):
joltage = [" "] * len(bank)
set_battery(bank, joltage, 0, len(bank)-1, 12)
joltage_str = "".join(joltage)
joltage_str = re.sub(" ", "", joltage_str)
return int(joltage_str)
def read_input(filename):
banks = []
for bank in open(filename).read().splitlines():
banks.append(bank)
return banks
# filename = "day03/my_example_input"
# filename = "day03/example_input" # 3121910778619
filename = "day03/input" # 170147128753455
banks = read_input(filename)
total_joltage = 0
for bank in banks:
total_joltage += get_joltage(bank)
print(f"Total joltage: {total_joltage}")

4
bob/day03/example_input Normal file
View File

@ -0,0 +1,4 @@
987654321111111
811111111111119
234234234234278
818181911112111

200
bob/day03/input Normal file
View File

@ -0,0 +1,200 @@
2235324222232244322422312234251333343425243363443152244111122632336242225745433452452451332445546443
4342633549426242625533823432244459548433412443246235533216334436553544934221624474453562462242374424
8434422643334243334243543423324744383442433444345133334323443723387546342444334386334543315426294343
3314333333333253227333289433334173324336435282333332374344333346362333436223333531247332233332431333
2432233222232224244344214455331424832252285224272831524326258455142222732648222482237235275222221622
6456555534646565564173459654354446546674345456432576443336544564465623793536365563494844343586266956
4922331489448743346893584377735442834632443434373231124434247962234578473993747531534353225262874382
4329634636558644535534455549345256353469443795539452657625226416756735576575463654843527584644953254
2454396282342313233436423353433434546123342334253853234273545734632444263222242142542533335242531345
4635522634347741234563672633543582877478744697226363535745728883684345552215423665654453566356374355
2224223422282212222122522222221222223222224422214224332223272212322422211242222251213213533222418262
3333323433222542122533332343333416333236333137213354323639622333222322323353633143223233386462553523
4464345474367222662273337653635454976376733275452394774336256334698437588364442363336256726342366843
1222331523332222323221222212323322212432332123113224332112226241322122233222221222121233222323322226
1144235573732262335565652436461426436275664241144242414324425444422128642454423642624133252328534342
1524344342292446366422332163232524143645435264413335635425264332564221331257424467433633431536313333
6522282332222324724233223129622584622214234561222231422239243441433122222452122432232132223952622232
4155352555244325535343342355654243343155236334354554243485257534253338436555484543535584532355453534
6468655452675256353555445144743665645455543555644546754456447542457465444555555154564425555841855936
5222222221622121123264422214222252212213512212822212772221226222262272222622222742417215282243632241
5434223163254553454522553225547245512224333544425332549152425254451236456645423241323554544456344256
5424526293254361243635554415382323322225524343233622554332533455434433517232355631244233433432432528
9321283728428452622327222344422172212235228213222223255626526312275215522352294117275122222222822241
2298345455532222354144482748685223534841432853256544231754233422253376575254556214433252512786148479
2122424412272742122222213122282243125211272226462222411231221252623221242221214261225722411452243222
5427434212244142253243242124231221243224222222422324222143223242124123112124433231212242423264262123
4454545664435434354543554374342177456567473643244355455344466354536785443248645467344424554457666475
2322532242222322244221422243112132232323223142431222332422232122212343452232321434225124243222222322
2622164222137423255122752492222422661893325225822224443223222823282223225272452222282422222244332225
6354556555622355255524555375554567565654555543444564437575555375553452544564535445345525555533475554
3221342522312282432224432443242223132122241223223121323343133414421323132214322222443262733312322232
3224632342835254223232221243242332233232314323433156163393433112242256232276356423322232221423342323
3222332512121224222222223221212322222122221222222322223222323122329322252213422223253122222253114232
4222234233323423433333153233232336222453343547223172433222325534134432434213234222313144534443332335
3221222123132222112152221122312224433223311231222122131322222222223322222224222222231213321222212221
7326246135345245521424815232325722372711252462712232438342291624862323243242265182332123442233739437
2433733355513566223342253543213465528552533226334364352333443355213433253157534664352433564322344123
7756675354666543363676593566536546956757565561673943631664446365744655535285357653653525674462274967
4323333334233333534333323334343333342233333433333243333432333334343323334332332336344335433522432433
3333332543434532342252354343243423322441332541442534643333423124326134423661635334224124233433423174
5235323335232417222541642263122622223822242263255324463356321141524121515424427193745222453222141334
5886868774555746344643885473376676884344675734948355455843433537685787785745645786674574548985575575
3547866352236644664573227563164454434563474557214356536355366554436444344465743441774145553622545244
2454542445455454335434451454454434434474452533324232524334341443363345334445444333733546444434534343
1232131114123623332241132222224225224222232263211324231213315372222524322142233412121735172623122225
9267262423528474362245832533348735374544892892233421337236372142334223347313276322562331634332122245
2223175344331222122123222233314252237251132723333321213232122532223222624333233312323452332222123222
2313333333355313653336333333333332633333353253333336633333433234533823365342433553333233314344453153
5323433341124332233332513233244283823243445365333343562232342421323322443533255323422433243333441213
4525333422333222464324322731134244133112262362226244312425212143324224123334221393224333221248233213
7543744772447787783677676778677928435645714765755486767764556624553564714656687537567755747764638674
2363513321125441315322124323334423212227323613125424432242424252344234422122322232272123122222224142
2433513143732523833433251632623433453233348414253337543422233332389863834322243443533343343334333642
3323232223343324263335332467366733331323232373322232764343323323327433276326263333243343332331333124
2221322221232233122232123241242222342222252222435242242235122222222212221234126622222213214112322332
5536354554532533744275244143353333343253443444523343432646224933253565432536554363555645524534444536
2422212112242637521222122322122232273272222221122322222222221212322232222231222223223211211223122222
2222422322332345343223324223424232343432223234431232332333641334432433232423442342433351223342423222
2247532227235434222242212232415333444344424544522422142523224424524314424432343332443424412342122424
4495423343134452554163238453543152226335335553251337422195521742257135235734235935152333543434533974
2222222221232222233321522231313213222122222232143212232323222232323123122121223232323321221221212233
2433131322322136132325123312222123535312232322121252233214355225323225325567115133332223222232532513
6648343426636674545466234347476676446534463263723454424843573354375563255343674256458722563524649566
2281323233549441673264334423352265724433232443462436234482228223382337144646537332332774633432222535
4221422232832221122222222222212211222231422122232221122442432122232122222235221232212112322212224312
6122122432223246224421243724227262244522225225527332232343222122322612123224241252242213442821732312
4542535343233343543352252333733653243422323323336733274455414363434474232432334333338333433373335953
2212232228124222242222311222432228222182442221131222222232512222212222232322122321213722142131722222
5485269856369364744625587696844859753855866824665868852663763638646166844169858473676295672166634584
5555564454655565455764564539653655535468665556646655435564556546755555755465666659656563937856465517
4522122123153322322322233226213212322324222247327212124125222822221222222272221222222222217412162221
1222221112211322132212222223221222422322312232222222223223123123222222222121222212223222323223222222
2233242121223121432524443142133422323232133215212342342933211323424132124231252224322233342432211244
5333333131332333333242245322334414354233122132221234333341322334223235443234232222413334133345433243
2132221453216322222152624232256227524322224355353322223432322132175224932664217225425632223222242243
3232213335324743333353335343254345135373334452213325324554333333323222355336332313233125432553353362
1232422222223222421122212123222232332212222312213122323222232221323222222322122433122432221221322223
3234334335233363333132333333233324333323335332314423222223341334328343214371232343323333334531343323
2322222222122322621321121242231122222122212122222222222211223222624122221222122122312122212135223322
4854723266855228321661642462484112234275424515255353443814315282216236251423522237547317242231288321
3366737366573633437447337543455753734345833464369237273644354443494443464735434534664746433343544446
3622422232313342432434333437534132262444112312231222233523242234233223432363532141723222432262322342
2238644233222253453521172222222212222222845226442223225122842535321151224622222222212526152522231633
3434227323442221482272722224864332533622244122411727544624334414122755624122336414672452761364564231
3235336354522334325545447733533362368545363643344435355623436335642634553423375233235533525335535355
2122322231232321222224231322522222272232262232222275325166252242222332262224261322225122612212212225
6431766427244447244444482435434325543313463449245454432874552543553444433235137433577322453253343225
4233312412221224424421232221332223422632222132423311514222212322213322222513613432423222433233134321
4333236242442222161243225636324232222443221221424221412222262224232214222342314224222224422324222642
9425731462535333637343153525232843823112558577389452666143422343432323342223261362531324364422224464
4443545335253335222422324353392453542133343323334344223157436233424653434241334234342434325553633142
2112222221224332242222231223232222222231222324212432222313221141222224242222222222332222122122222232
4424448253346263442196232222338536343325363235232557221334531732464492533223332333336223239326142324
8273382745437262112247321123335424321325418812532342233762371571223344338246259642223244332577137353
3643568577345257496756756647525657264356953642665544665536243455576758556265855656455638556557447456
1146336123332555645154645654113124462456216222244452524344544156456362131466166412265552465645212789
4423323253336333325332322323313332445332433333313335333423333632243333433633323333333323333333443134
2232134332422232423542222143312222122222222353445552242222223223525215531343432223341441221123512221
3388563352665326335685838248265472864333358125317224448577465733132743353843316835665356176322388136
4343126222424222332332142623221443421524232214344222122127242453422215443442122223433432134242511245
4232232741294227325232144222245224222453331332253552442322534342142233236432341432352242322722222232
2333333433334213433532343333633323752224232523233623343133342333361353222763352353427443223233325222
7622742384556724442694331499682333348332669372723424641787543253287429353635123812942325494425839212
3443431633463243334354333433323321334234733344333333343445321333323243253224224443443383423231237361
3322233123332423333224433325432322723344542432332223313222253262223323122342332323242214533355224211
5536245414643455463451243331555353532554453245443432455345394352454353455595543534364352633534455334
1337383323677353333328543446384362752123322237357487973446233239316472321236634427322223357512739785
4245442543154463555532446444545444324444338453344555556634442844574444624544544475554344344575445445
5227622228234266632265122722221242224652652322872437722222828145374243141871277224277276227622772122
2445943238324523263556566333143491837242357241383752458436144244234431645366335332333322529874941472
6542365637356542343523933333632585824545416284422325632355835215753387354465654353684647442635352646
3567535555645454555555455565546675844544446535558433555455644556265546564553457545344646565544653555
2332222222313444212222122222212313222213715132331222322433255332233222533222232352182231223442332122
6242124233233222232131237332323326323323312334224832632332214323223232333322224231231331223333332132
4473222193444229636394274424547559743225364543465343657754664282675734446284295222251874532536732413
1622212326441562522272294367261612532425124251672424643425128334344652342222955798276224743651883432
1374362333744223664454634866483344447343432633576333346446333146464528664536334372264254653227654645
1353333335532221323213332323433323323532424113212262313223312221223363433334324433224624323332232133
2252123372322223322232112223432317232122325223212233423233225222333242343433335232333211321224433242
5233342233222226246652432233246332633215515611348646321252524221323552733213121126332465263322222444
3434442332153513353355444524532134344445352555244132443542243443242434345453544334663223344433436155
4624444433424434337447343443445444434442444432435454442224344542334482442514353444442242446244225643
5622337382723222412242238223933626255262515662526534472532552294842282213225525422411232342122912162
2792772122185564465655562269264545557358525657762127234667785274447842613355354527646138745738359454
3246465343246123476722432534224243441353352634423334432444442644223453641633344463456335434444343354
4443233423224543333233333434544442343463233462444374241224433224326221242324321444242473422344434342
5423137443343444411335233742733833373344544374622435133453353333333342336332411343335255434343543111
4563632453226354453425553264325352346626354553264455545453284274744245255444525343435453763425432446
2233245222335422343322212442152332323322953331233312344232321423332322111221212232122431333222262242
5562945766545795582764287247375738646786596434467544855546632566873675287544754451579464523496455865
5224262222123223132213192123212217262222311221224211232232131222223222222232212252423222612221321122
5144422522153311244522222222221324522224522332252523435274252122758244222245222421252322233325162335
1424212487752147436667259652374126573126217453457523224213227566322242222373234422626252157711724692
2453423224552435423112223453332242243525221242324422221522412322426233472333213824242132233242314524
4223433321344422321424342224524212223325242423243243124233242422432222225225143512232225332342243322
3344144322124124441111231222211341313141112132234144341421443243111424334124413112412432113341156789
3423733214438543343234153433482322333217252333324224435444324423332244233433242333134333241222222223
4253243123253153326232822254244222331452632338222222122442222123219543224333832235111133331542232322
2222323221342322152225421332342625222222524243223435232722253225352322532322527172221245221452222222
2222238322211222122232332224411243222621522221112221132312522512212223422223222122222222312242422312
2254161436222322122222425521212262272251452423261221614322211373644122542524212551242442525222724161
2252224352242364313325242232222242422131412146343242341132533342212224424221341442442314234232242312
2539422252222352725272376321463262533245722224452315223313347473135234143342224222543343242533233436
4266311282672157315161786415787446166768175727684645385258652611658825512185533435733352237752211459
3382422412323362332533332233333433323433233233223322324252133453314431334332436132323322222241252323
2212422521212222111222142153112622212222223254222132222222242212122222252222325222122223122222232242
2221232364223124333225322322233322222322342213422322213212322333322434223512112322243231225323522434
3732352549634766264297143323142389237291252259781845622492659412246463147653449541262628265764234623
6554245554545453445445455954573458554345511344555443555444465255312455545555535544444434433333355394
3513233822424124131312922122432362422443333522324257432153531243423274223233431222252332452542312472
2535435265127353622262465444756254353338357546326631366433264475453353342474344864652365645463535534
2222211212112232322322223222123423232122121122341322227231222222211221242122312122223221221322222222
6555553573344343355444645555455246555545426635555364435465693655333542555455353563645664563455555538
3336723439433762342243436534344473653364441424424224434443333444453443346344444339414354343544443444
1322242323234322122215112223224222122323221221211431321222114221332452422224213212321232332112225243
2558256544524445335535543454343432434455433564534453452553445552335535335143243353454464444355575545
3356652564327455364353263324336344272412622553446354225557452323244233232525563625665455224224232335
6273333233322222322763433233239621452263335132233252322332233323345223333255132222533463245242332333
3321314222334222233333433322333333233232332343222333332311433432322322322333323233323313332223232443
4321323324142522521243122328313152318236133123252263252324337143532263822723332233222431323338235212
2421143323742373422474351343344414644632221352224112446231242422447322222233313325522224432434453324
2222226223221222231232223322322225131111322332243232322322325152323322332134122432522514142223223213
3336311124323433333333633441322122333232382326762333343136343121429332313233645333424333322263233332
4122223425131211313532221211432344251543123544533321522354422524542152223414144352234434322344226789
3753374431324644254253363333368232333322333343353264622233324517434354224213313363352531333252231343
5447424435544446345633387344444344454444749634754443444559446358453336844244864383444444584354432668
6322235363222463221216574322226373252452613323151424813243563523222137232235224652255522335355342226
2233252525316222242232222522223222722232432211222232333224322223653532322232612123112355222228123322
2226243423352324641332242443434224234422224423214247212412343444215334233423234134282212333322414624
5453265556564498465453555553654565445515554454655545653545355539654555555956555554225454354444555454
4433253234212342232434426224442336432533224442122341228444214222413415232372231232264333333424432334
2323133232333221212222334323221234512344223323444332123332233272323332133243332213212333223321532263
9349519328233523239438423843613896993215448258317133676388457727546377598132829434333513373533772423
4666645656676966776775567597577964575666766658456577767676736646653665553545675763566785696465684676
3333744343334355543298887212444294634472533533392532744343439433462444452344633153433463464664424367
7651211116242563411746522426715414643134265413742514344277775633277527652747351435432146663611323589
8337354444445333444444433345434424433433543342354754435434335434253224533422163434333327343344334653
3322553321233233345533113137333335332353333354234545134333334253743542539333233852332332533334363333
4322331141263364332322422832413334322422412122223222224412442143115226221233242421315528425623232331
6345341544334342374172244444544452324334644436442245564533244344464446455233545434464442142444645443
6564593454533545336695968366692269894591267363955467455458344474374622652552676273977443855874883692
2222212222211222222112212212422122222121212122311222421222112212133222221122322212212422212221221212
3233152631337353223322342261437613334633132322333133221433244346324323325334333232463334233262722343
6626333373332133233334562512331344335364331251333233424323243633373635334324255223243443334324333333
2333841322332225352522123742223272323613232333542322222113332233222323232313722233339225221234332223
4557533355362533443313555257414234557533343224255435533445325432352644233634333734735138443433548225
2223322332213632234312322324522755623325212234222213343222212223321313222232332223142222232222163132
2122222322251222312122232222232222723222222321252323242233222342222122212217212222332222211212342233
2615245472552234243474572652243722753243233635223225342223222721642135221132214425222474252523222335
4345443532441442344443544545333433426444243434733243432734345445254424333736463354633542422444444323
2322224232123433233333242325433133133322743463233433243232173533322434313433333342343722333244323334
4422145234442334242455145125543424551223943225232242494422254314553645442334426343252214413943254425
4465532384353243537252398442534145213673443322242656552543935464556315467556543186554424322356523243
1222232233374372323232323323242343362123722422312632223332213312322247343423223323322241341242121313
2211135222282222212222221222222211222642422122222214142122222432432212222211352222122622441222525121
4144272233134434423296444643224431442442323443441442113224242324514374444664743713233133443322322233
3435364346335235433434536431464642533325336432334433324343343348345334335513343353573432462435433445
1322332232123333231122235282322332132233243232231243253522221182232623322312232223332213122212222333
1332242223122322223432422223223222231321422232323322315323254332421213323312211322342222121233222222
2122222222222321221222211222242314232222112262321222232226222422222212222222222222222221222242222212

View File

@ -0,0 +1,4 @@
811111111111119
234234234234278
818181911112111
987654321111111

File diff suppressed because one or more lines are too long

View File

@ -37,3 +37,9 @@ 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.

View File

@ -6,4 +6,16 @@ hyperfine --warmup 5 --export-json ../bram/benchmarks/data/bob-d01-p1.json \
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"
# Benchmark day 3
hyperfine --warmup 5 --export-json ../bram/benchmarks/data/bob-d03-p1.json \
--runs 100 "python day03/day03-p1.py"
hyperfine --warmup 5 --export-json ../bram/benchmarks/data/bob-d03-p2.json \
--runs 100 "python day03/day03-p2.py"
cd ../bram/benchmarks

View File

@ -8,4 +8,12 @@ cargo build --release
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 "for run in {1..100}; do target/release/aoc2025 2; done"
# Benchmark day 3
hyperfine --warmup 5 --export-json ../benchmarks/data/bram-d03.json \
--runs 100 "for run in {1..100}; do target/release/aoc2025 3; done"
cd ../benchmarks

View File

@ -10,4 +10,24 @@ hyperfine --warmup 5 \
--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 ../
# Benchmark day 3
cd 3/
hyperfine --warmup 5 \
--export-json ../../bram/benchmarks/data/brechtje-d03-p1.json \
--runs 100 "python 3-1.py"
# hyperfine --warmup 5 \
# --export-json ../../bram/benchmarks/data/brechtje-d03-p2.json \
# --runs 100 "python 3-2.py"
cd ../
cd ../bram/benchmarks

View File

@ -17,6 +17,42 @@
],
"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": "bob-d03-p1.json",
"author": "Bob",
"lang": "Python",
"puzzles": [
"3-1"
],
"runs": 1
},
{
"name": "bob-d03-p2.json",
"author": "Bob",
"lang": "Python",
"puzzles": [
"3-2"
],
"runs": 1
},
{
"name": "bram-d01-100.json",
"author": "Bram",
@ -27,6 +63,26 @@
],
"runs": 100
},
{
"name": "bram-d02.json",
"author": "Bram",
"lang": "Rust",
"puzzles": [
"2-1",
"2-2"
],
"runs": 100
},
{
"name": "bram-d03.json",
"author": "Bram",
"lang": "Rust",
"puzzles": [
"3-1",
"3-2"
],
"runs": 100
},
{
"name": "brechtje-d01-p1.json",
"author": "Brechtje",
@ -45,6 +101,24 @@
],
"runs": 1
},
{
"name": "brechtje-d02-p1.json",
"author": "Brechtje",
"lang": "Python",
"puzzles": [
"2-1"
],
"runs": 1
},
{
"name": "brechtje-d03-p1.json",
"author": "Brechtje",
"lang": "Python",
"puzzles": [
"3-1"
],
"runs": 1
},
{
"name": "sander-d01-p1.json",
"author": "Sander",
@ -53,5 +127,41 @@
"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
},
{
"name": "vicky-d03-p1.json",
"author": "Vicky",
"lang": "Python",
"puzzles": [
"3-1"
],
"runs": 1
}
]

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": "python day03/day03-p1.py",
"mean": 0.0660799919,
"stddev": 0.025562380847174715,
"median": 0.0548976352,
"user": 0.05923819000000002,
"system": 0.0061979943999999985,
"min": 0.0430741142,
"max": 0.13645839420000003,
"times": [
0.0580094412,
0.0479218002,
0.0467777452,
0.0487909782,
0.0568163352,
0.054945985200000005,
0.0873796792,
0.1266311662,
0.0563937692,
0.060725026200000004,
0.0476747372,
0.0474197492,
0.048355934200000006,
0.0469648582,
0.0478248612,
0.04853774420000001,
0.04466234720000001,
0.0448723452,
0.0439995782,
0.05148014120000001,
0.054453686200000004,
0.0720802272,
0.09020339620000001,
0.1001945402,
0.09638806820000001,
0.055358244200000004,
0.0468372552,
0.0606053892,
0.0638592332,
0.0922908422,
0.10698714220000001,
0.1044674492,
0.05800262120000001,
0.04659443020000001,
0.061099284200000006,
0.0548101342,
0.0468830492,
0.0657145312,
0.07448295020000001,
0.059065898199999994,
0.0443573832,
0.0430741142,
0.0438149122,
0.0459145032,
0.061378683200000006,
0.0728903592,
0.0977631482,
0.1137083432,
0.1248132872,
0.04906956820000001,
0.04501981120000001,
0.046184610200000004,
0.0436409282,
0.054372100199999995,
0.09953690920000001,
0.12195182120000002,
0.0703806292,
0.1103826442,
0.1260261212,
0.0464217982,
0.0463901332,
0.0617853892,
0.0548492852,
0.044766891200000006,
0.0536407262,
0.11619950120000001,
0.11864129820000001,
0.050199670200000004,
0.0488492802,
0.0482894502,
0.044182603200000004,
0.0452517732,
0.0507959392,
0.060989947200000005,
0.0620729822,
0.044499067200000006,
0.051901206199999994,
0.0526471062,
0.0627863622,
0.0728570552,
0.060794447200000004,
0.0469039242,
0.0971304202,
0.13645839420000003,
0.0816798682,
0.04396929520000001,
0.0442168822,
0.04408973320000001,
0.0535603102,
0.1162714572,
0.1043759072,
0.12440874920000002,
0.04929632120000001,
0.04931024020000001,
0.0634268662,
0.05277431020000001,
0.0690710262,
0.0876780362,
0.05742365320000001,
0.0462994122
],
"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 day03/day03-p2.py",
"mean": 0.09414321873999999,
"stddev": 0.01832509350311759,
"median": 0.08736366594,
"user": 0.08812937,
"system": 0.005363350000000001,
"min": 0.07237158344,
"max": 0.14640847944000002,
"times": [
0.08058291244,
0.07628245044,
0.07969654144,
0.09520080544,
0.09930194044,
0.07825368544,
0.08392984844,
0.07737118043999999,
0.07788930944,
0.07749630844,
0.07952176043999999,
0.09787982744,
0.08150873044,
0.08176495044,
0.08633617744,
0.10993066344,
0.07870264444,
0.07887313044,
0.11759371244000001,
0.14640847944000002,
0.07996222643999999,
0.09731879943999999,
0.07707701444,
0.07385610144,
0.08259913244,
0.09680778844,
0.11890589244000001,
0.08543212844,
0.10530924944,
0.07660466744,
0.07237158344,
0.07377316044,
0.07496567443999999,
0.08222708044,
0.11440945644,
0.12379463944,
0.08831812944,
0.09060156143999999,
0.09417247944,
0.10397773444,
0.07700830344,
0.07477282644,
0.07389806843999999,
0.08066847544,
0.09046442344,
0.11788687244,
0.07385357844,
0.07357571044,
0.08391386544,
0.09809230144,
0.11828182144,
0.11357936444,
0.11709032343999999,
0.09366015844,
0.12241708644,
0.08967856644,
0.11136426544,
0.10635690744,
0.12570409044000003,
0.08240299144,
0.08341971044,
0.08110020844,
0.08025836344,
0.07834463644,
0.07356606644,
0.08846380344,
0.11980265844,
0.08049780844,
0.09870591944,
0.11650581444000001,
0.10046443644,
0.09956565044,
0.12974481444000002,
0.07494186343999999,
0.07891511344,
0.09839348544,
0.11864865944000001,
0.12580707744000003,
0.11363200844,
0.12271954944,
0.08420987944,
0.12219339344,
0.11876301444,
0.07576832244,
0.07380642143999999,
0.08069492144,
0.09729451344,
0.10398245644,
0.11655304443999999,
0.07787526644,
0.08640920244,
0.12098887044,
0.12086899544,
0.11050377944,
0.13328684144000003,
0.09596151744,
0.08029424943999999,
0.07421061644,
0.07551346744,
0.07996589343999999
],
"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

@ -2,114 +2,114 @@
"results": [
{
"command": "for run in {1..100}; do target/release/aoc2025 1; done",
"mean": 0.10949902425999998,
"stddev": 0.01303120138107424,
"median": 0.10794122648000001,
"user": 0.0481385,
"system": 0.06004530999999999,
"min": 0.08743557148000002,
"max": 0.14346140548,
"mean": 0.21164170808000005,
"stddev": 0.056955047683642006,
"median": 0.24140312996000002,
"user": 0.08617460999999998,
"system": 0.12323376000000001,
"min": 0.09427125596000001,
"max": 0.29016765496,
"times": [
0.10262904248000002,
0.10309315948000002,
0.08788191948000001,
0.08788880848000001,
0.08988906048000002,
0.08751818448000001,
0.08957111248,
0.09758415848000002,
0.09701446348000001,
0.09691613148000001,
0.09622675148000001,
0.09456499148000001,
0.09579022648000002,
0.09444151848000001,
0.09508792248000002,
0.09606605248000001,
0.09695228048000001,
0.09945660648000001,
0.09628507748000001,
0.09672642548000002,
0.09634512948000001,
0.09588621348000001,
0.09470692948000001,
0.09532162748000002,
0.09455080948000001,
0.09497292148000001,
0.10120339848000001,
0.11154805048000001,
0.11532427548000002,
0.12480157548000002,
0.12592739948,
0.12507496648,
0.12549518748,
0.12522092848,
0.12732470448,
0.12790656448,
0.12489098348000001,
0.13339627348,
0.10624044648000001,
0.10724894148000001,
0.10669420748000001,
0.10763329948000001,
0.10534154348000001,
0.10543322348000002,
0.10665542748000001,
0.10487852848000001,
0.10716879648000001,
0.11600640648000002,
0.11622806648000002,
0.11648707548000001,
0.11719899848000001,
0.11843976248000002,
0.08857608548000001,
0.09061829048000002,
0.08743557148000002,
0.10892493048000002,
0.11079558148000002,
0.11606146848000001,
0.12125704848000002,
0.12159368348000002,
0.11949176648000001,
0.11928547748000001,
0.12190114648000001,
0.12102119648000001,
0.12058027548000001,
0.12061425148000002,
0.12009168948000001,
0.12136069848000001,
0.12952496048,
0.09928884548000001,
0.09773379248000001,
0.09590983548000001,
0.10297853048000001,
0.11318080748000002,
0.11342295148000002,
0.11455993448000001,
0.11295701548000002,
0.11299484748000001,
0.11239145748000001,
0.11219660648000002,
0.11406977448000001,
0.11238566648000001,
0.11289772048000002,
0.11166642748000001,
0.12329825748000002,
0.12529479848,
0.13912101548,
0.14346140548,
0.14263528748,
0.12373552048000001,
0.10561196548000001,
0.10513752748,
0.10701318248000001,
0.10513885148000002,
0.10542516148000002,
0.10548880248000002,
0.10595660348000001,
0.10824915348000001,
0.11516850448000002,
0.12826149748000001
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,

View File

@ -0,0 +1,218 @@
{
"results": [
{
"command": "for run in {1..100}; do target/release/aoc2025 2; done",
"mean": 0.31470294114,
"stddev": 0.03199635516413443,
"median": 0.32647921220000004,
"user": 0.07126165999999999,
"system": 0.24127882000000014,
"min": 0.2110023297,
"max": 0.41121181170000004,
"times": [
0.28789600470000004,
0.29233324270000005,
0.30447699070000006,
0.30604592070000003,
0.2980340227,
0.3042085447,
0.31601446670000005,
0.3013712217,
0.30324271770000005,
0.32785871270000005,
0.31156347370000004,
0.31208932270000006,
0.41121181170000004,
0.31799863570000003,
0.33992077270000004,
0.3369579147,
0.32291744670000005,
0.3400554397,
0.3373144127,
0.32988819370000005,
0.33633534470000004,
0.32649490470000003,
0.24973634970000003,
0.2379149197,
0.29469709670000005,
0.28634381670000003,
0.2975846407,
0.24994015970000005,
0.21708724270000002,
0.22108192570000001,
0.22381864770000004,
0.26313973770000004,
0.2888522747,
0.29970076370000004,
0.30172343970000004,
0.3051582647,
0.3022762097,
0.30299157070000005,
0.3143551627,
0.3003338387,
0.3045328997,
0.32734090270000005,
0.31374024070000006,
0.3149945357,
0.3232337457,
0.3146408217,
0.31715429170000004,
0.34547788170000004,
0.32486034370000005,
0.32440604970000003,
0.3452610607,
0.33209796170000005,
0.3268754427,
0.34545075970000005,
0.3295807727,
0.32884609670000003,
0.3455743927,
0.33288479270000004,
0.32795059870000004,
0.3365149297,
0.32855343470000004,
0.33339330570000003,
0.3473504217,
0.3321817737,
0.32830522870000006,
0.34760668070000006,
0.32824177870000004,
0.33336813270000004,
0.3395041267,
0.32442966170000004,
0.32838544070000003,
0.3374683357,
0.3297805757,
0.3391899057,
0.34050074170000005,
0.32646351970000004,
0.33531602070000005,
0.33838851670000003,
0.31628309870000004,
0.3377080477,
0.33689578670000003,
0.33373161570000004,
0.32770362470000003,
0.3299733167,
0.32683999970000005,
0.34766178770000006,
0.32503415170000005,
0.32846571970000005,
0.34563105270000005,
0.33034485770000005,
0.3304866677,
0.34363647570000005,
0.33028165070000004,
0.2875129417,
0.25051270070000003,
0.27724555770000003,
0.27341198070000006,
0.29751710670000003,
0.28160194070000005,
0.2110023297
],
"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 3; done",
"mean": 0.2858219798399999,
"stddev": 0.11911241840008398,
"median": 0.2780274708,
"user": 0.13235246999999994,
"system": 0.15105486,
"min": 0.1617816493,
"max": 0.4466764503,
"times": [
0.27788059230000006,
0.2339800653,
0.30596414530000005,
0.3035362233,
0.3450809993,
0.38581612130000004,
0.3789666803,
0.43647181030000004,
0.42590342830000005,
0.31160748330000004,
0.32686600930000004,
0.3351626803,
0.38901525230000006,
0.39305780130000006,
0.35875977830000005,
0.1675035133,
0.1722495683,
0.1732900133,
0.1650050793,
0.1776681703,
0.1691414903,
0.1637963703,
0.1672267273,
0.1617816493,
0.1631604783,
0.1652634953,
0.1629138223,
0.1650890333,
0.1648178853,
0.1637581273,
0.1643174363,
0.1636355433,
0.1640868523,
0.1647233763,
0.1639534483,
0.1621999673,
0.1637627413,
0.1648785603,
0.1635657323,
0.1697515313,
0.1665315373,
0.1664922383,
0.1636477263,
0.2015597083,
0.4399764453,
0.43566508130000003,
0.43843071530000005,
0.43717739930000005,
0.44117839430000005,
0.4383437143,
0.44289095930000005,
0.4466764503,
0.4340191983,
0.38891430530000004,
0.31792457430000004,
0.2781743493,
0.29652729530000005,
0.32400008430000005,
0.32573575130000004,
0.3552500223,
0.35653021730000006,
0.39221699330000004,
0.41257687630000006,
0.4055779453,
0.43111143530000007,
0.40042304130000006,
0.4412894613,
0.41781259530000003,
0.1854528053,
0.1701201473,
0.1779843383,
0.1683290163,
0.1667868963,
0.1811534223,
0.1681221393,
0.1662736183,
0.1715112723,
0.1702715243,
0.1678216483,
0.1684258623,
0.1685099203,
0.1660978933,
0.1630387413,
0.1848142833,
0.1995848083,
0.1675094073,
0.2163439033,
0.4370722463,
0.44037415930000007,
0.43945498130000005,
0.43611861930000007,
0.44157850230000006,
0.43407264630000003,
0.4394844613,
0.43866582230000006,
0.4372620253,
0.43830210030000005,
0.44074636130000006,
0.4378032733,
0.4408469393
],
"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": "python 3-1.py",
"mean": 0.04121359861,
"stddev": 0.01925979464565644,
"median": 0.03321260526,
"user": 0.033925540000000004,
"system": 0.006530669999999996,
"min": 0.02099105726,
"max": 0.08260498326,
"times": [
0.051904651260000004,
0.07081237026000001,
0.07550464926,
0.07386956426,
0.05226041826000001,
0.02245401626,
0.021673267260000004,
0.022984726260000005,
0.021070968260000003,
0.022354786260000002,
0.02207817326,
0.02265223326,
0.022228742260000003,
0.021890656260000002,
0.027320925260000004,
0.027147791260000005,
0.02660499526,
0.033888322260000006,
0.05204111326000001,
0.07783879126000001,
0.07545674326,
0.07537733826000001,
0.07891184926,
0.07663281226,
0.08194317426,
0.07275445526,
0.02677728226,
0.02146064626,
0.02126091226,
0.022596147260000005,
0.025912396260000005,
0.02637571726,
0.029881821260000004,
0.032719728260000004,
0.037371311260000005,
0.04147204526000001,
0.02693493626,
0.02099105726,
0.021683471260000003,
0.02325691926,
0.030879524260000006,
0.037412061260000004,
0.053491290260000005,
0.057412962260000006,
0.05373986226000001,
0.028096754260000002,
0.06869860526,
0.07218100526,
0.05327467526,
0.025161592260000004,
0.024661289260000004,
0.02454142426,
0.025319026260000002,
0.03712941226,
0.049977244260000005,
0.07055158726,
0.048365752260000006,
0.05857217026,
0.06317722226,
0.04863136826,
0.06011220426000001,
0.041733240260000005,
0.047502842260000004,
0.038220037260000006,
0.058726324260000004,
0.061521019260000004,
0.024227173260000005,
0.029794275260000003,
0.03370548226,
0.04198545126,
0.044787625260000005,
0.05080426326,
0.047328115260000005,
0.025825472260000003,
0.02565365126,
0.026707547260000006,
0.027339551260000004,
0.025979196260000004,
0.027713986260000004,
0.030965964260000006,
0.07263531026,
0.05937729026000001,
0.02620647526,
0.030743662260000006,
0.03128535526,
0.04805048926,
0.08260498326,
0.07357149826,
0.046451266260000006,
0.025180880260000003,
0.028250977260000004,
0.036459030260000004,
0.07202390626,
0.045909026260000006,
0.021836287260000004,
0.02222378926,
0.022240946260000005,
0.021696904260000004,
0.021384970260000004,
0.02296663626
],
"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
]
}
]
}

View File

@ -0,0 +1,218 @@
{
"results": [
{
"command": "python vicky_py/d03p1.py",
"mean": 0.04658310239999999,
"stddev": 0.017986176484155007,
"median": 0.04145815832,
"user": 0.03983408,
"system": 0.006274310800000001,
"min": 0.02585583432,
"max": 0.09157175432,
"times": [
0.03625472532,
0.03465417832,
0.03396654632,
0.03618384132,
0.04315716032,
0.06217007632,
0.061074496320000005,
0.046393020320000006,
0.05460350832000001,
0.05359424932000001,
0.050319720320000004,
0.030011169320000003,
0.030839434320000005,
0.02988077232,
0.03070780932,
0.029755778320000002,
0.03274030832,
0.029488529319999998,
0.029114787320000002,
0.04140808932,
0.07890296532,
0.07442519632,
0.06510410432000001,
0.049949000320000006,
0.02817988532,
0.03847507932,
0.03981689932,
0.02994783332,
0.04516316732,
0.051098552320000004,
0.05484034532,
0.05636680932,
0.05764491832,
0.06463834432,
0.06740387332,
0.06323831732,
0.06079315432,
0.04869693932,
0.025995433320000004,
0.026150188320000003,
0.02585583432,
0.02664621732,
0.03747833332,
0.04495923332,
0.06181685432,
0.05188516532000001,
0.02641675532,
0.03257015632,
0.031908224320000005,
0.037440533320000004,
0.05320423932,
0.07328332832000001,
0.062135716320000006,
0.02798000732,
0.02795615932,
0.02868359332,
0.02806963932,
0.029425172319999998,
0.05467381032,
0.07707768832,
0.08245113032000001,
0.08727142932000001,
0.08412591932,
0.03244172632,
0.027792763320000004,
0.03184680832,
0.03138939632,
0.03165902632,
0.03652552332,
0.03918774232,
0.03934787932,
0.04719080232,
0.06493572432,
0.055012023320000006,
0.08109600032,
0.08112990932,
0.05461992032,
0.026321486320000004,
0.03283362032,
0.035878437320000005,
0.05989386632,
0.08422506332,
0.04630633932,
0.02667289932,
0.03158212732,
0.03470449432,
0.04696434732,
0.04663383032,
0.02905690732,
0.04150822732,
0.03999464532,
0.027363504320000002,
0.038492724320000005,
0.04438371432,
0.062389057319999996,
0.07938231232000001,
0.09157175432,
0.08544142632,
0.048485489320000005,
0.02758437332
],
"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.

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

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

@ -0,0 +1,17 @@
# 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"
# Benchmark day 3
hyperfine --warmup 5 --export-json data/vicky-d03-p1.json --runs 100 \
"python vicky_py/d03p1.py"
# hyperfine --warmup 5 --export-json data/vicky-d03-p2.json --runs 100 \
# "python vicky_py/d03p2.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)

View File

@ -0,0 +1,60 @@
#!/usr/bin/env python
# coding: utf-8
# # Puzzle 2 of AoC 2025
# Author: Victoria Ramírez López
#
# Date: Dec 3, 2025
# In[59]:
def calculate_max_joltage(bank = ''):
# This function calculates the max joltage
# that can be achieved in a battery bank
# when turning on 2 batteries
# input: bank = String
# output: max_joltage = int
# Create a list containing all the batteries in the bank
battery_list = [int(battery) for battery in bank_string]
# Find the battery with the highest number
max_battery = max(battery_list[:-1])
max_position = battery_list.index(max_battery)
if max_position == len(battery_list) - 1:
max_joltage = (battery_list[max_position] * 10) + battery_list[-1]
else:
second_max_battery = max(battery_list[max_position + 1:])
second_max_position = battery_list.index(second_max_battery)
max_joltage = (battery_list[max_position] * 10) + battery_list[second_max_position]
return max_joltage
# In[60]:
# Read input file
battery_banks = open('../rust/inputs/03.txt', mode ='r') # Open in 'read only' mode
# In[61]:
# Select 2 batteries per bank to turn on
max_joltages = []
for bank in battery_banks:
bank_string = bank.strip('\n')
if len(bank_string) == 0:
continue
bank_joltage = calculate_max_joltage(bank_string) # For part 1
max_joltages.append(bank_joltage)
sum_joltages = sum(max_joltages)
# print(max_joltages)
print(sum_joltages)

File diff suppressed because it is too large Load Diff

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

View File

@ -0,0 +1,201 @@
2233643232222242333443433223122333324326451323323334325223136631334332233233323164354342233332238233
6436547659356357277564683346658554864789866767856546426667566576537557576764753366663247799566575359
4322212422212222222222112222221252322222222222121152214312222222226122122421262632221222352222223522
5242873574376258254526262841222235756126125363535226724625252231422222223232432416114933476433226425
4423241233122222212222152223222321224343432221222131223143222222223442622361254132221212223321223232
2354443335444444444445473233436443443447434343453464372444444744444341435444543443433645644446664444
7344773375355374532433311243433365663564579278356438583444355566467535626553263862265655437577558445
2422122121212324322412122634143132116824441421223222862232324232233322227221224221222232422452322422
2335425524341553453213523155345249534445348244223423324254265524132552444254422523422425353142334556
2543542334354463443444631655434665743432434343442354554443244445263434575354472655455354443554334453
2533222231331423136323422331324323122212222133234123324923235534153325322253223223121312212332233222
3655636344614544753471372637363622461657323523555373676516477617243136625537745875577456765251534745
8347857486272332654345885359345864556245456476353536374444758537485854624467575625455471966355365444
2333131222324323323333122331322333223232233313232332423233313334321321324232231322333313332323233322
4333455333232133222434323424423223782622224423233533223343333237344243134333437453254322633363332442
3333224546432265536343345623343413494323264462333222332725333245323343134323244336443544223233233344
1122222222422322432314212522412222221222221222213224222532253232222211212243222222112122242232335222
6223222222211527224244221412234422422713221226223222321153222234233432222213222222222222222324231636
5522284428622511162523222215246221521122222226162118422222222122212222225432222224262224422471367526
5956484444745474342547425434594374468434864864145434543435444445445435447847779785545443385653654957
3142333733311646312333123413312243223323322322513332472235234224324411362463132422246321332342334253
2492222222662312432222234253224154223124222422222213353722442234192272247469222421222262223267156265
1222322226313332322222322222252325331322122133223322232222712222224726531252321222222231322222222233
4438912132222624231242322622336222122622235321223232221222212122524232224232242223126113262212212435
4342543122243322234244522425514322434334515225622212522435254747435834212524224434345847214233232221
2232662535536423636216213652233222333323333326232362322345211258324623265442343221333714253323275637
2692334323322554444433246235632624244563226221655324344313452376684265724434633442434233553662233643
1644224326534722127241464425124252623243373421327743244224241335526234247333375133245132323342647346
5333657533435533437765632361628578858239468476298973236397242266676766654544552648636554686924674746
4251343354552554445476666443753334477733455252244352372543524364954246663435527633554214534575345543
3245444253442524962129783345453352426254163846525128886263548552344445395534373553663544462243475363
2142532422249222122122222121162472244223312421312253332722222114213222352432221242221233181232122212
4566465546696559368565756646438955545369947544855754656465452555756544447765644457465366557485337369
1772653222555582242247246232214292222697233222223253514255232252129642112322335241212183231264525284
4354354427322426542444547537346731353311444756444523378323634345432344556435433536444746445434454453
5344542553344445244734444454543444343844354445344455544437343413454472243534445445435545543335434544
2421234244222324252243122112531222432451151212536641122423232254323625642217243224625513637522242233
2444236443231233244646213453222422433135223422213222112323142221124322223132322364143222422234525135
3993952352239334636476372777272353823836333556663343425385311323219418661163732333739633435335233629
2335132452334122223322212232323222332121214232343232321253615232234232222225124143231423232421221232
3435253533345115535125331555355212454321233141243323222231511511242334253123412222244355444111336789
4342262562424446414642344324642513444741415543524724444347445424742344243227544243834261383344344433
5133269339551412322324214425133339363433753643223332253433334733423351353332323252563825324213546533
3365372336245325375435335434332645526446285234343523632282522323636232643244678477432531362385446246
2311131324212395342286212542325322246532472361652435616622122663643522122343832326532338222232323482
7765353451358575733572283573547384566323256675564262642584334376524365537964746444124713224735546774
2252222525225522412122213464272135235332236223312272922282292361721421642435252222222226223782322215
2134223233222221422122222223312222321222423333322222233223223232122322211216211222321222223242222422
2222361132122134212316842523222722221729212242142646822267221232222222222412222222522222242753222222
5337864557478543434125566533466435547454453457543754463395635497321323245554355354848544555244335554
4466625524532724322343146236829413367515473225463633637657254355393224314422246746538323136326741268
2322233123334342233531132214322222423222332332324712223135133223235235532233233332322352216243433223
3633623322235342316346231131633361331265333443339233365455623337353332167234337236515462224252333216
3322584324332533632225363333332331626133332232223132322321336323322334213633233333215232333442313275
5965751122343223845246255553658564621769664976957663344222229522752322289731722915285462282698823463
3121123533222322223221263122523242222123232221232342322162223241233222314224211222222122122322232212
6122331319122223262333221232321143613412232222221213242132321221322221332342352322122226512222222633
5145245555235222232228435425532224121513422242326222356224253225455252412222754222322432125224161442
3132322122223332322332242224222322222422352533113232233223232223222341222123253242213213224323354225
3252413233224241123451142223232242212442241222231545322234225222422473143343222322424222122252122416
1222222432232632232221222223222122521241321222251212132222211232332222334222222232224222322222222133
2133325423225322332222532333232222323233222322122152432122332224212222222222212323324323322362632221
4122341242242411343233341124424221223432443244144143434244411231333334322314223334222434334414256789
2222212542623221122371215317524472552543532242222229542515225421552216216324337665122323271821561222
2122122122122422123242223132212211232222223222228423241243212222232242216422232232113122122222232222
2342451233212332332223232222123322212234372232433123322242422233233221221324231233221221232222235312
1531224333222562318222324631131222342272182322522822182242335222241223334222527222212244253473221323
2222233222142234223233121222223122242221213223222122332242431122213321122214222212223322224222223312
2222222143243227332452232222322322321323613266223112234422442212224233243242223133522611232111122321
5654553447313533554553893854763333467444552579533944455663535653524659436665547645355435546543554545
5323331522211233252524233313212132234222532343133332653523335426323323143321221322323323221347322323
3344255554553462322384556525546538353335583545124321555537334342254324532523646534635433532353543335
2252335254447422332431226227992713322234315316472133442221225414241542213654242426442132142182572344
3135523223226233323223323223222544253222122262342343232237222425282315212232123222235333112312222334
3354773326663365346493365244732433363452542643435334753354577776335434754556592544964263743422332443
6371439222222352424162472287212322327622532242273512222352621682699762212223226214132243222323527222
2232543232222452352224332423252323532333242233144332224232233325233442123233222442332344242445234243
6425615474554454141541665641252716724411315412715646331276275654347342167232742714674637136141217389
3235333323334334433422362433341233323333231333336463133333453437363325442333342333823233363633333354
5765262746346263664544526674676762456349723566665876664674156663555573556676764444715554476437677855
7423434333422334442444334422343286432323333344344314233133333443444333838532343434543341233343232733
6774788365875695878887443545568759778677247747655763848548555778646627725586786843876788675548758494
3262313215125212725325312211423222332227433222263225122322254423222211222422352233312213443215423525
6142243652443244444342244442113325153442421335264515232174224223431316224224433264315222264244474425
2921833253133742442324622132642228232344243922221222431224543231122332332233333123362234243552323522
5632565666566658566466565564426236675643353576665434456559645576553857764724552526336855216775546576
2532452536565234455556555433545333343535235259355533573737535333495454353444323553254555558327634454
5548929366483365659354448563354373455759474784978453866356866476356667554667454666687754395646666584
2422224232218244232132234324422124322122422432233246415332224232332414212225332241243325223322222222
3758934793272332176257536845332333423543533433543322226223463523347666464677433843442824654415933924
2622232121212222232322152424125221342152122221224222323442222231221231265222424444243222225322221222
6214422421342323434331423232234143232134222323441334231133223132222426213232335122424533433312424333
5495352464253923643432324472475257423635544644337693443224359353932343696565533473655334633335357234
7254749566545484267477472424253562668987384296476363553384653423843774734634364663792242324756555646
6226324333333271442443546421325232432323192149222232363654233652232253322232543523855788643345523533
6423316551511466142352352513435356146435255444345656413213453213333153116125465222652164154334412789
3233343444252424634655344331632462565545324335341334523524342535241225553354334625422632545362561363
3445525556368253862333435337455253455524557517455232345255743265518361673494731765233544323823734449
8544272422454343423222253523841223262532426642832273222113352334442513324141234434252431222216421154
5423334354644265263636536355524642453634246642522263635654356321443365454125632234324233624247276342
6443545413135523533265443323245434225234223442514335322555552333234542252323354441535625432213233475
3212212222223312122122125221321232213221322313122221312222226222222122212222222922221223212132141212
2323212122324611722242222244224112222243222123241262221222362413421211233222242222215222124222122331
5844366354463476656352455342626163223651573323322732274227653444734256235242233221366322344236655364
2625454454614434442613618224132466334432732446343621534141835624243221346614444345314364443148234344
2323222223223124321322321223214122333222332222231313222222332322222522333223222122132323212343223223
4437368344416381611321431224542447234422632416425742323247454382441741433122653324364923229242444543
1246633747466243525472445465264464613362434426572366643424314563444534564662442453243348442543252552
8455213554255167364635127532563534225444445625337655356663242455242553536364567566362637563621552464
1145243234422322531234121131315342152533253745423235234129642243232433334524273522215353252222256345
2222221322232522222222232222223222212222223212222232222112321222123213222222242121522231322322222222
5554324763412143342413244121235412334563414442244613543522434445264434234433442544443434242225336524
3212234222234342422134323321353344221222241463622421223322332224422435432352244231322324233321242222
1738535622754134632333123483712322334123243222775212333324326533722431671361323312322346241332334322
4351132523543724323443552656312222233223234323221255492443514427243424322442435353343365537374457525
2226222122222222222211222321222222362222222222262221222222222462222242422221222112213252923212222227
7372265262132122222222222282647132453212233322331232223212732224333228225333323211212536423333531243
3342577332235352233233553852633532263644351255533142324433446226235457211213535744631435423223364363
8446255244282932322534869773258925347844614356985425432837381986388785453532534245572534443192852357
5446735236335373623324345623337331834844472537246434774964444227448844322344333544544434382344464148
4433323344453244323434533223334334444433433643133631233655333413335732264332842324635343324544539433
6344376432398243372333532336643528844236533248338383473645366575356475384433935577645374443832252963
3443222635222221244334227234322246222342227224235242323213273234134421523235225245425122222255224231
6585657577798869776763766747566877567766997677734495477637554466647747676466367736757977637777676777
3242552333334223333252225333433565333333465343535354235233123752242314432223435333332233333332223332
1311222262211312324225221221345121353311223322212222241343223322112224651422143221323251213224222225
5533566445555425555535555545655564353354655435445566346633555555464665566547564434755465554654365665
3463363433672383135556336377441633635538123755433353487535473513268444423364361656537543324433363331
2222122334223322241131242133321225242732213242326212422232444422322212222223342231223222322222422213
4323633242332312332424232178525522242552333523216333423225215442333672335222322723212232753241221533
4362565458455443433534444665335234724445746564455242246332242464545442435623423325344343664843444243
2223437712828555541728813515663367733828286734326188656173257638346432837355155675314858434277276319
5244262352623221152324113352242726453823552433244642443115222322322662622123452436542542126162944562
2222362523222242322324333353323221232222533231223413323541411332323322544333232433153322333233223142
2225312222212215222122212322213222513122221422323222322225262221222251222457222112222121342121222221
4313232231424332229233454343224319396724123323633382235223632236322391443232222332212432283863439233
5213575451225235425253533432213743534342624252124435242432121345254352522422122212553341253217252322
2123412112522432522412192122226522121425425222252222522512262432222222411232122222423341231351232221
5465625548366424522551965584434936726545472565217598582254364534384215551343672449253467655554836446
7254422422222617225423523253332238633333432123322237324623122462125452782322233252232462154221236133
6535353554552342214454325582546583245579544353448348251572751295756482557556245336852375322477534475
4322124613433135333247343244442342123263246432131544439324486672223437344234314333231434329452334422
3222122222211221222442221522222323121122254222222212221122222222212132223211142223221222122232253223
4522264542561523248146564185215223352222363522622331425472532241114233344524356242234315554712254611
4524553354655655655852774652636663566555536557376256434754354524655756453536565466492456544475546375
6482342921224824333643274834413223286723233143344312632422114943523238322122443642964332282223862242
2222532222225126242562235312251241241152363142662511122221241252422235424523144132221224242525432316
3352233122122222414623322422421412265422222322631132532211362245214223424432222632322122452236232543
7435435245443454483642323432454553456537424534753454323445333535524536533132553244725534224634223674
4442455534524835435555455546253515474453446464546545554444443534453544443464344544455454444445545656
6318372235932344212322623432143332348233334233234531434374327935349323133422333672232723333333333313
2343437112323223553423322434332234373285822222438334742444737123322352633236431422342337553563236343
2534525223332122254212422543221212222333444234231612225123231222134222224211232431442153233222232235
3311333353223232533542243332322443233333433334433333333334343333233225332233334323333332233323334534
3728642494543682323613638224245843442324642214465451312451322235317994852247254439532312342435223415
2644444442446656433255324244844744224332444644642423633224344444334435346443263334422284244442354422
2132343337743333341331172224332353222832422333133333324323434332423323223323333123532233221521332232
6456746544533347353533424453434256445454442444545332474441436424325427632384444467424543463243246273
3133424321432223332224512124224222232131232222432232433224233324222323231122133222444342422223422412
2951222223232342212324221372233422121222222122428412742122222272113231225115272231252232221122231342
4332522234422363462322222143321322323545222323433222352435311251238232125232422442222133116432133222
7666998669668693896756755965999793569795865899869698558598997759886859928589579967584996689695478789
4352363453212525423622255562341442344215444134321422542354722245343422441244464243637481135554112362
3223443344545244343434584554333453154433434434333249442265443244333635455338332244343243311134334424
1665322162231323425324323123442341125222233315531323536111322442242235242132414112244264232443422245
2414221222221172231122222143244322162212222222425232121223222222221222422345212226312222112112221232
3331333314633233122533233233233112324313222231331243321234122333341411343323323432121313333225221232
2642724252231252242432324542254325124442563345455242145355324151614235225515342253523532421213493425
6315423423623323244234343366465111333233473411272233343328223323662414442233633141132225735345273323
2255222422222341222222221221242522222412222122121222222221222225322225221312112222122422222222221252
3221262222222452233122222424222222221221233427232242322221283223253322122222222222221211222222222322
3563473466663465624422525832655214646265347424423434534754575561344661544144721234545452426624325665
1512522452333543222325524385269535432435333245472553438445343544134325483212359524535452434233544546
1242352442411351533231323433123333232332131522241133232223323312221332252133231231222521342332233113
6796977884635885678886386887784686985966565558559785568975267889586689776858777746657576899885687867
1322221211222232222222212224341222212122652423212122232222221622222212122222264522211212112222222222
2221122242132222242321653225213222212212123122122225216212241422222121335224252128222312122223152213
2222485454314145422676223532428253544275212444246273219543235423266271388223486621383423434123322786
9264342243354532322432433325652333233452313535423525423336263384434513334133343152333512233333211423
2221254122222222483253222232224232221212127215222224142222112222222222312552242222122224121422222211
1234422452224434224462441231223422424234232233163423323463242243214153522224424343443144243233321226
2322212322222232222122222111221213222232122222212222222212222322321212111322222122221222222212221221
3434526563345631541253456353554355344534635445555335344434585646443364555465443732452735555413335455
3225312137123114121262224262133222252322222211222221322324232222112222621222224422222232222221266238
2353522543223422534146562225414223172345423224513313523223255542242224543225213372456442522442223274
2321822523345672525222333345331141642241339237232233346584343212323556147252622534732253132335723124
2221142243241323222232423422323251235242422122522224222322222325214214222222234332641212512222222223
5352353234444335353333325633455343325334323243442544543453525334742134535534164234322442365546552443
1644535454544465443444444444356555544434446443634464664335484454462433434354444442444466442444522245
6433454454447444425444475352634433345446225436132754337645216743354253676545324347755544565443915533
3467493473794344524434814455434343541545634344354934325134523344486353664347445446466468352473724335
6583456635588454567555367246548474858674467585559584465654664563665845468923825636652445446833546865
5444533574534446655337755343315552455447755452563434858445835538545235556545555373594853555475534542
3441235133213337324673253262369232322322523734393339321333332333338374353323483332652333273343333334
2422443223431842223321234271323322427434181322342241645342244245114331332453823332343424413141233222
3324243325325223334126334234442422148382225223733442252241413434444155241324232233814134662324642534
4426433352444223343443233364226332215123531534353433343449744443257223333742332354436544443343235466
1311262322731223323222364222211222212331291223331233416323222221212322331423211242312141133222213123
2231221213222221212231221334133642822242221322242121224231222213322222222222223213122225213222251122
2222462325135343335552659427182617224656226146173226235225282512237335226552631126273541364136347217

View File

@ -1,55 +1,33 @@
use crate::utils;
struct Dial {
points_at : i16,
clicks : u32,
passing_clicks : u32,
}
impl Dial {
fn new() -> Dial {
Dial { points_at : 50, clicks : 0, passing_clicks : 0 }
}
fn rotate_by(&mut self, r : i16) -> () {
let start : i16 = self.points_at;
self.points_at += r;
self.points_at = self.points_at.rem_euclid(100);
self.passing_clicks += (r.abs() / 100) as u32;
if self.points_at == 0 {
self.clicks += 1;
// Avoid double counting when starting and landing on zero
if r / 100 != 0 && r % 100 == 0 {
self.passing_clicks -= 1;
}
}
if r < 0 && start < self.points_at && start != 0 {
self.passing_clicks += 1;
}
if r > 0 && start > self.points_at && self.points_at != 0 {
self.passing_clicks += 1;
}
// println!(
// "Dial {} now points at {} ({} clicks, {} passing)",
// r, self.points_at, self.clicks, self.passing_clicks
// );
}
}
pub fn answer(text : String) ->( u32, u32 ) {
let mut dial : Dial = Dial::new();
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) {
dial.rotate_by(d);
let new : i16 = old + d;
// Part 1 clicks
if new % 100 == 0 {
clicks += 1;
}
( dial.clicks
, dial.clicks + dial.passing_clicks
)
// 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 str_to_dir(s : &str) -> Option<i16> {

189
bram/rust/src/day_02/mod.rs Normal file
View File

@ -0,0 +1,189 @@
use std::collections::HashMap;
use crate::utils;
pub fn answer(text : String) -> ( u128, u128 ) {
text.trim()
.split(",")
.flat_map(Range::from)
.map(|range| range.invalid_id_sum())
.fold((0, 0), |(x1, y1), (x2, y2)| (x1 + x2, y1 + y2))
}
struct Range {
low : String,
high : String,
}
impl Range {
fn from(s : &str) -> Vec<Range> {
let mut ranges : Vec<Range> = Vec::new();
let (low, high) = match s.split_once("-") {
Some(pair) => pair,
None => return Vec::new(),
};
// Sanitize input - for AoC, optional
if low.len() > high.len() { return Vec::new() }
if low.bytes().any(|c| c < b'0' || c > b'9') { return Vec::new() }
if high.bytes().any(|c| c < b'0' || c > b'9') { return Vec::new() }
for size in low.len()..=high.len() {
let range = Range::new(
if low.len() == size {
String::from(low)
} else {
std::iter::once('1')
.chain(std::iter::repeat('0').take(size - 1))
.collect()
},
if high.len() == size {
String::from(high)
} else {
std::iter::repeat('9').take(size).collect()
},
);
ranges.push(range);
}
ranges
}
fn has_pattern(&self, s : &str) -> bool {
assert!(s.len() > 0);
assert!(s.len() < self.len());
assert_eq!(self.len() % s.len(), 0);
for (l, c) in self.low.chars().zip(s.chars().cycle()) {
if l < c {
break;
} else if l > c {
return false;
}
}
for (h, c) in self.high.chars().zip(s.chars().cycle()) {
if c < h {
break;
} else if c > h {
return false;
}
}
true
}
fn invalid_id_sum(&self) -> ( u128, u128 ) {
// Part 1
( if self.len() % 2 == 0 {
self.total_of_pattern_size(self.len() / 2)
} else {
0
}
// Part 2
, self.pattern_hashmap().values().sum()
)
}
fn len(&self) -> usize {
self.low.len()
}
fn new(low : String, high : String) -> Range {
// Verify they're the same length
assert_eq!(low.len(), high.len());
// Verify they're all 0-9
assert!(low.chars().all(|c| '0' <= c && c <= '9'));
assert!(high.chars().all(|c| '0' <= c && c <= '9'));
// Verify they're in order
for (l, h) in low.chars().zip(high.chars()) {
assert!(l <= h);
if l < h {
break;
}
}
Range{ low : low, high : high }
}
// Create a HashMap that counts the number of patterns for each value
fn pattern_hashmap(&self) -> HashMap<usize, u128> {
let mut h : HashMap<usize, u128> = HashMap::new();
// Populate the HashMap
for size in 1..=(self.len() / 2) {
if self.len() % size == 0 {
let mut patterns : u128 = self.total_of_pattern_size(size);
// We'll double count a few patterns.
// For example,
//
// 247247 247247
// |------|------|
//
// this number is a pattern of 6, but it is also a pattern of 3! (lol)
// 6-patterns always catch ALL 3-patterns. In fact, all
// k-patterns are always caught by n-patterns iff k | n.
// Therefore, if we want to accurately count the number of
// 6-patterns that AREN'T already counted as 1-patterns,
// 2-patterns or 3-patterns, we must subtract our total by
// those amounts.
for (key, value) in h.iter() {
if size % key == 0 {
patterns -= value;
}
}
h.insert(size, patterns);
}
}
h
}
// Count all invalid IDs where the pattern is of a given size.
// Then count the numbers of those chunks.
// These can then be re-used to count the full value efficiently.
fn total_of_pattern_size(&self, size : usize) -> u128 {
// 1. Find the range of all patterns of size `size`
let inf_str: &str = self.low.get(0..size).unwrap();
let sup_str: &str = self.high.get(0..size).unwrap();
let inf : u128 = if self.has_pattern(inf_str) {
utils::str_to_u128(inf_str).unwrap()
} else {
utils::str_to_u128(inf_str).unwrap() + 1
};
let sup : u128 = if self.has_pattern(sup_str) {
utils::str_to_u128(sup_str).unwrap()
} else {
utils::str_to_u128(sup_str).unwrap() - 1
};
// No patterns exist!
if inf > sup {
return 0;
}
// 2. Calculate the sum of the pattern snippets
let pattern_sum : u128 = ((sup - inf + 1) * (inf + sup)) / 2;
// 3. Calculate the sum of the patterns when they repeat themselves.
// For example:
// Step 2 calculated the sum of x = 123 + 124 + 125
// Step 3 calculates the sum of
// y = 123123123 + 124124124 + 125125125
// by realizing that:
// y = 1001001 * (123 + 124 + 125) = 100100100 * x
// = (10^6 + 10^3 + 10^0) * x
let layers : usize = self.len() / size;
let factor : u128 = (0..layers).map(|layer| 10u128.pow((size * layer) as u32)).sum();
factor * pattern_sum
}
}

View File

@ -0,0 +1,56 @@
use crate::utils;
pub fn answer(text : String) -> ( u64, u64 ) {
text.as_str()
.split_whitespace()
.map(|s|
( BatteryBank::from(s, 2), BatteryBank::from(s, 12) )
)
.fold((0, 0), |(t1, t2), (b1, b2)| (t1 + b1, t2 + b2))
}
struct BatteryBank {
digits : Vec<u8>,
size : usize,
}
impl BatteryBank {
fn add_battery(&mut self, b : u8, min_pos : usize) {
for i in min_pos..self.size {
match self.digits.get(i) {
Some(x) =>
if b > *x {
self.digits.truncate(i);
self.digits.push(b);
return;
},
None => {
self.digits.push(b);
return;
},
}
}
}
fn from(s : &str, size : usize) -> u64 {
let mut bank = BatteryBank { digits : Vec::new(), size : size };
let l : usize = s.len();
for (i, n) in s.chars().filter_map(utils::char_to_u8).enumerate() {
let offset : usize = l - i;
bank.add_battery(n, if offset > size { 0 } else { size - offset });
}
bank.measure_joltage().unwrap()
}
fn measure_joltage(&self) -> Option<u64> {
let mut joltage : u64 = 0;
for i in 0..self.size {
let n : &u8 = self.digits.get(i)?;
joltage = 10 * joltage + (*n as u64);
}
Some(joltage)
}
}

View File

@ -0,0 +1,5 @@
use crate::utils;
pub fn answer(text : String) -> ( u32, u32 ) {
( 0, 0 )
}

View File

@ -1,7 +1,7 @@
mod day_01;
// mod day_02;
// mod day_03;
// mod day_04;
mod day_02;
mod day_03;
mod day_04;
// mod day_05;
// mod day_06;
// mod day_07;
@ -26,26 +26,26 @@ pub fn day_01() -> DailyOutput {
( 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);
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 )
// }
( 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);
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 )
// }
( 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);
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 )
// }
( p1 as u128, p2 as u128, d )
}
// pub fn day_05() -> DailyOutput {
// let s : String = read_from_file("inputs/05.txt");

View File

@ -6,9 +6,9 @@ fn main() {
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(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),
@ -29,9 +29,9 @@ 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(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());

View File

@ -2,6 +2,10 @@ use std::fs;
pub mod diagnostics;
pub fn char_to_u8(c : char) -> Option<u8> {
c.to_digit(10).and_then(|n| u8::try_from(n).ok())
}
// pub fn char_to_u64(s : char) -> Option<u64> {
// s.to_string().parse::<u64>().ok()
// }
@ -36,6 +40,10 @@ pub fn str_to_i16(s : &str) -> Option<i16> {
// s.trim().to_string().parse::<u32>().ok()
// }
// pub fn str_to_u64(s : &str) -> Option<u64> {
// s.trim().to_string().parse::<u64>().ok()
// }
pub fn str_to_u64(s : &str) -> Option<u64> {
s.trim().to_string().parse::<u64>().ok()
}
pub fn str_to_u128(s : &str) -> Option<u128> {
s.trim().to_string().parse::<u128>().ok()
}

19
brechtje/2/2-1.py Normal file
View File

@ -0,0 +1,19 @@
raw_input = open('input.txt', "r").read().split(',')
input = []
for item in raw_input:
input.append(item.split('-'))
answer = 0
invalid_numbers = []
for item in input:
for i in range(int(item[0]), int(item[1]) + 1):
str_i = str(i)
if len(str_i) % 2 == 0:
halfway = int(len(str_i)/2)
if str_i[0:halfway] == str_i[halfway:]:
answer += i
invalid_numbers.append(i)
print(answer)

50
brechtje/2/2-2.py Normal file
View File

@ -0,0 +1,50 @@
from itertools import pairwise
raw_input = open('input.txt', "r").read().split(',')
input = []
for item in raw_input:
input.append(item.split('-'))
answer = 0
invalid_numbers = []
for item in input:
for i in range(int(item[0]), int(item[1]) + 1):
str_i = str(i)
if len(str_i) % 2 == 0:
halfway = int(len(str_i)/2)
if str_i[0:halfway] == str_i[halfway:]:
answer += i
invalid_numbers.append(i)
continue
if len(str_i) % 3 == 0:
third = int(len(str_i)/3)
if str_i[0:third] == str_i[third:2 * third] == str_i[2 * third:]:
answer += i
invalid_numbers.append(i)
continue
if len(str_i) % 4 == 0:
quarter = int(len(str_i)/4)
if str_i[0:quarter] == str_i[quarter:halfway] == str_i[halfway:3 * quarter] == str_i[3 * quarter:]:
answer += i
invalid_numbers.append(i)
continue
if len(str_i) % 5 == 0:
fifth = int(len(str_i)/5)
if str_i[0:fifth] == str_i[fifth:2 * fifth] == str_i[2 * fifth:3 * fifth] == str_i[3 * fifth:4 * fifth] == str_i[4 * fifth:]:
answer += i
invalid_numbers.append(i)
continue
else:
all_the_same = True
for pair in pairwise(str_i):
if pair[0] != pair[1]:
all_the_same = False
break
if all_the_same:
answer += i
invalid_numbers.append(i)
print(invalid_numbers)
print(answer)

27
brechtje/3/3-1.py Normal file
View File

@ -0,0 +1,27 @@
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)

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

View File

@ -0,0 +1,200 @@
6739459674389333459433695375559949344734767926833587823236783998689734978783695374574455875833736627
2373132532343213331342343333323324363713834443362242454554343333223332333335533234623223382233732244
2222441333231342122121622224212212232122222112222122311332222212273223433234222423211112132353251223
2272421512212232712632222221523524213442212223262216623152226212222221225272522223212222532222422323
2217222212362341131525335321122324234324223212742131242212142527224532246323122744833459212221122131
6813346133475314448426121761834648738623643213726761185353582458174121486641462776426112246165435119
2235322222212422321231252252212322241213233213221351223222222622222545214222213222322232422213132241
7648868634667457694727389566453477683138824974478548353762562379434349956786463565646545578448865493
2232322222272322552342542212222432512231313132533323713323222121122925282112215142213222222221221422
7378621536927447566642237444326735875635564782944732267883374679374572291556321372283535258364561428
1334223114253224534122334243242124273114222224322272334943143264254333322328312323224743333223222413
5283934323221234344351874335434342554432424342322757233443633433247254423333534425541235222323429255
6122264424275543533425551322224123443423422244434233542422226242126336524322442444524234552411263232
3443433244333314444224322523243224242332342332231522315233263422237434428222432123142363223243122323
2233352333342262213333232263345434333233236442643232343223622333542433543232553723343472444343144344
1235322122234425513353323233233121313223332222322324126232232333222223222237222333233323333214223323
4325536553242521223435445232395213355134524142322535362352345232535235334532452224141422535244355336
1531221153311234144121313322135341553411453555332543414153122541252131523331312331122441352413256789
2232231112132223322312321422222224211322231122222222222312222325233322325622212332222132322222222221
2271154221775226562431222343772273735324566146362762534541555626247166372734737154373435715644351589
1322321221282223222123242423224522232222222321132212222321512722312232222244311522253532222122221222
5675373654492446328553454633465763638638344343656363366623636255464662661735553323346336465333638336
6222154822345362222322222522826252516222212162122242142222622122427422231223222223423614522215652242
6222632224242211424242122221223142223522122272314221322111422725222212233232111222111221311222122223
7733645442442732531223245525486362495334532522464225353224187425436324512624552272122562562232464133
3122212312222222223262221222241212424214221222222252222212222331144322372726213221422222122222222221
3317564633543532241232338653138233333333364324334323332543322237249336434693237335433133563657333654
2222112144232342525175554221722162744427124325232272237315162252521294737141422751612264275623365412
5233336323444433338634333933257235232354342523921453333345233233432644331633334383243645338643368232
6555744775753685565359587685688568577765366857785355475445486372239447764684674376558464546868574784
3131322312625422313233136243434323233235451234422242642422221233433241342243343332222333122346552351
5545548564544551455444547425574454555985534445454524586545294455554235363458655233939254543595655353
2359665436622224221613324821315324832636221353316524645512225232332321223262434122723638222264123246
1333332423122433422244223222413244221332222222331334124322323329146144322323222422225353223432143332
2252325526527774625423122221535454723322284746512441336421532621335835341737442224474213326432923142
5766753863736644458639676412563282136344433663331635335665536244554854252673336867536454745553535586
5139931557883857995839397424342233394134332434843834938397764484863413686484933823989527723385843673
7286354682444934529442314333841634632432443946348225224943437945312764582252426642212443354433463245
5333223424222352523443254452734543444234454442121354623444212324542542244445314223324234433224341241
2336332233323335432319231323313522133234131534443333333332433123523233523223166334633533319254346322
3333333143332223113333442323223342232243235425354354334356334432335435533321344432432242742523542442
2261454235142314252241242213243143364232222332141662222322248442436223423324264231211282313214412424
3488334264566233754443373333343622327563345364254589363855559833246336332334356352363232364353368336
1232122227141322242221232223224122312242228221224222246224222232213222212222221222222232212222422231
3236763295122212613233243222122225436251538243322312245321313565232523264723325426332723223263241226
1222222232335142362222123254322223622322422223426444223622322223434432433222525212484422336222122133
2322424323244432341252312213322335622323221422345313125352332433421222212431335222342332124312432442
3232821222332422722233212211212324153232331422222222321222323322223622272523212713232321332413272622
3422652314245672235233363232413624422433323321424244162284333425222232322256212251232238721357223148
7774837647487566658756757755755847647655586686578356759987875456786575764558968987878778565587969586
1234223452224271232352455273726233633352227221354347283132212635572422643245234445451363372373482533
5545555754466555455554847555655474545653574744655454656557557545555565555443556555756654565567525555
5553554575554637555471355555154554444754485554555554465523825542545538455434435424455955526476554764
3254522513355333222211324322242533123234124252622229333233422522362352423245261252142252422114324223
2425344423234243432242213333252242333444451414325232234342213224352224134253221152324523223532441142
2582466442443388322624223813222631742479616132436235434553312364912322732234884746223356613144486223
3636223323332312624333322113312432342431432142262253223314236396612381142232422222213122423643323362
7325293432331383666195334723512337573622433434353563239235379451235352335833733463443262233842631543
2232624222332421511175521154321232335222932322461112227222122223213224257225223228222231413222222322
4552958886759955368935997537673735734558749419267255538878465394745752594544365557345558264585655169
2226216222224424524222422122422222224543262772122116426553224212223554631621145422424122825225242116
1222335126326444352764222342426663636441411345223343625343235185633672347245263355582632531664629135
6446446722356324442432213242214223324334335245335452632255422221143347414572397313223584225324331422
5224345323222424434244363345434133334432432442422434334343444345442434433343442433454144443324346244
5336333663337324323323235333336533343334125433374634569233686933546363236465133343459236212383233315
3431212332243413441121331234133441131314434431411433224142211222213143223434341442213344211133456789
5443222683292272324125357143312453332369372333522333233932316972333341214932333824122147432321723342
2367262824212222291672572242672121223153327226222625761267322242612343213625422253225276322142114524
6974563985343496663494433344643427344996686328654636476843646347684276485993646913458343453532176484
2312521543522312123137242323132222221231426242224327114213221222242224322222552327224254122142112333
6223242624251223217243624212512223241767442131244861652377673335441221242314494224319222352132462144
2333332335532332253234215732233323322235422433832233633332422321433233353223223324633524336332332224
2222222254612122222211642121222141234242212212122224252225222222211221224421423222122222532122221124
7421232222222133463122231324223212213131262222222222262223222217223332222242112324223212223323223222
3772242534373521568445363327624535346923343253955164573325436332351227545337435465955345446335669443
5858895152574569257889189996518531539296968776753453347738719235827481499877364362498567754855232996
4342235342363223564433432224563177215352333463431323332332366346334374333222313642241822536513753653
3354323732241336324523344333384638354233345323235333356414435734334356233343815243323232355328535543
3232231323322233322232342342232424122122233213223233212332333242223333133232223335322432333233233222
4222124152125212126225265152124132222832522242612921242522725231324422291234253262251252922212222622
6212552142225252118422223212232132222212722222213122224272253114265212154222226212272212113222621332
4552534756756595545354443365654557336354364737575555533553643535547465544767455573755756641664753655
2511242562394123244232225311322431521234233122422224223242358321213352344333234233713224232844173274
5526573675275646255558956655553398735354554524555427427584565653555545563555555663555386643559595476
4232222322223212512221132222227252235212222222124221221112232212223222453212215322552222422212122213
3323424433432431244433341433443334252333344333423447143363335444343444424424333333334314334534734333
9963543266528685935319932224777827787327354466945986687988877635834976575546746666448364958368484663
6263444224532863343259522662665342226323162222857382232425236267222252462342222824722545227136623635
3613233413353333333733232333232232314323633243331463333723643352333333533333264723363332314333323323
3122425225223233212711545223521542342751432242342216624212233222124622255451462253213221324322312523
4644734133536424434624843436434362694444315342324843447433442362627451364355523726343468233665395334
4423752435257822384423397544537263283356855845353384355467172425447276333227266721254779455411724215
1232222542232223232321322222187293523223312725724724421177222422132522224332622417141822722342212252
1353462356374364544444752374433432367667363527433336443445574733653443133657644213156634465463366664
3192682326222225434218233965252711232242242236626283422252542162524165353222421222322292921262515229
3312233223612332333341332232322333242232223222131312332231232232133322132322233232332333263222412332
3234443454533643613563332542531736363323533332113364323434522333534323225213524556624642433653522553
2356547419343244352723362645244353646442345436343242314441245442452344326474324314552253321131474344
4445493462456534126735454332732865436442644324962445644548387755234434462466476473934635423425734474
3442442214253562342232334243274474423334242283443262663132232234435423322826434324322328667162354334
9222423542321221122258446212213211172721233221222221223272256232642372212224522123332524124143432326
4838673447445676256588638865556356667346668652334584256363964445648566415477386645366466656544567654
4133131233343233241633333254242345323313343244335321522133232321433234243434543352332263632372375333
5828945793549483935858838333432326954645791684532333453883537868337762597642674263434432357934531374
2462313322354323424333646243334253243223325422243531637423233322332433424542344312432533643324436543
2539348544557567255225664845627542364542463624645864444225522842247237721342534922336455362226526365
4313432313333334433332333333722734342333313336332233233233243313333312233323332333333323333334133727
1323322332333334352335343422333333313434243233132333332323433343143341333533143323443344234261233433
4223243421322262122224452325212324411352242723212223222526252232122721211223222332222242215215722252
2122243223224224122252224224652241224312121112242122848123262222222225222222222323223222224122241222
5459575645652678467695654954544755554654556689544674556527565856685345655767347655553755585395765556
4383447444642633635122355334333542442544584433334813341335344332326442333353544332353435434413446234
2423344333433353334546425355243722444635353463435554444333335333343344352563531337322284832853331384
4344441443463433342533145457735744443464345463435763434644743746347434463565745744767446646744313864
3112622325223212232232184172222122311261131225132125212532233125325352242225221233322322254266254222
2421274222332221222313121222321224121244232212223133243213421422123241222122144324214122214425232244
2252234212322333222333523311221223223332432243433311222222311337442363222222245236321222321312511423
2312212222222121212222322222224222222222122222222222221232222241122232322132132222222212232222222122
7262448448421222424318593452122252371672822885228388224822722243224431442228622226178225632277243862
2344523224412264412234421843923324224234342321232125413533424482134222423222714233232222322321642882
1232232212212212121221223233422312211227122221242222222221421521222132222141223222212212313123412222
2421555222443346242342325142532329744622464222455253942465222437421925254433254513524523242264522232
4232364222233223225422625448524281542252232522532734642617212447412431262622232224732414524822558622
2232222122231222222222222121123231223222222223221222222222212222312332222122132222222222231222231222
1693242656125335113327232727222355534235553925255524352364142322551624375266322233222122623649145923
3191622272845397635962226263372437781255371428539472315456786262324541857136172382276663246422552254
2341631463341235353222762222332132322233235534224433242533322672626235543433335824222112122563848222
4243352323393323322412422723421344531443344454133533423332252222525243363335353323442534322434624333
4122122434441322212222232241231253242212423143524122122221222217222331222922224213122242232122112222
8526423444659538534644434443534767654446388646433363374624465623394854334333835689839623378845467864
4313524326322723333653229556672243256457353312433262243536222232243437572346242312182416365263363632
3421432222332125453333232334338344233523333163632322363363515263335412227122266337233332633252733322
2275513536253364556536326359452448225266635634263644244436526674634662244266625636275259662225628464
2222136221237222222112825432222212642741375221233222222212222732324412221253641211214253222228243222
2322321212231213122111233212228222323142251222221222232222462332222222122521122351322522224222232422
7828633443736627726586266432543635144134379442252564462478743746263525583722448333372335374497538124
3222251227311241235422312222323222264311412232322233341221223122222162422212226323422221231211513222
5421435122248223255222326522521252121341244234153622222227423222224612542233443421224122174226163622
4222222222222122113235623133222212322222112232222122252221322321212222222242222332223222321224223122
4233252445312226722225223542226243322454643222228529422542432642233324322422222232232322222413121553
3615624141464526353322824153676424526435724645414624562233359465646754544546524532454445363348642541
3474387467558466355565563784234546623884345559524345534553425662362764666345824956865955463556564644
1222522123722125232431423122312221313222222242227211222212221246224221223122282113232212223221222722
4454441334924563343346322321343234496483913614877527343344493134728782224847974423844453215347431443
4224223212291233225225132212253425261931487567442622576642326112223572438512272224122415569742162525
6445335414254335336633343555235745445554554455535334535356454374324555334533853355353325455547325554
6626581624635444362364651825256666457665474336555556556644435447463645326235256526535444414733534454
5422576923223945122374796322152228884422452328642342753427334326724922222154422242222232232224147344
4223124232132333633123141122222412256142215212333232322372323321121221222222223232322233232323324532
3438133563332253313223323733342334333547565235332563234333513353132433224223733323433153334339332432
2232222222222322552222321413122332322583424323222112232222343122123221632232922421112352212242351221
2144423335464534433412253343495544445443423457247313364443722832342431533337637732644324464447454464
3322412224224232642223433412311245672241314223325221311433242222221421474234544323222122432332342424
3222332324232417422293428432253523184223543221221334231354221534223154231326547412423222932222232423
6454435364652351435243121321513136424162525615464322641241355622412655562155263545644145116561433789
5651549646656564446654548545658544637344446644764426624444646566644356545536335644427954453454845455
1131338231231236463826221222271244933251332426223213122235217233532262423233333232222523523362232232
2534465354338456343753333332343257573256325453237553435457423535435555555343364434344555542935444537
4322212242322122412222273222322242322213244222222612322222214325222212223621321232352231122232222424
5554555422343543534535553555455554872545238244655255353555555535425355545625355635545436646435534944
2423442532223524223122234133414442223441212221427223222232221222222126522422542211125452121224231354
1225222172436272232152224472436378228238344252537321232143222162232422241622442237322439142322224332
2134222222621363445321422363333314221122222223244313241224232522243214274432346243462431342212242424
2121443212224135231222223113432432222232318221222214222213222221232362211212122222447213222412414122
1566355333393336334172656442374316389732383778336895623949463733633559423424688358375253739713963278
2341254222222332212427223222222642221332224111722741226322434121222243214226221723244132622112112222
6644642354573624554464472324223453542555645455422354444343626843445234444444464232522646245432242461
3247436536134438548873464346333532755684353334675455432343435333344342364244863454955333432551323333
1235215233244313532333113423336323344236333333463553332363232223353134733242353532332532433235323331
9222226122322232272232261242721521223265414242325421722226222125122232222231213222672252242812254326
1321222223122222222232223523415321322322222244221222222232233212323122123122223221232542424214322539
3444232433344233344454133423435235333414322363245333434435335434413545373344433431434333433325353439
2212231212222123222222225221229521332221225212351322113133232211222223562322313223231212312212132342
3446665745854144677546554847575954733732467444426485447556754446464596854754334252247464584775744424
4346262565225353555549454323452344542464454435533544545555222345534465553645355534534534542354335354
1335222241344263233453344231323221127323221184223234423232221222322332323423213224332341222223121326
5344331336363574334353641632133233443333323413442443343323633245842438635472374733453364333646334433
9444334434444244644444345323745554354344344442435442435432433266524353434344383446433135455453554445
4533434334344535345534333423444431344333442423245543134433552254344459432435544425422436135444413644
2221322532223525175451345547567432822312232752333534963253638162474322348231743243225235335422414474
5254537535635118228352459323444144421232545422514324214363242754457442221353275325294663252333452344
2413222233253222363233382222333233152212233222212337331353332323322443221324233422332213312322322133
2222353561222523135513522223232521222522222242432335222215412222223212333534452236531127122125221212
2442384334158465433823365235674363435555433458234364573525766645443242362442362654345585533525374685
3333362346234532333524724934541315323533324353333233612233443433323533333394347536227433666337336345
3322344485213336532312332343343333354224833344334424424445333432633913344243324113436484424263233322
3342333423262333433223332234432223332323323233423328434732342233331733323332432433321152213332433334
3333313232317322332533333233335133721333233433822273382244353338333441233242825341253133329383633221
2322243422312132242231323224322324422135322335433593322322522123323251242522132231334321332322335223
5635623236946239558355233633854435593532134143353443243324233533164555442233345444454463345533536943
3544244193244226529332426724342221335632234551423312214452252222623354242453451522223552173531454254
8316113362363225333531324323422213323312453324252323432416222221353339564652322435137224342323323333
7342633555612222253253223233314222132543262332234425246244543534553653523375332342323242224241345132
2426443634943333523434526234444346524431545314136223423324424436344554416413323244144424537235436263
2422345222227262832125222262122535563213221362163123126225342722332424326626434424452442652213242233
2695512227221334661242722252244682332252321214131628211624213412225241322622222125224122222215272282
8352222447535225362515335225152142332257652128665342313311225323322435782254832283123285572331272623
2522423322322452621212352246423223132352222625543322132323122213622223136386123225124222253232522212
6233333553433344335534335441536333444432144432234444434333424533233441434443342335444542211343343443
4353732444512234333345235313431332543323433323223443373336442333335434932835543135333462635233343534

137
vicky/dec3/dec3.ipynb Normal file
View File

@ -0,0 +1,137 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "dbfb3e8e-42b3-4272-975f-65ffaa80f9e3",
"metadata": {},
"source": [
"# Puzzle 2 of AoC 2025\n",
"Author: Victoria Ramírez López\n",
"\n",
"Date: Dec 3, 2025"
]
},
{
"cell_type": "code",
"execution_count": 60,
"id": "f96768d1-57d4-4244-b910-3dddd0a7b023",
"metadata": {},
"outputs": [],
"source": [
"# Read input file\n",
"\n",
"battery_banks = open('battery_banks.txt', mode ='r') # Open in 'read only' mode"
]
},
{
"cell_type": "code",
"execution_count": 61,
"id": "aec9c7ad-f752-4aa9-8a01-c102b599dd8e",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[99, 88, 75, 77, 93, 89, 65, 99, 98, 99, 98, 99, 76, 86, 77, 74, 96, 89, 63, 89, 87, 98, 88, 77, 98, 77, 99, 97, 99, 99, 66, 99, 98, 96, 94, 98, 99, 99, 76, 99, 75, 88, 99, 86, 98, 86, 65, 87, 88, 99, 88, 87, 97, 96, 55, 99, 98, 99, 98, 99, 86, 95, 98, 66, 99, 89, 99, 97, 99, 77, 99, 86, 66, 77, 99, 99, 87, 88, 54, 99, 87, 97, 98, 99, 75, 77, 99, 98, 77, 77, 99, 99, 98, 77, 99, 66, 76, 97, 99, 88, 98, 98, 77, 99, 76, 99, 77, 64, 77, 88, 99, 88, 88, 86, 87, 75, 76, 44, 98, 98, 75, 99, 88, 33, 99, 99, 88, 97, 94, 99, 98, 87, 99, 88, 86, 99, 76, 87, 65, 96, 98, 99, 87, 99, 99, 87, 88, 99, 75, 94, 95, 98, 77, 99, 89, 99, 97, 97, 76, 94, 76, 94, 76, 87, 99, 77, 86, 95, 75, 98, 59, 79, 96, 99, 96, 86, 88, 98, 96, 98, 99, 87, 75, 88, 99, 98, 87, 98, 95, 99, 99, 97, 77, 97, 87, 98, 88, 86, 66, 98]\n",
"17766\n"
]
}
],
"source": [
"# Select 2 batteries per bank to turn on\n",
"\n",
"max_joltages = []\n",
"\n",
"for bank in battery_banks:\n",
" bank_string = bank.strip('\\n')\n",
" bank_joltage = calculate_max_joltage(battery_list[0]) # For part 1\n",
" max_joltages.append(bank_joltage)\n",
"\n",
"sum_joltages = sum(max_joltages)\n",
"print(max_joltages)\n",
"print(sum_joltages)"
]
},
{
"cell_type": "code",
"execution_count": 59,
"id": "3c69aa03-9fc9-4c55-9b85-13e4f06f7b18",
"metadata": {},
"outputs": [],
"source": [
"def calculate_max_joltage(bank = ''):\n",
" # This function calculates the max joltage \n",
" # that can be achieved in a battery bank\n",
" # when turning on 2 batteries\n",
" # input: bank = String\n",
" # output: max_joltage = int\n",
"\n",
" # Create a list containing all the batteries in the bank\n",
" battery_list = [int(battery) for battery in bank_string]\n",
"\n",
" # Find the battery with the highest number\n",
" max_battery = max(battery_list[:-1])\n",
" max_position = battery_list.index(max_battery)\n",
"\n",
" if max_position == len(battery_list) - 1:\n",
" max_joltage = (battery_list[max_position] * 10) + battery_list[-1]\n",
" else:\n",
" second_max_battery = max(battery_list[max_position + 1:])\n",
" second_max_position = battery_list.index(second_max_battery)\n",
" max_joltage = (battery_list[max_position] * 10) + battery_list[second_max_position]\n",
"\n",
" return max_joltage"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "59b1fd8b-6aff-408c-b0bb-aa1e55410914",
"metadata": {},
"outputs": [],
"source": [
"## Unfinished start of part 2\n",
"\n",
"def calculate_max_joltage_12(bank = ''):\n",
" # This function calculates the max joltage\n",
" # that can be achieved with a battery bank \n",
" # when turning on 12 batteries\n",
"\n",
" # Create a list containing all the batteries in the bank\n",
" battery_list = [int(battery) for battery in bank_string]\n",
"\n",
" # Find the battery with the highest number\n",
" max_battery = max(battery_list[:-11])\n",
" max_position = battery_list.index(max_battery)\n",
"\n",
" if max_position == len(battery_list) - 1:\n",
" max_joltage_list = [battery_list[i] * 10**(-i-1) for i in range(-12,0)]\n",
" max_joltage = sum(max_joltage_list)\n",
" else:\n",
" for battery in battery_list(\n"
]
}
],
"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
}

83
vicky/dec3/dec3.py Normal file
View File

@ -0,0 +1,83 @@
#!/usr/bin/env python
# coding: utf-8
# # Puzzle 2 of AoC 2025
# Author: Victoria Ramírez López
#
# Date: Dec 3, 2025
# In[60]:
# Read input file
battery_banks = open('battery_banks.txt', mode ='r') # Open in 'read only' mode
# In[61]:
# Select 2 batteries per bank to turn on
max_joltages = []
for bank in battery_banks:
bank_string = bank.strip('\n')
bank_joltage = calculate_max_joltage(battery_list[0]) # For part 1
max_joltages.append(bank_joltage)
sum_joltages = sum(max_joltages)
print(max_joltages)
print(sum_joltages)
# In[59]:
def calculate_max_joltage(bank = ''):
# This function calculates the max joltage
# that can be achieved in a battery bank
# when turning on 2 batteries
# input: bank = String
# output: max_joltage = int
# Create a list containing all the batteries in the bank
battery_list = [int(battery) for battery in bank_string]
# Find the battery with the highest number
max_battery = max(battery_list[:-1])
max_position = battery_list.index(max_battery)
if max_position == len(battery_list) - 1:
max_joltage = (battery_list[max_position] * 10) + battery_list[-1]
else:
second_max_battery = max(battery_list[max_position + 1:])
second_max_position = battery_list.index(second_max_battery)
max_joltage = (battery_list[max_position] * 10) + battery_list[second_max_position]
return max_joltage
# In[ ]:
## Unfinished start of part 2
def calculate_max_joltage_12(bank = ''):
# This function calculates the max joltage
# that can be achieved with a battery bank
# when turning on 12 batteries
# Create a list containing all the batteries in the bank
battery_list = [int(battery) for battery in bank_string]
# Find the battery with the highest number
max_battery = max(battery_list[:-11])
max_position = battery_list.index(max_battery)
if max_position == len(battery_list) - 1:
max_joltage_list = [battery_list[i] * 10**(-i-1) for i in range(-12,0)]
max_joltage = sum(max_joltage_list)
else:
for battery in battery_list(

View File

@ -0,0 +1,4 @@
987654321111111
811111111111119
234234234234278
818181911112111