2025 Day 6 Complete!

This commit is contained in:
2025-12-06 08:24:31 -06:00
parent 9e23f49a94
commit e724b08961
5 changed files with 251 additions and 0 deletions

5
2025/day06/input Normal file
View File

@@ -0,0 +1,5 @@
836 7512 183 33 113 1 47 655 3 7 43 57 46 1 75 74 96 8 37 785 785 92 425 95 1144 977 7 57 619 53 13 8925 9 755 32 13 34 792 395 39 2 4 873 66 31 24 438 9274 79 6 675 76 14 156 45 78 631 35 844 76 32 636 9 56 1 83 44 165 22 217 643 3 748 676 2 648 57 53 95 6 3 42 765 17 51 6392 6 24 98 477 847 86 67 783 63 3 2 16 4 15 26 92 6 3139 534 855 21 539 6 3 369 538 24 19 57 812 635 37 53 487 151 658 76 91 73 26 749 438 866 785 3 45 1527 21 58 76 148 11 3 83 6 86 73 83 64 444 419 1 616 51 7 81 183 1 14 2 4 1 39 33 23 7 58 7232 28 91 198 299 17 814 898 49 738 64 528 63 96 211 39 4 2 37 9 82 2646 283 541 981 4336 41 285 11 28 89 841 961 31 8 78 61 374 59 71 157 574 8 1 795 326 226 415 59 552 84 71 8712 667 81 38 116 8749 518 743 628 48 8 39 696 345 31 49 87 71 94 8352 79 834 418 57 36 54 3 41 738 85 2763 8231 4824 298 1 68 7188 86 2417 582 858 6376 393 91 274 9 33 8652 19 11 88 1 59 469 415 87 594 25 44 85 324 2 373 55 139 36 172 7 64 25 8727 7 91 884 44 13 1682 1133 86 13 3957 442 4551 3 795 46 664 129 5 86 858 675 76 9 6 5 652 3 7676 63 851 2417 3 54 6 22 945 7 9218 76 981 5 239 133 3329 33 128 2 9828 76 78 24 968 33 6 26 673 2521 95 2 43 572 429 3391 891 81 95 379 2 834 7 52 82 16 96 99 42 4364 99 6 22 6 744 9 34 4 291 3721 79 5 76 64 112 88 923 18 8 798 653 482 6164 2 364 4 15 4 73 289 4313 88 77 8 9 78 33 81 3191 75 317 89 8 543 3 613 77 85 883 432 842 3 69 84 9 31 747 96 488 29 537 6 9 249 74 35 6312 8547 52 9 765 36 34 788 76 74 29 38 596 732 86 6 73 32 53 92 9 95 17 64 378 3918 74 96 15 318 2 63 382 597 45 353 16 37 69 255 51 83 24 685 4454 51 23 38 2 2 3 813 98 155 97 139 5765 4 388 1 7 5953 492 68 417 7622 92 658 963 3 43 161 455 243 587 438 46 475 3 25 578 3163 95 4847 347 71 11 1 2 259 65 39 45 8 76 586 116 3 3 618 5 65 62 22 262 511 716 86 46 2933 253 2 17 76 46 23 76 648 386 875 115 43 525 9 4 563 2655 79 123 728 48 969 586 37 3 26 7 423 17 232 19 22 8 6 63 35 4 9451 231 2 8 134 417 168 755 922 97 44 36 1 133 47 9 51 9 7 784 21 65 34 4823 912 9 135 12 28 6 88 95 493 37 67 518 388 9 4 987 56 57 47 218 721 12 322 2 14 22 6 13 53 9323 11 54 1158 32 61 436 62 7 5 3511 1 511 316 9 32 29 42 79 749 64 69 82 18 62 47 99 9 61 2 26 5427 553 145 82 874 11 554 24 39 759 97 32 74 742 869 6 2 957 831 36 33 18 4 1 265 94 1 241 76 6 21 524 4 26 13 47 23 97 63 3 33 25 473 272 3 66 87 1385 32 3 59 719 898 62 44 1457 86 12 8 968 19 745 95 3 83 71 55 4573 8 73 2 527 29 673 97 66 31 68 74 31 29 271 154 7 4 51 83 77 44 6334 429 4 486 39 3 58 4 81 888 1 48 66 1 149 3 5174 14 35 791 8668 76 6 2 664 291 94 9 8485 59 866 71 116 6256 1 871 6345 251 92 29 21 7 925 5 938 1962 774 94 3 65 615 4 14 111 7374 95 45 764 13 96 15 83 18 576 21 1 66 13 65 46 7 46 352 58 85 72 378 3779 7898 85 96 15 49 21 251 44 38 61 98 97 13 5596 3415 86 959 53 615 14 1 557 16 424 312 4 2 13 749 51 62 472 438 6381 252 89 3 815 3685 82 692 44 6 23 82 62 68 1 968 57 53 57 2 99 62 41 87 77 37 2 174 753 36 815 65 4 71 94 843 124 977 7892 13 4 6 38 1699 477 952 156 3655 915 377 61 97 75 221 635 914 62 83 23 75 25 26 13 37 296 7424 6 97 956 13 4 131 517 16 5 95 97 3983 7 746 1 65 86 3234 782 9 14 93 186 341 12 856 87 74 5222 62 69 4459 568 2365 1278 63 79 97 38 675 8 5366 74 49 38 5 741 33 5 94 988 96 31 2319 7 4 92 68 18 7956 77 8112 462 9232 97 168 8 1183 4392 8593 736 383 3 43
183 685 317 99 739 68 58 669 2 5 49 27 18 6 18 39 67 7 38 187 2267 79 996 13 5948 317 23 15 344 681 45 8187 1 514 87 953 91 195 831 23 29 72 543 86 13 672 972 1527 49 5 242 22 86 649 22 929 346 73 122 41 81 28 14 93 881 23 826 28 58 3651 492 62 335 727 597 322 281 86 39 273 8 85 231 79 47 1339 1 72 86 691 132 15 39 514 28 2 68 9 76 59 31 51 22 4266 169 746 85 839 76 19 215 678 58 75 683 278 621 671 23 7463 818 645 72 17 87 74 349 123 596 137 8 96 1657 98 73 69 393 57 28 76 17 484 85 987 347 169 177 115 955 4 79 32 142 13 17 72 293 96 61 61 32 18 41 311 67 254 788 812 58 779 993 118 558 98 843 74 35 489 11 213 18 41 9 87 4476 725 161 869 144 46 999 79 879 581 284 447 32 27 44 34 6474 62 28 687 4851 9 13 385 681 875 188 4 571 636 67 1946 922 49 22 494 2295 312 2636 141 39 615 72 923 652 26 9 31 81 23 1169 12 593 945 37 71 972 455 12 914 69 1652 6556 1716 829 95 76 7486 54 4727 9269 275 952 933 36 764 429 51 7587 43 477 3 96 92 478 229 84 617 342 33 472 9571 238 689 1 215 75 217 92 95 426 3787 591 397 921 358 8139 4314 6311 84 17 2771 964 7434 782 444 64 878 394 95 6816 638 414 146 995 61 1 932 4 3599 18 154 6373 1 36 41 858 163 95 411 58 279 3 178 66 448 13 764 362 3724 75 42 32 274 569 87 13 384 4112 629 4 43 537 872 6177 852 39 38 353 9 49 29 87 94 333 36 34 21 5988 74 948 48 87 38 44 13 925 223 8825 25 218 12 66 846 76 8325 32 6 299 183 522 1484 9 464 1 82 57 52 4832 8124 87 65 65 26 94 71 95 2234 89 329 41 49 576 7 171 44 16 135 4181 114 54 79 22 881 265 222 959 473 58 38 27 32 495 76 712 1926 4596 34 75 199 75 35 535 95 94 37 55 832 551 12 575 4894 34 92 58 917 71 71 582 153 6284 43 22 77 875 76 3 513 423 14 759 54 288 33 969 49 14 14 473 446 44 6485 31 96 3 7 494 14 62 48 453 1335 62 199 3 1 9335 779 48 469 1848 38 864 736 29 53 136 514 311 421 547 21 987 77 61 264 7446 26 7384 145 777 36 4 93 936 17 39 97 15 84 571 439 18 27 544 5 83 23 89 196 692 517 259 34 3899 693 1 75 29 36 32 86 839 136 721 3961 47 413 27 53 47 5952 94 2956 882 12 149 893 3 497 15 71 452 565 895 69 64 23 98 37 257 77 686 867 79 7 887 574 271 276 331 96 97 461 31 197 65 3 35 43 354 176 34 41 69 4234 538 66 115 22 48 23 95 311 511 43 37 845 612 14 8 253 217 99 71 614 963 27 877 2 2388 37 86 35 55 5778 48 182 422 81 47 717 15 99 3 1316 975 8121 49 22 24 66 58 43 388 91 18 69 23 47 88 62 6 86 976 67 6993 439 824 612 138 81 973 16 73 833 95 73 57 253 975 65 2 292 18 573 114 82 4 828 577 31 78 777 93 19 6 974 313 74 63 93 16 915 24 279 21 54 446 583 94 16 89 9434 584 7 666 961 4929 45 89 7651 81 39 4 216 84 74 38 75 452 514 76 5696 54 52 45 284 88 1544 69 74 49 33 97 96 26 931 414 655 8 23 67 38 1 6374 688 5 162 78 18 11 37 916 552 44 949 86 75 431 6 7265 53 17 943 2494 38 22 7 865 5337 36 14 594 4 675 46 274 8826 91 425 4958 772 29 45 68 914 916 73 562 986 255 59 67 158 249 14 19 661 9238 26 81 561 68 141 48 31 683 197 35 49 832 61 298 387 55 63 781 67 72 14 4481 1922 1148 631 53 51 3 13 29 71 92 92 49 29 27 398 2592 9 725 81 993 34 757 64 17 289 212 488 1 434 948 741 71 144 892 1857 4551 18 219 183 1997 86 311 78 49 27 494 76 91 59 827 26 58 3 42 93 372 24 74 94 31 35 461 743 27 546 94 6 99 76 373 384 916 4343 4535 26 9 392 8234 681 1372 66 2985 636 249 78 116 79 495 57 45 58 93 42 14 53 166 18 89 367 9452 1 418 437 52 9 171 337 71 838 988 21 123 493 736 65 84 47 1996 598 94 477 56 538 283 68 7245 48 75 146 46 97 3749 613 5658 7934 8316 68 25 69 1564 9 964 99 45 73 2 312 95 43 46 914 25 89 6211 74 2 67 51 92 1695 39 1832 361 461 31 28 471 2523 2775 3347 312 734 979 57
26 319 36 341 266 33 9 889 66 3 72 58 22 37 62 69 53 86 19 388 9962 52 324 845 964 849 53 11 343 798 98 6315 16 43 8 847 43 915 79 7 67 39 593 79 63 761 37 6127 55 92 238 38 86 74 72 922 374 4 849 49 96 36 19 91 418 88 147 85 44 1848 491 137 73 492 165 73 166 76 19 169 22 44 25 64 27 3557 3 63 42 555 735 91 8 317 28 77 94 1 85 72 12 65 533 694 553 214 36 918 972 19 191 269 136 21 673 468 687 418 85 1792 73 753 88 666 47 86 694 129 11 133 3 71 1151 816 14 61 37 665 23 278 92 367 96 881 465 613 938 3149 854 2 76 32 422 46 27 78 263 859 32 75 79 56 34 68 23 266 16 473 33 62 8 648 973 72 499 19 71 514 97 686 86 25 68 65 5554 578 24 237 232 22 55 7 683 197 629 797 37 1681 52 99 7263 44 86 941 1431 38 52 858 631 249 47 9 319 388 2 628 574 44 98 316 3499 739 1941 617 1 921 19 761 69 7 9 62 3 96 7448 19 916 757 7 92 359 538 48 643 6 621 936 3819 873 62 41 9891 43 1454 2256 356 377 675 51 2965 989 14 4876 74 316 5 84 71 29 784 48 787 795 27 346 1568 856 164 8 354 32 745 482 48 2185 3681 649 7972 731 362 2339 1265 6525 97 54 751 789 9779 9526 529 68 524 816 572 4788 969 18 616 745 31 9 336 15 7697 3186 3939 577 9 39 58 5388 825 994 61 12 174 26 471 89 316 54 11 837 4336 92 12 32 79 925 93 82 758 879 386 5 13 5578 337 153 32 51 95 64 1 5 196 44 57 4695 38 6 25 8931 485 628 17 17 33 79 7849 235 115 5451 19 861 683 89 197 24 4393 44 63 73 633 72 8714 4 918 95 76 14 55 8421 2487 9 31 78 785 96 3 95 1869 29 95 17 69 253 24 631 53 28 286 4366 446 63 51 5 6297 144 426 385 948 81 96 419 34 631 35 338 2859 534 66 939 447 781 56 618 11 9 78 9 955 748 39 599 3992 8 33 9 196 79 6 988 457 13 98 37 17 93 829 6 558 366 66 642 81 683 6 793 93 75 51 357 42 84 5834 1 12 89 115 3 5 74 51 68 2346 273 426 72 65 649 85 69 243 569 39 231 156 67 84 383 878 58 825 523 12 762 97 71 84 197 69 8282 998 784 26 72 47 51 8 62 25 26 43 677 254 31 5526 2117 1 585 95 595 385 776 713 693 3 2577 586 6 62 52 8 5 96 911 58 152 1115 76 198 12 9693 43 1288 13 5891 428 82 92 763 1 188 65 56 849 669 72 95 972 65 729 78 942 195 78 29 46 51 81 394 488 327 267 66 1 1996 24 84 53 28 6132 17 2858 891 22 18 35 3737 99 314 183 53 34 45 62 382 388 94 89 661 661 27 5 53 165 29 46 9653 551 9781 981 26 1886 99 47 34 92 3171 88 267 896 95 64 717 58 76 5 7563 178 7152 6 68 59 737 8 39 523 41 27 7357 49 96 93 84 11 88 614 15 4289 278 38 767 483 4 847 61 57 51 651 76 41 719 177 563 55 5 72 2542 9841 84 91 592 264 33 48 916 22 98 6 75 779 41 64 414 74 655 69 253 27 51 768 42 541 56 81 257 375 61 3417 827 7471 96 666 2144 17 34 91 385 69 25 66 83 222 118 95 727 31 3 62 23 65 1183 43 15 35 8 16 331 29 44 6857 415 53 5 82 586 7 314 22 7 23 83 22 98 496 678 35 994 767 8212 399 67 82 41 53 44 749 8198 7 19 451 915 3583 43 99 64 6 99 89 244 8468 996 535 5435 43 88 16 8 575 53 955 325 412 728 15 798 675 834 59 83 931 517 59 99 268 59 713 81 47 7117 399 45 144 737 37 614 362 75 6 493 81 94 34 2588 3353 7814 762 8 93 5 49 28 47 83 87 92 789 21 666 1157 7 748 27 377 1 254 61 226 146 189 124 86 9954 8 185 3 746 6929 3178 5778 92 336 423 834 39 712 238 29 213 5463 56 38 763 846 18 24 8 33 12 726 79 56 78 18 42 79 343 8 183 63 71 98 287 729 229 297 686 6936 18 1 559 1446 193 2491 7 9821 598 964 93 844 51 38 4 62 2 313 513 9 29 141 569 45 998 5577 65 8212 492 17 29 121 381 5 781 275 13 792 931 49 2472 68 85 198 557 83 292 81 583 718 66 4462 14 41 684 3 41 8737 717 5369 384 9643 13 54 453 3418 93 25 98 38 44 58 347 96 58 4 39 8 17 8727 928 51 35 54 42 65 69 466 96 46 3 32 237 6928 1214 382 55 682 813 49
22 51 63 985 428 94 9 49 82 82 52 37 4 59 7 8 36 72 62 2 5356 4 998 656 1 41 25 1 75 857 9 37 26 17 1 7277 75 677 9 6 81 58 23 85 9 473 2 7596 37 47 411 8 88 37 46 991 56 7 449 4 6 6 69 48 329 26 874 66 15 5378 968 819 59 669 146 3 168 44 24 119 14 8 88 65 2 713 89 45 5 918 3 56 8 19 21 53 64 2 19 539 93 748 285 88 714 926 584 311 691 96 47 98 792 52 383 732 991 777 39 5773 35 83 58 144 85 86 767 422 4 71 31 59 86 187 9 13 7 467 55 744 95 747 91 696 262 79 44 7485 58 3 17 62 59 97 89 61 391 627 2 14 47 37 37 6 16 767 18 573 28 32 7 423 999 25 76 68 896 749 73 148 98 243 47 88 574 318 99 925 671 5 26 1 871 581 596 32 52 5522 45 589 9389 4 13 578 9328 85 36 528 97 67 4 3 526 215 6 14 85 7 67 656 682 345 9789 242 6 7512 42 85 9 6 5 4 2 7 3759 83 971 124 5 98 9986 2573 8 2178 6 185 7 5119 71 76 33 4 53 977 9812 456 25 968 64 6422 496 84 724 44 685 5 914 55 8 189 6 693 975 38 666 6826 641 596 1 999 74 96 839 73 3112 243 416 2589 51 864 8529 8982 18 3 21 44 2 645 7982 31 2 716 278 226 4942 7 8 465 914 72 77 463 778 853 5846 7923 93 98 6 97 3661 429 532 4 44 928 858 82 44 628 1 92 621 33 7 8 86 34 848 52 63 542 3 572 58 29 3432 781 59 2 85 97 9 863 4 312 99 4 2712 15 3 39 2162 598 866 9 165 85 69 6378 672 912 737 8 548 463 3 2 76 3261 95 81 9 6 92 3 42 68 83 26 31 17 2521 182 9 6 56 531 48 1 36 952 36 46 24 96 23 41 32 78 792 518 3685 97 83 1 9 7248 643 77 158 839 99 68 937 43 958 361 559 283 654 56 833 919 489 59 1 7 7 9 5 886 783 47 239 3332 7 52 1 958 38 1 495 4 73 43 88 74 16 283 5 2 62 141 44 13 411 6 717 2 99 72 6 74 1 2545 1 74 39 657 5 4 73 99 2 8262 583 527 47 87 93 3 27 2 347 66 9 67 93 11 9 6 37 438 7 51 8 32 17 64 12 56 75 8 756 55 63 37 61 4 29 65 14 56 931 247 25 7138 3388 64 161 67 255 16 1 74 185 9 9264 67 72 6 99 9 7 4 16 64 39 4372 74 433 46 1493 48 2333 72 2993 886 2 2 695 5 7378 652 34 2 442 62 42 372 87 364 57 788 813 7 4 77 87 7 1 747 42 882 72 7 9912 97 34 786 596 1723 79 4429 856 16 68 7 1171 17 849 49 99 38 61 6 392 7 6 41 932 217 93 61 49 987 15 47 3525 895 9155 76 54 8711 59 83 1 354 24 86 525 71 4 55 23 3 53 18 423 434 8391 7 77 39 976 6 51 168 53 9 7741 11 98 2 27 75 63 435 61 5555 918 3 724 38 3 824 42 78 4 297 97 78 52 9 551 51 3 5 6826 4369 61 55 132 59 43 46 463 45 68 9 45 455 98 9 981 16 261 64 226 45 6 636 24 681 94 96 76 389 55 6242 634 3747 94 671 8674 48 4 12 328 9 2 73 34 378 287 387 941 73 3 721 8 6 2591 36 71 84 6 75 666 2 3 3354 972 39 6 14 875 4 898 7 29 46 4 61 24 663 641 1 319 931 3263 256 73 67 51 4 75 137 827 4 78 924 132 4243 11 52 47 9 4 9 677 9 375 619 69 58 13 7 8 259 9 463 46 92 993 52 151 445 13 92 49 64 796 11 23 467 4 4179 1 13 8995 14 67 363 363 6 739 269 83 5 134 6 7 16 2976 84 1237 842 6 14 8 3 9 53 72 31 89 874 9 99 9886 2 78 9 961 3 615 6 246 471 771 643 98 7632 4 122 2 59 8914 3483 2292 15 914 15 54 63 2 413 13 639 6615 35 76 472 452 59 8 2 16 7 432 7 35 986 24 92 34 19 6 77 22 93 1 468 648 222 857 93 7966 65 27 531 68 335 7699 6 7651 4 865 24 415 5 52 5 11 5 8234 426 9 2 538 5342 48 81 872 297 3997 827 483 74 523 92 5 2763 618 15 48 159 17 9766 27 3 83 5 97 257 4 684 34 5 5677 76 59 477 8 55 4 752 36 12 1767 812 89 729 3416 73 97 35 91 57 99 44 87 72 6 58 8 95 68 191 74 66 96 2 1 6 69 59 4 7 2 383 457 5225 519 22 74 849 51
+ + + * * + + * * + * + * * + + + * * * + * * * + + * + * * + + + + + + * * + + * * + * * * * + * * * + * * * * * + + + + * + + * + * * * + + * * * + * + + * + * + * + + + * * + + * * + + + + + * + * * * + + * * * + * + + + + + * + * * + + * + * + + + + + * * * * + + + * * + * + * + + * + * * + * + + * + + + * * + + * * * * + * + * * + * * * * + * * + + * + + * * * + * + + + * * * * * * * * + + * + * + * + + * * + + * * * + + + * * + * + * + + + + + * + + + * * * + + * + + * + + * + + + + + + * + + * + + + + + * + * * + * + + + * + + * + * * + + + * * + + * + + + + * + + * + + + * * + * + + + + * * + + + * * * + + + * + + + + + + + + + + + * * + * * + * + * + * * * * * * * + + * + + + + + + * + + * * * + * + + + * + * * + + + + + + + + + + * * * * + + + + + + + + * + * * * + + + + * + * + * + * * * + + * + * + * + + + * + + + + * * + + + + + * * + + * * + * * * * + + * + * * * + * * * * + + * + + + + * * + * + + * + + + * * * * * * + + + + * + * + * + * + + * + * + + * * * + * * + * * * * + + + * * + * * + * + + + + * + * * * + * * * + + + + + * + * + + * + + + * * + + * * * * * + + * * * + * + * + * + + * + + * + + + + * * * + + + + + * * + * * + + * + * + + * * + + * + * * + * + * * * * * * * + * + * * * * * + * + * + + + + * + + * * * + * * + + + * * + + + + + * * + * * * * * * + + * * + + + + * + + * + * * * * + * * + * * + + * * + + + * + + * * * + + + + * * * * + * * + * + * * + * * * + * * + + + + * + + * + * * * * * * * * + * + + + + + + * * * * + * * + * * + + * * + * + * * * * + * * + + + + + * + * + * + * * * * + * + + + * + * + * * + + * * + + + * * + * * * * + * + + + * + * * + * + + * + * + * * * * * + * * * + + + * * + * + + * + * + * * + + + * * + + * * + * + + * + * + * * + + + * * + + + + + + * + + * * + * * + + + + + * * * * * + * * * * * + + + + + + * * * + + + + + + + * * * * + + + + * * * + + + * + + + + + * * * * + + * + * + + * * + * * + * * * * + * * + * * + * + + + + + + + * + * + + + * * + + + * * + * * * * + + * + * + * * * + + + + * + *

125
2025/day06/main.go Normal file
View File

@@ -0,0 +1,125 @@
package main
import (
"fmt"
"strings"
h "git.bullercodeworks.com/brian/adventofcode/helpers"
)
func main() {
inp := h.StdinToStringSlice()
part1(inp)
fmt.Println()
part2(inp)
}
func part1(inp []string) {
var ret int
nums := pt1ParseNums(inp[:len(inp)-1])
var results []int
ops := strings.Fields(inp[len(inp)-1])
results = pt1ApplyOps(ops, nums)
for i := range results {
ret = ret + results[i]
}
fmt.Println("# Part 1")
fmt.Println(ret)
}
func part2(inp []string) {
var ret int
nums := pt2ParseNums(inp[:len(inp)-1])
var results []int
ops := strings.Fields(inp[len(inp)-1])
results = pt2ApplyOps(ops, nums)
for i := range results {
ret = ret + results[i]
}
fmt.Println("# Part 2")
fmt.Println(ret)
}
func pt1ParseNums(inp []string) [][]int {
var nums [][]int
for i := range inp {
l := strings.Fields(inp[i])
// Row of numbers
var n []int
for j := range l {
n = append(n, h.Atoi(l[j]))
}
nums = append(nums, n)
}
return nums
}
func pt2ParseNums(inp []string) [][]int {
var nums [][]int
var cols [][]byte
for _, row := range inp {
for j := range row {
if len(cols) <= j {
cols = append(cols, []byte{})
}
cols[j] = append(cols[j], row[j])
}
}
var nCol []int
for i := range cols {
stC := string(cols[i])
if strings.TrimSpace(stC) == "" {
if len(nCol) > 0 {
nums = append(nums, nCol)
nCol = []int{}
}
continue
}
nCol = append(nCol, h.Atoi(stC))
}
if len(nCol) > 0 {
nums = append(nums, nCol)
}
return nums
}
func pt1ApplyOps(ops []string, nums [][]int) []int {
var res []int
for i := range ops {
var colRes int
switch ops[i][0] {
case '+':
for j := range nums {
colRes += nums[j][i]
}
case '*':
colRes = 1
for j := range nums {
colRes *= nums[j][i]
}
}
res = append(res, colRes)
}
return res
}
func pt2ApplyOps(ops []string, nums [][]int) []int {
var res []int
for i := range nums {
var colRes int
switch ops[i][0] {
case '+':
for j := range nums[i] {
colRes += nums[i][j]
}
case '*':
colRes = 1
for j := range nums[i] {
colRes *= nums[i][j]
}
}
res = append(res, colRes)
}
return res
}

116
2025/day06/problem Normal file
View File

@@ -0,0 +1,116 @@
[1]Advent of Code
br0xen [7](AoC++) 12*
--- Day 6: Trash Compactor ---
After helping the Elves in the kitchen, you were taking a break and
helping them re-enact a movie scene when you over-enthusiastically jumped
into the garbage chute!
A brief fall later, you find yourself in a garbage smasher. Unfortunately,
the door's been magnetically sealed.
As you try to find a way out, you are approached by a family of
cephalopods! They're pretty sure they can get the door open, but it will
take some time. While you wait, they're curious if you can help the
youngest cephalopod with her [16]math homework.
Cephalopod math doesn't look that different from normal math. The math
worksheet (your puzzle input) consists of a list of problems; each problem
has a group of numbers that need to be either added (+) or multiplied (*)
together.
However, the problems are arranged a little strangely; they seem to be
presented next to each other in a very long horizontal list. For example:
123 328 51 64
45 64 387 23
6 98 215 314
* + * +
Each problem's numbers are arranged vertically; at the bottom of the
problem is the symbol for the operation that needs to be performed.
Problems are separated by a full column of only spaces. The left/right
alignment of numbers within each problem can be ignored.
So, this worksheet contains four problems:
 123 * 45 * 6 = 33210
 328 + 64 + 98 = 490
 51 * 387 * 215 = 4243455
 64 + 23 + 314 = 401
To check their work, cephalopod students are given the grand total of
adding together all of the answers to the individual problems. In this
worksheet, the grand total is 33210 + 490 + 4243455 + 401 = 4277556.
Of course, the actual worksheet is much wider. You'll need to make sure to
unroll it completely so that you can read the problems clearly.
Solve the problems on the math worksheet. What is the grand total found by
adding together all of the answers to the individual problems?
Your puzzle answer was 6295830249262.
--- Part Two ---
The big cephalopods come back to check on how things are going. When they
see that your grand total doesn't match the one expected by the worksheet,
they realize they forgot to explain how to read cephalopod math.
Cephalopod math is written right-to-left in columns. Each number is given
in its own column, with the most significant digit at the top and the
least significant digit at the bottom. (Problems are still separated with
a column consisting only of spaces, and the symbol at the bottom of the
problem is still the operator to use.)
Here's the example worksheet again:
123 328 51 64
45 64 387 23
6 98 215 314
* + * +
Reading the problems right-to-left one column at a time, the problems are
now quite different:
 The rightmost problem is 4 + 431 + 623 = 1058
 The second problem from the right is 175 * 581 * 32 = 3253600
 The third problem from the right is 8 + 248 + 369 = 625
 Finally, the leftmost problem is 356 * 24 * 1 = 8544
Now, the grand total is 1058 + 3253600 + 625 + 8544 = 3263827.
Solve the problems on the math worksheet again. What is the grand total
found by adding together all of the answers to the individual problems?
Your puzzle answer was 9194682052782.
Both parts of this puzzle are complete! They provide two gold stars: **
At this point, you should [17]return to your Advent calendar and try
another puzzle.
If you still want to see it, you can [18]get your puzzle input.
References
Visible links
1. https://adventofcode.com/
2. https://adventofcode.com/2025/about
3. https://adventofcode.com/2025/events
4. https://adventofcode.com/2025/shop
5. https://adventofcode.com/2025/settings
6. https://adventofcode.com/2025/auth/logout
7. Advent of Code Supporter
https://adventofcode.com/2025/support
8. https://adventofcode.com/2025
9. https://adventofcode.com/2025
10. https://adventofcode.com/2025/support
11. https://adventofcode.com/2025/sponsors
12. https://adventofcode.com/2025/leaderboard/private
13. https://adventofcode.com/2025/stats
14. https://adventofcode.com/2025/sponsors
16. https://adventofcode.com/2021/day/18
17. https://adventofcode.com/2025
18. https://adventofcode.com/2025/day/6/input

4
2025/day06/testinput Normal file
View File

@@ -0,0 +1,4 @@
123 328 51 64
45 64 387 23
6 98 215 314
* + * +

View File

@@ -7,6 +7,7 @@ import (
func main() {
inp := h.StdinToStringSlice()
part1(inp)
fmt.Println()
part2(inp)
}