summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXander Bil <xander@biltopia.org>2024-12-02 23:38:23 +0100
committerXander Bil <xander@biltopia.org>2024-12-02 23:38:23 +0100
commit1c2490f5f2c9419ddb5035fc3a8967beef691e6c (patch)
tree0dd2cb0a588e5fff69d7002585ace9bc81099fb4
downloadaoc2024-1c2490f5f2c9419ddb5035fc3a8967beef691e6c.tar.xz
aoc2024-1c2490f5f2c9419ddb5035fc3a8967beef691e6c.zip
solutions day1 and day2
-rw-r--r--.gitignore2
-rw-r--r--build.zig7
-rw-r--r--inputs/day01.txt1000
-rw-r--r--inputs/day02.txt1000
-rw-r--r--main.zig39
-rw-r--r--src/day01.zig81
-rw-r--r--src/day02.zig91
7 files changed, 2220 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..bc5bffb
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+zig-out/
+.zig-cache
diff --git a/build.zig b/build.zig
new file mode 100644
index 0000000..3234a16
--- /dev/null
+++ b/build.zig
@@ -0,0 +1,7 @@
+const std = @import("std");
+const print = std.debug.print;
+
+pub fn build(b: *std.Build) void {
+ const exe = b.addExecutable(.{ .name = "day01", .root_source_file = b.path("main.zig"), .target = b.standardTargetOptions(.{}), .optimize = .ReleaseFast });
+ b.installArtifact(exe);
+}
diff --git a/inputs/day01.txt b/inputs/day01.txt
new file mode 100644
index 0000000..2755b49
--- /dev/null
+++ b/inputs/day01.txt
@@ -0,0 +1,1000 @@
+63721 98916
+83871 23584
+55026 62690
+21948 69139
+11201 33499
+96077 62705
+41231 87261
+71203 13285
+53280 86974
+31172 11658
+56516 98916
+59380 19138
+96772 61094
+63969 69126
+20073 82512
+20834 38571
+92030 96010
+84089 39901
+18339 22036
+28056 25937
+75715 99430
+70846 98374
+56817 62289
+97037 22364
+32411 51681
+41809 98156
+76944 37563
+58189 69139
+21939 82512
+45097 86974
+62705 26019
+95791 61094
+31801 84428
+69238 88614
+39850 13908
+26002 39901
+64599 33304
+44590 98374
+78335 51888
+82512 52047
+57887 78631
+27860 51468
+72024 12311
+47520 51468
+97347 59780
+13728 65706
+52302 74556
+33471 98916
+14163 40376
+20346 83807
+80912 17961
+95998 65684
+32219 24194
+46236 13285
+98428 88835
+40577 61608
+91716 98121
+60156 70703
+54527 51961
+42782 12309
+42240 83795
+15918 50087
+42622 14360
+22114 99603
+87281 54967
+91581 99603
+52780 23792
+46822 82512
+30877 29405
+33424 11774
+32272 82512
+78679 62052
+36612 29914
+42681 61094
+48481 52039
+69769 62690
+64189 40376
+54255 66788
+54850 66572
+12528 22130
+86174 40376
+65976 80500
+63915 28775
+66788 83807
+83422 66572
+90402 99603
+85348 80418
+14682 98916
+45822 28775
+13157 20346
+38402 31258
+80935 10753
+65070 20317
+32676 34871
+31427 15594
+42781 47864
+55644 44957
+30989 42965
+38756 62052
+39293 97881
+30968 62690
+56882 29405
+65462 68541
+76422 50715
+34547 24194
+72282 62690
+92342 42296
+25897 20849
+14452 82122
+75858 15046
+75577 85634
+20594 77936
+39912 68541
+69139 31502
+64342 61039
+71898 31258
+53098 20346
+39892 37035
+10887 98374
+97900 94957
+67382 97046
+10705 40376
+68234 89731
+51652 54595
+51440 62705
+97584 97240
+21827 63629
+96359 84707
+15434 61734
+93030 97129
+56574 67650
+24020 67035
+23745 68753
+40655 66572
+97113 16063
+81714 15465
+27278 54255
+36489 66572
+30802 98374
+26081 72575
+61525 18852
+82667 66788
+73634 90961
+64265 61589
+21183 62690
+77550 68541
+29208 12408
+54092 85880
+40518 54255
+89148 50707
+50039 64048
+38834 73718
+62607 75650
+15015 78049
+97975 29405
+92080 42574
+83720 22415
+93384 69139
+40696 44729
+97526 23792
+61734 92736
+38878 98762
+20162 77446
+77727 69139
+27458 18662
+36125 20197
+75944 18725
+86346 22364
+44849 75485
+65394 60670
+39257 34871
+17370 35661
+61046 66572
+73445 78735
+23792 95066
+33670 28775
+31800 69139
+37622 60352
+34456 98916
+82819 39901
+36275 77446
+71616 33673
+14730 28900
+62052 60624
+55307 34871
+75279 74526
+89572 31258
+66278 27816
+84982 57963
+99221 19953
+86616 56531
+31692 98916
+51468 24249
+48579 38018
+52462 97340
+80487 28775
+99371 35813
+70905 66987
+39381 33563
+62589 23792
+24144 83850
+16708 29405
+43869 28900
+39310 53542
+85314 15046
+95478 28900
+61190 98374
+21175 82122
+13285 72243
+99081 70483
+10815 39901
+93293 86144
+95585 98933
+65731 50087
+99562 23792
+93416 66572
+49380 22364
+95099 29405
+94262 62052
+50620 98916
+16427 34871
+18103 13285
+17044 86336
+35640 61734
+27106 34871
+99272 28807
+68345 44179
+47215 14224
+99510 34186
+59344 66788
+56087 23535
+54047 80026
+18016 63772
+72531 71440
+59402 40376
+92026 34871
+56899 79559
+45736 36788
+43217 91863
+77064 98157
+56018 20317
+76327 28900
+72821 19407
+63500 62937
+68547 66572
+42193 37130
+81823 22364
+72027 82450
+59894 57408
+22894 26775
+49624 34871
+85677 13285
+59165 28469
+15814 98374
+18197 93778
+48375 14885
+94778 98916
+86385 97997
+41779 73577
+52971 34871
+91842 61256
+22568 61256
+14237 54358
+76119 55268
+54946 28775
+71933 65810
+86928 24194
+10238 98916
+80990 69427
+28001 39901
+47286 32918
+70609 66079
+15760 36747
+36567 94015
+11786 34931
+18890 78631
+46903 39901
+50399 74710
+89746 66572
+31258 50430
+49217 99603
+71388 98374
+65381 63073
+26294 20317
+97188 98374
+36571 22130
+68437 35813
+40142 31258
+51693 29405
+29472 67550
+85983 99480
+83807 38797
+36204 40376
+22611 40376
+66861 24683
+86715 62690
+24390 12106
+78554 74773
+16233 91468
+46647 17362
+18129 98916
+74379 24194
+39901 94180
+28130 89936
+15255 53500
+90359 98374
+36114 24194
+69761 78631
+40961 96415
+32323 35661
+72742 53446
+18224 51468
+79717 66788
+63337 62052
+83257 77446
+70340 20417
+37092 23073
+11465 91804
+93712 51468
+70424 20346
+79670 47774
+53326 99603
+61413 35813
+28509 77446
+10392 51646
+20411 79767
+10834 34900
+46987 77824
+84749 14347
+64003 60388
+37510 23792
+67074 15046
+86583 22130
+74774 17706
+27254 32069
+24780 62690
+74592 66572
+19956 50397
+87787 78631
+27551 86335
+27313 62690
+11764 13285
+16566 68541
+52387 43204
+32314 30981
+50548 23792
+66572 98374
+23813 14490
+10031 73014
+98916 99603
+85669 51468
+41290 31893
+79434 77446
+41146 75460
+21093 31258
+22150 39901
+77726 76376
+86750 35661
+52067 34432
+22075 52433
+80197 29405
+43183 40376
+48981 51468
+49114 65262
+17821 83795
+66079 72103
+61094 54261
+22863 86785
+79221 35813
+37160 86690
+43323 60348
+27816 98916
+23797 13285
+52087 83795
+69710 62690
+37097 62690
+58946 35813
+25528 78631
+95945 39426
+10344 83292
+25204 22035
+20851 44476
+49675 18087
+60917 98916
+38511 66788
+50625 13566
+92213 42204
+14434 35517
+16747 79017
+98256 82122
+13429 23798
+10505 22364
+56299 51468
+11971 98374
+82974 95791
+71227 93187
+17329 20899
+86233 48880
+64887 13285
+67572 72363
+42339 16540
+37301 88128
+99216 13285
+21173 13285
+39433 80508
+56739 98916
+19158 66788
+99366 97494
+78631 76828
+64445 49058
+84071 27319
+76591 94653
+72285 39901
+86827 68541
+97195 50087
+94820 39901
+51240 66572
+19704 13285
+82252 54471
+90511 81325
+39890 82624
+28900 23792
+89837 29405
+27432 20051
+12464 68541
+51911 49067
+70069 51468
+38185 96194
+61979 61734
+44809 34871
+50816 74433
+88128 62052
+68302 11847
+65790 14562
+18639 61545
+43973 50325
+32245 71996
+32770 78631
+80007 24194
+81848 17710
+48925 27816
+36951 78631
+44300 83864
+39815 88563
+33287 87639
+81599 40376
+83780 34010
+76105 37309
+66186 57599
+30330 15408
+85410 76902
+32775 62690
+96368 35661
+36267 31258
+63258 50558
+29106 28298
+82546 62690
+11099 61734
+78293 25816
+96305 15046
+29590 35661
+62248 69139
+28271 78631
+28395 61256
+64484 97925
+25386 35813
+27975 55981
+62690 55244
+36937 36761
+14288 78631
+58395 15040
+71622 20346
+29580 10650
+19543 29405
+91211 62052
+67129 23792
+71075 89904
+35814 78631
+24320 66399
+68616 62052
+81607 13285
+16440 69113
+20317 34871
+34990 86694
+46814 17420
+48773 18642
+16983 12462
+76286 22364
+43760 50461
+89012 98374
+76734 83795
+82889 81347
+94844 83039
+87086 42228
+79066 34871
+60930 62690
+14671 98362
+15046 98916
+23105 64417
+15963 26384
+17578 66788
+19749 35813
+73717 77781
+55768 78631
+81328 86974
+98374 30582
+74371 98916
+62198 66788
+18216 29620
+83718 35167
+97216 66806
+21853 23792
+95659 45644
+54690 19553
+99854 54434
+60953 82122
+29405 20346
+77446 61734
+74477 61881
+59384 34871
+22201 82512
+41680 22364
+70388 33526
+79474 35813
+95676 61734
+81066 86974
+50184 69139
+92334 73193
+63301 74886
+88694 25546
+29122 40376
+35513 61734
+34871 51468
+27159 78631
+92093 22364
+97523 46887
+75320 75413
+50553 66788
+69335 39901
+31428 36441
+63138 38796
+65691 66589
+18442 61734
+95290 40828
+30463 84566
+13760 20346
+63642 38111
+38068 99603
+88985 51468
+86911 13890
+81763 98405
+60314 34871
+79229 98374
+54222 37457
+41191 35661
+94686 14344
+48723 40376
+53331 51468
+82320 32023
+13879 64243
+77615 78631
+21373 81177
+99603 28900
+74982 17203
+61957 82512
+49736 29405
+71158 16258
+46734 68257
+91305 13285
+15307 77446
+88888 75540
+96953 82122
+73049 34871
+25806 66509
+28775 22364
+88849 84256
+73085 31258
+82002 45833
+92219 61094
+94438 62690
+74931 10907
+19013 56348
+61330 51468
+45424 32416
+85351 51468
+43176 78631
+92511 31258
+74316 50766
+52865 80456
+90670 19338
+60903 50287
+13027 23792
+70012 37373
+28645 95137
+29890 52066
+90210 22364
+83928 91550
+84224 95653
+52748 22364
+25385 89306
+29258 61754
+22425 81852
+83606 23792
+86286 33987
+78304 78631
+46454 77446
+68130 78631
+84341 34871
+32536 98374
+46176 51468
+18381 52328
+74842 12157
+99320 34871
+36587 51215
+65504 11768
+62256 20755
+62433 28900
+18797 64268
+46028 56766
+34433 39901
+55237 69139
+67094 83807
+59294 29927
+18052 66788
+37438 65122
+89900 22130
+86138 66808
+17409 61734
+41410 77446
+36675 98987
+93185 40326
+68737 97123
+12420 28900
+28431 13285
+79903 61734
+85029 49719
+87114 38161
+10277 97814
+91030 77446
+60032 40376
+26941 71642
+40711 62052
+66007 98916
+36232 22130
+77300 66788
+82122 74191
+93403 86974
+10869 26173
+32606 39901
+36002 90403
+37936 61256
+36223 14536
+90084 98370
+13588 29405
+92588 23792
+76528 68541
+91855 98758
+65053 77446
+31950 15046
+20160 83646
+98329 13285
+59162 20346
+78821 86974
+73311 15046
+83143 14519
+61256 47938
+68103 43062
+62427 72651
+50329 77446
+93857 91804
+50509 31563
+12726 98916
+91094 51468
+62068 97829
+88270 51468
+98814 42679
+96608 66788
+21920 22364
+85592 59267
+56819 39901
+60434 69139
+68767 20590
+23123 31258
+64662 78921
+26559 45234
+72799 82122
+83414 62705
+35661 22364
+22499 53665
+90831 52136
+31956 56969
+53393 20346
+30160 91715
+40872 68541
+96530 20724
+73972 46762
+23784 77789
+51604 14275
+24516 33815
+51694 36170
+54999 40276
+71340 77446
+33559 50566
+97770 86974
+57181 98916
+11456 95791
+43991 35813
+39647 99603
+31291 48238
+24411 66572
+50087 15046
+36907 81744
+84965 43494
+80699 26639
+70287 28114
+30928 62052
+29829 27652
+45493 29405
+96002 68340
+86510 83248
+58569 14674
+95602 83044
+60548 62973
+87844 29873
+64650 24194
+91993 61256
+25193 12039
+93597 69445
+44397 75998
+16429 68541
+36998 98916
+46382 35813
+73943 56489
+18980 38254
+52184 29113
+27861 53315
+78208 52158
+39137 95325
+71411 96871
+11297 50795
+24795 10762
+45672 85223
+20458 45112
+68342 86974
+48555 68541
+14057 89657
+45348 83795
+69091 85340
+32017 91553
+47365 29405
+69846 42783
+42794 66079
+55767 35661
+79443 18679
+97731 28900
+78728 46714
+51662 61502
+86974 40376
+66784 69988
+21713 26696
+67541 89573
+63234 48739
+75844 11283
+72169 63197
+68116 27816
+39756 58055
+49060 52912
+86033 20346
+77374 32945
+54054 15032
+10242 66300
+39964 39901
+16823 98374
+35949 64043
+45790 71364
+85734 62690
+39953 67342
+19397 36827
+30706 47034
+62392 27816
+36736 76359
+41284 27040
+91564 18615
+27419 49560
+35658 83795
+88035 27816
+58920 61094
+24194 53105
+41569 61734
+88977 67702
+59178 31337
+91804 24194
+68538 51029
+45699 22539
+64646 39901
+49570 66788
+42702 66572
+10875 16521
+54579 34871
+30993 82512
+46568 99603
+36007 61734
+41554 40376
+28737 86974
+47642 54509
+95772 28900
+91043 31258
+84273 98374
+75931 71232
+40158 35777
+40376 95791
+52356 68460
+63119 77046
+85547 24461
+48564 15619
+61344 14922
+20517 68541
+69816 52014
+33687 82149
+39886 57790
+85582 77421
+16170 48400
+32839 24194
+59842 14809
+40767 22364
+14572 86974
+94812 29405
+29781 20317
+25093 51468
+22523 15286
+69772 49833
+24511 89853
+95422 63827
+18619 62557
+71465 56921
+80392 23792
+75031 22130
+88990 61046
+62453 63513
+10363 61094
+33426 40376
+34338 98916
+19106 22364
+16632 21897
+93602 80485
+70657 83807
+87290 93753
+48905 69139
+19137 58766
+74790 78631
+17479 66515
+59784 40376
+35921 69139
+63281 99603
+49035 54255
+42278 49216
+88656 61094
+18166 68541
+15171 27816
+25018 66572
+58709 66788
+26678 52650
+51627 82122
+71638 28900
+52703 93929
+54658 29405
+63402 77446
+62250 36480
+20727 96945
+66177 13629
+11052 95791
+16012 70360
+14890 58523
+68314 61256
+27581 61256
+68541 66572
+96645 99603
+79922 66079
+45897 37920
+46727 62690
+92327 50087
+97244 19990
+97604 92430
+10996 21728
+54944 66788
+51431 75661
+44593 70853
+57290 22130
+44100 51468
+88066 95791
+64545 62690
+15185 98374
+81005 83795
+24581 59570
+18803 39901
+31017 35731
+52752 16550
+55973 83795
+41888 77446
+54026 23792
+45685 23792
+39267 15380
+74192 99479
+48209 75402
+43467 78806
+83468 68541
+22364 44940
+22179 52910
+61634 23792
+45998 72739
+41096 35813
+17074 39901
+34245 99603
+38149 66572
+87211 34871
+39320 39901
+35813 69139
+72525 29405
+17308 20346
+26336 35661
+16331 31258
+18176 61256
+28796 86974
+91989 40376
+76266 72180
+79522 97407
+46148 98374
+91891 90085
+29539 88770
+97919 99153
+14625 62052
+33094 31225
+75423 62690
+64206 66079
+91522 17031
+36889 86974
+98905 35912
+67253 22364
+86480 62690
+47746 68541
+54727 40171
+39202 68929
+83795 17632
+19065 77446
+73523 79097
+63938 59651
+64774 22364
+86179 83795
+19996 75565
+49609 66760
+22417 31817
+90246 15046
+25158 27060
+27237 61256
+20154 11191
+80548 61256
+83429 39901
+82411 39901
+36646 99815
+89469 34241
+69714 73572
+17832 65920
+98578 62023
+26264 78372
+23951 10088
+91003 39552
+14615 99603
+78726 83194
+31384 44477
+22130 45848
+83121 81284
+87043 42282
+25669 40376
+61080 98374
+29216 68226
+19808 31190
+12025 77446
+49018 46070
+71086 35813
+26776 48041
+94075 35661
+51192 34871
+18698 61094
+77232 66079
+18652 44005
+47380 86974
+91250 69139
+54224 23792
+22462 23279
+96949 25734
+18113 60075
+76499 35842
+13733 89585
+47074 51199
+30881 61256
+41926 82925
+51892 88913
+56351 49034
+39241 85194
+43972 20620
diff --git a/inputs/day02.txt b/inputs/day02.txt
new file mode 100644
index 0000000..f5116f0
--- /dev/null
+++ b/inputs/day02.txt
@@ -0,0 +1,1000 @@
+45 47 48 50 51 52 54 51
+23 26 27 30 30
+40 41 44 47 49 51 55
+12 15 18 19 26
+78 81 83 84 83 84
+5 7 10 7 4
+28 30 32 29 29
+65 68 70 73 76 78 75 79
+5 7 8 6 9 10 12 17
+63 64 64 67 68 71
+34 37 38 39 39 40 37
+72 74 74 75 76 77 77
+57 60 61 62 62 64 68
+12 14 15 16 16 23
+82 83 87 90 91 93 95 96
+25 27 31 32 29
+20 21 23 26 30 30
+34 37 38 42 45 47 51
+24 27 30 34 40
+10 13 15 16 18 20 26 27
+76 78 83 86 83
+49 51 56 59 60 62 62
+27 28 29 32 39 43
+55 56 62 63 66 73
+21 20 23 25 28 29 30
+79 77 80 83 85 86 87 86
+29 26 28 30 30
+48 47 50 53 55 57 59 63
+12 10 13 15 16 17 19 26
+50 49 51 52 50 52
+87 86 87 86 83
+60 59 60 59 61 61
+32 30 33 30 34
+44 41 39 40 41 48
+27 26 28 28 31 33
+16 13 16 16 17 19 21 19
+39 38 38 40 42 44 46 46
+57 56 58 59 61 64 64 68
+47 44 46 48 48 55
+16 15 19 22 23 25
+11 8 9 13 15 16 13
+4 2 6 8 9 9
+15 14 16 17 21 25
+37 34 38 39 41 46
+88 85 92 93 94
+83 81 83 85 91 93 91
+40 37 40 42 47 48 48
+72 69 70 72 74 80 81 85
+18 17 19 21 26 28 33
+39 39 42 43 46
+53 53 54 56 58 59 57
+80 80 81 84 84
+73 73 75 78 80 83 86 90
+74 74 77 79 80 86
+78 78 81 83 82 85
+24 24 22 24 22
+28 28 31 29 30 30
+62 62 65 63 64 68
+49 49 52 49 52 55 61
+85 85 85 87 89 90 92 95
+6 6 6 8 6
+75 75 75 78 81 84 85 85
+74 74 75 77 77 79 83
+21 21 22 22 28
+80 80 83 87 88 89
+66 66 68 72 74 72
+86 86 87 91 94 95 95
+62 62 65 68 71 75 76 80
+41 41 44 45 46 49 53 58
+31 31 34 35 36 38 44 46
+83 83 86 87 89 95 98 96
+31 31 32 35 41 41
+79 79 81 84 85 90 92 96
+69 69 75 77 78 85
+55 59 60 61 62 65
+81 85 86 88 87
+57 61 63 65 67 68 70 70
+3 7 9 12 16
+36 40 43 45 52
+2 6 7 9 10 9 11
+69 73 76 73 72
+54 58 61 64 62 63 63
+18 22 20 21 25
+55 59 57 60 67
+51 55 56 56 57
+6 10 13 13 12
+26 30 32 32 35 38 40 40
+54 58 58 59 63
+14 18 19 22 23 23 26 33
+45 49 52 55 59 60 63 66
+52 56 58 61 65 68 65
+1 5 7 11 12 12
+61 65 66 67 71 75
+62 66 70 73 78
+21 25 32 33 34 36 38
+56 60 61 64 70 73 71
+25 29 34 35 35
+31 35 41 44 47 51
+2 6 8 15 22
+53 60 61 63 66 67 68
+70 76 77 80 83 81
+10 17 19 21 23 25 25
+8 14 15 16 18 20 24
+42 47 49 52 54 55 57 62
+9 15 14 17 19 20 22
+14 21 20 22 20
+70 75 73 74 74
+86 91 90 92 96
+33 38 39 38 44
+73 79 80 80 82
+81 87 89 89 91 94 91
+63 70 70 72 72
+72 78 78 79 83
+8 15 15 17 19 25
+60 66 69 70 74 75 77 79
+19 24 25 29 28
+28 34 38 40 42 42
+24 31 34 35 39 43
+11 17 18 21 25 28 34
+63 69 76 77 78
+28 35 37 43 41
+71 78 79 84 85 87 90 90
+25 31 32 33 36 41 45
+36 41 42 43 48 53
+37 36 35 32 29 32
+25 23 20 17 16 13 13
+33 31 30 27 25 22 20 16
+47 45 43 41 39 33
+15 12 11 8 11 10
+63 60 58 59 58 57 56 57
+5 4 3 2 1 4 4
+58 56 53 50 49 51 50 46
+88 85 84 86 80
+47 46 45 45 43 41 39
+45 42 39 37 36 36 37
+69 68 67 66 65 62 62 62
+83 80 80 78 75 71
+37 35 32 29 29 28 23
+34 33 29 28 25
+51 48 46 42 40 42
+65 64 61 57 56 54 54
+52 49 45 44 41 37
+48 46 44 41 37 32
+59 56 55 52 51 44 42 40
+40 38 36 34 31 25 23 26
+93 91 88 83 83
+44 43 42 40 34 31 30 26
+86 84 83 77 72
+83 84 81 80 77 76 74 73
+14 15 14 13 11 8 7 9
+74 75 74 73 71 68 68
+52 53 52 49 47 46 42
+20 21 19 18 17 16 11
+63 65 64 61 64 63
+62 64 63 60 62 64
+36 37 35 36 33 31 31
+70 72 73 72 70 68 65 61
+30 31 33 32 26
+14 17 17 15 14 13 11
+28 31 31 29 28 31
+33 36 36 35 33 32 32
+79 81 81 78 75 74 73 69
+78 80 80 79 78 72
+71 72 71 67 64 63 60
+81 82 81 80 76 79
+62 63 59 58 57 57
+82 84 83 81 78 77 73 69
+76 78 74 71 65
+56 57 50 48 46 44 43 40
+96 97 95 92 90 84 81 84
+70 73 66 65 64 61 58 58
+34 35 28 27 26 25 21
+47 49 46 44 41 34 33 27
+97 97 95 92 90 88 87
+47 47 45 42 44
+70 70 69 68 65 64 64
+13 13 10 7 3
+83 83 80 78 77 72
+14 14 17 16 13 11 10
+76 76 74 77 74 72 71 73
+31 31 29 28 26 27 27
+80 80 77 79 76 73 71 67
+19 19 17 20 19 12
+28 28 25 23 23 20 18 17
+86 86 84 81 78 78 79
+36 36 34 34 31 30 30
+75 75 75 74 72 71 67
+55 55 55 52 47
+64 64 60 57 56
+80 80 76 75 74 72 73
+56 56 52 49 49
+31 31 28 24 20
+68 68 67 63 61 60 53
+43 43 38 36 33 32
+72 72 70 64 66
+40 40 38 32 30 30
+37 37 34 33 31 25 24 20
+62 62 60 55 50
+30 26 23 22 19 17
+94 90 87 85 83 81 78 81
+62 58 55 53 52 52
+90 86 84 83 80 76
+98 94 92 90 85
+47 43 40 38 37 40 39
+39 35 37 36 37
+76 72 69 68 65 64 65 65
+26 22 19 17 19 18 16 12
+42 38 36 39 34
+93 89 86 86 85 82 81
+47 43 40 38 37 34 34 36
+63 59 59 56 56
+70 66 65 63 63 60 56
+95 91 88 86 86 85 78
+43 39 36 32 30
+22 18 15 12 8 7 8
+78 74 73 70 66 64 61 61
+37 33 32 28 27 24 23 19
+30 26 25 22 18 16 9
+75 71 66 64 62 59 56 55
+50 46 45 44 38 35 32 35
+82 78 77 76 69 67 67
+64 60 53 50 48 47 45 41
+90 86 84 83 82 77 76 69
+54 49 48 45 42 40 39 38
+76 70 69 66 65 64 62 64
+12 5 4 3 2 2
+49 43 41 38 37 34 30
+95 90 89 86 85 80
+82 77 74 72 71 73 70 68
+50 44 43 42 40 38 40 42
+51 44 42 45 45
+22 15 17 15 11
+32 26 25 27 26 23 17
+32 27 27 25 22
+43 36 36 33 35
+74 68 66 63 63 60 57 57
+45 40 38 38 35 31
+64 57 56 53 53 50 49 42
+92 87 83 82 79
+55 49 47 44 40 43
+34 27 26 24 22 18 18
+95 88 85 84 80 76
+76 71 67 64 62 56
+68 62 60 59 52 50 47
+28 22 19 13 10 13
+90 85 84 77 74 72 72
+81 75 70 69 66 63 62 58
+68 62 57 56 55 54 52 46
+73 76 79 77 76 73 72 72
+97 97 95 94 94 93 90
+67 68 62 60 57 56 58
+41 45 47 50 51 54 56 60
+75 75 75 76 73
+84 84 81 83 86 90
+11 11 6 5 1
+27 27 30 32 36 38 43
+57 53 51 50 48 44 44
+39 32 31 30 29 30 31
+89 93 94 94 96
+56 63 70 73 75 78 75
+48 46 48 52 52
+31 35 35 38 41 44 47 51
+96 92 89 92 88
+23 27 26 29 34
+45 41 40 39 40 38 32
+36 36 38 42 44 46
+66 65 66 69 70 72 77
+13 13 16 15 15
+78 76 78 79 86 87 85
+10 10 7 3 1
+52 49 51 56 60
+3 5 8 9 16 19 23
+13 18 22 23 23
+45 45 43 42 45 42
+73 66 65 63 66 63 57
+26 27 26 25 21 18 14
+28 28 29 31 33 39
+91 92 89 87 82 81 78 74
+88 88 91 91 94 95 95
+66 65 64 62 61 58 58 57
+50 45 44 38 36 39
+22 15 13 11 7
+39 38 37 40 45
+74 70 65 63 60 57 57
+26 22 21 21 20 19 19
+55 52 50 46 43 36
+77 76 74 75 71
+27 25 25 28 30 33 36 36
+67 67 68 70 71 72 75 75
+95 91 88 87 89 86 84 83
+6 5 9 11 13 14 15
+25 25 22 20 19 22
+80 76 74 73 72 72 67
+51 51 48 47 47 47
+23 16 13 11 10 10 7 9
+27 31 34 36 37 42
+72 73 76 79 81 80 84
+7 4 6 7 8 10 13 15
+19 21 19 15 18
+75 73 68 67 64 65
+85 81 78 77 76 72 71 69
+66 68 70 69 71 74 75 74
+28 27 24 26 29
+78 74 72 70 68 65 58
+91 84 82 78 77
+49 53 52 55 55
+52 54 57 60 63 62 64
+33 33 30 28 25 22 18 14
+99 98 94 91 88 85 83 83
+62 64 70 72 79
+28 28 30 31 31 32 36
+83 79 74 73 72 69
+49 53 57 60 61 62 63
+50 56 57 63 65 67 68 72
+77 84 81 84 81
+40 43 45 42 38
+58 61 64 71 73
+54 58 61 62 65 68 68 74
+7 8 11 14 18 21 23
+13 10 9 8 7 6 6
+38 41 39 37 34 30 29 26
+49 55 57 54 55 55
+78 75 76 75 75
+4 8 10 13 14 15 15
+79 84 85 88 89 89 86
+91 90 93 90 93 97
+33 32 33 38 40 41
+13 15 12 14 9
+48 46 48 49 54 54
+34 35 35 33 29
+38 40 41 45 50
+51 55 56 60 63 67
+30 33 35 38 39 42 42 48
+70 74 77 80 81
+14 12 14 11 13
+53 58 61 62 63
+13 13 12 9 6 5 5
+56 59 60 63 65 66 68
+16 14 11 9 7 4 1
+82 80 78 77 76 75 73
+33 32 30 28 26 24 23 21
+40 41 44 47 50 51 53
+22 25 26 27 28
+73 71 70 67 65
+37 36 35 34 32 31
+72 70 67 64 61 60 59
+6 9 11 12 15 18 20 22
+81 83 84 86 88 90
+12 13 16 19 20 23
+62 64 67 69 72 75
+19 17 16 14 12
+76 74 73 70 68 67 66 63
+90 89 86 85 83 81
+13 16 19 21 22 25 26 29
+22 23 24 26 27 30 31
+28 26 25 23 21 20 17 14
+65 64 61 60 57
+20 23 24 26 27 28 30
+65 63 60 59 57 55
+57 56 55 54 53
+13 16 18 21 24 27
+58 55 53 51 50
+36 34 32 29 26 24
+82 79 77 76 73
+43 46 49 51 54 55
+29 28 25 24 21 20 19
+56 59 62 64 66
+48 45 42 41 38 35
+35 34 31 28 26 23
+44 43 41 40 37 34 31 30
+43 46 49 52 53 54 55 57
+63 64 66 68 71
+92 90 88 87 85 84 81 80
+62 64 65 68 70 72 74 77
+48 50 51 52 54 57 58
+21 24 26 29 32 33 36 39
+83 81 79 78 75
+6 9 10 11 14 16 17
+22 21 18 17 15
+18 17 14 11 10 8
+83 84 85 88 91
+32 31 30 28 25 23
+28 30 33 36 38 39 40
+21 19 16 15 12 10 7
+13 15 16 19 21 24 27
+17 15 13 12 9
+61 62 65 66 68
+32 30 29 26 25 23
+69 68 65 64 62
+66 68 69 70 72
+69 66 65 63 60 57 54
+50 48 45 42 39
+12 15 18 19 20 21 24
+87 85 83 82 81 78
+56 57 60 61 64 66
+58 60 61 63 64
+23 26 28 29 31 34
+6 7 8 9 12 14
+66 69 70 73 76
+68 71 72 74 75 78 81
+27 26 23 21 19
+25 26 29 31 33 36 38
+4 6 8 11 14 17 18 21
+41 43 45 46 47 50 53 54
+16 18 21 24 26 28 29
+59 56 55 53 50 48 47
+88 85 84 81 80 77
+8 9 12 14 17 19
+9 10 12 15 17 18
+69 67 66 63 60 58 55
+61 63 66 67 69
+74 73 71 68 65
+4 5 8 10 13
+47 45 42 41 39
+11 13 15 17 20 23 25
+69 70 72 73 75 76
+89 90 91 93 94 97
+32 29 28 27 26 25
+13 11 8 5 4 2
+32 33 36 39 42 45 47
+54 52 50 48 46 44 43
+17 16 15 13 10 7 4 3
+52 49 48 47 46 44 41
+18 21 23 24 27
+80 81 83 84 85
+76 74 71 68 67
+32 34 35 37 40
+10 13 15 18 20 21
+52 55 57 60 63 65
+30 31 33 35 38
+52 50 47 46 44 43
+19 22 25 28 30 33 36 38
+76 79 81 82 84 85 88
+67 65 63 62 60 59 57 54
+26 23 20 19 18 17
+83 84 85 87 89
+16 17 19 22 24 26 27
+53 54 56 58 60 63 64 65
+42 44 47 48 49 51 52
+31 28 27 25 22
+21 18 17 16 15 12 10 8
+41 43 44 46 47 48 49 52
+40 42 45 48 49 50 51
+31 29 26 23 21 18 16
+9 11 13 14 16 18 20
+21 18 15 13 10
+91 90 88 87 85 84
+57 60 63 66 68 69
+30 31 33 34 35
+62 61 60 58 57 55
+41 44 45 46 49 51
+66 68 70 73 75 76 79
+60 61 63 64 66 68 71
+35 32 30 29 27 24
+21 22 24 25 26 27 28
+53 54 56 58 59
+14 17 18 20 21 24 26 27
+13 12 9 8 7
+65 66 67 68 71 72 75
+50 52 54 55 57 59
+15 13 11 9 8 5
+9 10 12 13 16
+21 19 17 16 13 10 7 6
+84 83 80 77 75 72 70 68
+41 40 37 34 32 30
+19 16 15 12 9 8
+42 45 47 50 52 55 57
+65 64 61 60 59
+93 91 90 89 88
+4 5 7 8 9 11 13
+75 74 72 70 68 67 65
+36 37 38 39 41
+29 32 35 38 41 44 47
+50 51 54 56 58 61
+76 75 72 69 67 65 63
+75 78 81 83 85
+60 62 63 65 67 70 71
+88 86 83 80 79 78
+63 62 59 56 53 52
+14 16 18 19 21 22 23
+50 52 55 58 60 61 64 65
+50 49 48 47 45 43 41 40
+37 39 41 42 43 45 47 48
+93 90 88 86 84 81
+44 46 48 50 53
+18 20 23 24 26 29 31
+31 33 34 37 40 41 44 47
+26 29 30 32 34 36
+68 70 71 74 76 77
+65 64 63 62 60 59 57 56
+3 5 8 11 13 16
+37 36 34 33 32 30 29
+85 82 80 78 75 73 71 69
+91 90 88 86 83
+65 62 61 58 57 55 53 51
+56 57 60 62 64
+2 3 5 6 7 10 13
+63 62 61 60 58 55
+7 9 11 13 14
+58 55 52 51 50
+30 31 32 34 37 40 43 44
+57 58 59 62 64 66 68
+65 64 62 60 57
+65 62 61 59 57 55 53
+21 18 16 13 12
+48 47 46 45 42 41 38 36
+40 39 37 36 34 31 28
+84 85 87 88 90 91 92 94
+58 57 55 54 51 49 47 44
+41 43 46 49 51 54
+84 85 88 91 92 93 95 96
+16 15 12 11 8 7 4
+52 54 57 58 60
+48 45 43 40 38 37 36 33
+91 88 87 84 82 79
+88 85 82 81 80 79 76
+45 46 48 51 53 56 57
+43 44 45 47 50 51 52 53
+61 60 57 54 52 50 48
+89 88 86 85 82 79 76
+81 79 76 73 70 68 66 63
+84 87 88 90 91 93
+42 41 38 36 33 30 27
+49 50 53 54 57 58 59 62
+39 41 43 46 47 48 51 53
+85 86 88 91 92 93 95 98
+90 87 84 81 80 77
+64 63 62 59 57
+71 72 73 76 78 79 81
+43 41 38 37 36
+56 57 59 60 62 65 68 71
+45 43 40 39 37 34 31 29
+30 32 35 36 38 40
+90 87 85 84 83
+1 3 6 8 9 10 12 13
+52 54 56 57 58 61 64 65
+69 66 64 62 61 58 57
+89 91 92 94 96 98
+69 72 73 75 77
+76 73 70 69 66
+54 56 58 59 61 64 67
+34 33 31 30 29 28 27 26
+48 47 45 42 40 37
+69 72 74 75 78 81 83 85
+31 33 36 37 38
+43 45 46 49 52
+38 41 42 43 45
+76 79 82 83 85
+55 53 51 50 49 48
+17 18 21 24 27 30 33 35
+42 40 39 38 35 32 30
+33 30 28 26 25 22
+34 32 29 27 25 23
+12 13 15 18 19 21 23
+33 35 36 38 41 44 46
+42 43 44 45 47
+18 20 21 23 25
+27 30 33 34 35 36 38
+28 26 23 22 20 17 15 14
+84 83 82 80 78 75 72 69
+17 18 19 20 22 25 27
+68 71 73 74 75 78 81 84
+69 66 65 63 60
+50 52 54 55 56 57 60
+10 12 14 16 17 18 21 24
+72 74 75 78 79 81 84 87
+77 74 73 71 68 66 64
+75 72 69 66 65 64 62 59
+90 87 84 83 80 79
+60 63 66 68 69 72
+35 37 40 42 44 46 48 50
+61 60 57 54 51
+12 11 8 7 4 1
+15 18 20 21 22 24 25 28
+4 5 7 9 10 11 13 16
+98 97 94 93 91 90
+34 35 37 40 42 43 46 48
+14 16 18 19 21 22 24
+71 72 75 78 80 82
+49 47 45 44 41 40
+85 86 88 89 90 93 94 96
+81 78 76 74 73 72
+63 65 68 70 71
+62 63 64 67 70 71 74
+78 76 73 70 67
+59 58 55 53 52 51
+52 50 49 46 45 44 41
+81 78 75 74 72 70
+28 31 33 35 37
+50 53 56 58 59 60
+36 33 30 28 27 24
+92 89 86 83 82 81 78 75
+35 33 32 30 27
+2 3 6 7 10 11 14 15
+21 22 23 26 29 31
+31 28 27 24 21 18
+17 14 12 11 8 6
+71 70 69 66 65 62 61 59
+90 89 88 86 85 83 82 80
+9 12 14 16 18 21 23
+46 48 51 53 54
+71 69 66 63 61 60 57
+85 82 80 77 75 74 73
+51 52 55 57 59 62 64 65
+66 65 64 63 60
+54 57 59 62 63
+10 9 8 7 4 2
+53 50 48 47 46 43 41
+77 80 83 84 87 88 91
+78 81 84 85 86 88 91 94
+31 29 28 27 25 23 21
+6 8 10 13 14
+27 24 21 20 19
+16 14 12 9 7
+18 19 20 23 25 26 29
+26 28 29 32 34 35 38
+26 25 23 22 20 18
+28 31 32 35 36 37 38
+1 4 6 9 12 13 15 16
+52 49 48 46 43 40
+76 77 80 82 85 87 90 91
+41 44 47 48 51 53 55
+56 55 53 51 49 47
+75 72 70 69 67
+78 81 82 83 85 87 89 90
+20 17 14 12 10 7 6
+80 79 77 76 74 73
+32 33 36 39 42
+59 62 64 66 67 70
+33 36 37 38 39 40
+1 2 4 6 8 9 12
+25 27 30 32 33 34 36
+17 18 19 21 23 24 26
+33 36 39 42 43 44 46 48
+12 10 9 7 4
+79 76 74 71 70 69
+87 84 83 81 80
+36 35 34 33 31 30 27 24
+42 41 40 39 37 36 33 32
+43 41 40 39 38 37 36 33
+50 51 53 54 57
+64 67 68 69 71
+75 76 79 81 83
+62 65 66 67 70 72 73
+53 52 50 47 45
+26 23 21 20 19 16 15 13
+59 61 64 65 68 70 72
+69 72 73 76 79
+54 55 57 59 60
+38 39 40 42 43 46 49
+76 77 79 81 82 84 86 89
+83 86 87 90 93 94 96 98
+29 31 34 37 40 42 44 46
+64 63 60 57 55 52
+1 4 6 8 11 14 17 20
+39 40 42 43 46
+70 72 73 74 75 77 80 82
+18 19 20 22 25 28 31
+1 3 5 6 8 10 11 13
+55 53 50 47 44 43 40 37
+92 90 87 86 85 82 81 78
+73 72 70 67 64 63 61
+82 81 79 78 77
+37 35 34 32 31 28 27 26
+85 88 89 92 94 97
+87 84 83 80 78 75
+18 15 13 10 8 5 2
+3 6 7 10 13 15 18 21
+96 94 92 89 87
+48 46 45 44 41 40 38
+1 2 3 4 7 8
+25 27 28 30 31 34 35
+97 94 92 89 86
+79 76 74 73 70
+58 55 52 51 48 46 44 42
+85 84 83 81 78 75 74
+57 59 60 63 66
+75 78 79 82 84 87
+90 89 86 84 81 78 76
+60 62 64 65 67
+28 29 31 33 36 38 40
+78 75 72 71 68 66 64
+76 74 73 71 68 67
+57 55 54 53 51 49 47 44
+73 75 78 80 81 84 85 86
+82 84 87 88 91 94 95 97
+74 76 77 80 81 84 85 86
+20 21 23 25 28 29 31
+10 13 15 17 20 23 25 28
+38 41 42 45 48 51
+22 21 19 17 16 15 12
+60 59 56 53 50 48 47 45
+54 56 58 60 61 63
+37 38 39 41 43 44 46
+97 95 92 89 87
+75 78 80 83 85 87
+68 71 74 76 78 79 80
+55 54 53 51 48
+52 55 58 60 62
+40 41 44 46 49 52 55
+39 41 43 44 46
+36 34 33 31 30 28
+44 47 48 51 52
+38 35 34 33 31 30
+49 48 45 44 41 40
+23 26 27 28 31 33 35
+58 57 55 53 50
+39 41 43 44 47 50 52
+74 72 70 68 67
+8 9 12 15 16 19 22 24
+44 45 48 51 52 54 56 58
+25 22 19 18 17 14
+51 53 56 57 58
+21 19 18 15 14 12 9 7
+57 55 54 53 50
+22 21 18 16 13 11 8
+84 83 80 78 76 75 72
+32 30 29 27 24 21 18 17
+28 29 30 32 35 38 39
+69 71 74 76 77 79 80 81
+74 71 68 66 64
+70 69 68 66 65
+39 37 34 33 30
+85 86 88 89 90 91 92 94
+75 72 69 67 64 61 58
+56 59 61 63 64 66
+88 85 84 81 78 75 73 71
+54 57 58 60 62 63 64
+56 54 52 51 48
+36 38 40 41 44
+74 71 69 66 63
+85 86 88 89 91
+38 37 36 35 34
+40 39 38 37 34 32 30
+72 69 67 66 63 60 59 57
+38 35 34 32 29 28 25 22
+30 32 33 36 39 40
+62 65 66 69 70 72 75 77
+41 40 38 37 34 33 30
+14 11 9 8 7 4 3 2
+40 38 37 35 34 31
+93 92 90 88 85 82 79 78
+80 79 76 74 71 68 65
+56 58 60 61 63 66
+10 13 16 18 20 22
+6 7 9 11 13 14
+97 96 95 93 90
+17 19 22 24 26 29 30
+74 73 70 69 66
+39 41 42 44 46
+47 44 41 40 38 36 33
+77 78 81 82 85 87 88
+85 82 81 78 77 74
+60 57 55 54 53
+59 60 61 64 67 70
+65 67 68 70 73 76 77
+99 98 97 96 93 90
+97 94 91 88 85 83
+74 72 69 67 65 62 61 59
+23 24 26 27 30 32
+39 36 35 34 31
+16 13 11 8 6
+34 36 39 42 44
+81 78 75 73 71 68
+14 11 9 8 7 6
+89 90 91 93 96 97
+45 47 49 50 53 56 58
+8 11 12 15 16 19 20
+74 77 79 80 83 84
+55 54 53 52 51
+36 33 32 30 29 28
+77 76 73 70 68 66
+74 75 78 81 84
+34 32 31 30 27 26 25 24
+11 9 6 3 1
+74 71 68 67 64 63 60
+62 65 67 68 71
+52 53 55 56 58 61
+11 13 16 17 18
+77 76 74 73 71 70 67 65
+54 51 49 48 47 45 43 40
+17 14 12 11 9
+74 73 70 68 66
+36 39 40 43 46 47 50 52
+92 91 89 87 86
+79 76 75 72 71
+98 95 93 92 89 87 85 83
+7 8 9 12 15 17
+39 40 43 44 45 47 48
+60 59 57 56 53 52 50
+28 27 26 23 21 19 18
+40 42 44 46 48 50 51 54
+15 14 11 10 7 6 3
+23 26 28 30 33 36 37
+15 16 17 19 20 21 24 27
+43 42 41 38 37 34
+52 55 58 61 63 64
+76 75 72 71 68 65 63 60
+52 50 49 48 47 45
+68 70 71 74 77
+58 59 60 63 65
+56 54 53 51 49 48 46
+62 65 66 67 68 69 70 73
+11 10 9 8 7 5 2 1
+43 40 38 35 33 30
+77 79 80 83 85 87 88 91
+16 14 11 10 7
+69 68 66 65 62
+76 77 79 82 85 86 87
+17 15 13 10 8
+81 83 86 88 91
+42 40 39 36 33 30
+38 36 35 32 31
+47 46 45 43 41
+95 94 91 90 88
+5 6 7 10 13
+41 40 39 36 35
+65 62 61 58 57 56
+13 10 7 5 4
+69 72 73 76 78
+15 17 20 22 25 26 27 29
+5 7 8 9 11
+39 36 33 30 27 25 23 21
+73 70 69 67 64 63 62
+32 35 38 41 42 44
+79 80 83 86 89 92 93 96
+43 41 38 36 35 32 30 27
+48 49 50 53 54 57 59
+32 29 27 26 23
+92 91 90 89 87 85 82
+22 24 25 27 28 29 30 33
+20 22 23 25 27
+71 69 66 65 63
+43 41 38 35 32 29
+71 69 67 64 62 59 58 56
+61 59 57 55 52 50 48
+57 56 53 50 49 48
+78 77 75 74 73 71 68 67
+85 82 80 78 77 74 73
+18 20 22 25 27 28
+40 41 42 45 46 49 51 54
+23 20 17 16 13
+72 74 75 78 79 82 85 88
+39 42 45 47 50 51 53 54
+31 32 33 36 38 41 44 46
+30 29 27 26 24 23 22 19
+45 42 39 36 35
+76 74 73 71 68
+44 47 48 51 53 54 55
+48 46 43 41 38 37
+90 89 86 83 82
+59 57 56 55 52 51
+34 31 30 28 27
+39 36 35 32 31 28 27
+84 86 87 90 93 95 98
+95 92 91 88 85 84 81
+23 25 28 30 31 34 36 39
+7 8 11 13 15 18
+80 77 74 71 68 66 64 63
+36 33 30 27 26 25 24 23
+96 94 93 90 89 87 85 82
+18 16 13 11 10 8
+80 77 75 74 71
+82 80 79 78 77 74 73
+18 17 16 13 12
+91 88 87 85 83
+41 43 46 48 49
+74 72 69 68 66 65
+59 62 65 68 69 71
+44 46 47 50 51
+59 60 63 66 69 70
+26 25 24 21 18 15
+40 38 35 34 31 30
+84 87 90 93 96 98
+39 42 44 46 47
+22 25 26 27 30
+14 11 9 8 7 4
+81 84 85 87 90 91
+98 97 96 94 92
+79 76 73 70 67 64 62 61
+80 81 83 85 88 91
+91 88 87 86 83 82 80
+51 54 57 60 62 64 67
+34 32 29 27 25 23 22 21
+62 60 58 57 54 53 52
+16 19 22 24 27 29 32 35
+26 23 21 20 18 16
+15 14 11 8 6 3 2 1
+49 46 43 42 41 40
+52 54 57 59 61 62
+87 85 84 81 78 75 72
+77 76 74 71 70 69 67 65
+77 74 71 70 69 67
+66 68 70 73 74
+15 13 11 10 9 7 6 5
+52 55 56 58 60 62 65 66
+80 78 75 73 70
+88 89 90 93 95
+76 74 71 70 68 67 66 64
+87 84 82 80 78
+76 75 74 73 72
+73 74 76 79 80 83
+41 38 37 34 31 28 27 26
+17 18 20 22 24 25
+9 11 12 15 18
+29 31 33 35 38
+99 97 95 93 90 87 85
+91 88 85 82 80 79
+9 12 13 14 16 18 20 21
+84 81 79 78 77 75 74
+21 19 17 16 15 12
+67 65 64 62 59 57 56
+68 71 73 75 76 78 79
+68 70 72 73 74 76
+33 30 27 24 23
+22 25 28 30 32 34
+15 18 21 23 26 29 30 32
+73 70 69 66 64 61 58
+83 82 79 78 75 74 71 70
+76 75 73 70 67
+49 52 55 58 60 63 64
+33 34 35 38 41 43 44
+52 51 48 45 44 42 39 37
+91 92 93 95 97
+8 9 11 12 13 15 18 19
+64 63 60 59 56 54 52 51
+63 61 58 56 54
+18 16 13 11 10
+69 66 63 62 59 58 55
+19 18 15 13 12
+58 59 61 63 66 68 69 72
+23 26 29 32 34 37
+28 26 24 22 19 17 16
+66 69 72 74 75 76
+20 23 25 26 28
+3 4 5 8 10
+60 57 55 52 51
+15 18 19 20 21 22 25
+46 49 51 53 56
+58 56 54 51 50 47 46 43
+60 63 64 67 68 71 74 76
+4 7 9 12 14 15 18 20
+29 32 34 35 38 40 43
+21 19 18 16 14 12
+83 82 80 78 76 73 72
+64 66 69 71 74 75
+12 14 15 17 20 22
+76 75 73 70 67 64 63 62
+32 31 30 27 26 23 22
+61 64 66 67 69
+98 96 94 91 88
+44 42 40 38 36 35 33 31
+37 36 34 33 32 30 28
+25 27 29 31 33 36
+78 75 72 70 69 66
+47 44 42 41 40 37 35 32
+71 69 66 64 61
+16 15 14 12 11 9 8
+93 90 89 87 85 84
+49 52 53 56 58
+40 38 37 34 32 29
+97 95 94 91 90 88 87 85
+67 68 70 72 75 76
+35 32 31 28 25
+85 86 87 90 93 95 96
+41 40 38 37 35 32 29 28
+6 7 10 12 15 18
+86 89 90 91 94 96 99
+50 52 53 56 59 62 65 68
+50 51 54 55 58 60 62
+73 72 70 67 64
+7 9 11 12 14 17 18 19
+24 26 27 28 29 32
+78 75 73 70 68 66 64 62
+79 82 84 87 89 90 91
+46 44 41 38 37 35 33 31
+25 23 21 18 15 14 13 12
+4 6 9 12 15
+94 91 88 85 82 79 78
+15 13 12 9 7 4
+69 68 66 64 61 59 58
+40 43 46 47 49
+80 83 84 86 88 90 91
+53 50 49 48 47 44 43 41
+68 69 70 72 73
+56 55 54 52 49
+35 38 39 40 41
+44 41 38 35 33 30 29
+32 35 37 39 40 43 46 48
+16 15 14 11 10 9 6
+10 11 13 15 18 19 20
+37 40 42 45 48 49
+21 19 18 15 12 9 7
+68 70 73 76 79 80
+70 67 64 61 60 57
+49 52 54 56 58 61 63
+91 88 85 82 81
+23 22 21 19 17 15 13
+72 73 75 77 78 80 81
+73 72 71 70 68 66
diff --git a/main.zig b/main.zig
new file mode 100644
index 0000000..4facde2
--- /dev/null
+++ b/main.zig
@@ -0,0 +1,39 @@
+const std = @import("std");
+const print = std.debug.print;
+
+const day01 = @import("src/day01.zig");
+const day02 = @import("src/day02.zig");
+
+const Day = enum { day01, day02 };
+
+pub fn main() !void {
+ if (std.os.argv.len != 3) {
+ print("Usage: {s} <day> <part> < <input> \n", .{std.os.argv[0]});
+ return;
+ }
+
+ const stdin = std.io.getStdIn();
+
+ var gpa = std.heap.GeneralPurposeAllocator(.{}){};
+ const allocator = gpa.allocator();
+ defer {
+ _ = gpa.deinit();
+ }
+
+ const stat = try stdin.stat();
+ const buffer = try stdin.readToEndAlloc(allocator, stat.size);
+ defer allocator.free(buffer);
+
+ const args = try std.process.argsAlloc(allocator);
+ defer std.process.argsFree(allocator, args);
+
+ const day = std.meta.stringToEnum(Day, args[1]) orelse {
+ print("Not valid day or day not yet implemented\n: {s}", .{args[1]});
+ return;
+ };
+
+ try switch (day) {
+ .day01 => day01.solve(args[2], buffer, allocator),
+ .day02 => day02.solve(args[2], buffer),
+ };
+}
diff --git a/src/day01.zig b/src/day01.zig
new file mode 100644
index 0000000..33b0a67
--- /dev/null
+++ b/src/day01.zig
@@ -0,0 +1,81 @@
+const std = @import("std");
+const print = std.debug.print;
+
+pub fn solve(part: []u8, buffer: []u8, allocator: std.mem.Allocator) !void {
+ var lines = std.mem.splitScalar(u8, buffer, '\n');
+ var left = std.ArrayList(usize).init(allocator);
+ var right = std.ArrayList(usize).init(allocator);
+ defer left.deinit();
+ defer right.deinit();
+
+ if (std.mem.eql(u8, part, "part1")) {
+ try part1(&lines, &left, &right, allocator);
+ } else {
+ try part2(&lines, &left, &right, allocator);
+ }
+}
+
+fn part1(lines: *std.mem.SplitIterator(u8, .scalar), left: *std.ArrayList(usize), right: *std.ArrayList(usize), allocator: std.mem.Allocator) !void {
+ while (lines.next()) |line| {
+ if (line.len > 0) {
+ var components = std.mem.split(u8, line, " ");
+ try left.append(try std.fmt.parseInt(usize, components.next().?, 10));
+ try right.append(try std.fmt.parseInt(usize, components.next().?, 10));
+ }
+ }
+
+ const left_s = try left.toOwnedSlice();
+ const right_s = try right.toOwnedSlice();
+ defer allocator.free(left_s);
+ defer allocator.free(right_s);
+
+ std.mem.sort(usize, left_s, {}, std.sort.asc(usize));
+ std.mem.sort(usize, right_s, {}, std.sort.asc(usize));
+
+ var sum: usize = 0;
+ for (left_s, right_s) |item_l, item_r| {
+ if (item_l > item_r) {
+ sum += item_l - item_r;
+ } else {
+ sum += item_r - item_l;
+ }
+ }
+
+ print("Sum is {d}\n", .{sum});
+}
+
+fn part2(lines: *std.mem.SplitIterator(u8, .scalar), left: *std.ArrayList(usize), right: *std.ArrayList(usize), allocator: std.mem.Allocator) !void {
+ while (lines.next()) |line| {
+ if (line.len > 0) {
+ var components = std.mem.split(u8, line, " ");
+ try left.append(try std.fmt.parseInt(usize, components.next().?, 10));
+ try right.append(try std.fmt.parseInt(usize, components.next().?, 10));
+ }
+ }
+
+ const left_s = try left.toOwnedSlice();
+ const right_s = try right.toOwnedSlice();
+ defer allocator.free(left_s);
+ defer allocator.free(right_s);
+
+ std.mem.sort(usize, right_s, {}, std.sort.asc(usize));
+
+ var map = std.AutoHashMap(usize, usize).init(allocator);
+ defer map.deinit();
+
+ var sum: usize = 0;
+ for (left_s) |item_l| {
+ sum += map.get(item_l) orelse blk: {
+ var amount: usize = 0;
+ for (right_s) |item_r| {
+ if (item_l == item_r) {
+ amount += item_l;
+ }
+ }
+ try map.put(item_l, amount);
+ break :blk amount;
+ };
+ }
+
+ print("Sum is {d}\n", .{sum});
+}
diff --git a/src/day02.zig b/src/day02.zig
new file mode 100644
index 0000000..cad2d9d
--- /dev/null
+++ b/src/day02.zig
@@ -0,0 +1,91 @@
+const std = @import("std");
+const stdin = std.io.getStdIn();
+const print = std.debug.print;
+
+pub fn solve(part: []u8, buffer: []u8) !void {
+ var lines = std.mem.splitScalar(u8, buffer, '\n');
+ if (std.mem.eql(u8, part, "part1")) {
+ try part1(&lines);
+ } else {
+ try part2(&lines);
+ }
+}
+
+fn part1(lines: *std.mem.SplitIterator(u8, .scalar)) !void {
+ var count: usize = 0;
+ lines: while (lines.next()) |line| {
+ if (line.len > 0) {
+ var components = std.mem.splitScalar(u8, line, ' ');
+ var previous: i32 = try std.fmt.parseInt(i32, components.next().?, 10);
+ var increasing: i32 = 0;
+ while (components.next()) |number_s| {
+ const number = try std.fmt.parseInt(i32, number_s, 10);
+ if (increasing == 0) {
+ if (previous > number) {
+ increasing = -1;
+ } else {
+ increasing = 1;
+ }
+ }
+
+ const difference = (number - previous) * increasing;
+ if (difference < 1 or difference > 3) {
+ continue :lines;
+ }
+ previous = number;
+ }
+ count += 1;
+ }
+ }
+
+ print("Safe count: {d}\n", .{count});
+}
+
+fn part2(lines: *std.mem.SplitIterator(u8, .scalar)) !void {
+ var count: usize = 0;
+ while (lines.next()) |line| {
+ if (line.len > 0) {
+ var components = std.mem.splitScalar(u8, line, ' ');
+
+ var i: usize = 0;
+ var j: usize = 0;
+
+ counter: while (i <= j) {
+ j = 0;
+ components.reset();
+
+ if (i == 0) {
+ _ = components.next();
+ }
+
+ var previous: i32 = try std.fmt.parseInt(i32, components.next().?, 10);
+ var increasing: i32 = 0;
+ while (components.next()) |number_s| {
+ if (i != j) {
+ const number = try std.fmt.parseInt(i32, number_s, 10);
+ if (increasing == 0) {
+ if (previous > number) {
+ increasing = -1;
+ } else {
+ increasing = 1;
+ }
+ }
+
+ const difference = (number - previous) * increasing;
+ if (difference < 1 or difference > 3) {
+ i += 1;
+ continue :counter;
+ }
+ previous = number;
+ }
+
+ j += 1;
+ }
+
+ count += 1;
+ break;
+ }
+ }
+ }
+ print("Safe count: {d}\n", .{count});
+}