adventofcode

git clone https://git.ce9e.org/adventofcode.git

commit
3d092fa146c4b2e3e61c75c28e317a556690a307
parent
94b425b0aefa818580ca92ac7e13b5782a147bc8
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2024-12-01 11:22
2024-12-01

Diffstat

A 2024/01/input.txt 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A 2024/01/solution.rs 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A 2024/01/test.txt 6 ++++++
A 2024/lib.rs 20 ++++++++++++++++++++

4 files changed, 1091 insertions, 0 deletions


diff --git a/2024/01/input.txt b/2024/01/input.txt

@@ -0,0 +1,1000 @@
   -1     1 56208   95668
   -1     2 52621   74203
   -1     3 95252   33335
   -1     4 79799   26047
   -1     5 88005   37435
   -1     6 61887   93836
   -1     7 48454   95821
   -1     8 62543   40154
   -1     9 68631   73255
   -1    10 76702   79056
   -1    11 70838   34466
   -1    12 18680   46550
   -1    13 51787   55754
   -1    14 37646   48228
   -1    15 85603   29306
   -1    16 37768   75105
   -1    17 90135   21612
   -1    18 35469   74470
   -1    19 21245   49622
   -1    20 18699   49193
   -1    21 21078   61415
   -1    22 10873   95775
   -1    23 91781   60483
   -1    24 56840   42667
   -1    25 81094   12954
   -1    26 71762   61434
   -1    27 64670   22232
   -1    28 33536   77827
   -1    29 24607   75889
   -1    30 37829   78341
   -1    31 36203   82413
   -1    32 31747   95700
   -1    33 22170   79056
   -1    34 28403   89045
   -1    35 82265   37081
   -1    36 10713   74405
   -1    37 76191   43205
   -1    38 99737   87526
   -1    39 75120   72550
   -1    40 82607   40971
   -1    41 81396   47693
   -1    42 11533   39908
   -1    43 21138   40655
   -1    44 97567   42427
   -1    45 11179   89506
   -1    46 19548   50064
   -1    47 43080   93836
   -1    48 90155   37743
   -1    49 21664   58398
   -1    50 90621   89990
   -1    51 52392   94519
   -1    52 82246   62358
   -1    53 14857   73475
   -1    54 56878   69951
   -1    55 48921   56211
   -1    56 49545   83117
   -1    57 84329   12955
   -1    58 71390   48442
   -1    59 27461   28450
   -1    60 94969   86731
   -1    61 32344   14652
   -1    62 89304   37435
   -1    63 61343   61730
   -1    64 38097   85797
   -1    65 21480   31806
   -1    66 79330   58398
   -1    67 29803   73475
   -1    68 83903   58398
   -1    69 82961   37081
   -1    70 19048   16800
   -1    71 46338   45021
   -1    72 65120   97811
   -1    73 94574   18471
   -1    74 43129   37435
   -1    75 80135   20553
   -1    76 13860   30053
   -1    77 23228   37081
   -1    78 75373   99812
   -1    79 72438   43358
   -1    80 62029   81330
   -1    81 46550   11995
   -1    82 86921   92694
   -1    83 34790   20959
   -1    84 98862   85030
   -1    85 82648   53872
   -1    86 23156   43559
   -1    87 86507   43025
   -1    88 78535   78226
   -1    89 86410   58158
   -1    90 23699   18312
   -1    91 43083   25346
   -1    92 69925   11280
   -1    93 93761   82246
   -1    94 31314   38097
   -1    95 31775   47098
   -1    96 50720   24867
   -1    97 59647   66769
   -1    98 95275   17550
   -1    99 12756   82744
   -1   100 93464   99949
   -1   101 50801   55400
   -1   102 12063   60335
   -1   103 10930   12955
   -1   104 96820   63957
   -1   105 51672   40727
   -1   106 35874   40727
   -1   107 23608   79584
   -1   108 94056   80438
   -1   109 46387   50916
   -1   110 34304   37081
   -1   111 83311   93836
   -1   112 25295   43512
   -1   113 17263   63763
   -1   114 70673   30357
   -1   115 68716   11280
   -1   116 52238   27269
   -1   117 99670   49467
   -1   118 50516   93196
   -1   119 84006   78719
   -1   120 61795   33177
   -1   121 43228   87640
   -1   122 77557   99949
   -1   123 98130   64716
   -1   124 96939   61786
   -1   125 95849   79056
   -1   126 16209   89990
   -1   127 65420   44437
   -1   128 94486   11280
   -1   129 66223   99949
   -1   130 43524   86363
   -1   131 62859   61786
   -1   132 90225   84321
   -1   133 88954   98335
   -1   134 75285   17907
   -1   135 38457   73475
   -1   136 42857   24650
   -1   137 10995   32077
   -1   138 91376   57464
   -1   139 77255   90595
   -1   140 89361   86284
   -1   141 59270   46550
   -1   142 71756   57794
   -1   143 87966   17022
   -1   144 58398   55419
   -1   145 96091   37435
   -1   146 17150   87526
   -1   147 39389   12196
   -1   148 76990   67087
   -1   149 61924   34998
   -1   150 95291   73475
   -1   151 50147   84321
   -1   152 53391   84401
   -1   153 36506   93836
   -1   154 52291   27344
   -1   155 12731   50538
   -1   156 60534   89078
   -1   157 79539   10368
   -1   158 56787   99949
   -1   159 54143   40727
   -1   160 98095   75373
   -1   161 30744   52795
   -1   162 12926   38097
   -1   163 51613   50801
   -1   164 36198   65515
   -1   165 28401   27065
   -1   166 56046   78440
   -1   167 70329   71912
   -1   168 95114   36977
   -1   169 60740   47082
   -1   170 56549   11280
   -1   171 57725   26874
   -1   172 56639   89045
   -1   173 79567   29741
   -1   174 94022   76570
   -1   175 96358   90832
   -1   176 12302   95795
   -1   177 76023   82246
   -1   178 15612   97271
   -1   179 17185   90595
   -1   180 46709   45432
   -1   181 13154   46550
   -1   182 88519   43458
   -1   183 32560   90478
   -1   184 65035   71620
   -1   185 92462   61237
   -1   186 69416   79584
   -1   187 35688   21793
   -1   188 28438   39240
   -1   189 82325   27813
   -1   190 78531   84321
   -1   191 24899   36148
   -1   192 85012   89990
   -1   193 23508   67634
   -1   194 66264   60161
   -1   195 66503   38477
   -1   196 15986   91668
   -1   197 79146   63922
   -1   198 37435   85030
   -1   199 62752   85977
   -1   200 26512   81606
   -1   201 40841   82246
   -1   202 46251   73475
   -1   203 34026   19249
   -1   204 50440   41947
   -1   205 76774   11280
   -1   206 22007   60880
   -1   207 94909   87526
   -1   208 58404   84321
   -1   209 75320   18175
   -1   210 76222   89990
   -1   211 91724   15431
   -1   212 48733   37574
   -1   213 36629   12879
   -1   214 58515   21379
   -1   215 12471   45395
   -1   216 37709   79056
   -1   217 14932   47109
   -1   218 98634   80670
   -1   219 97279   38097
   -1   220 96785   84321
   -1   221 12591   89556
   -1   222 36934   61786
   -1   223 41593   32076
   -1   224 78262   38097
   -1   225 60695   50941
   -1   226 79770   93836
   -1   227 41948   58398
   -1   228 84058   63922
   -1   229 35466   34206
   -1   230 99842   86919
   -1   231 57631   53042
   -1   232 22167   33022
   -1   233 61786   68147
   -1   234 69070   89045
   -1   235 30553   48228
   -1   236 96972   46550
   -1   237 49251   79584
   -1   238 50994   75840
   -1   239 91178   59794
   -1   240 29903   18646
   -1   241 92270   63922
   -1   242 50470   19887
   -1   243 68328   87526
   -1   244 87788   29501
   -1   245 56579   59667
   -1   246 23154   37081
   -1   247 29012   69142
   -1   248 24751   89990
   -1   249 12191   38097
   -1   250 14613   62616
   -1   251 88157   75476
   -1   252 78319   74115
   -1   253 57573   37081
   -1   254 49634   88296
   -1   255 80779   23920
   -1   256 58363   45944
   -1   257 38626   23891
   -1   258 44119   43477
   -1   259 87012   92308
   -1   260 94285   19887
   -1   261 47957   58398
   -1   262 98671   73475
   -1   263 80957   90536
   -1   264 75724   97254
   -1   265 55207   34449
   -1   266 26929   46570
   -1   267 88177   67524
   -1   268 42538   87526
   -1   269 60062   34610
   -1   270 31875   89453
   -1   271 84401   51230
   -1   272 30370   37435
   -1   273 77609   26508
   -1   274 54400   89045
   -1   275 16998   76877
   -1   276 53993   49621
   -1   277 80345   11280
   -1   278 33089   83000
   -1   279 59754   54338
   -1   280 10070   58398
   -1   281 79056   47218
   -1   282 38998   94596
   -1   283 78946   93836
   -1   284 17022   58398
   -1   285 26488   96876
   -1   286 29505   48228
   -1   287 87585   84630
   -1   288 11881   50840
   -1   289 34065   89196
   -1   290 92780   57959
   -1   291 84213   19887
   -1   292 89873   64164
   -1   293 88432   76456
   -1   294 27932   48228
   -1   295 75295   51234
   -1   296 87532   48228
   -1   297 89045   79056
   -1   298 90024   40848
   -1   299 83717   70022
   -1   300 44095   35548
   -1   301 61389   31672
   -1   302 45153   80712
   -1   303 53642   46743
   -1   304 79895   27572
   -1   305 62353   63922
   -1   306 31718   43553
   -1   307 47638   16679
   -1   308 68079   37435
   -1   309 99980   82246
   -1   310 28989   53198
   -1   311 55315   72011
   -1   312 39285   57048
   -1   313 63939   79056
   -1   314 79274   44485
   -1   315 67372   46550
   -1   316 37081   89990
   -1   317 90006   46550
   -1   318 78226   14583
   -1   319 49740   39212
   -1   320 57801   58398
   -1   321 99700   89990
   -1   322 20514   78226
   -1   323 74207   90650
   -1   324 30895   37435
   -1   325 45690   48228
   -1   326 59599   95569
   -1   327 36570   43919
   -1   328 27098   46550
   -1   329 23232   58398
   -1   330 64885   62096
   -1   331 85030   17022
   -1   332 91242   68818
   -1   333 32735   79056
   -1   334 84321   35330
   -1   335 15556   73475
   -1   336 65535   20996
   -1   337 46287   47868
   -1   338 72870   88715
   -1   339 26102   28963
   -1   340 53627   60988
   -1   341 24886   17144
   -1   342 96189   76191
   -1   343 24759   45636
   -1   344 98950   93836
   -1   345 47061   90595
   -1   346 74001   11280
   -1   347 91701   50701
   -1   348 35581   79056
   -1   349 55474   50020
   -1   350 39955   95451
   -1   351 16183   78226
   -1   352 76584   61285
   -1   353 22474   97165
   -1   354 23396   37435
   -1   355 71483   50801
   -1   356 94355   26883
   -1   357 16187   82246
   -1   358 48892   19971
   -1   359 78206   44272
   -1   360 90897   53164
   -1   361 60606   54389
   -1   362 15976   30489
   -1   363 64132   87526
   -1   364 30030   56758
   -1   365 58524   78226
   -1   366 37832   38097
   -1   367 78244   99949
   -1   368 10124   28222
   -1   369 45015   95384
   -1   370 98771   10124
   -1   371 69753   82069
   -1   372 71588   56590
   -1   373 39250   55040
   -1   374 60302   75373
   -1   375 44720   75373
   -1   376 49715   89857
   -1   377 17921   63358
   -1   378 20595   41212
   -1   379 71304   86278
   -1   380 52931   42672
   -1   381 12734   79056
   -1   382 96838   51840
   -1   383 69950   91553
   -1   384 20134   46460
   -1   385 44631   57523
   -1   386 21834   82246
   -1   387 87705   67785
   -1   388 67003   90674
   -1   389 57615   46550
   -1   390 24713   27095
   -1   391 92252   37081
   -1   392 69531   40818
   -1   393 95550   98970
   -1   394 69979   52208
   -1   395 86183   56378
   -1   396 97271   66222
   -1   397 34116   56073
   -1   398 61862   26938
   -1   399 69230   60312
   -1   400 39386   73475
   -1   401 91297   27731
   -1   402 91115   71904
   -1   403 65373   32930
   -1   404 22264   84534
   -1   405 42510   24914
   -1   406 31022   11750
   -1   407 79868   79584
   -1   408 52225   11280
   -1   409 81993   22693
   -1   410 90622   29200
   -1   411 10788   36850
   -1   412 19596   74840
   -1   413 18745   89990
   -1   414 95360   48049
   -1   415 37314   40727
   -1   416 43291   88941
   -1   417 16658   42023
   -1   418 42096   91462
   -1   419 35810   67282
   -1   420 60361   64835
   -1   421 92458   79056
   -1   422 75435   68039
   -1   423 28125   44179
   -1   424 59855   53140
   -1   425 77935   17022
   -1   426 54641   63922
   -1   427 38395   79056
   -1   428 57487   60560
   -1   429 28437   42839
   -1   430 70988   11280
   -1   431 71731   44391
   -1   432 71274   97823
   -1   433 26290   50801
   -1   434 44854   28186
   -1   435 48594   90871
   -1   436 77287   73475
   -1   437 65614   84401
   -1   438 15083   12542
   -1   439 46738   84321
   -1   440 97269   92183
   -1   441 70388   79584
   -1   442 43702   50801
   -1   443 68959   40727
   -1   444 85936   67896
   -1   445 66276   61786
   -1   446 46788   79046
   -1   447 75138   51794
   -1   448 67218   16350
   -1   449 84121   37435
   -1   450 85923   46550
   -1   451 27696   64738
   -1   452 33242   97663
   -1   453 53268   90595
   -1   454 74163   13720
   -1   455 35519   37435
   -1   456 95673   76504
   -1   457 75926   50898
   -1   458 31828   46367
   -1   459 13255   34762
   -1   460 91251   19661
   -1   461 35165   60459
   -1   462 89359   57486
   -1   463 56104   68802
   -1   464 23120   10446
   -1   465 27928   94429
   -1   466 13036   87135
   -1   467 68217   89045
   -1   468 90595   77093
   -1   469 64564   19604
   -1   470 20580   38456
   -1   471 95473   99949
   -1   472 23762   19970
   -1   473 94918   49478
   -1   474 95915   73475
   -1   475 43165   21655
   -1   476 28604   10124
   -1   477 77991   89045
   -1   478 69168   12955
   -1   479 67281   36803
   -1   480 63168   34514
   -1   481 54261   92874
   -1   482 43629   11280
   -1   483 58472   56533
   -1   484 87513   85394
   -1   485 78278   38097
   -1   486 27186   53704
   -1   487 12183   15651
   -1   488 85071   34888
   -1   489 74115   71810
   -1   490 38589   42387
   -1   491 59858   58282
   -1   492 81623   50530
   -1   493 18220   40720
   -1   494 80203   37435
   -1   495 25112   95576
   -1   496 27487   51328
   -1   497 52735   36378
   -1   498 57441   83458
   -1   499 16583   74359
   -1   500 68008   88649
   -1   501 93205   93836
   -1   502 29428   76277
   -1   503 63669   73090
   -1   504 27809   91190
   -1   505 71814   87028
   -1   506 36345   69002
   -1   507 19141   71868
   -1   508 85043   10124
   -1   509 35017   38242
   -1   510 72320   53921
   -1   511 66740   17022
   -1   512 28399   78733
   -1   513 22592   81140
   -1   514 30299   45195
   -1   515 34919   40727
   -1   516 19792   89045
   -1   517 25687   93836
   -1   518 83082   90916
   -1   519 40314   82874
   -1   520 80873   63922
   -1   521 21542   11066
   -1   522 55959   94833
   -1   523 77334   37081
   -1   524 19353   21529
   -1   525 19186   73475
   -1   526 34259   95072
   -1   527 13064   74519
   -1   528 41193   49662
   -1   529 55457   72223
   -1   530 16381   65670
   -1   531 50435   19770
   -1   532 50032   50801
   -1   533 49806   46550
   -1   534 18336   37435
   -1   535 13333   90595
   -1   536 90334   19267
   -1   537 60180   82246
   -1   538 93184   62302
   -1   539 74440   26507
   -1   540 63011   87526
   -1   541 40458   91304
   -1   542 23721   57800
   -1   543 63922   17206
   -1   544 95151   38097
   -1   545 51880   98112
   -1   546 20539   54229
   -1   547 93904   62420
   -1   548 72851   46550
   -1   549 42399   61786
   -1   550 99078   63519
   -1   551 12254   84321
   -1   552 10577   44243
   -1   553 46056   37435
   -1   554 51235   39472
   -1   555 50954   12660
   -1   556 77199   56517
   -1   557 18283   63922
   -1   558 52859   87526
   -1   559 15246   98536
   -1   560 93836   97622
   -1   561 49522   88978
   -1   562 73549   40727
   -1   563 31118   75373
   -1   564 51627   61786
   -1   565 89566   93643
   -1   566 23542   37435
   -1   567 54992   11280
   -1   568 24990   37435
   -1   569 33159   19657
   -1   570 53499   17022
   -1   571 84995   72286
   -1   572 45818   50732
   -1   573 41169   14636
   -1   574 40120   26973
   -1   575 64286   84321
   -1   576 63432   30593
   -1   577 99949   24130
   -1   578 61077   17022
   -1   579 36433   82246
   -1   580 54816   59964
   -1   581 85544   84321
   -1   582 60397   52196
   -1   583 76341   37081
   -1   584 31479   79027
   -1   585 16260   17420
   -1   586 96337   10124
   -1   587 65067   62284
   -1   588 26483   44801
   -1   589 96326   17022
   -1   590 14058   54149
   -1   591 13393   65898
   -1   592 65901   53423
   -1   593 38500   57276
   -1   594 20118   79584
   -1   595 44353   40727
   -1   596 47498   49739
   -1   597 93041   47833
   -1   598 46970   46550
   -1   599 33688   75373
   -1   600 68223   90514
   -1   601 87884   94553
   -1   602 65159   37435
   -1   603 58329   74006
   -1   604 42199   37350
   -1   605 76135   20844
   -1   606 46639   93433
   -1   607 65739   49055
   -1   608 43290   40727
   -1   609 31619   86698
   -1   610 77506   86616
   -1   611 65377   56317
   -1   612 31884   84321
   -1   613 52311   81238
   -1   614 99796   93836
   -1   615 51116   95658
   -1   616 41167   73020
   -1   617 16379   18876
   -1   618 12306   97271
   -1   619 31299   48015
   -1   620 73188   70147
   -1   621 11052   42268
   -1   622 65938   89990
   -1   623 26961   98705
   -1   624 95494   58398
   -1   625 59265   23555
   -1   626 87502   32132
   -1   627 70660   84797
   -1   628 12091   89045
   -1   629 41613   26719
   -1   630 68419   20739
   -1   631 26943   58398
   -1   632 89349   89990
   -1   633 16651   17022
   -1   634 95467   28221
   -1   635 89990   98021
   -1   636 85616   86929
   -1   637 16479   51259
   -1   638 76664   83454
   -1   639 78928   74941
   -1   640 31423   45590
   -1   641 93437   82778
   -1   642 85851   52691
   -1   643 76954   15659
   -1   644 16646   74584
   -1   645 48296   46550
   -1   646 77084   70921
   -1   647 27964   99119
   -1   648 41032   78157
   -1   649 32094   82246
   -1   650 29499   49175
   -1   651 79737   13077
   -1   652 25423   68557
   -1   653 12219   58628
   -1   654 70282   29077
   -1   655 87976   11280
   -1   656 57871   43034
   -1   657 81209   58398
   -1   658 56626   45328
   -1   659 29128   28793
   -1   660 14975   38794
   -1   661 58884   36392
   -1   662 24278   46550
   -1   663 77033   27547
   -1   664 74285   73475
   -1   665 10130   32903
   -1   666 34728   11456
   -1   667 40336   17022
   -1   668 62399   45936
   -1   669 95138   53688
   -1   670 12955   16609
   -1   671 74887   93836
   -1   672 18948   93836
   -1   673 28427   26898
   -1   674 67749   80949
   -1   675 94522   17022
   -1   676 76210   82892
   -1   677 78717   36081
   -1   678 13088   80671
   -1   679 80352   18670
   -1   680 68720   41082
   -1   681 62146   69651
   -1   682 39371   84952
   -1   683 41619   27315
   -1   684 90093   58398
   -1   685 32716   45626
   -1   686 11280   27624
   -1   687 22129   94534
   -1   688 24812   10124
   -1   689 43238   86431
   -1   690 35791   97662
   -1   691 13162   53170
   -1   692 57534   15678
   -1   693 66069   63618
   -1   694 49841   11541
   -1   695 23345   38097
   -1   696 36649   79056
   -1   697 37193   76443
   -1   698 18519   64707
   -1   699 34081   61786
   -1   700 47018   75935
   -1   701 30452   48882
   -1   702 12559   58817
   -1   703 32825   91051
   -1   704 16051   19974
   -1   705 80171   17022
   -1   706 19374   54710
   -1   707 57295   84738
   -1   708 81314   38097
   -1   709 33479   49965
   -1   710 38611   79056
   -1   711 63785   49754
   -1   712 18774   70415
   -1   713 98510   72330
   -1   714 85801   73475
   -1   715 10744   17022
   -1   716 15097   11280
   -1   717 52514   37435
   -1   718 86860   96099
   -1   719 27804   22005
   -1   720 62601   79155
   -1   721 86020   70452
   -1   722 26991   15399
   -1   723 98690   69989
   -1   724 18491   79768
   -1   725 85009   79056
   -1   726 11329   20212
   -1   727 10782   70405
   -1   728 85026   40727
   -1   729 26888   34001
   -1   730 36315   42445
   -1   731 49098   37435
   -1   732 59474   38097
   -1   733 86676   41947
   -1   734 55178   84321
   -1   735 53985   87526
   -1   736 65575   47299
   -1   737 57292   82817
   -1   738 24657   37081
   -1   739 82204   10439
   -1   740 82639   73475
   -1   741 81107   74139
   -1   742 89946   97271
   -1   743 93306   41394
   -1   744 62863   46550
   -1   745 48547   86956
   -1   746 12374   55301
   -1   747 81681   95539
   -1   748 94195   84321
   -1   749 15303   24017
   -1   750 36395   93928
   -1   751 28572   10804
   -1   752 62931   45406
   -1   753 33902   88845
   -1   754 25697   83483
   -1   755 86956   51476
   -1   756 73957   55123
   -1   757 83525   29803
   -1   758 16581   19887
   -1   759 96012   90129
   -1   760 14067   40727
   -1   761 66384   38351
   -1   762 43782   75373
   -1   763 53517   29489
   -1   764 17126   71797
   -1   765 10854   68046
   -1   766 68594   89990
   -1   767 89786   17022
   -1   768 81737   11280
   -1   769 71138   84321
   -1   770 77457   62041
   -1   771 99540   54740
   -1   772 15369   87693
   -1   773 73475   39716
   -1   774 35348   99949
   -1   775 67944   97271
   -1   776 91345   20757
   -1   777 48703   99901
   -1   778 56450   84321
   -1   779 75169   70680
   -1   780 27015   45299
   -1   781 34175   85030
   -1   782 21184   64377
   -1   783 95716   97271
   -1   784 25738   70254
   -1   785 79049   75062
   -1   786 54904   68773
   -1   787 12813   47161
   -1   788 95857   74505
   -1   789 17456   87526
   -1   790 24008   30203
   -1   791 92925   17022
   -1   792 17008   98227
   -1   793 53399   13325
   -1   794 84080   49498
   -1   795 23522   62070
   -1   796 80392   37081
   -1   797 67497   89518
   -1   798 31797   46550
   -1   799 67380   29610
   -1   800 29237   47817
   -1   801 32106   13477
   -1   802 17711   61786
   -1   803 19802   35480
   -1   804 46456   37081
   -1   805 17560   67389
   -1   806 59598   64837
   -1   807 30808   10592
   -1   808 78213   86193
   -1   809 34411   89045
   -1   810 22714   61786
   -1   811 88368   79584
   -1   812 49172   37435
   -1   813 28106   30525
   -1   814 34595   65269
   -1   815 67363   90595
   -1   816 50389   33649
   -1   817 57932   74115
   -1   818 85665   15566
   -1   819 68846   84257
   -1   820 37420   75483
   -1   821 70969   85030
   -1   822 53989   74115
   -1   823 30509   81520
   -1   824 92232   63922
   -1   825 12314   64612
   -1   826 59372   76983
   -1   827 31019   75373
   -1   828 28072   58019
   -1   829 51728   67527
   -1   830 82597   36949
   -1   831 66512   46706
   -1   832 89805   89043
   -1   833 13220   72753
   -1   834 19121   31313
   -1   835 27852   89644
   -1   836 29411   97271
   -1   837 10756   88672
   -1   838 60773   82080
   -1   839 81746   11688
   -1   840 90653   23550
   -1   841 59400   14905
   -1   842 97489   44079
   -1   843 20132   40678
   -1   844 82210   43722
   -1   845 90436   80985
   -1   846 92889   18182
   -1   847 40727   19573
   -1   848 76922   17022
   -1   849 27554   78420
   -1   850 47592   87324
   -1   851 78580   75728
   -1   852 91390   63922
   -1   853 82409   80324
   -1   854 60005   53958
   -1   855 46353   90334
   -1   856 89672   26377
   -1   857 52436   11280
   -1   858 71495   41947
   -1   859 59787   93836
   -1   860 13621   79584
   -1   861 16093   31156
   -1   862 11603   51436
   -1   863 31593   12955
   -1   864 70829   89990
   -1   865 61100   96353
   -1   866 71072   61786
   -1   867 33450   17022
   -1   868 65493   48359
   -1   869 51250   44884
   -1   870 49691   61786
   -1   871 41947   61786
   -1   872 60973   93836
   -1   873 44926   87954
   -1   874 90989   35723
   -1   875 98883   30386
   -1   876 83974   67713
   -1   877 86576   17323
   -1   878 32534   77745
   -1   879 57475   32708
   -1   880 86499   43190
   -1   881 26325   71687
   -1   882 16737   58398
   -1   883 88460   17022
   -1   884 10798   61963
   -1   885 59899   54790
   -1   886 84722   56390
   -1   887 38117   75766
   -1   888 12595   97271
   -1   889 23267   78757
   -1   890 70504   97271
   -1   891 44104   63922
   -1   892 22950   85030
   -1   893 66137   84321
   -1   894 18407   99949
   -1   895 37598   61786
   -1   896 28201   24323
   -1   897 19404   79868
   -1   898 53725   33781
   -1   899 56941   41947
   -1   900 88231   83925
   -1   901 30916   73475
   -1   902 81019   46011
   -1   903 91386   23123
   -1   904 29455   79332
   -1   905 32603   42378
   -1   906 61578   46922
   -1   907 67431   12955
   -1   908 85884   15692
   -1   909 40799   89045
   -1   910 27326   97271
   -1   911 79681   11280
   -1   912 35614   38097
   -1   913 99407   54190
   -1   914 30288   10124
   -1   915 59805   66109
   -1   916 27031   12955
   -1   917 51952   46550
   -1   918 63420   17022
   -1   919 96282   17307
   -1   920 45123   17022
   -1   921 95858   32553
   -1   922 85339   98702
   -1   923 19887   81650
   -1   924 20177   66465
   -1   925 92548   84663
   -1   926 28915   38097
   -1   927 48995   58398
   -1   928 32153   97259
   -1   929 14697   55843
   -1   930 15115   31921
   -1   931 97258   21175
   -1   932 11833   75150
   -1   933 20476   37081
   -1   934 57780   87869
   -1   935 20868   16813
   -1   936 55154   72786
   -1   937 51855   79056
   -1   938 58551   94071
   -1   939 32367   60493
   -1   940 70926   16754
   -1   941 95196   94004
   -1   942 30949   32933
   -1   943 93955   10128
   -1   944 14553   61786
   -1   945 67116   11579
   -1   946 34377   85680
   -1   947 69983   79584
   -1   948 92220   38097
   -1   949 69116   11280
   -1   950 83291   10124
   -1   951 63499   30127
   -1   952 48167   97271
   -1   953 70014   13990
   -1   954 40226   78226
   -1   955 71699   12411
   -1   956 40455   75750
   -1   957 74381   11343
   -1   958 88846   74967
   -1   959 17219   79739
   -1   960 78747   30775
   -1   961 98201   18354
   -1   962 54571   68841
   -1   963 85738   49837
   -1   964 17375   10897
   -1   965 44862   46550
   -1   966 15932   11030
   -1   967 79584   17022
   -1   968 77641   58398
   -1   969 54882   38097
   -1   970 87246   75159
   -1   971 33635   41878
   -1   972 75249   60331
   -1   973 46712   55151
   -1   974 48228   91967
   -1   975 17264   39458
   -1   976 58907   86956
   -1   977 62693   87904
   -1   978 72122   43222
   -1   979 70553   73934
   -1   980 43027   90334
   -1   981 69420   97905
   -1   982 91527   10124
   -1   983 34146   96995
   -1   984 77998   88728
   -1   985 80279   91008
   -1   986 35125   77608
   -1   987 33786   63922
   -1   988 82027   38917
   -1   989 10855   49903
   -1   990 66407   38097
   -1   991 50926   49360
   -1   992 73591   97271
   -1   993 97759   84321
   -1   994 82742   49137
   -1   995 16002   57753
   -1   996 53455   38875
   -1   997 66703   40727
   -1   998 76244   92842
   -1   999 87526   49664
   -1  1000 92147   87526

diff --git a/2024/01/solution.rs b/2024/01/solution.rs

@@ -0,0 +1,65 @@
   -1     1 use std::iter::zip;
   -1     2 
   -1     3 #[path = "../lib.rs"] mod lib;
   -1     4 
   -1     5 fn part1(list1: &Vec<u32>, list2: &Vec<u32>) -> u32 {
   -1     6     return zip(list1.iter(), list2.iter()).map(|(a, b)| a.abs_diff(*b)).sum();
   -1     7 }
   -1     8 
   -1     9 fn part2(list1: &Vec<u32>, list2: &Vec<u32>) -> u32 {
   -1    10     let n = list1.len();
   -1    11     let mut v = 0;
   -1    12     let mut i1 = 0;
   -1    13     let mut i2 = 0;
   -1    14     let mut k1 = 0;
   -1    15     let mut k2 = 0;
   -1    16     let mut sum = 0;
   -1    17 
   -1    18     while i1 < n && i2 < n {
   -1    19         if v == 0 {
   -1    20             if list1[i1] == list2[i2] {
   -1    21                 v = list1[i1];
   -1    22                 k1 = 1;
   -1    23                 k2 = 1;
   -1    24                 i1 += 1;
   -1    25                 i2 += 1;
   -1    26             } else if list1[i1] < list2[i2] {
   -1    27                 i1 += 1;
   -1    28             } else {
   -1    29                 i2 += 1;
   -1    30             }
   -1    31         } else {
   -1    32             if v == list1[i1] {
   -1    33                 i1 += 1;
   -1    34                 k1 += 1;
   -1    35             } else if v == list2[i2] {
   -1    36                 i2 += 1;
   -1    37                 k2 += 1;
   -1    38             } else {
   -1    39                 sum += v * k1 * k2;
   -1    40                 v = 0;
   -1    41             }
   -1    42         }
   -1    43     }
   -1    44 
   -1    45     sum += v * k1 * k2;
   -1    46 
   -1    47     return sum;
   -1    48 }
   -1    49 
   -1    50 fn main() {
   -1    51     let mut list1 = vec![];
   -1    52     let mut list2 = vec![];
   -1    53 
   -1    54     for line in lib::iter_input() {
   -1    55         let (left, right) = line.split_once("   ").unwrap();
   -1    56         list1.push(left.parse::<u32>().unwrap());
   -1    57         list2.push(right.parse::<u32>().unwrap());
   -1    58     }
   -1    59 
   -1    60     list1.sort();
   -1    61     list2.sort();
   -1    62 
   -1    63     println!("part1: {}", part1(&list1, &list2));
   -1    64     println!("part2: {}", part2(&list1, &list2));
   -1    65 }

diff --git a/2024/01/test.txt b/2024/01/test.txt

@@ -0,0 +1,6 @@
   -1     1 3   4
   -1     2 4   3
   -1     3 2   5
   -1     4 1   3
   -1     5 3   9
   -1     6 3   3

diff --git a/2024/lib.rs b/2024/lib.rs

@@ -0,0 +1,20 @@
   -1     1 use std::env::args;
   -1     2 use std::fs::File;
   -1     3 use std::io::BufRead;
   -1     4 use std::io::BufReader;
   -1     5 
   -1     6 pub fn iter_input() -> impl Iterator<Item = String> {
   -1     7     let path = args().nth(1).unwrap();
   -1     8     let file = File::open(path).unwrap();
   -1     9     return BufReader::new(file).lines().map(|l| l.unwrap());
   -1    10 }
   -1    11 
   -1    12 #[allow(dead_code)]
   -1    13 pub fn div_floor(a: i64, b: i64) -> i64 {
   -1    14     let x = a / b;
   -1    15     if (b > 0 && x * b > a) || (b < 0 && x * b < a) {
   -1    16         return x - 1;
   -1    17     } else {
   -1    18         return x;
   -1    19     }
   -1    20 }