V2BPQIR2KMSVDOCF5NT2BKYENX24B3AOPFTIOOKSWFXC6UR5VROQC 29911388013279151495076544967213044479466488669279011963619169287272342109960833834200829744393114642401880322623905640276818874217331456532609447373067909686274133738210242695966749148511039624686925812998539757048882209272092754843188424211872469614627794428659279333477370296493433328857793578574414516182286351230553588915398880104431068813205172310526550561487407131613861908635033941405126811224933423273447816743077321048485194622617936392296933706749532338181117956997426205575924222130838981905574737368450409354323650491517621643254851605841355224073754111220954010464847847355614938425997903381252140570187175937136924077081560382241719713418703129059024113649687603179662994692728850356056421421635102578520145626118552115093167411292135557836822592117714148697034424661104547239170682086913141304211732331316316365361146218906227335842125220896507564635391135391133123864156112421577492864844452763742783223259669582926839878344227735666239626663186071220912140743982331078019554179311524614052196548672999466763052033215627205333714642237494246394383799598388105352664460793698501188307311577516364741734494886586210676451616562694526214533662907610034481254548660032304429749934572139736081043577322672790329858421241741281077913809445512524490791702300478710507325230175847165532741333134529741634598426323336312959764261537723563298418518840829415459312198673554092245058279291153231140212265112031040563107512348518555631560669325481270015864820927485701569310382559864110022245103094417144033846667140869903329584264783103433839296740605648222029525233541059571267546556861843560828761869332856571292259467216816618032335446119611266370722157711747217824892483800612977288288251093769191640305064509125934580488338985093146249743315475043388285107311887465691219339366103016604317075692109254018698537952564406314752271533792499885852261536735691653588926564559433640472517316334645707408029223148462846371384660992447402464572455528519821048602931684278428443794699539334914928276948533575517827615158566231389471314229902640534443978037915024633333123791140649612356104383104962806924458057741092198755131612377561172074100827925978343121598372711011110061191328704152772402523191183066711185371932460214008721434993902495425793091322956594769822070068314123724550824435512389616350211132477413594387376659543018223014204371952595263372165838816444435135091460855872126909101441840615594287451103416384348672379532331262865143857395554241425544077204854882691508921883358168029243096210417171833301911757444174693234477982911996422348673717564926685702502339014406551026611533419114007414110934301863590476843006686121515424176630461493228728361791379939466174500010121078105463784060243173422818610230561051485640669799314186156150541160906618013083145869638939791289162111521759195273753873721076816517043119710657388444634241668101927218102106133908464310608935840728940636010068211647915553448355804445340525284133543149303270511931001032368349322529237291053643775696183124832420104511425294317846785912438925175257300841251039911897129524591327533112538245775342154639352972591768077051701848552378397469433464484350731477805468733861418474386297529821534410457245806756707610434894772262142109369618191287392812336297518518643200323062272079153633801856185345044101116750463233252224094679571810445828282433235732171640821812645152494976612513535689624210848644634430494275627534505792222524353099501841174452107567422359559636311390865963238505080331455673659301928327616001073477297379139860149163294335622032782169136051710149944694907315128764872537697464484672664056379669515466393628521337112265531354494472025295476670491991009311924131321096980212266640741163708886681188493638264141402615738119781604741033333277430927997384479165528631923174643197393748542410393224286861076976853863231616129278366117387602137025922054515235375643529366321418477928836204106441243412655125922494338926196847451053065385183245411086273952103384979645105360576954921364625665996302510709681194511852273645486752588024286486528458206206197762711565236360841943571446444032164321564055456751655035760544272647801129081168326655297711238331061915010506049076624539510166929538037645532783153297904284110181426457945103989128982734279127361419016883328354317119351844546169411964373234740495666569828174678398022571550437209475745796807144215366602390568847226310111203849559048923081253660821532231827773641286425051679488011632077394831283485164139895132605753845990625765073405396038682939371157433425596556203055693045004733401115538219201571049465722011495073884958670110093506263652966477061784993512814386268555233293863425636471580215143232744283820842356291257975836600162836956587253661071342379505515760648334363675473042085276530465378725839302047521159483480966361087148980010254920379371221891391362276961032911172940198971014361009964215473197498878051177036303717065242724972842078172817577723010234189368416118523966979299222532917730584884622668552994251254937905368722157067925650278086241435175523775677372257567582039503540108073253394463318696327390214213541736148507359515697793045374118894935350632352392238417221272129737841520413645976208171317356325755316115346526610075645229561809027171498891228601006541021019586197174299032087040140501387308610540899924831601114905551792679327784819541032371959807446432342104223549643309217752224738271452813441445643521169280831383274887798115627638275215837550440316402344164835283103613355285468354017344416914771189613377643832977216552214712817536964773806659957246522607632398915808028121607519858963895122920305527483758213149315916566030201046042844460457411144051634355184457634911298952676645496843173036172417845800135754117472857839013132401384215191314147657938289879742035780319091098909792916535117447941525580873452768725522575602135751996517232275035642769767191812135842643776067892752649206775212925487524511452944056176731306214865148741382188358451514029721323133330539642696793720176199344947258352234208887631631229175261090100957301354686571406000338010624176412161817289712217630027776061485517491893217882408476219295118940828041325311279503358326524372685319676620448432234281527317666234557468285915345868062814414586425397254979846032540339595411417955401545443024841772327955601907288548321221413316142348164168356891422124303820249959984269332212577604326187845152605996553995136384250283011687615613642380222598241512637866751571693751991593461224875548203825916347304410794688523873044476293037827293372614041901444570156752841968926548267117574123346325707263522951927325137827314126771247713486523013577393410077916647177645535821983312480125274034199947645788345828434598232224224872314015991635887591634841100285565246434543594952487225689156058123010670215704223348121327282324521768982033491865189991659679487068685972924227210102402530812582138445243575449043074222823146750827374563176333698114671057116358687365629855225083260726406784742130971671627433427291122173143739493131844064211913815228102448153119131024012109105806179210208432455831138992234904610055211951145052267130801405875871131350893437222945056358724079774973130867762254718951822620281430954199117321481367600251006194333811694422159920983218399233737069408065504385541241407124247367891286707945591459674738495240309027841711618851220206834335136812709449957697705555443245470594617757411404574491652596274061113676368924421115137256326129659441223111144461905925181531281433021661116233386424231797596109912236241102048694247490652082362536556565553268928322248256540273744449432622013339727122766105067802011552968367063226510758673313823103281196124881908357623672913725860056231257329384048500559734602214814141018508012867079247659753865715332925474220016665834650449834229568953585298496837626038614084244933220288719421116310520252761451123366259877112832075022351489026685522448814945735200954893132278918765855127715973115515351945268105713024087464026871436344758241836795233796602104007891710261276646679065134780437759112832642329094189171149758072530412460124067023599364621631642920253339715781824927365442731615680082078296127097088266966536788681032278499952731412629132620268875
const std = @import("std");const PATH = "import/day01.txt";pub fn first(allocator: std.mem.Allocator) !usize {_ = allocator;var max: usize = 0;var elf: usize = 0;var lines = std.mem.split(u8, @embedFile(PATH), "\n");while (lines.next()) |line| {if (line.len == 0) {if (elf > max) max = elf;elf = 0;continue;}elf += try std.fmt.parseUnsigned(usize, line, 10);}return max;}pub fn second(allocator: std.mem.Allocator) !usize {_ = allocator;var max: [3]usize = .{ 0, 0, 0 };var elf: usize = 0;var lines = std.mem.split(u8, @embedFile(PATH), "\n");while (lines.next()) |line| {if (line.len == 0) {const idx = std.mem.indexOfMin(usize, &max);if (elf > max[idx]) {max[idx] = elf;}elf = 0;continue;}elf += try std.fmt.parseUnsigned(usize, line, 10);}return max[0] + max[1] + max[2];}test "day01a" {try std.testing.expectEqual(@as(usize, 68467), try first(std.testing.allocator));}test "day01b" {try std.testing.expectEqual(@as(usize, 203420), try second(std.testing.allocator));}const test_input =\\1000\\2000\\3000\\\\4000\\\\5000\\6000\\\\7000\\8000\\9000\\\\10000;