From 2368fef619c053175eda97fac09f3b4e9e505386 Mon Sep 17 00:00:00 2001 From: Curtis McEnroe Date: Sat, 9 Dec 2017 02:50:05 -0500 Subject: Day 8 --- 2017/input/day08.txt | 1000 +++++++++++++++++++++++++++++++++++++++++++++++++ 2017/src/bin/day08.rs | 57 +++ 2 files changed, 1057 insertions(+) create mode 100644 2017/input/day08.txt create mode 100644 2017/src/bin/day08.rs (limited to '2017') diff --git a/2017/input/day08.txt b/2017/input/day08.txt new file mode 100644 index 0000000..eefae91 --- /dev/null +++ b/2017/input/day08.txt @@ -0,0 +1,1000 @@ +o dec -427 if wnh < -1 +ugc dec -128 if baj <= 3 +ugc inc 294 if xml <= -1 +ugc inc -277 if wfu < -2 +l inc 302 if sqf == 0 +l inc -940 if wnh > -6 +vke inc 687 if fy >= -3 +b inc 976 if ugc > 118 +rz dec 201 if jyi < 5 +y dec -960 if l >= -647 +baj dec 879 if xbp <= 3 +vke dec 360 if b <= 981 +az dec 237 if baj <= -875 +wnh dec 818 if pp > -7 +baj dec -434 if ugc >= 121 +az inc 501 if k < 1 +y inc 43 if sb < 4 +e dec -195 if o < 3 +y inc 729 if u == 0 +l inc 993 if xbp <= 0 +u inc -252 if o < 5 +k inc 547 if k == 0 +e inc -781 if c != 4 +y inc -963 if k >= 545 +k inc -906 if xml != -9 +k dec 394 if rz <= -210 +l dec 676 if baj < -442 +rz inc -376 if sqf >= -7 +l inc -388 if sz >= 6 +jyi dec 464 if jyi < -1 +sb dec -397 if rz == -577 +jyi dec -391 if b != 975 +rz dec 85 if xbp != 2 +rz dec -971 if az != 255 +e inc 622 if vke < 337 +pp dec 506 if l < -318 +k inc -471 if az < 262 +wnh dec -346 if vke <= 331 +sb dec 23 if o != 1 +y dec -29 if k != -349 +fy inc 83 if sb < 377 +c dec -283 if tme < 3 +az dec 852 if e == 34 +fy inc 935 if b == 976 +pp dec 553 if e <= 44 +sz dec 847 if k < -366 +wnh dec -717 if o != -1 +xbp dec -607 if e == 26 +jyi inc -362 if y > 788 +wfu inc 306 if baj <= -440 +sb inc -512 if pp == -1065 +jyi dec -190 if sqf != -4 +k dec 810 if sqf >= -6 +u inc 76 if fy > 1011 +sqf inc -844 if c <= 286 +wnh inc -326 if k <= -1162 +wnh dec -199 if baj == -447 +k inc -828 if sqf < -839 +wnh inc 288 if l > -321 +o dec 769 if c != 280 +pp dec -95 if rz > 299 +vke dec -752 if b <= 982 +rz inc 334 if pp == -964 +sqf inc 987 if y >= 797 +eia inc -938 if az > 271 +tme dec 849 if b > 972 +vke inc 322 if c <= 282 +l inc -43 if baj >= -446 +fy dec 760 if rz <= 641 +sqf dec 947 if wnh != -80 +e inc 267 if eia == -6 +xbp dec -340 if b >= 975 +xbp dec 887 if wfu != 315 +az inc 911 if o < -766 +sb inc 494 if wnh < -87 +sqf dec -25 if sz <= 8 +fy dec -36 if xml == 0 +ugc dec 429 if rz >= 652 +sz dec 139 if ugc <= 130 +eia inc -762 if sz != -141 +c inc 868 if vke == 1079 +l dec 36 if pp > -974 +jyi dec -645 if wnh != -81 +tme inc -361 if tme > -840 +sqf inc 761 if eia != -762 +o inc 361 if xbp != -548 +pp dec -999 if pp > -969 +sz inc -383 if k <= -1995 +y dec -940 if ugc != 132 +sqf dec -957 if k < -1989 +tme dec 528 if e >= 38 +baj inc -803 if rz == 643 +y inc 799 if sz > -530 +fy dec 120 if vke != 1086 +wnh inc 141 if pp <= 36 +c dec 481 if wfu == 306 +tme inc 536 if eia < -758 +sz inc 954 if u <= -174 +o dec 473 if y <= 2528 +l dec 976 if wfu >= 297 +tme inc -26 if baj != -1252 +k dec 786 if xml > -7 +az dec 817 if sqf == 178 +c dec 980 if k == -2776 +baj dec -954 if tme == -348 +rz inc -178 if vke <= 1088 +jyi inc 426 if fy >= 930 +xbp inc -708 if wnh >= 63 +c inc 364 if az > 353 +l dec -393 if xml == 0 +wfu dec -619 if l != -983 +y inc -454 if xbp == -547 +wnh inc 909 if jyi >= 642 +az inc 251 if k > -2777 +c inc 985 if rz >= 470 +e inc -810 if wnh <= 978 +e inc 785 if fy == 934 +wnh dec -872 if vke >= 1083 +baj dec -827 if rz > 457 +wfu dec -186 if sqf > 170 +sqf inc 522 if wnh > 970 +sb inc 307 if wfu <= 489 +ugc dec -765 if sz == 432 +wfu inc 429 if e > 7 +fy inc 730 if jyi <= 653 +sb dec -265 if sb >= 376 +b dec -276 if c == 1033 +u inc -99 if k > -2788 +e inc 114 if l >= -986 +vke dec -845 if wnh >= 963 +c inc -263 if xbp > -549 +sz inc 905 if sz > 425 +baj dec 298 if o >= -412 +l dec 118 if baj == -719 +rz inc -472 if pp >= 31 +sb dec 489 if fy <= 1670 +xbp dec 876 if sqf == 178 +y dec 504 if o != -407 +u inc 410 if xbp >= -1427 +xml dec 95 if xml != -2 +wfu dec 440 if xml <= -101 +sqf dec -270 if pp <= 39 +k inc -812 if pp >= 34 +jyi dec -498 if pp > 27 +jyi dec 848 if vke != 1924 +xbp inc 675 if sqf > 440 +jyi dec -697 if b <= 981 +jyi dec 172 if baj > -725 +fy inc 349 if c >= 767 +wnh inc -683 if c >= 771 +e inc -667 if u <= 144 +jyi dec -991 if rz != -7 +sb inc 547 if k < -3586 +l inc -645 if jyi != 1669 +sqf dec 912 if xml > -99 +u inc 782 if az >= 354 +az dec 752 if xbp > -755 +y dec 296 if k >= -3603 +c dec -816 if fy >= 2007 +sqf inc 776 if pp < 43 +wfu inc 502 if l != -1742 +sb dec 228 if e != -542 +fy inc 171 if k == -3595 +wnh dec 998 if jyi < 1663 +k dec -762 if xbp == -748 +tme dec -660 if az == -394 +eia inc 969 if vke == 1924 +l inc -324 if sqf != 309 +az inc -982 if sz >= 1336 +rz dec 651 if tme == 321 +xbp dec -196 if vke == 1924 +eia inc 538 if b > 973 +eia inc -326 if k >= -2842 +baj dec -47 if eia <= 422 +jyi inc -851 if eia == 419 +ugc dec -846 if xbp >= -553 +e inc -473 if wfu < 1424 +sqf inc -401 if k < -2832 +c inc 975 if c > 1591 +o inc -235 if xbp == -552 +xml dec -34 if k < -2827 +xbp inc 333 if e >= -1016 +baj dec -74 if sz > 1327 +xml dec -288 if vke >= 1921 +sqf inc -180 if pp <= 42 +wfu dec 820 if b != 971 +e inc -113 if vke <= 1923 +jyi inc 466 if rz > -661 +eia inc -410 if pp != 44 +az dec -404 if l > -2078 +wfu inc -537 if az < -979 +xbp inc -667 if pp != 37 +sz inc -774 if b == 979 +sz dec 35 if b >= 979 +b inc -641 if e < -1020 +eia dec 914 if c <= 1588 +pp inc -250 if o > -647 +b dec 46 if k < -2830 +u inc 275 if c < 1589 +rz dec -946 if az < -971 +sqf inc -197 if sz == 1337 +sqf dec -853 if tme >= 321 +b dec -719 if b >= 923 +baj dec 614 if e == -1015 +o inc -224 if u < 1195 +sqf dec 130 if vke <= 1925 +eia inc 388 if xml >= 224 +xbp dec 561 if pp > -218 +o dec -959 if k >= -2841 +tme inc -89 if az >= -972 +xml dec 745 if b >= 1652 +baj dec 649 if xml <= 235 +wfu inc -762 if o <= 101 +l inc 424 if jyi >= 1277 +rz dec 685 if o == 101 +u dec -49 if baj >= -1868 +u dec -495 if eia >= -517 +az inc -450 if y > 1273 +sz dec -860 if y == 1283 +wnh inc -896 if xml >= 226 +eia dec -319 if tme >= 229 +vke inc -535 if o == 92 +vke dec 10 if fy > 2190 +b dec -683 if l == -1646 +tme dec -522 if jyi > 1274 +tme inc -211 if wnh < -604 +u dec -383 if rz <= 285 +baj inc 928 if u >= 1732 +eia inc -286 if y <= 1282 +pp dec -422 if ugc <= 1747 +e dec -123 if o != 96 +u dec -163 if wfu == -159 +y dec 802 if rz <= 289 +o dec -992 if eia >= -199 +sqf dec 275 if e < -887 +az inc 801 if e < -889 +pp inc 893 if c < 1595 +sz inc 913 if o < 1094 +wfu inc 870 if k <= -2833 +tme inc -203 if wnh < -609 +eia dec 431 if xml < 228 +sqf dec -722 if sz == 3110 +xml inc -527 if fy > 2175 +sqf dec -314 if fy < 2176 +baj inc -425 if l < -1636 +rz dec -774 if k >= -2838 +jyi inc -797 if pp != 1097 +u inc 856 if o < 1091 +ugc dec 29 if o > 1089 +wnh dec 629 if rz <= 1070 +rz dec 919 if fy != 2184 +wfu dec -789 if fy >= 2178 +o inc 229 if wfu < 1491 +wnh inc -873 if sb != 432 +wfu inc -29 if rz != 1062 +pp dec 542 if ugc == 1739 +tme dec -321 if l <= -1638 +baj dec 515 if b < 2340 +k dec 976 if sqf >= 701 +e dec -940 if eia >= -631 +b inc 173 if l <= -1644 +e inc 649 if sb < 439 +ugc inc 598 if c > 1579 +baj dec 920 if u == 2755 +sz inc 165 if eia < -622 +c inc -461 if fy != 2181 +sqf dec -574 if pp == 558 +jyi inc -511 if o <= 1089 +k dec -876 if pp == 558 +l dec -830 if wnh < -1234 +az inc -524 if pp < 550 +y inc 141 if vke < 1383 +tme inc 365 if rz <= 1067 +u inc 33 if e >= 696 +sqf inc -241 if sz == 3275 +k dec 918 if baj == -2793 +jyi inc 82 if y > 471 +sb dec 730 if k >= -3857 +u dec -690 if wnh <= -1237 +jyi dec 962 if e >= 695 +xml dec -513 if wnh <= -1238 +sqf inc -77 if sz >= 3285 +wfu inc 697 if az > -624 +l dec 200 if eia < -621 +l inc 258 if k < -3846 +wnh dec -578 if b <= 2513 +l inc -871 if wnh < -659 +pp dec 916 if b < 2496 +eia inc -445 if fy <= 2189 +b dec -759 if o >= 1077 +ugc inc -582 if xml != 219 +vke dec 915 if sz < 3280 +e dec 752 if sz != 3271 +k inc 447 if pp > 550 +wnh inc -272 if jyi > -910 +b inc 762 if xml >= 209 +vke inc 33 if eia < -1070 +wnh dec -943 if vke >= 501 +y dec -627 if wnh != 4 +k dec -240 if eia >= -1080 +tme inc -731 if eia <= -1069 +y inc 138 if pp < 567 +wfu dec -839 if u < 3480 +sz dec -268 if az >= -624 +tme inc 413 if l > -1629 +vke inc 699 if l == -1626 +pp dec 962 if fy != 2179 +pp inc -972 if eia != -1068 +e dec -223 if xbp < -1445 +pp inc -559 if xbp > -1440 +pp inc -869 if sb <= -299 +wfu dec 229 if sz == 3543 +az dec -885 if fy != 2189 +tme inc -542 if wfu >= 2806 +sqf dec -797 if e >= 172 +l inc -159 if c >= 1119 +baj dec 602 if e > 158 +sb dec -546 if sb < -295 +ugc inc -531 if k != -3171 +xbp inc -800 if sqf > 1033 +eia dec 281 if tme >= -255 +b inc -997 if tme != -247 +k inc 140 if xml >= 216 +pp inc -83 if pp > -1377 +sb inc -697 if l <= -1781 +baj inc 101 if wnh < 19 +b inc -330 if wnh < 17 +baj dec -602 if ugc > 1219 +fy dec 642 if tme == -247 +e inc 212 if c >= 1120 +sqf dec 693 if c > 1122 +tme dec 277 if az <= 265 +k dec 430 if ugc >= 1222 +rz inc 182 if wfu >= 2806 +sb inc 158 if wfu == 2807 +wfu inc -223 if wfu == 2807 +pp dec -734 if ugc != 1224 +rz dec -809 if c != 1124 +vke dec -963 if y < 1247 +sqf dec -654 if l != -1791 +az dec -939 if o < 1090 +eia inc 753 if vke == 1470 +fy dec 494 if u > 3473 +jyi inc -739 if ugc > 1217 +jyi inc 216 if e != 380 +l inc -95 if ugc > 1222 +pp dec 400 if baj > -2695 +o dec -915 if k < -3603 +c dec 810 if c <= 1128 +fy dec 33 if k >= -3598 +c inc -193 if sz <= 3540 +ugc inc -415 if l > -1885 +c inc 12 if baj != -2692 +eia dec 376 if c != 309 +jyi inc 168 if xbp != -2255 +u dec 814 if sz != 3553 +wfu dec 247 if xbp != -2247 +xml dec -716 if eia <= -970 +sqf dec -985 if baj <= -2689 +sz inc 280 if pp != -1867 +tme dec 277 if jyi <= -1475 +pp dec 122 if l == -1883 +tme dec -329 if sz != 3818 +eia dec 980 if sb == -291 +jyi inc 373 if b > 3696 +y inc -203 if baj < -2688 +ugc inc 263 if u == 2664 +eia inc -278 if xbp >= -2250 +ugc dec 654 if xbp <= -2246 +fy inc 814 if rz == 2053 +wnh inc 709 if y != 1034 +e dec 939 if tme > -476 +wfu inc -792 if az > 1193 +u inc -506 if baj <= -2689 +b inc 350 if vke == 1480 +o inc 938 if o > 1074 +jyi inc -219 if rz == 2053 +wfu dec 349 if u >= 2162 +u dec -97 if o > 2025 +pp inc -211 if vke != 1471 +wfu dec -194 if b < 3699 +l dec 96 if sqf <= 1980 +vke dec 179 if az >= 1198 +vke dec -317 if wnh != 719 +tme inc 606 if baj < -2689 +k dec 148 if fy > 1829 +jyi dec 294 if y >= 1041 +wfu inc 963 if xbp > -2245 +sb dec -932 if o == 2022 +wnh inc -640 if c <= 316 +rz inc 90 if o != 2021 +tme inc 466 if rz != 2134 +l dec -771 if k < -3586 +vke dec 91 if e <= -551 +fy dec -312 if b < 3705 +vke dec -529 if wnh >= 71 +b dec -595 if xml < 937 +tme dec 540 if b != 4293 +o dec 502 if baj <= -2702 +tme inc -270 if jyi > -1991 +b dec -298 if u >= 2157 +c dec -599 if sz <= 3813 +y dec -909 if b > 4588 +y inc 477 if pp != -2201 +xbp inc 201 if u < 2163 +jyi inc 101 if sb >= 636 +l dec 75 if b == 4589 +e inc -15 if e <= -558 +fy inc -471 if sb != 638 +jyi inc 715 if u < 2167 +pp dec 364 if az == 1203 +az dec -740 if sqf >= 1988 +tme inc 772 if wnh < 75 +k dec 634 if u > 2156 +eia dec 141 if u <= 2162 +baj dec 776 if l < -1184 +wnh dec -920 if fy <= 1677 +xbp dec 169 if c <= 320 +sqf inc -193 if vke < 1736 +fy dec 96 if vke > 1724 +u inc -282 if az < 1206 +xml inc -395 if wnh != 1000 +az inc -492 if k <= -4233 +sz inc -210 if u < 1883 +c inc -584 if eia == -2380 +pp inc -772 if wnh >= 994 +ugc inc -946 if xml >= 528 +l dec -848 if rz < 2147 +o dec -570 if sqf > 1780 +ugc inc -849 if e < -564 +sb dec -327 if pp > -3332 +sqf dec -937 if u != 1869 +xbp inc 765 if o >= 2592 +ugc inc -2 if fy > 1574 +xml inc -976 if y < 2432 +o inc 762 if b > 4587 +xml inc 384 if tme == -210 +u inc -612 if wnh < 1005 +u inc -229 if e != -582 +eia dec 814 if wfu <= 1989 +fy inc -41 if sb > 964 +fy dec -487 if wnh != 1004 +xml dec -44 if jyi < -1164 +k dec 107 if sqf == 2727 +sz inc -819 if rz < 2141 +k inc 862 if wnh < 1009 +vke inc -935 if b == 4592 +k dec -547 if y != 2429 +k dec -804 if l >= -331 +o dec -869 if jyi >= -1178 +fy inc -527 if wfu != 1986 +vke inc -900 if jyi <= -1175 +ugc inc 878 if pp < -3322 +sz inc 96 if eia > -3192 +tme inc -888 if l != -346 +rz dec -879 if e == -574 +y inc -89 if wfu <= 1983 +u dec 106 if xml <= -21 +az dec 724 if y <= 2423 +sb inc -951 if wnh == 999 +wnh inc -583 if xbp == -1450 +sz dec -906 if c >= 311 +az inc -192 if b <= 4583 +l dec 307 if vke <= 1728 +xbp dec 553 if xbp >= -1455 +u inc 581 if tme > -1100 +e inc 993 if xml >= -22 +baj dec 484 if y != 2422 +u dec 797 if xbp <= -2002 +xml dec -448 if sqf > 2729 +l dec -97 if wnh <= 413 +c dec -211 if baj <= -3959 +k dec 925 if xbp > -2008 +wnh inc 198 if c == 316 +l inc 22 if l <= -331 +jyi inc -293 if xbp <= -2006 +e dec 271 if y <= 2432 +pp dec 309 if pp > -3327 +c dec 645 if jyi <= -1181 +l inc 706 if y <= 2428 +xbp inc 477 if c >= 307 +l inc -998 if u != 811 +xbp inc 879 if az != 1193 +k dec 954 if wfu != 1985 +sb inc -627 if jyi == -1173 +vke inc 766 if wnh != 614 +pp inc -177 if wnh != 616 +y inc -426 if wfu == 1986 +wnh inc -932 if wfu >= 1979 +sqf inc 328 if u != 821 +l dec -995 if u < 827 +xml inc 856 if sb < -606 +tme dec 985 if b >= 4586 +y dec 992 if wnh > -320 +baj dec -833 if y == 1011 +fy dec -733 if vke <= 1735 +xml inc 471 if ugc <= -491 +c dec -970 if tme < -2082 +eia inc -404 if sqf != 3051 +sqf inc 646 if rz < 3025 +jyi dec 997 if vke >= 1729 +c inc 114 if pp <= -3502 +b inc 385 if l != -322 +ugc inc -76 if rz < 3016 +sqf dec -180 if wfu == 1986 +jyi inc 876 if jyi == -2170 +jyi inc -663 if c == 1400 +k dec -530 if sb >= -612 +jyi inc 790 if rz < 3032 +vke dec -964 if wnh >= -319 +k inc 165 if ugc > -505 +xml dec -928 if vke > 2684 +pp inc 739 if e < 155 +sz inc 711 if baj < -3110 +o inc -420 if y < 1020 +xbp inc 362 if jyi <= -1162 +wnh inc -228 if az > 1201 +jyi inc 931 if xbp < -275 +rz inc 650 if wfu > 1983 +rz inc 136 if k > -4667 +c dec -923 if xml != 2236 +az dec -127 if u == 819 +fy dec 717 if baj <= -3115 +eia inc 14 if o <= 3807 +tme inc 928 if sqf >= 3879 +vke inc -148 if e <= 155 +tme inc 959 if az <= 1337 +c dec 306 if e <= 139 +vke inc -622 if b == 4974 +c inc -818 if sb >= -611 +az inc -107 if l >= -328 +l dec 42 if u <= 826 +fy inc -175 if ugc == -508 +e inc 208 if o <= 3806 +fy inc 239 if c != 1515 +sz dec -678 if wnh != -542 +sz dec 660 if e < 348 +az dec 636 if wfu > 1982 +tme inc -537 if k > -4658 +sb dec 977 if eia <= -3580 +u inc -171 if b < 4982 +wnh inc 141 if baj == -3119 +rz inc -648 if l == -362 +eia dec 910 if eia != -3579 +sz dec -202 if l != -355 +fy dec -235 if sz <= 6214 +vke inc 635 if eia == -4491 +eia inc -472 if b < 4977 +k dec -936 if tme < -729 +u dec -793 if eia <= -4958 +jyi inc -273 if jyi == -236 +xml dec 101 if u == 1441 +baj inc 553 if sz > 6205 +c dec -315 if wfu <= 1995 +e dec 504 if l < -356 +u dec -563 if eia > -4968 +wnh inc -81 if pp != -2768 +rz dec -784 if xml == 2140 +xbp dec 113 if l != -366 +b dec -545 if vke > 2554 +c dec -978 if e <= -151 +baj dec -782 if eia == -4963 +wnh dec 524 if pp < -2765 +sz dec 272 if sb >= -1587 +baj inc -501 if jyi > -519 +xml dec -246 if y < 1013 +az inc -607 if xml < 2377 +az dec -25 if pp >= -2769 +pp dec -488 if eia < -4962 +b inc -551 if xml > 2382 +sz inc 318 if az == 612 +xml dec -645 if pp == -2278 +u dec 681 if e < -140 +b inc -690 if sb >= -1588 +baj dec 927 if xml < 3034 +e dec 645 if wnh >= -1015 +sqf dec 621 if xbp <= -394 +rz inc 963 if fy <= 2513 +tme dec -163 if sz == 6252 +vke inc -132 if baj > -3220 +tme inc -151 if sqf <= 3265 +az dec 47 if fy >= 2505 +u inc -185 if vke > 2421 +jyi inc 785 if sb != -1582 +k dec -427 if e > -795 +sz dec 652 if xbp != -395 +eia inc -102 if eia >= -4967 +b inc -860 if wfu < 1990 +rz dec -501 if b > 3416 +y dec -772 if pp == -2278 +sz dec -982 if y >= 1777 +rz inc 874 if fy != 2510 +fy inc 965 if rz < 5410 +sb inc 303 if c < 1830 +pp inc 658 if wnh == -1010 +fy inc 206 if xml > 3029 +fy dec 60 if az > 558 +xbp inc -260 if jyi != 276 +xbp inc 398 if e >= -799 +sb dec -532 if xml < 3036 +wfu inc -63 if az != 565 +ugc inc -898 if xbp <= 0 +rz dec 875 if e < -789 +l inc -517 if az < 558 +wnh dec 936 if u == 1138 +k inc 665 if pp >= -1623 +xbp inc 200 if rz == 4533 +k inc 521 if b < 3428 +baj dec -634 if baj >= -3215 +l dec 265 if rz > 4523 +sb dec -725 if l >= -624 +eia inc 959 if wnh < -1944 +rz dec 721 if b == 3418 +sqf inc -659 if sb <= -746 +pp dec -30 if sb == -752 +sqf dec 938 if b <= 3424 +k inc 166 if k < -2108 +u dec 392 if o >= 3799 +l inc -784 if tme == -721 +sb dec 217 if pp >= -1596 +wnh dec -926 if b == 3418 +u inc -7 if rz < 3821 +sb dec -197 if baj >= -2582 +u inc -449 if vke > 2419 +c dec 688 if c <= 1827 +fy dec 53 if sz < 6578 +c dec 687 if jyi < 284 +pp dec -391 if tme == -721 +pp dec 695 if ugc <= -1392 +xbp dec 132 if e > -803 +e dec 215 if eia > -4111 +sb dec 602 if eia > -4112 +xbp inc -885 if baj == -2578 +vke dec -709 if sqf >= 1655 +az dec -378 if xbp > -819 +vke dec -263 if sb != -1368 +baj dec -783 if l >= -1413 +k inc 792 if c != 442 +c inc -31 if sb < -1368 +sb dec 904 if rz < 3821 +fy inc 167 if eia == -4106 +xml inc -764 if e > -999 +wnh dec -530 if baj <= -1794 +jyi dec -748 if e >= -998 +u inc -653 if e >= -1014 +tme inc -791 if l <= -1403 +fy dec -800 if e == -1008 +az dec 783 if k < -1313 +e inc -553 if pp >= -1900 +wfu dec -472 if baj < -1802 +xbp dec -53 if b >= 3427 +fy dec 174 if xbp < -816 +o dec 581 if vke < 3406 +k inc -458 if y <= 1785 +az inc 59 if az == 160 +tme inc 291 if wfu > 1978 +pp dec -933 if wfu >= 1989 +jyi dec -982 if l >= -1415 +pp inc 403 if jyi == 1258 +l inc -149 if pp >= -1491 +fy dec -663 if sb < -2275 +vke inc -866 if vke >= 3401 +sqf dec -397 if l < -1553 +xbp inc 1000 if wfu > 1981 +wnh inc -188 if wfu >= 1979 +l dec -260 if l > -1569 +baj inc 109 if xml <= 3033 +wfu dec -98 if rz < 3820 +az inc -676 if c < 417 +e dec -459 if wfu != 2083 +sb inc -556 if sz >= 6586 +l dec -104 if pp != -1490 +jyi dec 835 if e < -1096 +u inc 63 if wfu < 2094 +k dec 531 if ugc > -1405 +wfu dec 438 if xbp < 184 +wnh dec 304 if sz < 6589 +xml inc -278 if ugc <= -1391 +pp inc -25 if y == 1783 +k dec 179 if xml == 2753 +wfu dec 711 if u > -303 +eia dec 575 if wfu >= 931 +sb inc -1 if ugc <= -1398 +pp dec -948 if xml >= 2751 +xbp dec -441 if pp >= -558 +baj inc -558 if fy == 5077 +c dec -901 if sqf < 2063 +xml dec 572 if jyi >= 420 +c dec -286 if sqf >= 2051 +az inc 1 if tme >= -1221 +c dec 551 if eia > -4682 +sz dec 261 if xml == 2181 +b dec 354 if l >= -1192 +jyi inc 34 if xbp != 188 +wnh inc -591 if wfu == 935 +eia inc 639 if rz > 3807 +sqf inc 211 if sz != 6320 +fy inc 310 if baj < -2241 +fy inc -680 if az < -451 +b inc -352 if pp == -576 +k dec -704 if sqf != 2280 +ugc inc -664 if c == 1050 +eia inc -501 if e < -1103 +u dec 943 if b >= 3414 +baj inc -20 if sb >= -2284 +eia dec 571 if jyi > 461 +u dec 642 if o > 3212 +b inc -212 if rz >= 3808 +k dec -305 if wfu < 926 +eia dec -47 if k >= -1784 +u inc -15 if sz > 6316 +ugc inc -61 if xml <= 2184 +sz dec 663 if fy > 4700 +vke dec -340 if k == -1780 +eia dec 103 if l >= -1188 +vke inc -941 if wfu != 928 +baj inc 323 if rz > 3813 +fy dec 41 if wnh != -1573 +jyi inc 20 if pp >= -573 +o dec -656 if e != -1099 +sb dec 473 if tme >= -1225 +b dec 622 if vke != 2797 +c inc 484 if tme < -1221 +rz inc 363 if y > 1780 +b inc -74 if e != -1105 +sz dec -38 if k < -1784 +b dec -518 if xbp <= 192 +xbp inc -795 if sqf >= 2265 +u inc -484 if baj >= -2268 +fy dec 302 if wfu == 935 +k dec 643 if wnh == -1566 +wnh inc 16 if xbp < -611 +eia dec 289 if pp >= -575 +b inc 673 if rz == 4175 +wnh inc 305 if wfu <= 935 +b inc 18 if wfu == 935 +az inc 810 if pp == -568 +sb dec -609 if pp >= -559 +sz dec 311 if ugc >= -2122 +wfu dec -836 if wnh == -1252 +wfu dec -78 if baj <= -2270 +baj dec -186 if wfu < 1779 +c dec -129 if tme > -1220 +fy dec 662 if tme != -1214 +jyi inc 624 if u != -2394 +sb inc -906 if pp != -573 +rz dec -263 if wfu >= 1780 +k inc -364 if xml > 2179 +rz dec 214 if ugc < -2117 +o dec -539 if xbp < -606 +wnh inc -708 if l <= -1188 +sqf dec -901 if y != 1785 +ugc dec 0 if c != 1048 +wnh dec 712 if b < 4338 +wnh dec -554 if baj < -2086 +sb dec 777 if baj == -2078 +l dec 713 if c > 1046 +o inc 44 if eia == -4284 +rz inc 77 if o != 4456 +xml inc 862 if az > 346 +wfu dec 242 if k > -2151 +b dec 998 if k >= -2152 +sz dec 202 if o != 4460 +tme inc 941 if wfu < 1537 +pp inc -536 if c == 1050 +wfu inc 557 if y != 1781 +e inc -982 if y != 1783 +u dec -49 if y != 1790 +az inc 602 if jyi <= 1102 +e inc -457 if c != 1040 +wnh inc 914 if tme < -279 +tme inc -262 if c == 1050 +c inc -611 if c == 1050 +xml inc 921 if az >= 953 +tme inc -910 if k > -2148 +xml inc 994 if o >= 4452 +c inc 433 if xbp == -612 +wfu dec 591 if jyi == 1101 +jyi dec -916 if wnh < -1045 +eia dec -514 if jyi == 2007 +tme dec -305 if o <= 4463 +c dec -404 if baj <= -2076 +rz dec -942 if wfu > 1501 +xbp inc 286 if k == -2144 +xbp inc -119 if fy >= 3743 +ugc inc 171 if baj != -2074 +l dec -784 if xbp < -443 +ugc dec 146 if sqf < 3173 +c dec 397 if c > 1272 +k dec 468 if fy != 3743 +wnh inc -174 if sz == 5145 +u dec -225 if eia == -4284 +sqf inc 687 if fy == 3743 +e inc 705 if jyi == 2008 +wfu inc -904 if c <= 887 +jyi dec -593 if wfu <= 597 +tme inc 807 if e < -1554 +fy inc -497 if az > 946 +rz inc -921 if sz == 5146 +az dec -401 if wfu >= 591 +sz dec 728 if k > -2149 +c dec 884 if vke <= 2787 +l dec 764 if vke <= 2804 +xml dec 226 if b < 3346 +sqf dec -84 if c < 879 +eia inc 634 if e <= -1556 +o inc -473 if az >= 1357 +sb inc 917 if o == 3988 +ugc inc 411 if tme >= -334 +jyi inc 214 if az != 1353 +xbp inc -296 if c <= 879 +k inc -416 if sb < -3525 +eia inc -847 if tme != -350 +sb dec 525 if k <= -2139 +sqf inc -749 if sz > 4415 +c inc -382 if xbp != -749 +l dec -705 if wfu < 594 +sz dec 38 if xbp >= -739 +sqf dec 431 if xbp != -733 +b inc 766 if xbp >= -748 +wfu inc -263 if tme != -341 +wnh inc 435 if c != 494 +sqf dec -207 if vke != 2807 +sb inc -192 if sz < 4419 +sb inc 985 if wfu > 319 +wfu inc 478 if ugc != -2097 +eia inc -44 if rz < 4042 +u inc 457 if jyi >= 2818 +sb inc 929 if sb == -3249 +vke dec -199 if vke >= 2793 +sqf dec -144 if u < -1656 +sqf dec -917 if ugc == -2097 +rz dec 958 if b == 4109 +k inc -532 if vke <= 2996 +y dec -150 if sqf <= 3804 +jyi dec -149 if u == -1651 +jyi dec 939 if wfu < 337 +xml inc 266 if wnh <= -782 +pp inc 130 if tme == -338 +u inc 665 if xml > 4994 +o inc -510 if tme >= -341 +k dec -273 if sz != 4421 +vke inc 392 if wnh < -778 +pp dec -464 if wfu <= 334 +xml dec 746 if xbp != -741 +xml dec 215 if eia != -4541 +b inc 26 if sz > 4420 +wnh inc -601 if l != -1183 +u dec -660 if xbp < -744 +o dec -362 if xml < 5004 +k dec 689 if y > 1924 +ugc dec -245 if sb <= -2315 +rz inc 746 if o >= 3835 +sqf inc -65 if baj == -2078 +xml dec -571 if az > 1365 +xml inc -309 if wnh < -1379 +wnh dec -554 if y == 1933 +vke inc 542 if xbp == -741 +e inc -386 if o == 3840 +b inc -605 if c > 495 +az inc -784 if sz <= 4426 +pp inc 308 if sz < 4418 +c dec -79 if eia < -4549 +sb inc 224 if b >= 3497 +rz dec 681 if az <= 578 +ugc inc 210 if c <= 500 +baj inc -271 if o < 3834 +l inc 476 if sz < 4422 +o dec -432 if tme >= -345 +baj inc -713 if u < -982 +u inc -192 if baj == -2791 +baj dec 411 if wnh <= -833 +pp dec 728 if y == 1933 +ugc inc -200 if sb != -2096 +l dec 787 if fy == 3252 +pp dec -924 if rz >= 3136 +o inc 792 if o <= 4280 +b dec -300 if u < -1171 +sqf dec -328 if az >= 580 +vke dec 887 if baj >= -2799 +u inc -252 if vke == 3050 +o dec 640 if eia <= -4541 +sb inc -919 if wnh >= -836 +l dec 463 if wnh <= -841 +rz dec -942 if b <= 3797 +az dec -170 if fy <= 3253 +e inc 718 if eia > -4545 +az dec 103 if ugc <= -1650 +sqf inc 709 if jyi > 1879 +pp inc 566 if c == 502 +e inc -611 if sz <= 4417 +baj inc -998 if wfu != 328 +o dec 891 if sqf < 4450 +sz dec -86 if pp <= -143 +xbp dec 199 if sz > 4411 +rz inc -158 if c != 487 +rz inc -710 if wfu > 324 +ugc dec -635 if fy >= 3241 +k inc -221 if az <= 738 +sqf inc -74 if e > -1839 +az dec -317 if az >= 743 +eia dec 596 if tme <= -339 +vke dec 708 if wnh == -832 +u dec 414 if sz == 4417 +y inc 388 if e < -1841 +xml inc -783 if y == 1941 +o dec 695 if c < 498 +ugc dec -944 if baj != -2787 +b inc -964 if baj <= -2787 +vke dec -208 if sqf == 4373 +vke inc -206 if rz >= 2274 +ugc inc 726 if tme < -333 +eia inc 986 if ugc < 667 +baj dec -139 if vke < 2343 +o dec -19 if eia != -4156 +wnh inc -396 if sz > 4419 +ugc inc -74 if rz >= 2277 +pp inc 239 if wnh < -828 +sz inc -741 if u == -1594 +c inc 340 if k < -3089 +xml dec 156 if sqf >= 4371 +sqf dec 433 if b != 2841 +vke dec 231 if tme < -334 +u inc 393 if eia > -4150 +xbp dec -482 if u >= -1599 +fy inc 40 if u > -1601 +baj dec 29 if sz <= 3684 +sz dec 874 if xml != 4531 +ugc inc -50 if pp <= 103 +sb dec 96 if xbp == -458 +e inc 266 if jyi != 1894 +sz inc 336 if y == 1933 +eia dec -592 if wfu > 321 +rz dec -580 if o > 2863 +xml dec -468 if l != -701 +sqf inc -672 if sqf == 3940 +vke dec -600 if jyi < 1891 +e dec -31 if baj < -2677 +rz dec -409 if rz != 2275 +jyi inc 839 if ugc > 536 +wfu inc -886 if c > 830 +vke inc 500 if l == -708 +sz inc 490 if tme >= -344 +rz inc -478 if rz != 2684 +sqf inc -367 if o != 2853 +baj inc -461 if u <= -1585 +fy dec -642 if c <= 827 +ugc inc -371 if b > 2836 +l inc -983 if jyi <= 2727 +b dec 599 if wfu <= -565 +rz inc -852 if baj <= -3149 +sz dec -453 if c != 827 +vke inc 631 if jyi < 2725 +b inc 145 if xml >= 4996 +sqf inc -921 if ugc == 168 +c inc 933 if xml < 5002 +l dec 994 if y <= 1934 +eia dec 59 if wnh <= -828 +wfu dec 600 if ugc >= 166 +b dec -316 if az > 1050 +sz dec 832 if y < 1940 +fy dec -517 if fy >= 3280 +c inc -801 if jyi <= 2727 +xbp dec 381 if xml < 5007 +rz dec 115 if baj >= -3142 +az inc -553 if tme > -332 +wfu inc 837 if rz <= 2093 +ugc inc -490 if tme <= -334 +fy inc 645 if xbp >= -843 +tme inc -756 if tme >= -341 +rz inc -987 if e != -1543 +xml inc -423 if jyi > 2715 +rz inc 985 if c <= 975 +ugc inc -698 if o > 2847 +rz dec 498 if l <= -2684 +baj dec -826 if xbp != -845 +k inc 829 if o >= 2849 +xbp inc 632 if az == 1060 +ugc inc 778 if baj >= -2321 +y inc -806 if sz == 3249 +baj dec -91 if y != 1120 +xml dec 932 if fy == 4448 +fy inc -682 if xbp != -207 +eia inc -640 if u > -1602 +l inc -736 if baj == -2225 +xbp inc 244 if l >= -3429 +pp inc 26 if sqf < 1974 +wfu inc -465 if e != -1541 +e dec -224 if l != -3426 +wfu dec 424 if sb > -3117 +wfu inc 699 if u > -1597 +ugc dec -222 if b > 3298 +c dec 57 if c > 967 +e inc 318 if fy > 4440 +jyi dec -93 if pp != 102 +jyi inc 71 if xbp < 34 +pp inc 598 if xbp <= 42 +az inc 143 if wnh == -832 +xml dec 13 if baj > -2227 +ugc inc -643 if az >= 1200 \ No newline at end of file diff --git a/2017/src/bin/day08.rs b/2017/src/bin/day08.rs new file mode 100644 index 0000000..e5a9ad0 --- /dev/null +++ b/2017/src/bin/day08.rs @@ -0,0 +1,57 @@ +use std::collections::HashMap; +use std::io::{self, Read}; + +fn solve1(input: &str) -> i32 { + let mut regs = HashMap::new(); + for line in input.lines() { + let mut words = line.split_whitespace(); + let dest = words.next().unwrap(); + let op = words.next().unwrap(); + let val = words.next().unwrap(); + assert_eq!(Some("if"), words.next()); + let src = words.next().unwrap(); + let cmp = words.next().unwrap(); + let rhs = words.next().unwrap(); + + let mut val: i32 = val.parse().unwrap(); + if op == "dec" { + val = -val; + } + let rhs: i32 = rhs.parse().unwrap(); + let src = *regs.entry(src.to_owned()).or_insert(0); + let dest = regs.entry(dest.to_owned()).or_insert(0); + + let cond = match cmp { + "==" => src == rhs, + "!=" => src != rhs, + "<=" => src <= rhs, + ">=" => src >= rhs, + "<" => src < rhs, + ">" => src > rhs, + _ => unimplemented!(), + }; + if cond { + *dest += val; + } + } + regs.values().cloned().max().unwrap() +} + +fn main() { + let mut input = String::new(); + io::stdin().read_to_string(&mut input).unwrap(); + + println!("Part 1: {}", solve1(&input)); +} + +#[test] +fn part1() { + assert_eq!(1, solve1( +"\ +b inc 5 if a > 1 +a inc 1 if b < 5 +c dec -10 if a >= 1 +c inc -20 if c == 10 +" + )); +} -- cgit 1.4.1