{"id":15364788,"url":"https://github.com/chinesedfan/adventofcode","last_synced_at":"2025-04-15T09:35:45.012Z","repository":{"id":80137934,"uuid":"47756210","full_name":"chinesedfan/adventofcode","owner":"chinesedfan","description":"Solutions for Advent of Code, including 2015-2022","archived":false,"fork":false,"pushed_at":"2023-12-14T09:45:14.000Z","size":450,"stargazers_count":8,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-14T01:50:06.257Z","etag":null,"topics":["advent-of-code","advent-of-code-2015","advent-of-code-2016","advent-of-code-2017","advent-of-code-2018","advent-of-code-2019","advent-of-code-2020","advent-of-code-2021","advent-of-code-2022","adventofcode"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chinesedfan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2015-12-10T10:58:29.000Z","updated_at":"2024-01-12T18:06:38.000Z","dependencies_parsed_at":null,"dependency_job_id":"f48e92f0-dff3-4037-96fe-381474f912ab","html_url":"https://github.com/chinesedfan/adventofcode","commit_stats":{"total_commits":505,"total_committers":1,"mean_commits":505.0,"dds":0.0,"last_synced_commit":"2a09fa36202ace077f32a0b241b21cc6c6b830e1"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chinesedfan%2Fadventofcode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chinesedfan%2Fadventofcode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chinesedfan%2Fadventofcode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chinesedfan%2Fadventofcode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chinesedfan","download_url":"https://codeload.github.com/chinesedfan/adventofcode/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248243231,"owners_count":21071054,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["advent-of-code","advent-of-code-2015","advent-of-code-2016","advent-of-code-2017","advent-of-code-2018","advent-of-code-2019","advent-of-code-2020","advent-of-code-2021","advent-of-code-2022","adventofcode"],"created_at":"2024-10-01T13:13:17.227Z","updated_at":"2025-04-15T09:35:44.943Z","avatar_url":"https://github.com/chinesedfan.png","language":"JavaScript","readme":"## Introduction\n\nThis project contains solutions for [Advent of Code](http://adventofcode.com/).\n\nThe difficulty of these puzzles is usually less than competitive programming problems, i.e. [CodeForces](https://codeforces.com). Even you can calculate the answer by a pencil and paper. Test cases are very simple and examples include nearly everything that you need to care about. But some of them is hard.\n\nAnd the author provides a very interesting website!\n\nps.  \n- Remember to call `parseInt` when parsing the input by regular expressions.  \n- Do not try to find answers by binary search. The server will reject your submission after you have failed too much times.  \n- Solve puzzles by brute force searching if it is hard to find reasonable algorithms. Go to [Bogdanp/awesome-advent-of-code](https://github.com/Bogdanp/awesome-advent-of-code) or visit [reddit](https://www.reddit.com/r/adventofcode/) to get more hits.\n\n## How to run\n\nBy default, `part` is `1`, and `YEAR` is the current year.\n\n- `[YEAR=2015] node index.js \u003cday\u003e [part] \u003c input.txt`\n- `[YEAR=2015] node index.js \u003cday\u003e [part] -f input.txt`\n\n## Summary\n\nFor hardness: S(Simple), M(Middle), H(Hard).\n\n\u003cdetails\u003e\n  \u003csummary\u003e2015 (Done!)\u003c/summary\u003e\n\n| day | hardness | keywords                        |\n| --- |:--------:| -------------------------------:|\n|  1  |   S/S    | iteration                       |\n|  2  |   S/S    | iteration                       |\n|  3  |   S/S    | simulation                      |\n|  4  |   S/S    | md5                             |\n|  5  |   S/S    | filter strings                  |\n|  6  |   S/S    | simulation                      |\n|  7  |   M/M    | post-order tree traveling       |\n|  8  |   S/S    | string replacement              |\n|  9  |   S/S    | permutation                     |\n| 10  |   S/S    | iteration                       |\n| 11  |   S/S    | filter strings                  |\n| 12  |   S/S    | recursion                       |\n| 13  |   S/S    | permutation                     |\n| 14  |   S/S    | simulation                      |\n| 15  |   S/S    | permutation                     |\n| 16  |   S/S    | filter                          |\n| 17  |   M/M    | dynamic programming             |\n| 18  |   S/S    | simulation                      |\n| 19  |   S/H    | iteration/special laws          |\n| 20  |   M/M    | find bound                      |\n| 21  |   M/M    | permutation                     |\n| 22  |   H/H    | dfs                             |\n| 23  |   S/S    | cpu                             |\n| 24  |   M/M    | dynamic programming             |\n| 25  |   S/-    | iteration                       |\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e2016 (Done!)\u003c/summary\u003e\n\n| day | hardness | keywords                        |\n| --- |:--------:| -------------------------------:|\n|  1  |   S/S    | simulation                      |\n|  2  |   S/S    | simulation                      |\n|  3  |   S/S    | filter                          |\n|  4  |   S/S    | filter                          |\n|  5  |   S/S    | md5                             |\n|  6  |   S/S    | array operations                |\n|  7  |   S/S    | filter                          |\n|  8  |   S/S    | simulation                      |\n|  9  |   S/S    | string replacement/recursion    |\n| 10  |   S/S    | simulation                      |\n| 11  |   H/H    | bfs, optimization               |\n| 12  |   S/S    | cpu                             |\n| 13  |   H/H    | bfs                             |\n| 14  |   S/S    | md5                             |\n| 15  |   S/S    | iteration                       |\n| 16  |   S/S    | iteration                       |\n| 17  |   M/M    | md5, bfs                        |\n| 18  |   S/S    | iteration                       |\n| 19  |   H/H    | find laws/dynamic programming   |\n| 20  |   M/M    | merge intervals                 |\n| 21  |   S/S    | simulation                      |\n| 22  |   S/H    | filter/bfs with special laws    |\n| 23  |   S/M    | cpu/optimization                |\n| 24  |   M/M    | bfs, permutation                |\n| 25  |   S/-    | cpu, find first                 |\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e2017 (Done!)\u003c/summary\u003e\n\n| day | hardness | keywords                        |\n| --- |:--------:| -------------------------------:|\n|  1  |   S/S    | iteration                       |\n|  2  |   S/S    | iteration                       |\n|  3  |   S/M    | find laws/infinite grid         |\n|  4  |   S/S    | filter strings                  |\n|  5  |   S/S    | iteration                       |\n|  6  |   S/S    | simulation                      |\n|  7  |   S/S    | tree simulation/recursion       |\n|  8  |   S/S    | simple cpu simulation           |\n|  9  |   S/S    | iteration                       |\n| 10  |   S/S    | simulation                      |\n| 11  |   S/S    | find laws/simulation            |\n| 12  |   S/S    | bfs                             |\n| 13  |   S/S    | simulation/find first           |\n| 14  |   S/M    | iteration/bfs                   |\n| 15  |   S/S    | iteration                       |\n| 16  |   S/M    | simulation/find laws            |\n| 17  |   S/S    | iteration                       |\n| 18  |   S/M    | cpu                             |\n| 19  |   S/S    | simulation                      |\n| 20  |   S/M    | find stable/filter collisions   |\n| 21  |   M/M    | iterate grid                    |\n| 22  |   S/S    | infinite grid                   |\n| 23  |   S/H    | cpu/assembly to filter primes   |\n| 24  |   S/S    | dfs                             |\n| 25  |   S/-    | turing machine                  |\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e2018 (Done!)\u003c/summary\u003e\n\n| day | hardness | keywords                        |\n| --- |:--------:| -------------------------------:|\n|  1  |   S/S    | iteration                       |\n|  2  |   S/S    | filter strings/sort then diff   |\n|  3  |   S/S    | rectangles overlap              |\n|  4  |   M/M    | simulation                      |\n|  5  |   S/S    | merge with stack                |\n|  6  |   M/S    | simulation                      |\n|  7  |   S/M    | typology sorting/simulation     |\n|  8  |   S/S    | string parsing/recursion        |\n|  9  |   S/M    | simulation                      |\n| 10  |   M/S    | auto scale                      |\n| 11  |   S/M    | find the max sum rectangle      |\n| 12  |   S/S    | simulation/find loop            |\n| 13  |   S/S    | simulation                      |\n| 14  |   S/S    | iteration/string match          |\n| 15  |   M/S    | simulation/find bound           |\n| 16  |   S/S    | cpu                             |\n| 17  |   M/S    | water simulation                |\n| 18  |   S/S    | simulation/find loop            |\n| 19  |   S/S    | cpu/find logic                  |\n| 20  |   S/S    | parse regexp and bfs            |\n| 21  |   S/S    | cpu to find logic               |\n| 22  |   S/M    | dp/bfs                          |\n| 23  |   S/H    | filter/max clique               |\n| 24  |   S/S    | simulation/find bound           |\n| 25  |   S/-    | bfs                             |\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e2019 (Done!)\u003c/summary\u003e\n\n| day | hardness | keywords                        |\n| --- |:--------:| -------------------------------:|\n|  1  |   S/S    | iteration                       |\n|  2  |   S/S    | cpu                             |\n|  3  |   M/S    | line cross                      |\n|  4  |   S/S    | filter numbers                  |\n|  5  |   S/S    | cpu                             |\n|  6  |   S/S    | bfs/nearest common ancestor     |\n|  7  |   S/M    | cpu/generators                  |\n|  8  |   S/S    | count numbers/print and see     |\n|  9  |   M/S    | big numbers cpu                 |\n| 10  |   M/M    | check connectivity/sort by k    |\n| 11  |   S/S    | cpu count visited/print and see |\n| 12  |   S/M    | n-object simulation/lcm         |\n| 13  |   S/H    | cpu output map/game simulation  |\n| 14  |   S/S    | typology sorting/binary search  |\n| 15  |   S/S    | bfs                             |\n| 16  |   S/M    | fft simulation                  |\n| 17  |   S/M    | find intersections/cut routes   |\n| 18  |   M/H    | shortest path                   |\n| 19  |   S/S    | count/find                      |\n| 20  |   M/M    | shortest path                   |\n| 21  |   M/H    | boolean cpu programming         |\n| 22  |   S/H    | shuffle simulation/number theory|\n| 23  |   M/M    | multiple cpus                   |\n| 24  |   S/S    | life game simulation            |\n| 25  |   M/-    | cpu rpg                         |\n\nDifferent scripts for day 25,\n\n- day25.js, normal program but has `-i` option to load commands\n- day25-map.js, searching for all rooms\n- day25-input.txt, according to the rooms map, collect items and go to the checkpoint room \n- day25-drop.js, try each possible combinations of items to pass the weight check\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e2020 (Done!)\u003c/summary\u003e\n\n| day | hardness | keywords                        |\n| --- |:--------:| -------------------------------:|\n|  1  |   S/S    | 2 sum/3 sum                     |\n|  2  |   S/S    | filter strings                  |\n|  3  |   S/S    | count                           |\n|  4  |   S/S    | filter strings                  |\n|  5  |   S/S    | iteration/print and see         |\n|  6  |   S/S    | count                           |\n|  7  |   S/S    | bfs                             |\n|  8  |   S/S    | cpu                             |\n|  9  |   S/S    | filter/two points               |\n| 10  |   S/S    | sort and count/dp               |\n| 11  |   S/S    | life games simulation           |\n| 12  |   S/S    | moving iteration                |\n| 13  |   S/M    | find min/number theory          |\n| 14  |   S/S    | bits iteration                  |\n| 15  |   S/S    | iteration                       |\n| 16  |   S/S    | filter/match                    |\n| 17  |   S/S    | 3d/4d life games simulation     |\n| 18  |   S/S    | arithmetic ast                  |\n| 19  |   S/M    | regexp tree/special convertion  |\n| 20  |   S/H    | picture matching/pattern search |\n| 21  |   M/S    | analyze insets                  |\n| 22  |   S/S    | cards array iteration           |\n| 23  |   S/S    | array iteration                 |\n| 24  |   S/S    | hex flip/life game simulation   |\n| 25  |   S/-    | number iteration                |\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e2021\u003c/summary\u003e\n\n### 2021\n\n| day | hardness | keywords                        |\n| --- |:--------:| -------------------------------:|\n|  1  |   S/S    | iteration                       |\n|  2  |   S/S    | iteration                       |\n|  3  |   S/S    | count and filter strings        |\n|  4  |   S/S    | simulate game                   |\n|  5  |   S/S    | count grid points               |\n|  6  |   S/M    | simulate list/calculate         |\n|  7  |   S/S    | midpoint/find best position     |\n|  8  |   S/M    | filter length/analyse mapping   |\n|  9  |   S/S    | filter points/bfs               |\n| 10  |   S/S    | brackets matching               |\n| 11  |   S/S    | simulate grid                   |\n| 12  |   S/S    | bfs to find ways                |\n| 13  |   S/S    | fold dots/print and see         |\n| 14  |   S/M    | iteration                       |\n| 15  |   S/S    | shortest path                   |\n| 16  |   S/S    | parse packages                  |\n| 17  |   S/S    | simulate shoot                  |\n| 18  |   M/S    | brackets iteration              |\n| 19  |   M/S    | coordinates match               |\n| 20  |   S/S    | iteration                       |\n| 21  |   S/S    | simulate game                   |\n| 22  |   S/H    | cube overlap/discretization     |\n| 23  |   M/-    | move boxes                      |\n| 24  |   H/S    | cpu analyse                     |\n| 25  |   S/-    | simulate                        |\n\n\u003c/details\u003e\n\n### 2022\n\n| day | hardness | keywords                        |\n| --- |:--------:| -------------------------------:|\n|  1  |   S/S    | find max                        |\n|  2  |   S/S    | RSP game                        |\n|  3  |   S/S    | find same character             |\n|  4  |   S/S    | segment overlap                 |\n|  5  |   S/S    | stack simulation                |\n|  6  |   S/S    | scan string                     |\n|  7  |   S/S    | file directory size, DFS        |\n|  8  |   S/S    | matrix scan                     |\n|  9  |   S/-    | rope positions                  |\n| 10  |   S/S    | simple cpu/draw letters         |\n| 11  |   S/M    | simulation/keep reminders       |\n| 12  |   S/S    | bfs                             |\n| 13  |   S/S    | compare lists                   |\n| 14  |   M/M    | sand simulation                 |\n| 15  |   S/M    | count positions/merge segments  |\n| 16  |   -/-    | bfs                             |\n| 17  |   -/-    | tetris                          |\n| 18  |   S/-    | count cube surfaces             |\n| 19  |   -/-    | build robots                    |\n| 20  |   M/S    | list iteration                  |\n| 21  |   S/M    | dfs/binary search               |\n| 22  |   S/-    | simulate moving                 |\n| 23  |   S/S    | grid iteration                  |\n| 24  |   -/-    | bfs                             |\n| 25  |   S/-    | base conversion                 |\n\n## Bonus\n\nReleased at [reddit](https://www.reddit.com/r/adventofcode/comments/72aizu/bonus_challenge/). You can download `input.txt` directly from [here](https://gist.githubusercontent.com/topaz/15518587415ccd0468767aed4192bfd3/raw/c5bfd6a7d40eabe1ae8b9a0fb36a939cb0c5ddf4/bonuschallenge.txt).\n\n- `YEAR=2016 node index.js 26 \u003c input.txt \u003e bonus.out.1`\n- `YEAR=2016 node index.js 8 2 \u003c bonus.out.1`\n\n## Thanks to\n\n- [petertseng](https://github.com/petertseng), first met in [reddit](https://www.reddit.com/r/adventofcode/comments/5hoia9/2016_day_11_solutions/db1v1ws/) for 2016/day11, who also has full solutions in Ruby/Haskell/Rust/D.\n- [sguest](https://github.com/sguest/advent-of-code), for solving 2018/day22, with JavaScript solutions of each year.\n- [albertobastos](https://github.com/albertobastos/advent-of-code-2018-nodejs), for solving 2018/day15, with partial solutions of 2018 in JavaScript.\n- [kufii](https://github.com/kufii/Advent-Of-Code-2019-Solutions), provides a cool [website](https://kufii.github.io/Advent-Of-Code-2019-Solutions/) to show 2019 JavaScript solutions.\n- [mcpower](https://github.com/mcpower/adventofcode), also met in [reddit](https://www.reddit.com/r/adventofcode/comments/ee0rqi/2019_day_22_solutions/fbnkaju/) for 2019/day22, and has solutions for 2016(partial)/17/18/19 in Python/Rust.\n- [romellem](https://github.com/romellem/advent-of-code) for solving 2021/day24, with most of years in JavaScript.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchinesedfan%2Fadventofcode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchinesedfan%2Fadventofcode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchinesedfan%2Fadventofcode/lists"}