r/adventofcode • • Dec 23 '24

Help/Question - RESOLVED It’s not much but it’s honest work

Post image
1.1k Upvotes

Im a highschool student and I have finally finished the first 8 days of aoc and I know it’s not anything crazy but I thought that I could still post this as an achievement as I had only gotten the 5th star last year. My code isn’t anything grand and i know it’s ugly and unoptimized so if anyone would like to give me some feedback and code advice here’s my GitHub where I put all my solving code. github.com/likepotatoman/AOC-2024

r/adventofcode • • Dec 08 '25

Help/Question - RESOLVED [2025 Day 8 (Part 1)] Reading comprehension

100 Upvotes

Because these two junction boxes were already in the same circuit, nothing happens!

connect together the 1000 pairs of junction boxes which are closest together.

I didn't expect that I would need to count the "nothing happens" as part of the 1000 connections to make for part 1. It kind of makes sense that with 1000 boxes, 1000 connections would lead to a fully connected circuit, but I think it could've been worded better

r/adventofcode • • Dec 24 '24

Help/Question - RESOLVED How did you all get so smart?

156 Upvotes

I'll first say Happy Holidays =) and thank you so much to Eric Wastl and the sponsors.

This is my first year doing AoC and I had a blast, but I've had to cheat for part 2 for the last 4 days and I'm curious about a few things.

My background is a Data Engineer/Data Architect and I'm very proficient in my field. I work mostly in pyspark and spark sql or tsql and I'm really good with object oriented coding, but all we do is ETL data in data driven pipelines. The most complicated thing I might do is join 2 large tables or need to hash PI data or assess data quality. I don't have a computer science degree, just an app dev diploma and 15 years data experience.

Because of how I've been conditioned I always land on 'brute force' first and it doesn't work for most of these problems lol. I've learned a ton doing AoC, from dijkstra to Cramer's rule. Here are my questions about this stuff.

1) Where would some of these AoC logic solutions have practical application in computer science

2) Any recommendations on gameified self learning websites/games/courses (like Advent of Code) where I can learn more about this stuff so I'm less likely to cheat next year haha.

r/adventofcode • • Sep 04 '26

Help/Question - RESOLVED [2025 Day 6] Stuck on part 1

3 Upvotes

I'm stuck on part 1 for day 6 (https://adventofcode.com/2025/day/6). The code I wrote gives the correct answer for the example input and also if I take a small portion of the puzzle input and do the calculations myself. But for some reason the total for the puzzle input is incorrect. Below is the small C# code I wrote for this. Can someone give me a hint into the right direction?

class Program()
{
    static string[] input =
    [
        "886  63  27 258 98 318 99 975  7 6393 947 87 23 765 35      1 6415 4  5  882  7 475 74 598 4  47 66 9233 6  669   2  3 6   92 77   4  6 64 89 989 436 833 946 5927 398 2  262 594 752 79 3    3  44 117 149 74 119 48 17 762 621 81 3576 23 259 141   51 312 16 255  6 925 7     1 395 61 61 34 277 1366 44 8  32 26 932  61 48 29 693  3  27 89 9  618  95  693 3  3   11  7  366 2455  3 11 4  59  9    9975 81 2  71 989 697 8636 12 16 889 78 53 23 321 33  29  129 81 18 161 78 7365 8  9515 127 94 383 6    17  2 389 724 37 5227 64 55   5  1 9   983 36 194 377 476 938 81 39   76 3  9  935 16 16 99  79 84   1212 3  13 2865 3     13 85  66 898 636 7164  23 81 88 79 767 66  348 5114 426 62 33  42   31  46 16 964 4    54 957  66 156 94 7876 393 481 23  64 54 95 56 27 4  525 892 38 213 29   15   1 28 4     41 65  5 89  15 52 535 8972 89   74 7672 824  71 2   49 7  494  9 697 3291  6  97 221  6 942 3    776  54 175 25  93 951  353 7448 891   16 476  7 65  56   37    9 88 195  3 21   19 439 478 366  67 1543 76 112  3 8246 2    6 77  6 3889 85 32   9 13 85 45 27  3 896 84 46 29  384 9259 761 4165 72 5  71  48 512 822 25 74  78 91  31   43 195 12 84  94 35 48 29 265  133 25 1286 42 76 5411 327  3    8    485 488  2 747 243 476 31 138 13  49 44 74 8  898   7   2 96 28   1966 34 15   7 29 429 327 46  823 87  45 339 663 96   5 99 22 9283   7 297  79 63 3  5753 48 68 269 22  3 75 2  44 48 4584 75 83 467 44 4532  24 12 82 44  472 8      5 6414 35 329 388 268 36   8 75  6296 25 731 51   56  55 681 2  6  128 872 818 768 977 134 9147 2   29 2   16 281 119 456 882 415  4 72  538 693   882 219 538 288 293 41 327 366 9   125 261 66 69   113 114 18   759 554 247 98 22    9  78 62 57  1  76 86 61 24  54   2 938 251 72  55 831 5593 31   26 2186 85 34  17 73 14 785 511 18 39  4 61 72 63 817 4   49 57 775 9527 8   58 712  9 7   17   35 9  77 93   3 71 5  13    9 46 6    9 381 58 364 236 87 96 8   691 529 83 3   5   5   66 87 54 277 92  6 3   165 1  12  2 163  28 93 649 95  5 136 1  1    81  6359 35 212  164 636   56  8 3   3 8   52  17 414 2491 542  5553 629 24 594 357 35   83 8   9  77    7 55 34 54  693 1    86 6547 572 442 92 656  39     9 38    8 49  8 273 7  987 4686 38 549  86 6  75 616 623 6639 4224  68 131 539   6 2275   4 8547  785 4387 917 45    52 383 18 1967 2   5 21 64 92 8186  18 243  219 4   1126 426 58 1515  2 187 874 151 82 152 356 21 17 14 8   65  44 52 9149 91 936 74 81  816 87   48    7 28  165 5  27   73   99   75 739 69 62 839 1    548 58 996 687 77 28 584 39    32 294 551 3   9234 595 4353 984 236 9252 773 66   1  65 435  84 67 57 16 191 75 9   668   2 9533 437 86 839 82 94 1547 78 6281 9419 23   1   4 573  957 2163 5  49 41 8  644 35   435 6    217  2  9 77 21  92 12  9 32 1778 579 9   5   13 544 896 7592 39 637   9 33 21   71 791  89  32 946 579   2 1   456 971 951 15   7 112 85  23    7 521 551 2618 228 88 91  387 889 971 448 647   9 34  94 822 736  45 355  816 46 36  7 348 144 72     6 865   3 997 5248 897 257 177 69 44 64 925 177 965 25 11 979 773 8334 3195 236 9657 9  9  576 839 843 863    7 99  848 251 98  9 358 69 87 37  12    9 999  5 4576 828 35 6  78 74 127 9177 47   4 94 46 98 688 354 723 53 55    8   47 692 72  85 675 878 689  86 25  5 251 95   8 3   25 76 335  3    8 9  922 6  7  13 14 56 9   3 54 43 24 15 987 622 45 69  8   94 736 67 165  66 794 298 79 56  2 61 3431 65 652 83  656 44 66 8   52 95 2219 2   84 84 97  98 48  722 88 66 629   1 31    14  7 62   8 7577 96 22 46   25 58 3195 29  36 93 56 477 328 6   33 4     3 6143 6228 34 249 7    56   6  8 5   29 6   69    9 286 1   763 74  695 416 63 17   6   59 727 495  52 294 86 49   3 76  83 87  183 261 928 5919 99  3 27  147 94   467 821 72 362 49 36 473 6291 37 679 6  91 66  35 8757 9425 658 899  3 5164  64 787 52 141 68   6  59  776 99  8 58", 
        "652  49  14  97 72 335 28 269 23 1648 698 46 68 814 3193   89  421 13 4  585  4 962 48 983 3  59 59 4636 44 532   5 77 239 93 59 817  6 26 92 537 363 883 993 8984  64 36 976 613  39 57 777  3  66 299  62  2 429 12 91 367  45 63 4417 81 525 26  3617 225 26  69 53 562 985   5 261 71 29 89 134 7355 44 62 79 45 734  76 47 97 66   2 667 71 46 316  16 8339 29 84  21 65 8469 6312 63 9  1  476 22   9392 16 52 34 352 548 5181 89 81 466 6  22 92 793 321 44 1644 64 79 632 22 876  77 8748 929 75 294 19   17  4 218 641 48 621  61 76  16 81 39  431 36 895 982 545 493 57 134  14 25 2  521 87  2 731 43 33   4258 1  91 8384 764 2969 52  22 362 587 1528  99 21 83 12 133 135 697 4989 826 38 646 16   73  99 73 798 586  93 4584 81 618 79 9338 54  298 39  61 37 23 55 31 21 847 725 47 469 671  37   9 29 34   146 96 89 79  24 61 667 8745 17  594 1563 9596 25 678 28 26 935 25 543 7531 23 786 549  4 993 63   268 219 986 787 91 635  262 1472 5213  44 482 92 89  77 9225 5329 71 995 43 82  837 118 915 988  82 4754 42 111  7 3787 27   6 87  4 128  83 33 927 27 59 17 39 36 4   88 98 83 1747 2241 152  288 89 95 3   64 991 381 64 175 17 39 538  969 853 63 47  42 23 27 68 3555 374 44 5784 97 99 7355 667  271  62   845 318  5 831 117 389 14 785 26 461 58 39 26 891  95  45 5  43   7765 62 19  66 71 425 987 66  368 72  69 346 476 57 772 87 73 4987  74 459  48 91 9  4247 33 37 134 32 99 23 6  17 47 2612 37  8 786 73 262   21 77 38 24  497 88   585 1838 81 312 265 993 65 954 848 485  98 42  6591 65 693 273 77 6  268 888 252 656 591 69  5592 98 241 511 21 282 261 283  54 574 56 816 319 745   161 887 657 982 923 48 513 649 621 719 826 67 35    69 784 45    36 986 986 63 78   86  75 97 12  3 778 39 41 52  92  12 853 725 95  33 499 865  11  841 8793 92 41  75 64 62 636 657 14 15 58 35 83 22 644 68  94 22 876 5927 882 97 698  2 45  98 9187 49 21 36  17 25 51 35  546 82 46  41 852 79 996  87 87 59 76  93  337 32 84  7   9   54 25 15  52 89 96 75  224 3  19 97 9784 82 59   5 13 35 114 9  576  458 6664 45 177  631 212  263  8 2  65 248 292 52 485 3544 8919  647 789 89 223 173 558  54 14 99  88  515 93 85 886 471 292  24 4764 285 341 53 924  784   69 86  222 31 53 641 4  552 694  41 691 321 39 35 334 142 1639 1423 355 577 2479  4 5299 174 2621 2711 5423 515 83  5717 952 45 694  7  88 34 28 19 3519 184 696  348 57    94 999 47 3465  2 213 545 335 31 813  57 64 73 95 26  328 31 77  747 87 959 46 769 914 84   29   59 78  259 1  2435 54   932  42 652 59 49 813 66   933 82 738 888 29 59 359 15   835 364 62  37  41   472 7961 645 317 9724 194 882  3  43 921  57 66 56 27 979 24 8  1936   6 7434 726 38 79  46 31 6797 29 3347  762 83   7  93 7846 581 8867 92 79 74 8   15 39    87 43   686 86 65 84 96  68 91 89 17 2598 768 27  75  57 315 642 2231 57 425   2 48 41   94 1415 87  46 411 264  37 1  8581 872 359 817 41 751 79  673  89 613 765 1254 849 97 63  223 93  773 136 124  14 835 67 894 769 315 544  923 77 65  6 695 882 413    8 854  35 498 7665 776 526 164 31 64 45 646 937 727 37 84 73  511 9495 235  588 6894 5  71 257 71  821 262    6 57  637 773 91  6 248 24 84 256 872 997 324 72  233 536 94 9  19 98 287 782  29  37 12 14 31 582 611 317 89 16  713 2417 637 81  82 44  554 312 381 71  4 275  3   4 551 25 11 7939 72   1 8  431 21 22 12 25 72 71  5 31 95 92 52 398 735 75 21 22   55 137 54  75 554 645 126 41 58 17 27 1467 97 53  18  667 69 84 6   53 48 6561 47  75 84 16  95 348 99  3  65 366  79 758 5921  6 596  7 5146 27 53 693  39 69 1198 92  13  7 42 551 483 9  934 86   89 5442 8966 79  46 376  65   6 89 22  43 9   33  293 499 618 66  11  537 689 41 74   3  464 753 965 425 158 91 79 588 66 359 237 791 163 759 4374 39  7 35  554 2978 835 146 31 534 36 14 956 3881 59 419 79 56 63  32 8385 6366 997 86  76 3148  98 513 89 379 2296 81 31 6222 33  7 665",
        "65  143  36   8 42 429 55 327 44  775 558 76 85 171 6136 9139   23 97 73 575  9 933 52  87 43  2 27 869  88 415  28 17 292 19 36 158 31 67 39 682 8   712 182 373   52 21 675 286  95 41 114 35 754 13   97  1 387 83 96 582  71 46 6827 11 456 1   5474 198 64   6 94 126 814  69 66  83 42  3 28  1828  8 54 33 84 4562 34 23 45 67   4 376 34 66 6639 21 5723 62 666 21 19 9159 9428 35 9  3  993 349  982  8  46 16 244  77 5567 38 44 461 2  4  37 953 687 44 8648 49 72  23 96 54   61 7735 65  71  45 31 8828  2 591 867 45 397  34  4 137 52 89  733 36 735  79  51 169 43 5114 48 87 52 298 37  1 657 87 7346 7781 45 75 9752 949 2584 37   8 858 227   25 473 21 93 59 737 689 232  732 512 24 784 55   876 48 33  21 2199 99 7251 15 731 71  548 87  767 95  17 47 78 19 89 29 65  762 49 528 7417 134  4 55 157 3848 39 99 26  27 49  37 854  669 776 9414 1335 39 249 38 34   4 77 486 1457 13 477 472  6  97 416 2543 327 774 848 59 5848 191 1877 2552 546  59 99 44   8 4135 9669 88 838 16 44  392 859 192 8534 36  988 59 947 36 3467 95  59 49  9 769  45 93 366 39 19 22 63 37 9   73 41 55 5752 5777 324  136 65 46 8   44 195 696  9 863 4  55 767 6572 538 58 72 111  9 37 41 1211 875 16 428  43 94 7779 2746 4639 392  656 453 48 82  216 136 8  839 8  767 53 23 39 633 828 991 1  9128 351  12 85 314 9  521 491 48  318 463 3  386 838 39 482  5 24 2825 465  79 295 57 86 7627 42 63  55 53 63 38 8  87 66 655  85  6 274 66 989  999 37 97 25  139 639 8289 235  45 353 97   26 89 699 378 76   92 16  5661 14 324  99 75 46  68 644 367 748 689 52  893  22 558 278 73 738 216  93  22 724 59 865 313 7824 8221 683 36  162 938  9 611 672 318 895 521 25 157   58 382 483   89 768 325 23 875  44 973  1 42 23 146 84  4 59 398 744 579 157 15 959   1 786  53 9619 2845 83 73 153 46 84 525 463 76 24 97 38 65 9  572 95  28 97 1   7523 787 57 714  9 36   9 7412 65 47 55 368 25 55 98 2847 66 65 916 468 19 947   1 47 53 718 36  74  44 79  53  37 381 48 54  85 55 99 86 3772 44 66 42 9935 26 73   6 91 64 988 64 7975 476 9714 59 418 7468 613 1998 15 57 13 429 945  3 18  9864 1986   39 944 25 755 834 2558 57 69 63 357 4491 1  97 771  12 9157 91   12 375 138 48 4235 3215 538 67 1845 66 52 48  28   9 77   11 3   684 69 75 588 967 9226 1564 793 556 9826 63 9772 687 1639 6553 9472 624 84  3782 236 15 66   64 83 76 75 32 2978 619 2145 432 51    74 86  69  458 45 324 539 331 4   38  73 35 33 43 458 416 26 13   79 32 671 73 515 21  12  882  589 936 947 34 9536 92   7134 65 381 28 94 17  6569 461 24 473 552  6 42 937 255 5337 463 68  916 64   376   86  91 377  389 662 9297 66 51 64  783 43  4 38 698  3 95 3789  43 2466 691 69 84  66 28 622  91  469    5 91  87 785 8489 59   339 55 45 29 86  16 1962  34 577 2466 58 59 31 367 22 36 29 83  217 68  268 841 24 787 852 6686 55 423 151 18 1446 2  9728 34 559 245 89   36 3  8892 1   364 662 54 214 181 876 343 43  755 8623 93  62 43 4636 16  662 115 463 781 779 15 377 848 326 254 5293 86  7  9 43  951 574 6827 495 796 925 13   912 883 137 55 47 52 517 762 221 51 46 94  618   85 6    612 8977 33 47 336 16  456 545 9316 468 581 964 35 16  78 58 39 825 595 355 615 96  749  85 44 88 87 1  921 98   72 824 93 41 99 789   8 4   27 389 775 1463 89  31  7  13  26  225 594 46  7  42  9 425 234 17 56 4451 967 58 64 622 99 36  7  7 28 59 44 31 72 61 22 288 84  34 99 74 9488 946 17  18 176 874 135 88 12 99 27 2266 18 3   243 577 21 94 612 92 78  972 91  18 48 874 87 646 31  1  22 974 483 428 1834  5 218 91 3426 33 6  9247 87 55  344 64  99  4 71 15  565 65 774 138 625 8685 234  44  22 1957 36 224 38 183 45 83  17 1484 48  182 56  32   76 587 17 77  83 3772 945 564 852  13 14 39 967 46 272 373  66 569 37  6662 43 53 65 7157 1882 569 618 21 279 25 61 111  855 46 138 18 76 926 89 5524 3347  55 91  56 2742 729 939 21 319 2332 25 13 4445 55 52 911",
        "8   686 695   9 4  689 2  373 96  131 7   41 96 28  7328 8919   66 68 86 291 36   1 69  48 21  2  5 9    47 797 723 41 216  4 66 181 21 21 8   33 6   111 592 655   54 81  62 674  56 1  154 11 525 84   77  8 93  94 55 7     5 86 879  89 65  7   8855 15  46   5 64  25 729 772 38  78  3  1 1   31    1 75 49 86 8412  2 66 51 74  76 722 46 26 8592  9 2227 36 778 8  34 8635 76   87 8  91 837 3433 92   9  17 65 614   7  931  1 52 735 5  1  2   84 615 8  7675  6  9  58 3  51   12   32 6   8   78 55 1295 89 556 8   1  28    2  9 525 43 115 782 22 359   1  84 879 59 6796 87 44 23 36  3   2 282 21 3753   64 27 38   19 279 4487 264  8 367 329   67 517 25 65 94  44 147 772  354 773 15 883 4769 488 82  6  94 1562 79 1415 83 36  71   24 85  164 173 17 84 63 36 19 34 8    96 4  889 3851 963 91 14 297 3461  5 27 445 52 49   2 891  765 198 9972 9839 92 986 98 74   2 63   8   11 55 196 49  95   1 761 5741 296  68 166 3  9738  44   25 4642 198   6 16 834  3 5382 2549 15 41  42 28 5444 792 383 6762 16  882  2 54  59 5498 36 951 86 11 489  89 31 893 32 67 17 64 79 3   14 53 13 4991 6778 83   235 55 94 6  414 959 765  3 728 7  48 177 1273 556 9  4  623  5 93 11 8495 324 4  121   2 65 894  7831 6856 8921 183 894 67 56  647 797 1  41  3  344  9 85 56 1   571 157 3  4547 384  37  8 377 6  99  258 89 7485 362 9  9   49  52 688  8 51  779 315   8 775 8  51 2752  7 55   4 8  52 69 49 52 38 129  94  5 362  6 53   723  7  3 165 675 654 4688 8    4  872 73   79  6 967 257 3    32 92  6711 7  423   4 18 35   2 562 927 319 812 27  488  82 119 265 22  93 66    1  93 594 89 628 77  7185 9239 37  47  397 881  7 486 981 444 241 674 41 3575   9 237 2133  75 88  652 94 152 344 186  8 89 67 154 77  7 7  841 939 175   3  8 481   3 249  69 3253 48   17 47 169  1 27  15   4  5 28 67  6  1 7   34 686 52 46 4   572  122 97 972 77 411  2 6688 12 15 59 693 79 31 86 3915 67 96 674 229 52 794   4 9  65 986 34  43  58 677 493 76 215  8 35  51 59 24 66 9151 76 97 43 2698 26 49   6 1  69 838 46 5672 539 962  19 597 3585   8 8434 57 49 62 149 938  1 48  5555 3316    5 73  9  146 778 9175 74 74 77 376 1481 8  34 892  46 4369 35   71 872 192 63 6147 9188 245 41 1392 91 44 8   88   1 85   3  7   417 47 89 87  936 321  5818 511 636 8926 37 8851 815   71 9492 3632 64  191 4661 862 82 6    13 28 66  9 68 71   647 9139 922 235    8 7   21  559 86 181  37   6 6    9   4 2  47 41 482 128 4  17   48 9  372 61 721 74  78 5741 4613 854 736 91 5389 8983 8224 89 111 75 88 37  8942 251 84 274 22   2 28 4   744 7646 525 5   233 76    11    7   4  37  612 66  4459 33  2 25  966 8   9 24  88  4 11 3534 113 2272 714 13 9   86 79 93   88  674    4 12 865 294 5913 9     24 77  9 48 97  48 5751   6 921 1779 32 43 8  527 44 99 22 57   83 3   917 131 49 17  875  612 15 21  414 69 7935 3  9772 54 557 849 7   621 54 5848 6   349 281 22 793 653 438 343 93  59    92 35   4 46 4347 16  245 148  56 329 519 73  56 147 698 483 1435 57  2 44 13  196 978 4763 328 729 15  5    21    5 652 29 98 27 515 166 725 1  76 4   965   83 7    261 675  12 69   9 26  834 848 5817 986  27 128 3  64   3 61 8  265 297 268 14  16  436  25 17 94 41 1  15  4    65 257 29 56 63 597   3 9   36 185 368 6737 17  264 6  4   5    94 524 38 93  38  4 837 676 97  1 4844 557 31 38  42 14 86  6  2 18 11 66 14 2  61 65 78  3   98 7  48 3969 698 36   6 762 695 48  24 26 79 4  7343 99 3   835 27  93  9 541  1  5   18 992 31 1  116 44 912 18  3   7 81  662 718 3415 49 566 22   14 72 5  3899 94  1   97 488 28  7 23 6     7 26 523 129 289 7896 691  63  64 3383 36 169 45 777  1 318 94 2122 4   849 7   248   2 6   51 33 269 4469  28 716 692   1 97 6  658 68 713 153  75 715 79  219  37 99  6 7426 1336 585 71  76 248 87  6 791   76 15  82 59 66 459 73 995  7374   3 22  64 4681 228 439 73 8   8129 56  5 3884 84 64 343",
        "*   +   +   *   +  +   *  +   *  +    +   *  *  +   +    +    +    *  *  *   +  *   +  +   +  *  *  +    *  +   *   *  +   +  *  *   *  +  +  *   *   *   +   +    +   +  *   *   +   *  *   +  *   *   *   +  *   *  *  *   +   *  +    *  *   *   +    *   +  +   *  *   *   *   *   +  +  *  *   +    *  +  +  +  +    *  *  *  *   +  +   *  +  +    +  +    *  *   *  *  +    +    *  +  *  +   +    +    +  *  +  +   *   +    +  *  *   +  *  *  +   +   *  +    +  *  *   +  +    *  +    *   +  *   +  +    +  *   *   *  +    +  *  *   *  +   +   +  *   *   +   +   *  +    +  *  +  *   +  *  +   *  +    +    *  *  +    *   +    +   *  *   *   +    +   +  *  *  *   *   +   +    *   *  +   +    *   +  +  +   +    +  +    *  +   *  +    +   +   +   +  *  +  *  *  *  *   *   *  +   +    *   +  *  *   +    +  *  +   *  *  +   +    *   *   +    +    +  *   +  +  +   *  *   +    +  *   *   +  *   *   +    +   *   +   +  +    *   +    +    *   *   *  +   *  +    +    +  +   *  +  +    *   *   +    *  +    *  +   *  +    +  +   *  +  +    *  +  +   +  *  *  *  +  +   *  +  *  +    +    *   +    *  +  *  +   +   +   +  +   +  *  *   +    +   *  +  *   +  +  *  +    *   +  +    *  *  +    +    +    +    *   *   +  *   +   +   *  *   +  +   +  *  +  *   +   +   *  +    +    +  *  *   *  +   +   *  +    *   +  +   +   +  *   +  *  +    +   *   *   *  +  +    *  *  +   *  *  *  *  *  *  +    +  *  *   *  +    *   +  *  *   +   *   +    +    +  *   *   +   +  *   *   +    *  *   +    *  *   *   +  *  +   *   +   *   +   *   +    +  *   *   +  *   *   *   *   *   +  *   *   +    +    +   *   *   +   +  *   +   *   +   *   *  +    *   +   +    *   +   *   *  *   *   *   *  +  +  +   *  +  *  +   *   +   +   *  *   +   +    *  +    +    *  *  *   *  +  +   *   +  +  *  +  *  +  +   *   +  +  *   +    *   *  *   *  *   +  +    *  +  +  +   *  +  *  +    +  +  +   +   *  *   *   *  +  *   +   *   *  *   +   +  *   *  *  +   *  +  *  +    +  +  +  +    *  *  +   *  *  *   +  +    *   +    *  +   +    +   +    *  +  +  +   +   +  *   +    +    +    +   *  *   *   +    *  +  +  *   +    +  +  *   *   +    *  +    +   +   +  +    +    +   *  +    *  +  *   +  +   +    +  *   *   *  *  +   *   +    +    *   +   +    *  +    *   +    +    +    *   *   +    *   *  +    *  *  *  +  +  +    *   +    *   +   +    +   *  +    *  +   *   +   *  *   *   +  *  *  +   +   *  +  +    *  *   *  +   *   *  +    +    +   *   +  +    +    +    *  +   +  *  *   +    *   *  +   +   *  *  *   *   +    *   *   +   +    *   +    *   *   +    *   +    +  *  *   *   +  *  +  +   *  *  +    +   +    +   +  *   *  +  +    +  +    +    *  *   +   +    *   +    +  *  *  *  +   +    +   *   +    +  +  +  *   *  +  *  *  +    *   *   +   *  *   *   +    *  *   *   +  +    +  +    +  *   +   *   *   +  +    *   +   *   +  *   +   +   *   +   +   +    +   +  +  +    *   *   *   +   *   *   +  *   *   *   *   +    +  *  +  *   +   *   +    *   *   +   +    *   *   *   +  +  *  *   *   *   *  *  +   *   +    +    +   +    *  +  *   *   *   *   +    +   +   *   *  *  +   *  +  +   *   *   +   *  +    +   +  *  *  *  +   +    +  +   +  +  *  +   +   *   *  *   *   +    *   *   *  *   +   *   +   *  +  *   +  *   *   *  +  +    +   +  +  *   *  *  +  +  *  *  +  +  +  *  +  *   *   *  +  *  +    *   *  +   *   *   *   +  *  +  *  +    *  +   *   *   +  +  *   +  *  +    +   *  +  +   *  *   +   *  +  *   *   *   +    *  *   *  +    +  *  +    +  +  +    *   *  +  +  *   *   *  +   *   *   +    +    *  *   +    +  *   +  *   *  +   *  +    *   +   +   *   *   *   *  *  +   +    *   *   +   +   +  +  *   *  +   *   +   +   +   +    +  *  *  +    +    +   *   *  *   +  *  *   +    *  *   *  +  +   +  +    +    +   *   +  +    *   *   +  *   +    *  *  +    +  *  *"
    ];


    static void Main()
    {
        var mathSolver = new MathSolver();
        Console.WriteLine(mathSolver.Solve(input));
    }
}

public class MathSolver
{
    public long Solve(string[] input)
    {
        var splitArrays = input.Select(i => i.Split(" ", StringSplitOptions.RemoveEmptyEntries));

        // Reverse the arrays so that the operator is in the first array.
        splitArrays = splitArrays.Reverse();


        long total = 0;
        for (int i = 0; i < splitArrays.First().Count(); i++)
        { 
            // Take the numbers for the column but skip the operator.         
            var numbers = splitArrays.Skip(1).Select(s => int.Parse(s[i]));  
            if (splitArrays.First()[i] == "+")
            {
                total += numbers.Sum();
            }
            else
            {
                // Multiply all the numbers in the column.
                int multiply = 1;
                foreach (var n in numbers)
                {
                    multiply *= n;
                }
                total += multiply;
            }
        }


        return total;
    }
}

r/adventofcode • • Dec 01 '25

Help/Question - RESOLVED First AoC! I did it, but is my solution kinda bad?

18 Upvotes

Hi! I heard about Advent of Code thanks to a ThePrimeagen video like a month ago, and today I did the first puzzle and had a lot of fun actually :)

I'm not good at coding by any means: i tinkered with arduinos some years ago and this school year (i'm 17, next year i'll go to university, and i'll study CS wohooo) we've started learning python in class. That means that my solutions are horrible tbh, since i don't know well the tools that are at my disposal (in class we have a very low level, so i'm actually the best at coding and problem solving from them, by far).

So to solve today's puzzle i saw that i needed to read strings from a file or smth. I dont know how to do that, so i just pasted the puzzle input in neovim and run a simple macro 4080 times to format it as a tuple for python.
I mean, it works... but isn't this considered a bad approach or smth?

And then, since i also needed to use the number (excluding R or L) as an int, and I didn't want to waste time learning how to remove the first character from a string or smth, i just copied the puzzle input again, and ran another simple macro 4080 times so it would format it as a tuple full of strings (removing the first character).
I think that that sucks because now the first 8167 lines of my code is just this huge list of numbers and strings. I did that very fast thanks to vim motions, yeah, but I feel like that's a bad idea in general.

Also is the nesting too bad?

So what do I do? Should I try to solve the problems "the proper way". Tbh is much easier like i just did (in part i did that because tomorrow i have two exams so i didn't want to waste a loooot of time). Still, I spent a bit more than an hour and a half on this two puzzles lmao

Sorry for the long text and thanks in advance!

Btw this is my code for the second puzzle (with the example that's 10 movements long instead of the actual puzzle input):

document =('L68', 'L30', 'R48', 'L5', 'R60', 'L55', 'L1', 'L99', 'R14', 'L82')
documentNumber =(68, 30, 48, 5, 60, 55, 1, 99, 14, 82)

password = 0
dial = 50

for i in range(len(document)):
    if dial == 0: password += 1 # Removing everything but this password+=1 gives you the solution to puzzle 1 (that's why i spent much more time on the first one)

    if document[i].find('R'):   # Runs for L
        num = documentNumber[i]

        while num > 100:
            num -= 100
            password += 1

        if dial-num < 0:
            if dial != 0 and dial-num+100 !=0:
                password += 1
            dial = dial-num+100
            continue
        dial = dial-num


    elif document[i].find('L'): # Runs for R
        num = documentNumber[i]

        while num > 100:
            num -= 100
            password += 1

        if dial+num >= 100:
            if dial != 0 and dial+num-100 !=0:
                password += 1
            dial = dial+num-100
            continue
        dial = dial+num

if dial == 0:password += 1
print(password)

r/adventofcode • • Dec 09 '25

Help/Question - RESOLVED [2025 Day 09 (Part 2)] That escalated quickly... In need of an explanation

19 Upvotes

It’s my first year doing AoC (and my first year as a programmer), and I’ve found the previous days to be quite manageable, even if they required a fair bit of Googling. It’s been fun stumbling across algorithms and data structures I’ve never encountered before.

But Part 2 of today’s problem really takes the prize for being too complex for a newbie like me. Even after “being dirty” and resorting to AI for an explanation, I’m still having a hard time wrapping my head around the solution.

Is there anyone here who enjoys breaking things down pedagogically and wouldn’t mind explaining it in a way that could help me start understanding the path to the solution?

r/adventofcode • • 3d ago

Help/Question - RESOLVED [2022 Day 3 (Part 1)] [Lua] there isn't a better way to do this?

0 Upvotes

so the only thing i need is convert the item types to priorities. is there a better way to do this without making a big ol' if statement?

r/adventofcode • • Aug 13 '26

Help/Question - RESOLVED [2025 Day 1 (Part 2)] [C++] Where have I gone wrong?

2 Upvotes

I have never struggled with a Day1 like this before, so I'm a little embarrassed to have to ask for help. Here is the code I have tried:

Part2

The definition of a 'Turn' is:

class Turn {
public:
  int clicks;
  Direction dir;
  Turn(char d, int c) {
    switch (d) {
    case 'L':
      dir = Direction::Left;
      break;
    case 'R':
      dir = Direction::Right;
      break;
    }
    clicks = c;
  }
};

My solution for Part1 worked so I am reasonably confident the input is parsed correctly, and my part2 solution (pasted above) works on the example provided. Where have I gone wrong?

Edit: I needed an abs() call. Thanks for the help!! Updated code: Part2 Corrected

Don't code on an empty stomach!

r/adventofcode • • Dec 30 '25

Help/Question - RESOLVED [2025 Day 11 Part 2] Is DP enough?

4 Upvotes

I'm solving this year in Agda. I'm currently trying to get the solution for day 11 part 2.

For part 2 I'm using the same code I used in part 1, but finding the paths from svr to fft/dac from fft/dac to dac/fft and then to out. Then, getting the product should be enough.

For part 1 the code runs <1s (I haven't timed it but it's pretty fast). For part 2, I can't even get the number of paths from svr to fft/dac (I know I only need to find the paths to one of the two, but I won't post which one to not give away the result). It's still running after an hour.

I'm using the {-# TERMINATING #-} flag in Agda to avoid having to deal with termination proofs, but now I'm doubting that this is correct. I'm using memoization to avoid recomputing the number of paths.

This is my code:

{-# TERMINATING #-} 
countPaths : Map.Map (List String) → String → String → Map.Map ℕ → ℕ × Map.Map ℕ
countPaths adjacencies from to cache with to ≟ from
... | yes _ = 1 , Map.insert from 1 cache
... | no _  with Map.lookup cache from
... | just x = x , cache
... | nothing =
      let (result , cache′) = foldl goCount (0 , cache) (fromMaybe [] (Map.lookup adjacencies from))
      in result , Map.insert from result cache′
  where
    goCount : (ℕ × Map.Map ℕ) → String → (ℕ × Map.Map ℕ)
    goCount (acc , cache) neighbor = 
      let (count , cache′) = countPaths adjacencies neighbor to cache
      in (acc + count , cache′)

The adjacencies parameter holds a map of [String] that tells you which devices are attached to each device. from and to are the origin and final node: the from node changes as we traverse the graph, but to always stays the same.

cache is a map that tells you for each node, its distance to to. Initially, it's just an empty map.

Can you help me figure out whether my program is hanging because of a problem in my code or due to an inefficiency in the agda evaluation strategy?

Thank you.


Update: After experimenting a bit with the equivalent code in Haskell, I found out my issue has something to do with Maps being lazy in Agda. I'll have to figure out an alternative to avoid this edge case.

r/adventofcode • • Aug 21 '26

Help/Question - RESOLVED [2024 Day 6] Need a bit of guidance

3 Upvotes

Hello!

For part 1 of 2024's day 6 problem, I was able to get some Python code that works for the small example map they gave but not my puzzle input. As it stands I have about 100 extra locations the guard visited than I should have. I was wondering if anyone here could take a look at my code and give me a hint as to where my error is, as I am really struggling to find it. I know it has to be where my movement is programmed, I just can't figure out what part needs some tinkering. Thank you in advance!

with open('Day 6/mapinp.txt', 'r') as file:
    samp_inp = file.read()

format = samp_inp.splitlines()
matrix = []
for item in format:
    matrix.append(list(item))

#locate the guard, return the matrix coords and then the way the guard is pointing
def find_guard(map):
    coords = []
    for item in map:
        if "^" in item:
            coords.append(map.index(item))
            coords.append(item.index("^"))
            coords.append("^")
            return coords
        elif ">" in item:
            coords.append(map.index(item))
            coords.append(item.index(">"))
            coords.append(">")
            return coords
        elif "<" in item:
            coords.append(map.index(item))
            coords.append(item.index("<"))
            coords.append("<")
            return coords
        elif "v" in item:
            coords.append(map.index(item))
            coords.append(item.index("v"))
            coords.append("v")
            return coords


#nice function to track movements
def move(map):
    on_map = True
    step_count = 0
    step_loc = []
    #index error means the guard has left the map
    while on_map == True:

        try:
            coords = find_guard(map)

            if coords[2] == "^":
                if map[coords[0]-1][coords[1]] == "." or map[coords[0]-1][coords[1]]  == "X":
                    map[coords[0]][coords[1]] = "X"
                    map[coords[0]-1][coords[1]] = "^"
                    step_count += 1
                    loc = f"{coords[0]}, {coords[1]}"
                    step_loc.append(loc)
                else:
                    map[coords[0]][coords[1]] = ">"

            elif coords[2] == ">":
                if map[coords[0]][coords[1]+1] == "." or map[coords[0]][coords[1]+1] == "X":
                    map[coords[0]][coords[1]] = "X"
                    map[coords[0]][coords[1] +1] = ">"
                    step_count += 1
                    loc = f"{coords[0]}, {coords[1]}"
                    step_loc.append(loc)
                else:
                    map[coords[0]][coords[1]] = "v"

            elif coords[2] == "v":
                if map[coords[0]+1][coords[1]] == "." or map[coords[0]+1][coords[1]] == "X":
                    map[coords[0]][coords[1]] = "X"
                    map[coords[0]+1][coords[1]] = "v"
                    step_count += 1
                    loc = f"{coords[0]}, {coords[1]}"
                    step_loc.append(loc)
                else:
                    map[coords[0]][coords[1]] = "<"

            elif coords[2] == "<":
                if map[coords[0]][coords[1]-1] == "." or map[coords[0]][coords[1]-1] == "X":
                    map[coords[0]][coords[1]] = "X"
                    map[coords[0]][coords[1] -1] = "<"
                    step_count += 1
                    loc = f"{coords[0]}, {coords[1]}"
                    step_loc.append(loc)
                else:
                    map[coords[0]][coords[1]] = "^"

        except IndexError:
            print(f"Guard has left the premises after {step_count} steps!")
            on_map = "False"

    return map, step_loc

comp_map,coordinates = move(matrix)

move_counter = 0

for item in comp_map:
    for pos in item:
        if pos == "X" or pos == "^" or pos == "<" or pos == ">" or pos == "v":
            move_counter += 1
        else:
            continue


print(f"The guard has visited {move_counter} distinct locations.")

r/adventofcode • • Jun 15 '26

Help/Question - RESOLVED [2025 Day 8][Powershell] Slow Runtime

3 Upvotes

Src Code: Advent_of_code/2025/day8 at main · nrv30/Advent_of_code

TLDR: I am interested in making my PowerShell approach faster and I implemented a Union-Find in C# that I use for it.

Edit: Thought I should add my approach is semantically equivalent to what is described here <Advent of Code 2025 - Day 8: Playground | Joshua Chen>

I wanted to yap about my approach for this one because I think I stumbled into something kind of interesting. Initially I implemented this problem in Java. I didn't know what a Union-Find was but in retrospect I think I basically implemented one in a naive way as List<Set<>>. After reading some blogposts I wanted to try using a different approach.

After some research I realized you can call C# from PowerShell by using [System.Reflection.Assembly]. I implemented a union-find in C# and called it from Ps. It was cool initially but got super annoying because every time I want to compile my C# I have to exit the shell and re-open it because Ps has the dll open. Also, you have to use ps 7 to use a priority queue, which doesn't have a separate terminal (I think). This made iteration speed terrible because I had to exit and call pwsh.exe every time I want to compile my code.

Anyways, I wanted to ask if anyone has had any cool experiences combining interpreted langs with compiled langs in this fashion to "get the best of both worlds"

Also, my PS code is so freaking slow, especially considering that I think all the data structures are already compiled to dll (My U-f and dotnet standard lib). These aren't high-quality benchmarks; I just ran the programs 3 times consecutively.

Are there any PowerShell users that have any tips? I didn't implement path compression for the Union-Find but I doubt that's the problem compared to the O(N^2) process to build pairs

Language Solution Trials Runtime (s)
Java 1
1 0.151
2 0.146
3 0.154
2
1 0.117
2 0.134
3 0.112
PowerShell 1 1 11.747
2 11.11
3 10.686
2 1 11.092
2 11.175
3 11.29

r/adventofcode • • Dec 13 '25

Help/Question - RESOLVED [2025 Day 10 Part 2] Is this even possible without Z3?

16 Upvotes

I've been going at this problem set for so long now (since it got released) and I just can't find a way to do it on my own. Going over it manually takes over 12+ hours (had to stop running it since it got stuck on the last 4 with the code I had) and I feel like even if it completes, I might not get the correct answer anyway even with the test data being correct.

Is there any way to solve this without Z3? Or is it not really do-able? I'm using GDScript for this so even if I wanted to use libraries, it's not really possible. ^^"

Looking on GitHub to other people who solved it, or even on YouTube, everybody seems to just go for Z3... This year, this really is the hardest challenge imo. A lot of them can be challenging, but I feel like this one is just impossible :/ Any advices or algorithms or something that I could look at?

r/adventofcode • • Dec 14 '25

Help/Question - RESOLVED 2025 Day 9 (Part B) Hint needed

2 Upvotes

My initial approach to 9B was going to be to look up a general algorithm for determining if a point lies inside a polygon and implement it, passing 2 vertices for each rectangle constructed from each pair of input vertices. If both points are inside the polygon and the rectangle is larger than the previous largest candidate, keep it else discard and rinse and repeat until I'm done.

I also thought about leveraging a library to do the work for me but I figured I'd take a crack at it myself as I like to do with AOC problems.

As I thought some more, I started to wonder if there's a special case algorithm for this problem given the constraints of the problem - the fact that the polygon is rectilinear (I learned a new word today!) and the points aren't arbitrary, in fact, they are vertices of rectangles created from the vertices of the polygon itself.

Given the nature of AOC, I suspect there might be a simpler way to solve this than the general solution but I haven't been able to work it one out yet.

Could someone please provide a hint to set me off in the right direction?

Thanks everyone!

r/adventofcode • • Dec 12 '25

Help/Question - RESOLVED [2025 Day 12 (Part 1) Is it actually do-able on a laptop in reasonable time?

2 Upvotes

I know the solution is just use the areas. Can you viably explore the search space?

I did visualise it: https://www.youtube.com/watch?v=9MNyylFer5Y

r/adventofcode • • Jan 10 '24

Help/Question - RESOLVED Why are people so entitled

247 Upvotes

Lately there have been lots of posts following the same template: ”The AoC website tells me I should not distribute the puzzle texts or the inputs. However, I would like to do so. I came up with imaginary fair use exceptions that let me do what I want.”

And then a long thread of the OP arguing how their AoC github is useless without readme files containing the puzzle text, unit tests containing the puzzle inputs et cetera

I don’t understand how people see a kind ”Please do not redistribute” tag and think ”Surely that does not apply to me”

r/adventofcode • • Dec 01 '25

Help/Question - RESOLVED Were submission penalties always this brutal?

2 Upvotes

I didn't participate last year so maybe I missed something. I just don't remember getting locked out of submission so quickly or for so long in previous years. Seems pretty harsh, particularly when I'm fumbling for an answer and I've clearly missed something simple in my code.

EDIT: Chill with the condescension. It's not outside the realm of possibility that someone could make many well-meaning attempts to solve a challenge and simply lack some key bit of knowledge to solve it the way they want to.

All I wanted to bring up is that the lockouts feel pretty punishing - the one thing no one has talked about.

r/adventofcode • • Dec 10 '25

Help/Question - RESOLVED [2025 Day 10 part 2] how?

27 Upvotes

I have seen a lot of memes of people using Z3 for part 2. I tried to solve it myself using BFS and then DFS with some pruning but still couldn't get it. After 3 hours of trying to optimize it, I used Z3 and got my answer in like 20 minutes.

But since I haven't seen any solution that didn't use Z3, I am wondering how to solve it without it, one approach would be to build something similar to Z3, using matrices to solve multiple linear equations but is that really the only solution?

If you have any ideas let me know.

r/adventofcode • • Dec 16 '25

Help/Question - RESOLVED [2025 Day 12 (Part 1)] Is the last day always a bit of a troll?

28 Upvotes

This year I unfortunately got filtered on the last day because I focused too much on solving the problem as described.

I tried all I could during the day, including shapes as bitmasks and a system of linear equations similar to day 10. Ultimately none of what I tried worked; either I made a mistake or something was missing.

Indeed, had I noticed I could do a bit of "pre-filtering" on the input to get rid of the obvious solutions and non-solutions, I would have probably noticed what was going on.

I guess, for my sanity next year, is there a pattern to when these twisted days happen? Or is it something you usually have to pay attention to every day?

P.S.: Not complaining, if I didn't like participating I wouldn't; it was just a bit unexpected.

r/adventofcode • • Dec 05 '25

Help/Question - RESOLVED [2025 Day 5 Part 2] Request for additional sample inputs?

6 Upvotes

My solution works for the test case but not for the real input.. anyone have additional test cases that might not work for my solution?

My solution: https://github.com/HenryChinask1/AdventOfCode/blob/master/2025/2025day5.py

E: Thanks for the replies.. I'm marking this as resolved, need some time before I can get back on and try your samples.

r/adventofcode • • Feb 08 '24

Help/Question - RESOLVED I need help picking a fun language to learn for next year

18 Upvotes

Since we are a good 10 months away from the new AoC I want to start learning a fun new language to try out for next year. I love languages with interesting and fun concepts.

I am pretty fluent in C, C++, Java, Haskell, Python and Bash and currently in my 4th semester of studying CS. I love learning new programming languages and want to get into compiler design so it never hurts to have a few options. :)

2022 I did the first few days in Bash but had no time to finish because of uni - a similar story in 2023 with Haskell. 2024 I'm gonna have a bit more time on my hands though.

To give you some idea of what I am looking for in particular:

I've dabbled a bit in BQN and was originally thinking if I should give Uiua a shot for next year, but I don't like the fact that the only option for code editors are either online or some VSCode extensions that don't run on VSCodium. That pretty much rules it out for me. But I like the idea of a stack/array language.
I saw someone on our discord doing the AoC in Factor, which looked fun. That is a definite contender, although it wouldn't really be unique.
Elixir is also a contender since I enjoyed Haskell and like functional languages a lot.
Another idea I had was to do it in a sort of command-line challenge: Solving the AoC in a single command in a Linux terminal. That could be a cool challenge.

But basically any semi serious quasi eso lang suggestion is welcome. Be that stack based, array paradigm or functional. I also don't mind a little goofy fun.

Now I can already hear the crabs marching on: I don't wanna do Rust, I don't enjoy the community or politicized nature of the language much.Zig is another one of those modern languages: From my first impressions with it it seems great to use, but it's basically like a more convenient C. I'd like to get crazy though.

r/adventofcode • • Dec 06 '25

Help/Question - RESOLVED [2025 Day 6 part 1] Help me solve a programming dilemma

8 Upvotes

Hey so, by looking at the input i can see there are 4 lines of operands, and the 5th line has the operator to be used.

While writing the solution for the problem should i keep this above information in my mind? like;

  1. if I knew how many lines there were beforehand, my code would become much simple.
  2. but if i had not known this information, it would be a challenge for me to write code for it.

Please share your opinions!!

r/adventofcode • • Aug 23 '26

Help/Question - RESOLVED [20* Day *] I built tooling to do all of AoC from the terminal (fetch, run, verify, submit), in Rust and then again in C#

4 Upvotes

I got tired of tabbing to the browser to grab inputs and paste answers, so I built a CLI that does the whole loop. Then I rebuilt it in C# to learn the language. Both work end to end.

cargo run fetch -y 2015 -d 1 # puzzle text + input into cache/

cargo run solve -y 2015 -d 1 # run your solution offline

cargo run solve -y 2015 -d 1 --validate

cargo run solve -y 2015 -d 1 --submit

Output looks like:

year 2015 day 1 in 288µs (959ns parsing)

part one: 138 (correct) [216µs]

part two: 1771 (correct) [71µs]

Then --submit turns those into (new star), and running again shows (starred) since AOC only grades each part once.

The part I haven't seen other AoC tools do: --validate checks your answers against fornwall's independent solver before anything gets submitted. Wrong answers on the site cost an escalating cooldown, but the solver answers the same question as many times as you want, for free. So --submit only sends what the solver agreed with. If the solver doesn't cover the puzzle yet (live event), it submits anyway, since that's exactly when you'd be ahead of it.

Some other things it handles:

Solve fetches whatever is missing, so a fully cached run works offline with no cookie.

When part one earns a star, part two's text gets pulled in the same run.

Inputs are cached with a hash of the session that fetched them. Inputs are account specific, so switching accounts refetches instead of letting you submit an answer computed from the other account's input. That one bit me for real.

Day 25's second star is awarded, not puzzled, so the tool knows not to keep asking for its part two.

No solutions ship on main. There's a compiled template to copy for your first day, and my solutions live on a separate branch if you want examples. Inputs and puzzle text stay out of git, per the site's wishes, and it sends a User-Agent with a reachable contact.

https://github.com/scadoshi/rustmas

https://github.com/scadoshi/sharpmas

Credit: Advent of Code is Eric Wastl's (https://adventofcode.com/about). The verification leans on Fredrik Fornwall's solver (https://aoc.fornwall.net/, https://github.com/fornwall/advent-of-code).

On AI: I used it as a working partner on these repos, for doc wording, test scaffolding, and refactors I'd already designed but didn't want to push through by hand. The line I hold is understanding before generation: I write the code I want to write, which is most of it, and hand off what I could write in my sleep. Design decisions are recorded in each repo's context/ directory, including the ones that got reversed and why. Every line was written or reviewed by me.

r/adventofcode • • Dec 13 '25

Help/Question - RESOLVED [2025 Day 11 (part 2)] [Rust] Possible endless loop

0 Upvotes

Just wondering what size the answers folks got for part 2 mine has calculated

16895725 paths so far and still running and that's just to get paths some svr -> out. I have the following logic for my dfs:

fn depth_first_search(
    node: &str,
    adjacent_map: &HashMap<String, Vec<String>>,
    
visited
: &mut HashSet<String>,
    end_node: &str,
    
path_count
: &mut usize,
    
path
: &mut Vec<String>,
    required_nodes: Option<&HashSet<String>>,
    
unique_paths
: &mut HashSet<String>,
) -> usize {
    // Placeholder DFS implementation
    //println!("DFS from node: {}", node);
    
path
.
push
(node.to_string());


    let path_string = 
path
.join("->");
    if 
unique_paths
.contains(&path_string) {
        println!("duplicate path found {:?}", 
path
);
        process::exit(1);
    }
    if node == end_node {
        //check if all required nodes are in path
        //println!("Reached end node: {}", node);
        if let Some(required) = required_nodes {
            //println!("Checking required nodes: {:?}", required);
            let path_set: HashSet<String> = 
path
.iter().cloned().collect();
            //println!("Current path set: {:?}", path_set);


            if !required.is_subset(&path_set) {
                
path
.
pop
();
                return 0;
            }
        }
        
unique_paths
.
insert
(path_string);
        *
path_count

+=
 1;
        //println!("Found path: {:?}", path);
        println!("Total paths so far: {}", *
path_count
);
        
path
.
pop
();
        return *
path_count
;
    }
    if 
visited
.contains(node) {
        
path
.
pop
();
        return 0;
    }
    
visited
.
insert
(node.to_string());


    if let Some(neighbors) = adjacent_map.get(node) {
        for neighbor in neighbors {
            if !
visited
.contains(neighbor) {
                depth_first_search(
                    neighbor,
                    adjacent_map,
                    
visited
,
                    end_node,
                    
path_count
,
                    
path
,
                    required_nodes,
                    
unique_paths
,
                );
            }
        }
    }
    
path
.
pop
();
    
visited
.
remove
(node);


    0
}

Can post more of my code if needed for this does the heavy lifting as the fun that's running endlessly. In the time I've been writing this post it now has a value of: 21776839

r/adventofcode • • Jun 24 '26

Help/Question - RESOLVED [2019 day 05 (Part 1)] Strange input(?)

2 Upvotes

I got stuck on Day 5 of in 2019.

Below is the beginning of the program to run:

3,225,1,225,6,6,1100,1,238,225,104,0,1101,32,43,225,101,68,192,224,,...

In my interpretation, the first 3 instructions are:

3,225

1,225,6,6

1100,1,238,225

The first two instructions are fine.

For the third one, I get 00 as the two-digit opcode, which is -as far as I know- invalid.

I assume the input is correct, but I can’t see what I’m doing wrong!

Thanks if anyone can help!

r/adventofcode • • Feb 25 '26

Help/Question - RESOLVED [2026 Day 1 (Part 1)] [Javascript] Im stuck here

2 Upvotes

Hello, I'm stuck on this one.

The number only gets up when the thing goes into 0.

What I'm doing is the next:

I take the first part of the string for each entry, then take the R or L of the string.

At the start, I have a number that starts with 0, right? Then to that number I add if the first character of the string is left, and subtract if the first character is right.

Then I have a variable that saves the last position of the knob and starts at 0.

Then once I add or subtract the knob position, I ask if the modulo of 100 is 0, or if the result is 0, then add one to the password.

Then I take the modulo of the total knob position, and if it's from L, then I just take that one and use the modulo to make it the new knob position.

If it's R, then I do the modulo of the knob position and subtract the modulo of 100 of this one from 100.

This its my code

what its failing in my logic or code ?