{"id":20225662,"url":"https://github.com/kalaspuff/advent-of-code","last_synced_at":"2025-08-28T19:32:55.542Z","repository":{"id":64088849,"uuid":"319036674","full_name":"kalaspuff/advent-of-code","owner":"kalaspuff","description":"🎅 My solutions to some of the \"Advent of Code\" programming puzzles.","archived":false,"fork":false,"pushed_at":"2024-12-17T08:13:15.000Z","size":789,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-03T12:46:04.252Z","etag":null,"topics":["advent-of-code","puzzle-solution","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kalaspuff.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-06T13:13:04.000Z","updated_at":"2024-12-17T08:13:21.000Z","dependencies_parsed_at":"2024-12-16T16:34:30.980Z","dependency_job_id":"820fcfe6-7ae0-4846-83f8-135a1cf3f0bd","html_url":"https://github.com/kalaspuff/advent-of-code","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kalaspuff/advent-of-code","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kalaspuff%2Fadvent-of-code","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kalaspuff%2Fadvent-of-code/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kalaspuff%2Fadvent-of-code/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kalaspuff%2Fadvent-of-code/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kalaspuff","download_url":"https://codeload.github.com/kalaspuff/advent-of-code/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kalaspuff%2Fadvent-of-code/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272543322,"owners_count":24952689,"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-28T02:00:10.768Z","response_time":74,"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","puzzle-solution","python"],"created_at":"2024-11-14T07:14:15.054Z","updated_at":"2025-08-28T19:32:55.500Z","avatar_url":"https://github.com/kalaspuff.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `kalaspuff/advent-of-code`\n\n*My solutions to some of the [Advent of Code](https://adventofcode.com/) programming puzzles.*\n\n\u003cimg width=\"715\" alt=\"aoc2022-computer-day7\" src=\"https://user-images.githubusercontent.com/89139/207301060-74bdb4d2-c081-4a10-a38c-81ed8eaa79d1.png\"\u003e\n\n👆🧝💻 A custom shell for the device given by the Elves during [2022 - day 7](https://adventofcode.com/2022/day/7).\n\n#### Writing solutions\n\nSolutions go in the `yearYYYY/dayXX/part1.py` and `yearYYYY/dayXX/part2.py` files. The puzzle input goes into `yearYYYY/dayXX/input`. Additional example puzzle input could be put in the same folder with any arbitrary file name (`example` is a good name if there's only one type of example input).\n\nThe Python files `part1.py` and `part2.py` should have a function called `run` defined that will be called. The import `from values import values` is recommended to get easy access to the puzzle input.\n\nHere's an example solution for the puzzle from [year 2020, day 3, part 2](https://adventofcode.com/2022/day/13).\n\n```python\nimport functools\nimport operator\nfrom typing import List\n\nfrom values import values\n\n\ndef cmp(*args: List) -\u003e int:\n    return functools.reduce(\n        lambda a, b: a or b,\n        [\n            cmp(*map(lambda v: [v, [v]][isinstance(v, int)], pair))\n            if list in map(type, pair)\n            else cmp(*map(lambda i: [[]] * i, pair))\n            for pair in zip(*args)\n        ]\n        + [0],\n    ) or max(min(1, operator.sub(*map(len, args))), -1)\n\n\nasync def run() -\u003e int:\n    divider1 = [[2]]\n    divider2 = [[6]]\n\n    rows = [eval(row) for row in values.rows if row] + [divider1, divider2]\n    sorted_rows = [[]] + sorted(rows, key=functools.cmp_to_key(cmp))\n    return (sorted_rows.index(divider1)) * (sorted_rows.index(divider2))\n\n\n# [values.year]            (number)  2022\n# [values.day]             (number)  13\n# [values.part]            (number)  2\n# [values.input_filename]  (str)     ./year2022/day13/input\n#\n# Result: 19570\n```\n\n\n#### Running solutions\n\n```\n$ python aoc.py \u003cyear\u003e \u003cday\u003e \u003cpart\u003e [puzzle input filename]\n```\n\nIf no puzzle input filename is specified, the default `input` file for the puzzle's day will be used as the puzzle input.\n\nExample – to run the solution from the example above (year 2022, day 13, part 2).\n\n```bash\n$ python aoc.py 2022 13 2\n\n# [values.year]            (number)  2022\n# [values.day]             (number)  13\n# [values.part]            (number)  2\n# [values.input_filename]  (str)     ./year2022/day13/input\n#\n# Result: 19570\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkalaspuff%2Fadvent-of-code","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkalaspuff%2Fadvent-of-code","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkalaspuff%2Fadvent-of-code/lists"}