aoc2024

advent of code 2024 version unix - retour accueil

git clone git://bebou.netlib.re/aoc2024
Log | Files | Refs |

commit 6a70682ae9dec5f817d6d5334587938e72f988e5
Auteurice: Arthur Pons <arthur.pons@unistra.fr>
Date:   Tue,  3 Dec 2024 15:55:33 +0100

Début de l'aoc

Jour 2 partie 2 difficile

Diffstat:
A.gitignore | 2++
A1.input | 1001+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A1.solve | 25+++++++++++++++++++++++++
A2.input | 1000+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A2.solve | 42++++++++++++++++++++++++++++++++++++++++++
A3.input | 6++++++
A3.solve | 19+++++++++++++++++++
Amakefile | 5+++++
8 files changed, 2100 insertions(+), 0 deletions(-)

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