From 4d1c9c10eddd8b40ec042634e64982e3e3fa2a9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20T=C3=B3th?= Date: Wed, 3 Dec 2025 17:58:19 +0100 Subject: [PATCH] Day 3: Part 1 --- day3/index.html | 134 ++++++++++++++++++++++++++++++++ day3/input.txt | 200 ++++++++++++++++++++++++++++++++++++++++++++++++ main.py | 28 +++++++ 3 files changed, 362 insertions(+) create mode 100644 day3/index.html create mode 100644 day3/input.txt create mode 100644 main.py diff --git a/day3/index.html b/day3/index.html new file mode 100644 index 0000000..b561c3d --- /dev/null +++ b/day3/index.html @@ -0,0 +1,134 @@ + + + + +Day 3 - Advent of Code 2025 + + + + + + +

Advent of Code

   0x0000|2025

+ + + +
+

--- Day 3: Lobby ---

You descend a short staircase, enter the surprisingly vast lobby, and are quickly cleared by the security checkpoint. When you get to the main elevators, however, you discover that each one has a red light above it: they're all offline.

+

"Sorry about that," an Elf apologizes as she tinkers with a nearby control panel. "Some kind of electrical surge seems to have fried them. I'll try to get them online soon."

+

You explain your need to get further underground. "Well, you could at least take the escalator down to the printing department, not that you'd get much further than that without the elevators working. That is, you could if the escalator weren't also offline."

+

"But, don't worry! It's not fried; it just needs power. Maybe you can get it running while I keep working on the elevators."

+

There are batteries nearby that can supply emergency power to the escalator for just such an occasion. The batteries are each labeled with their joltage rating, a value from 1 to 9. You make a note of their joltage ratings (your puzzle input). For example:

+
987654321111111
+811111111111119
+234234234234278
+818181911112111
+
+

The batteries are arranged into banks; each line of digits in your input corresponds to a single bank of batteries. Within each bank, you need to turn on exactly two batteries; the joltage that the bank produces is equal to the number formed by the digits on the batteries you've turned on. For example, if you have a bank like 12345 and you turn on batteries 2 and 4, the bank would produce 24 jolts. (You cannot rearrange batteries.)

+

You'll need to find the largest possible joltage each bank can produce. In the above example:

+
    +
  • In 987654321111111, you can make the largest joltage possible, 98, by turning on the first two batteries.
  • +
  • In 811111111111119, you can make the largest joltage possible by turning on the batteries labeled 8 and 9, producing 89 jolts.
  • +
  • In 234234234234278, you can make 78 by turning on the last two batteries (marked 7 and 8).
  • +
  • In 818181911112111, the largest joltage you can produce is 92.
  • +
+

The total output joltage is the sum of the maximum joltage from each bank, so in this example, the total output joltage is 98 + 89 + 78 + 92 = 357.

+

There are many batteries in front of you. Find the maximum joltage possible from each bank; what is the total output joltage?

+
+

To play, please identify yourself via one of these services:

+

[GitHub] [Google] [Twitter] [Reddit] - [How Does Auth Work?]

+
+ + + + + + \ No newline at end of file diff --git a/day3/input.txt b/day3/input.txt new file mode 100644 index 0000000..72cb156 --- /dev/null +++ b/day3/input.txt @@ -0,0 +1,200 @@ +2221222621311222213132242151213242132162234231144212112222231222222222122221122241223232322424322112 +3543326422247421243461523246251225253652324623123514155262436222322736212622632535261512337153224225 +3222222314222211221232222212222122123212133222228331212211323332221223322223222121221222222212212121 +3224323622236944523235623633582354553243243425462556164564534655532214442234136726342452535235224521 +4463242484324251544436315213253238423242742225441254332255425532344624856246285453554421653275554443 +1762275124723427566439132222317332742546725316626264621222632333535422163371658522235287684667354262 +2222222221222221232222112243222162222223522222122121222122222115212222122222122224212118122121222222 +3322322221222122211222222252222212222225222221222232223212222222282212121222222341232222212212222222 +3343333332343443143333532233431521333135333233333533334333333234333234432322333333433533231132133333 +3785386723323225658553324532773545325523435172363575426333259433323353692363343253334939352343729333 +2327232424563359226332921323443284252244243833232432422333336527672222829333232223333163323346633653 +4688555556345636757755767773491789463648544754674965676677564473625347374535636347544747869368576577 +4463444745423443333365733765636365663446533383432449335434535773238653432323647443744364343526321744 +2323435553315255425532216253363363314352462431613452268642425647152427275723353562214245332236624266 +2212323132222222223112122221222231122212231223332221222222221122222212222213212222163213222222222222 +5223524923233333338356152351323242822352333235433232243233232333325533234225573313332225243333922133 +3331331433233422332423432433333333322545214213352323353233335343332343422233233533223332226251221333 +2235352232253522322225222552151722521253143424221542442352284223225322654252162443651155422245323373 +6989732784672676757565776763266695868564764675866555552669555186258773824686658968254676737663476872 +3517334233325372353311423123212243323323732622323113322241323222212612235135335163262311544322323363 +5231322435492642533526351123252644552732537536247335743563223145246742455355326624126665446166216242 +5612568562642436765657537544516632246163618351635225622626422435521463356327325259365233262325434212 +3335422243222262451242122332223113223223322232323133123313233233511321332283264241222333222122235132 +3254354334341632343337333355224333342323333832343232543514232323288333272433233443333423141435215323 +4244232344222343446373442444222422744452413322323214324242342432224153423344422223538444133424233477 +2224314121322213213313122212222434222612212212222223123241222314141222432432227222212272222222122222 +2342122233222233251122222231121128213223222222222212222232223232212222122222222232222222232222312323 +3232324214323133352311226332245322333624232342346455344922232233343433244343533322245216222322262232 +3544535322322352143324422212432253424321533463343524133351214153322431522522333423452133222143541224 +2628223222122262123321222312422222222322241212222422222322222224342221222121221321222222222622132132 +5535556552545545555555557645555464534554443854485557595644285535455855549533534558583443445524545545 +2244541422254354225522153243223254334222222222312211244332232221254233333212412223352154323512222323 +5236456254564453255452445446343365546543567644427446464434244434264463496356533366346544534644526426 +5833854982646444156648453555885136595394527679847933633834896575365445845954945558899587595495466575 +3572224343444323333333342633343534323337232433324334563333343241436333435343332323334332442514233335 +2435237332246352752445444215855445223253422327425623312362367642735482215528434654676664455476823175 +4435545733366338523334233265433343333422254325462365456634546545653615535842352433254955454336536551 +4472442323227225332322532343252322723252133352253223635253421322356435531565232394425233123244262651 +5345684245134333468526354245225256242345473442145552453434544444673223545423733223353554433533224743 +1424243323832263422365336123334328614521532321432213261332322224222242426632825353423344232372322434 +6256322274413722223125432244223243125142522926423354633412262415421543522551225211623514224522451235 +3323633243222133114233334223232323322125552432332333333234213223743235333233322323322332332433233333 +2334714312311122371225232122226224324227253242232262221312122232252232223232222221122213122322222432 +4554343336244152413243344344235342321364334424144234342524434332422225253533443446132142233323522443 +2343323163232235332431263212232221133233634212123132132261211343353213213222313122232623382222324225 +3125424642442232617562273753473623364534315321621542223342142324115535682882241283322222122248272423 +7228433313232643336621532253343627353421632223343332323331143111227332363472322322331533633732234223 +2222232522222624334325262222332223262422422312365363432322532423125223121216222223265222326234223366 +5234331314343232434335353333435125523333441233342442332332313532445233352333321533335233233233443453 +4242223553122225222241223312225224322322252472313421222122223313232222322221222323224213212423223222 +2222225222324122223212835332426222414226442126226524222242222253232222231222422223113526212221232122 +1422225322213321321212431222222522121123231212441235523522222322221426224434123212221422265352441222 +3444434424222122122134322243124422234143233552221122213212312343312123322224424334244223433422211232 +2451436664537546525513735566444554843334653353456624643635423656665541656437525543645434446453648546 +3524444464526354245245382322221622542375144464325566651444354514425225322233251223422322246224544643 +4631322252222223332732372324458532634623222373132533414342722633233384326222223225133233442333232223 +6324553232264554348322377776233355273732336433423375555494723333576225335433233433332243232332334433 +4311633322444322526522224231249748222332224123231247232463211436822233192245525224232232245232112222 +3453363332233223343334133235333333317443313853373743263363553512772335433344333422333333333364333434 +5421322232428343342432554412324246453522232223322152112413242233334127412117612183452217725228244352 +2242441353243435264326333252354134153925243347133463444444654422523256633346213552165265334346262334 +3242335463412545435542342455435434462225371414735284346244296426755243253343544533233225224592442542 +7175645488374551647875379848876595478385377735784336346554495185585165597366984896537679484837756718 +1142212623741651142733343133612642246226712223417762141434715666445534363164647145556331114533223389 +2553776554543453285443364652525547525442556455647521554555494455545553455575595653464435565525545745 +5221322223321213333123233133222222222113314223221332322532222223323234222332232233312432322323213222 +9746674837954545549896488534495555815596566359697846599426563668586745549546755339559663674957765949 +3122222252524321222212224423214242524221121422211222112221112426222252322222223224322242222222223242 +2212332533245334435344241422242322514355111514552512234332345241444434242522423343344143523555436789 +3223334334333343333234341333334333344233223342343433433443332322333332431343433133343323534442334233 +3223232233233332223133232232433443323715235231342433423334323233533323223414333335234236432432234332 +4675333343353333364435233435333332742347233352633225235735633253373443333233143333443322544343243334 +2364323563946282485252324242682245222531133832685444439324623525621652653435193544229628373393713543 +2233535735335355343333634574334334364432444233133434235333523395513442333353433352234354453334332533 +4332544423434343232354454415231355524453354232445331153256324435556872254374212524244434224453415454 +2232252142823332136541112223345252324123825322322643134952454223681222222662424524313463763232446876 +4369885952776849757844783687586499846598215774661698436866478693597877366358634462858778999754679986 +5353455553262776125556256636332536646424554253237322235541333542733323536855564433653542464573425364 +4323233374674274525523434512317334455432333363235473575425653545533732554324223533442645624357366363 +3121522224252541351242224222233234222211422321225222524281222242222322223112223222222155134225222522 +6333123342622434222323633412224421143522144422142532243312221343253122142422323226223232335323133323 +2524223122322446222621134114322233222714228223332422241722422222232322256122223223342234122422124234 +7737561969765366875564966493886555557856587235985467465866799748684765748357934865344669787383932445 +3123622322343323232673421232421212233236232326142121332234227542143221262222211234123433331234113222 +2342422332413422223223217233332421222321222222242341424122222322122323222322241132321735432432212132 +6232322232212272295229124522232226322215222125212311822262212522211715227232122353432312222223212342 +2724552623672452422782286624111221123452622835342523132225612433652422324345264242464652266222615567 +5486637886339537333447455465774454454364677367632364487724468785739863845348435365335583386933646576 +1333222332153222233211335733343351375626126352323726253273352232245322355344222655826252372733422333 +2234522214343233922253234243443242322321225221426446424226432544141532282112142324253123423212263448 +4433344434534334343236323457334446344543444533344434343445143334464242374443475335336334933443443434 +2223121242321225212221132322141122221251212421222222226122122212235422222113123241212221223221115222 +2233133333134233543348533236418355832242435333138373636325343926433633548233216235317426323368444274 +4343863464338386564934454645535464455444385444638436663368515452346543164854345444266656455664354442 +2325133212433632125233335333335442333236313315333343663214343323313233232223342223322243225132323342 +2762597754633144143375642334644552845963369348224334338735534553337361233552443387335493534314426733 +5649447645764657856646535974786834457426656499746775543486436375943665495486618458538536755573755466 +2222222224222421548782737672834442426372242478712622428228223416922263434854352249158222192331124128 +3223222223162612222334222153253543232352212355323222512322233222311322231224227236223215423232222221 +3875333244768161552854545275843768383133163735226133156724236148153435652814578381435746452784414459 +2324321222322261223222125261412622121328723133121632252287212212222231432222221162282315411214213122 +2429827257586545121721222245129224224531541322212636222222262414411253546422239425845534522446265242 +3352233332244236442341233422437425333514343324339424343614414644532414243834693234452622546432244372 +2222221322223231321222221233112222222322223122232222222226321222322114212261121112113212212222123253 +5242456346121322263122622233322273322435227233274352334624322142133182253232221234232932322215224433 +6344734335323423343243333443844432646244233222342433421334324223444324114133433272484624212322633144 +3342233812332232222172323732365326323213232241122227322323225432332222645432432324325234275232222314 +9754256445423375544475434544276537523554535442434343454239345579934534133542242714655556855236554442 +2353533435245531553953557444345555655255543358353553554462626533565522565255335814425542546353594525 +2225244322313252522225212321324252121221123552622222132221222124241812142322562234155617332122414331 +5252267814225231242424254352345223443341434472444478244344232463251555424328328664219532126524514656 +2433635566363453144436352433336722436666246364367337633475557544465273346749464356863875573381332626 +5483787564533828687455355335347133682657766623453576852374472467651537865836447476363356463456534753 +5445354756252347373443737331333332435554435647565555175144244444342537162465544454446442222355244243 +1123335232252222243243213444233338421544282224323334411223223854313424223342232233433122924243342242 +3444323323333223222533324235333217227213623342283333333236133331335323232314243283323133383323322226 +4333233133323133333333333335342333244333233333333313433433343333225382432333293323334435332423333333 +6353453554554444544459553864854464543346445463754854445442536437453454445545324544454645445456353644 +4454545383447454844854255246848545445594453559544548955453254836435654544644854434479995344445448476 +3435254493343234452338423464623244524336363473523556325584464373333444333439315354636343242434238272 +3271473522122511432123544221266722722918223875322122213223724524222252414129298225628412122922124185 +8835486445354453364452758966485649744744959858754855444387449444799934547799445594444474444428599445 +6367434987327381438226232363337314255232254353133352223226953892333953223523235223735353263123533666 +3122312342212332136322112422123323333311212232224342444322232133433141422414533313233123233421314342 +2342123523222233725232269222222326223122213424532322331322142251372322222232212533325322392281431422 +2322634379214242475242442524545362125333325544432525252425226116235145452132332542553514855493425545 +4421523223223221212122262212322222212262333223223212322121122212222223222162222523221242223212223221 +7822126424242332172242245322662244322232512522416234625232423212324722442223274244249221257723211442 +3221224242252623224335111292732335547435524493922224128144222333122444222219244322532349322232423297 +2233421213222242222133113233122222221132222223321233222326332231512321322132324212312216562223215232 +2523641213453364232213431344354563323322424344153323413452533448263422422224736225232323442735434332 +3255992277439366547524452858476684863234767584665742565679564744834616336634656734254538546226946177 +3443453432354345224342333354435434443424442432445445337424335525455444435543345443544512344463664233 +8747776574254746383338575434566376665344455444685464445344463644544645548464654954737434646234566787 +2363514423363332532553524151452223324125125332235324228223312475242257622324515224354375425246323312 +2571354112533444126645214354434563422442643652323422335311476243243164424232422322454264327445441522 +5428828225132552621211242397337332391729433224261424963792332157242423377232123816228246331538133334 +2533221223232121322233222212242132122122352212422222321422321222232123213221223223122322223522212322 +2932228252752544473772522238422461322694545722242554218824237228223325525227362196711612252154252227 +5525252253363442223453255552322535552653454546524545332672434353445254591154453551423355355545152265 +3334233213224312333221214222242233332212342234232122322333242223323323342342231522232422212312223422 +1242473533442242264357662354144479625264464124423326435252515539724524542633327132134243232523346224 +2544463544436635863426544475666365775535746777467556365377251345455667777375966737835634353633774443 +4522533555554153546443933554546334444445355333745625525453435455461635453354345674446465563554545754 +2232244254334322442422223234334233321412441343442132532223224342534432333232324324322244414442343322 +3137233232422432483242322335224239242234432332334456221113251223353322429417123224234232234221334321 +1483263445432232533282433443333239443343333441339343244333253533363333435634433344433714373343432433 +3126716424422753242334374625312523634232436264427323452154262223443625245234122445445144521255232111 +4323343631427333223334333333462634363331333223353334332333322313373333332263443333327333326643332338 +2112222122222211233231121222122222322221232242222123312222113224222614222225113222233222222222322131 +2214222322323122311322221212212222221121211122122221241222222222222322224222112222213322222222223222 +6616343535656426221614126114424442323356341612336322453146126133261122554555115256252511166526161789 +2533422234222842243344573242222411353822222422225262121422212222232233731311272612252722622426512522 +7132238523245415263322425522421325225321442613222135422343451242342231543222221253243221423513335332 +6244844834844285337627373736442734333726222841435988667445655283427444634343858382234884188259145355 +1332212132122222122222222222132112222122122311221212222222222132212212224222322222222222221222622331 +3425425344333442637533464374333533355645532574733554432255325554632526452523634335346293544332245134 +4334295657434422555555455556554136542535235485653545465345536673555545555554445523453534433232575543 +3325454224335334523637654573511333464142442333463229434433523532335123333124342534533784253547434235 +2531723311234332223423323223322254132122625132334161323323343323233222133422313333342332213225223253 +2322322422332542224232132228212223222332214242242273213122342244432322233234122222222122233221233222 +7696589646767664667993653664566696673826669656465757646686556652566646655958874697666588797864655465 +1321312342222232244433322313132132322333322444354334142234242323332422424133222223343243321222223434 +7236622264272476234336644331445766626532732233672456536625443656253327436535643452432752472736354631 +2746732463444534354466326442385574732557554633365555535776726694774456256334423361775567469363576944 +4314324424323445343353432342252245245234323424323644575332235153126421434444234324441324442445414543 +3322232242534422642324852254363344252342327222227322352121541125142322252252328224332543442635457222 +2414762322421262472222223241323228223232231223324224212262223226224432151522324342444242223131242212 +3314243322232336272352332464142323334362362323524222413333126322616466545232332233244332323433625522 +2222123312243222351312322213241223221222212532352412312112323222221323282232223522312212212231211233 +2622253282232528877333532736522321882243632563332227452523813332333232223293692623752623322824742263 +3133334351336613413224234241142423233333234312543642442444333344425254253432423344242443433541542133 +2464642335545633346742347843755324535263326456363333634213435665423344533421974446263643477635453623 +3425433353133422322243332335222331224123233222533423233342542122322333122232221221343132355232442213 +6343464338545563465644313444734463333246443444544244345534442342664445435344443436434446414464653422 +3644243652744224242465233473341253253323354164457323424343524668252433386344242465543834683428483443 +2342213123221313324444331112311133413143444432411213231413234431343142344343231133343424133343156789 +4432422543443344754448335826324344143444322443344424125423242244245445253313543447434576834333254432 +4434464569262365465644146434563544644636445452445544226435445645554644654444343454634734764554366673 +2222212222223232222222112225221222221212222122222221422313232122131212112222241222122222222224221224 +4836723231625273286323224224221424523244234463542222332432637522232322263236482334421222344752242318 +3524226442211322523223252254224222155424422233222274232112253944421462152214522327323322452442433422 +5264423431423132232332244232634444213224361345223563462354435543233343144243212342461347244455233123 +4251765235423733322312264235241643417263775713125242521224124317242312215262222233134172712334312752 +2231522642123241933212223112222212321224113452432212242623222121122332237222243122212323232551332323 +3122332423322225345222222534622225632332132222223344225223521231422631222311222322214431252352422412 +6523312724324833738323313322744134722353822343325142334344634415232335812443337322322445124425436238 +3323533424333435612722335453334233567316335223335537233692343344443833235333321335521433243454522423 +3342425245212222124123223226222512292222314323222112512421222224221622323123222222224322322412224343 +7443444343454444432644544634834536333335243344253253344653337345453343334443464454334344334444347343 +3533483733345852637635155624427843851223435485741355333834234373272333243333234765562347364247353323 +3442442254325343246233332332363374163215235152566433223332243423132423422222513222231313233423453261 +1222211222222322212231622322213223312322112223232222221222252212212311232222222222221222222212231222 +2142222434232434121243332542123223723223112224242226322522244413135344225222222524323342132344242423 +2326223312442322222223324422423221321312324622224324372411422213322711212324224122323244223243322142 +4686646668674667656766966447686676676565576577586566276657656947865666565676837636659466657465667766 +2521827228312721421225124454242521512252222332232222242226112263122243221413223223221424321222222244 +2323331241233212133323227233121242222222122726343324142234242221823634222263322232223322432242243334 +1233318223444255434472644637233422336336412424363623253447431632444277334744421343233631466233334454 +3333323334223342433313333134242323323333432333344232334433234343224233333433333343334334332333333233 diff --git a/main.py b/main.py new file mode 100644 index 0000000..f6264ef --- /dev/null +++ b/main.py @@ -0,0 +1,28 @@ +batteries = [] + +with open("day3/input.txt") as file: + lines = file.readlines() + for line in lines: + line = line.strip("\n") + data = [] + for joltage in line: + data.append(int(joltage)) + batteries.append(data) + +joltageSum = 0 + +for bank in batteries: + tenthPlace = max(bank) + onethPlace = 0 + indexOfMax = bank.index(tenthPlace) + if(indexOfMax == len(bank)-1): + onethPlace = tenthPlace + tenthPlace = max(bank[:-1]) + else: + onethPlace = max(bank[indexOfMax+1::]) + + joltageBank = int(f"{tenthPlace}{onethPlace}") + print(f"Bank {batteries.index(bank)+1} joltage is {joltageBank}") + joltageSum+=joltageBank + +print(joltageSum) \ No newline at end of file