{"id":20091584,"url":"https://github.com/petertseng/adventofcode-cpp-2015","last_synced_at":"2025-08-04T01:34:11.621Z","repository":{"id":72892782,"uuid":"325880190","full_name":"petertseng/adventofcode-cpp-2015","owner":"petertseng","description":"Solutions to https://adventofcode.com/2015 (complete) ","archived":false,"fork":false,"pushed_at":"2022-01-03T03:35:07.000Z","size":43,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-03T20:03:20.710Z","etag":null,"topics":["advent-of-code","advent-of-code-2015","cpp"],"latest_commit_sha":null,"homepage":"https://adventofcode.com/2015","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/petertseng.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-12-31T22:08:34.000Z","updated_at":"2023-11-28T01:37:05.000Z","dependencies_parsed_at":"2024-07-22T04:33:40.407Z","dependency_job_id":null,"html_url":"https://github.com/petertseng/adventofcode-cpp-2015","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/petertseng/adventofcode-cpp-2015","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petertseng%2Fadventofcode-cpp-2015","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petertseng%2Fadventofcode-cpp-2015/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petertseng%2Fadventofcode-cpp-2015/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petertseng%2Fadventofcode-cpp-2015/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/petertseng","download_url":"https://codeload.github.com/petertseng/adventofcode-cpp-2015/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petertseng%2Fadventofcode-cpp-2015/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268636332,"owners_count":24282077,"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","status":"online","status_checked_at":"2025-08-03T02:00:12.545Z","response_time":2577,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","cpp"],"created_at":"2024-11-13T16:33:22.425Z","updated_at":"2025-08-04T01:34:10.010Z","avatar_url":"https://github.com/petertseng.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# adventofcode-cpp-2015\n\nThese are my solutions to http://adventofcode.com\n\nAll solutions are written in C++.\n\n[![Build Status](https://travis-ci.org/petertseng/adventofcode-cpp-2015.svg?branch=master)](https://travis-ci.org/petertseng/adventofcode-cpp-2015)\n\n# Input\n\nIn general, all solutions can be invoked in both of the following ways:\n\n* Without command-line arguments, takes input on standard input.\n* With 1+ command-line arguments, reads input from the first, which must be the path to an input file.\n  Arguments beyond the first are ignored.\n\nSome may additionally support other ways:\n\n* 4 (Advent Coins): Pass the secret key in ARGV.\n* 10 (Look and Say): Pass the seed sequence in ARGV.\n* 11 (Passwords): Pass the initial password in ARGV.\n* 20 (Factors): Pass the target number of gifts in ARGV.\n* 21 (RPG): Pass the boss's HP, damage, and armour in ARGV, in that order.\n* 22 (Wizard): Pass the boss's HP and damage in ARGV, in that order.\n* 25 (Triangular): Pass the row and column number in ARGV, in that order.\n\n## Language notes\n\n### String splitting\n\nNot psrticularly impressed with the abilities of splitting a string by a delimiter.\nAs I see it, the options here are:\n\n* `find` and `substr`\n* `getline`\n* `scanf`\n* Regular expressions\n\nI could have written a utility function that does it, but for the most part I just intermingled parsing and solving.\n\n### `pair`s and `tuple`s\n\nI appreciate that they exist at all, but typing out the type is a little inconvenient compared to something like `(int, int)`.\nNo pattern-matching either, as far as I can tell.\n\n### Regular expressions\n\nI like them as much as the next person but they do increase the compilation time by a lot.\nSo for the sake of faster compilation I usually go without.\n\n### Range-based `for`\n\nThey're nice, but when iterating over a string, do I really have to use `for (const char\u0026 c : s)`?\nWhy not just `for (char c : s)`?\nThe latter does compile; is there some performance reason not to do that?\n\n### `variant`s (discriminated union, sum type)\n\nUsable, but `visit` is a little unergonomic, specifically having to do that `overload` thing.\n\n### Vectors\n\nReally wish there were a more convenient way to print the contents of a vector instead of having to write out the `for` loop.\n\n### References\n\nNot ideal for me.\nIt's too easy to forget to write the `\u0026` in the function signature and thereby fail to modify what you wanted to modify (if non-const) or accidentally copy (if const).\nSince the call is same either way (doesn't require `\u0026` or anything at the call site), there isn't really anything that prevents this.\nIt also means you can't tell from the call site whether the arguments will be modified.\n\n### `enum class`\n\nHelpful, but I wish I could associate data with each.\n\n### unsigned\n\nThe most interesting discussion I found of this was actually on the Rust subreddit: https://www.reddit.com/r/rust/comments/931leq/why_are_i32s_the_fastest/e3a3eop/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpetertseng%2Fadventofcode-cpp-2015","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpetertseng%2Fadventofcode-cpp-2015","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpetertseng%2Fadventofcode-cpp-2015/lists"}