diff options
Diffstat (limited to '2024')
-rwxr-xr-x[-rw-r--r--] | 2024/01/python.py (renamed from 2024/01/python/main.py) | 2 | ||||
-rw-r--r-- | 2024/01/python/pyproject.toml | 6 | ||||
-rwxr-xr-x[-rw-r--r--] | 2024/02/python.py (renamed from 2024/02/python/main.py) | 2 | ||||
-rw-r--r-- | 2024/02/python/pyproject.toml | 6 | ||||
-rwxr-xr-x[-rw-r--r--] | 2024/03/python.py (renamed from 2024/03/python/main.py) | 2 | ||||
-rw-r--r-- | 2024/03/python/pyproject.toml | 6 | ||||
-rwxr-xr-x[-rw-r--r--] | 2024/04/python.py (renamed from 2024/04/python/main.py) | 2 | ||||
-rw-r--r-- | 2024/04/python/pyproject.toml | 6 | ||||
-rwxr-xr-x[-rw-r--r--] | 2024/05/python.py (renamed from 2024/05/python/main.py) | 2 | ||||
-rw-r--r-- | 2024/05/python/pyproject.toml | 6 | ||||
-rwxr-xr-x[-rw-r--r--] | 2024/06/python.py (renamed from 2024/06/python/main.py) | 2 | ||||
-rw-r--r-- | 2024/06/python/pyproject.toml | 6 | ||||
-rwxr-xr-x[-rw-r--r--] | 2024/07/python.py (renamed from 2024/07/python/main.py) | 2 | ||||
-rw-r--r-- | 2024/07/python/pyproject.toml | 6 | ||||
-rwxr-xr-x[-rw-r--r--] | 2024/08/python.py (renamed from 2024/08/python/main.py) | 2 | ||||
-rw-r--r-- | 2024/08/python/pyproject.toml | 6 | ||||
-rwxr-xr-x[-rw-r--r--] | 2024/09/python.py (renamed from 2024/09/python/main.py) | 2 | ||||
-rw-r--r-- | 2024/09/python/pyproject.toml | 6 | ||||
-rwxr-xr-x[-rw-r--r--] | 2024/10/python.py (renamed from 2024/10/python/main.py) | 2 | ||||
-rw-r--r-- | 2024/10/python/pyproject.toml | 6 | ||||
-rwxr-xr-x[-rw-r--r--] | 2024/11/python.py (renamed from 2024/11/python/main.py) | 2 | ||||
-rw-r--r-- | 2024/11/python/pyproject.toml | 6 | ||||
-rwxr-xr-x[-rw-r--r--] | 2024/12/python.py (renamed from 2024/12/python/main.py) | 2 | ||||
-rw-r--r-- | 2024/12/python/pyproject.toml | 6 | ||||
-rwxr-xr-x[-rw-r--r--] | 2024/13/python.py (renamed from 2024/13/python/main.py) | 2 | ||||
-rw-r--r-- | 2024/13/python/pyproject.toml | 6 | ||||
-rwxr-xr-x[-rw-r--r--] | 2024/14/python.py (renamed from 2024/14/python/main.py) | 2 | ||||
-rw-r--r-- | 2024/14/python/pyproject.toml | 6 | ||||
-rwxr-xr-x[-rw-r--r--] | 2024/15/python.py (renamed from 2024/15/python/main.py) | 2 | ||||
-rw-r--r-- | 2024/15/python/pyproject.toml | 6 | ||||
-rwxr-xr-x[-rw-r--r--] | 2024/16/python.py (renamed from 2024/16/python/main.py) | 2 | ||||
-rw-r--r-- | 2024/16/python/pyproject.toml | 6 | ||||
-rwxr-xr-x[-rw-r--r--] | 2024/17/python.py (renamed from 2024/17/python/main.py) | 2 | ||||
-rw-r--r-- | 2024/17/python/pyproject.toml | 6 | ||||
-rwxr-xr-x[-rw-r--r--] | 2024/18/python.py (renamed from 2024/18/python/main.py) | 2 | ||||
-rw-r--r-- | 2024/18/python/pyproject.toml | 6 | ||||
-rwxr-xr-x[-rw-r--r--] | 2024/19/python.py (renamed from 2024/19/python/main.py) | 2 | ||||
-rw-r--r-- | 2024/19/python/pyproject.toml | 6 | ||||
-rwxr-xr-x[-rw-r--r--] | 2024/20/python.py (renamed from 2024/20/python/main.py) | 2 | ||||
-rw-r--r-- | 2024/20/python/pyproject.toml | 6 | ||||
-rwxr-xr-x | 2024/21/python.py | 42 | ||||
-rwxr-xr-x[-rw-r--r--] | 2024/22/python.py (renamed from 2024/22/python/main.py) | 2 | ||||
-rw-r--r-- | 2024/22/python/pyproject.toml | 6 |
43 files changed, 84 insertions, 126 deletions
diff --git a/2024/01/python/main.py b/2024/01/python.py index f920d5d..425f6c7 100644..100755 --- a/2024/01/python/main.py +++ b/2024/01/python.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 + from collections import Counter from fileinput import input diff --git a/2024/01/python/pyproject.toml b/2024/01/python/pyproject.toml deleted file mode 100644 index ed9dd6f..0000000 --- a/2024/01/python/pyproject.toml +++ /dev/null @@ -1,6 +0,0 @@ -[project] -name = "aoc-2024-01" -version = "0.1.0" -description = "advent of code 2024-01" -requires-python = ">=3.13" -dependencies = [] diff --git a/2024/02/python/main.py b/2024/02/python.py index b4c8c9a..f2c807d 100644..100755 --- a/2024/02/python/main.py +++ b/2024/02/python.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 + from fileinput import input reports = [[int(level) for level in report.split()] for report in input()] diff --git a/2024/02/python/pyproject.toml b/2024/02/python/pyproject.toml deleted file mode 100644 index 7344524..0000000 --- a/2024/02/python/pyproject.toml +++ /dev/null @@ -1,6 +0,0 @@ -[project] -name = "aoc-2024-02" -version = "0.1.0" -description = "advent of code 2024-02" -requires-python = ">=3.13" -dependencies = [] diff --git a/2024/03/python/main.py b/2024/03/python.py index f5617b5..f456580 100644..100755 --- a/2024/03/python/main.py +++ b/2024/03/python.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 + import re from fileinput import input diff --git a/2024/03/python/pyproject.toml b/2024/03/python/pyproject.toml deleted file mode 100644 index 683451d..0000000 --- a/2024/03/python/pyproject.toml +++ /dev/null @@ -1,6 +0,0 @@ -[project] -name = "aoc-2024-03" -version = "0.1.0" -description = "advent of code 2024-03" -requires-python = ">=3.13" -dependencies = [] diff --git a/2024/04/python/main.py b/2024/04/python.py index cc04f04..fe5021b 100644..100755 --- a/2024/04/python/main.py +++ b/2024/04/python.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 + from fileinput import input grid = { diff --git a/2024/04/python/pyproject.toml b/2024/04/python/pyproject.toml deleted file mode 100644 index 141044b..0000000 --- a/2024/04/python/pyproject.toml +++ /dev/null @@ -1,6 +0,0 @@ -[project] -name = "aoc-2024-04" -version = "0.1.0" -description = "advent of code 2024-04" -requires-python = ">=3.13" -dependencies = [] diff --git a/2024/05/python/main.py b/2024/05/python.py index e3a10e2..9e81978 100644..100755 --- a/2024/05/python/main.py +++ b/2024/05/python.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 + from fileinput import input from functools import cmp_to_key from itertools import takewhile diff --git a/2024/05/python/pyproject.toml b/2024/05/python/pyproject.toml deleted file mode 100644 index 720c539..0000000 --- a/2024/05/python/pyproject.toml +++ /dev/null @@ -1,6 +0,0 @@ -[project] -name = "aoc-2024-05" -version = "0.1.0" -description = "advent of code 2024-05" -requires-python = ">=3.13" -dependencies = [] diff --git a/2024/06/python/main.py b/2024/06/python.py index 5fd6c3d..52b61d0 100644..100755 --- a/2024/06/python/main.py +++ b/2024/06/python.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 + from fileinput import input obstacles = set() diff --git a/2024/06/python/pyproject.toml b/2024/06/python/pyproject.toml deleted file mode 100644 index 8ad63e7..0000000 --- a/2024/06/python/pyproject.toml +++ /dev/null @@ -1,6 +0,0 @@ -[project] -name = "aoc-2024-06" -version = "0.1.0" -description = "advent of code 2024-06" -requires-python = ">=3.13" -dependencies = [] diff --git a/2024/07/python/main.py b/2024/07/python.py index 0e72772..008af39 100644..100755 --- a/2024/07/python/main.py +++ b/2024/07/python.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 + from fileinput import input lines = [line.strip() for line in input()] diff --git a/2024/07/python/pyproject.toml b/2024/07/python/pyproject.toml deleted file mode 100644 index bbd42d3..0000000 --- a/2024/07/python/pyproject.toml +++ /dev/null @@ -1,6 +0,0 @@ -[project] -name = "aoc-2024-07" -version = "0.1.0" -description = "advent of code 2024-07" -requires-python = ">=3.13" -dependencies = [] diff --git a/2024/08/python/main.py b/2024/08/python.py index c7bb47d..783203b 100644..100755 --- a/2024/08/python/main.py +++ b/2024/08/python.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 + from collections import defaultdict from fileinput import input from itertools import product diff --git a/2024/08/python/pyproject.toml b/2024/08/python/pyproject.toml deleted file mode 100644 index e00a133..0000000 --- a/2024/08/python/pyproject.toml +++ /dev/null @@ -1,6 +0,0 @@ -[project] -name = "aoc-2024-08" -version = "0.1.0" -description = "advent of code 2024-08" -requires-python = ">=3.13" -dependencies = [] diff --git a/2024/09/python/main.py b/2024/09/python.py index d435163..1cf450e 100644..100755 --- a/2024/09/python/main.py +++ b/2024/09/python.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 + from fileinput import input disk = list(input())[0].strip() diff --git a/2024/09/python/pyproject.toml b/2024/09/python/pyproject.toml deleted file mode 100644 index 66c042a..0000000 --- a/2024/09/python/pyproject.toml +++ /dev/null @@ -1,6 +0,0 @@ -[project] -name = "aoc-2024-09" -version = "0.1.0" -description = "advent of code 2024-09" -requires-python = ">=3.13" -dependencies = [] diff --git a/2024/10/python/main.py b/2024/10/python.py index 4e85b49..88892b6 100644..100755 --- a/2024/10/python/main.py +++ b/2024/10/python.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 + from fileinput import input grid = [[int(c) for c in line.strip()] for line in input()] diff --git a/2024/10/python/pyproject.toml b/2024/10/python/pyproject.toml deleted file mode 100644 index 8458dc5..0000000 --- a/2024/10/python/pyproject.toml +++ /dev/null @@ -1,6 +0,0 @@ -[project] -name = "aoc-2024-10" -version = "0.1.0" -description = "advent of code 2024-10" -requires-python = ">=3.13" -dependencies = [] diff --git a/2024/11/python/main.py b/2024/11/python.py index 445809a..37f658e 100644..100755 --- a/2024/11/python/main.py +++ b/2024/11/python.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 + from fileinput import input from functools import cache from math import floor, log diff --git a/2024/11/python/pyproject.toml b/2024/11/python/pyproject.toml deleted file mode 100644 index aa72c8e..0000000 --- a/2024/11/python/pyproject.toml +++ /dev/null @@ -1,6 +0,0 @@ -[project] -name = "aoc-2024-11" -version = "0.1.0" -description = "advent of code 2024-11" -requires-python = ">=3.13" -dependencies = [] diff --git a/2024/12/python/main.py b/2024/12/python.py index 6faa6f1..81761bc 100644..100755 --- a/2024/12/python/main.py +++ b/2024/12/python.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 + from fileinput import input grid = { diff --git a/2024/12/python/pyproject.toml b/2024/12/python/pyproject.toml deleted file mode 100644 index b36941b..0000000 --- a/2024/12/python/pyproject.toml +++ /dev/null @@ -1,6 +0,0 @@ -[project] -name = "aoc-2024-12" -version = "0.1.0" -description = "advent of code 2024-12" -requires-python = ">=3.13" -dependencies = [] diff --git a/2024/13/python/main.py b/2024/13/python.py index de31184..e78e35f 100644..100755 --- a/2024/13/python/main.py +++ b/2024/13/python.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 + import re from fileinput import input from itertools import batched diff --git a/2024/13/python/pyproject.toml b/2024/13/python/pyproject.toml deleted file mode 100644 index aae82b9..0000000 --- a/2024/13/python/pyproject.toml +++ /dev/null @@ -1,6 +0,0 @@ -[project] -name = "aoc-2024-13" -version = "0.1.0" -description = "advent of code 2024-13" -requires-python = ">=3.13" -dependencies = [] diff --git a/2024/14/python/main.py b/2024/14/python.py index ebfe29c..2bb6cb4 100644..100755 --- a/2024/14/python/main.py +++ b/2024/14/python.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 + import re from fileinput import input from itertools import groupby diff --git a/2024/14/python/pyproject.toml b/2024/14/python/pyproject.toml deleted file mode 100644 index 45527a8..0000000 --- a/2024/14/python/pyproject.toml +++ /dev/null @@ -1,6 +0,0 @@ -[project] -name = "aoc-2024-14" -version = "0.1.0" -description = "advent of code 2024-14" -requires-python = ">=3.13" -dependencies = [] diff --git a/2024/15/python/main.py b/2024/15/python.py index a565f00..4cfd48c 100644..100755 --- a/2024/15/python/main.py +++ b/2024/15/python.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 + from fileinput import input from itertools import takewhile diff --git a/2024/15/python/pyproject.toml b/2024/15/python/pyproject.toml deleted file mode 100644 index 0dfbb68..0000000 --- a/2024/15/python/pyproject.toml +++ /dev/null @@ -1,6 +0,0 @@ -[project] -name = "aoc-2024-15" -version = "0.1.0" -description = "advent of code 2024-15" -requires-python = ">=3.13" -dependencies = [] diff --git a/2024/16/python/main.py b/2024/16/python.py index f66fe94..fda3714 100644..100755 --- a/2024/16/python/main.py +++ b/2024/16/python.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 + from fileinput import input grid = { diff --git a/2024/16/python/pyproject.toml b/2024/16/python/pyproject.toml deleted file mode 100644 index d38516f..0000000 --- a/2024/16/python/pyproject.toml +++ /dev/null @@ -1,6 +0,0 @@ -[project] -name = "aoc-2024-16" -version = "0.1.0" -description = "advent of code 2024-16" -requires-python = ">=3.13" -dependencies = [] diff --git a/2024/17/python/main.py b/2024/17/python.py index a441d40..9ea7de4 100644..100755 --- a/2024/17/python/main.py +++ b/2024/17/python.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 + from fileinput import input from itertools import takewhile, zip_longest diff --git a/2024/17/python/pyproject.toml b/2024/17/python/pyproject.toml deleted file mode 100644 index daf149a..0000000 --- a/2024/17/python/pyproject.toml +++ /dev/null @@ -1,6 +0,0 @@ -[project] -name = "aoc-2024-17" -version = "0.1.0" -description = "advent of code 2024-17" -requires-python = ">=3.13" -dependencies = [] diff --git a/2024/18/python/main.py b/2024/18/python.py index 071fa90..1f987c6 100644..100755 --- a/2024/18/python/main.py +++ b/2024/18/python.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 + from bisect import bisect_left from collections import deque from fileinput import input diff --git a/2024/18/python/pyproject.toml b/2024/18/python/pyproject.toml deleted file mode 100644 index f1deef2..0000000 --- a/2024/18/python/pyproject.toml +++ /dev/null @@ -1,6 +0,0 @@ -[project] -name = "aoc-2024-18" -version = "0.1.0" -description = "advent of code 2024-18" -requires-python = ">=3.13" -dependencies = [] diff --git a/2024/19/python/main.py b/2024/19/python.py index a41156c..efd3272 100644..100755 --- a/2024/19/python/main.py +++ b/2024/19/python.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 + from fileinput import input from functools import cache from itertools import takewhile diff --git a/2024/19/python/pyproject.toml b/2024/19/python/pyproject.toml deleted file mode 100644 index 539ef74..0000000 --- a/2024/19/python/pyproject.toml +++ /dev/null @@ -1,6 +0,0 @@ -[project] -name = "aoc-2024-19" -version = "0.1.0" -description = "advent of code 2024-19" -requires-python = ">=3.13" -dependencies = [] diff --git a/2024/20/python/main.py b/2024/20/python.py index bec6ebf..610f1a3 100644..100755 --- a/2024/20/python/main.py +++ b/2024/20/python.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 + from fileinput import input grid = { diff --git a/2024/20/python/pyproject.toml b/2024/20/python/pyproject.toml deleted file mode 100644 index 4031bd1..0000000 --- a/2024/20/python/pyproject.toml +++ /dev/null @@ -1,6 +0,0 @@ -[project] -name = "aoc-2024-20" -version = "0.1.0" -description = "advent of code 2024-20" -requires-python = ">=3.13" -dependencies = [] diff --git a/2024/21/python.py b/2024/21/python.py new file mode 100755 index 0000000..5873d65 --- /dev/null +++ b/2024/21/python.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 + +from fileinput import input +from functools import cache + +seqs = [s.strip() for s in input()] + +numpad = { + "0": {"^": "2", ">": "A"}, + "1": {"^": "4", ">": "2"}, + "2": {"^": "5", ">": "3", "v": "0", "<": "1"}, + "3": {"^": "6", "v": "A", "<": "2"}, + "4": {"^": "7", ">": "5", "v": "1"}, + "5": {"^": "8", ">": "6", "v": "2", "<": "4"}, + "6": {"^": "9", "v": "3", "<": "5"}, + "7": {">": "8", "v": "4"}, + "8": {">": "9", "v": "5", "<": "7"}, + "9": {"v": "6", "<": "8"}, + "A": {"^": "3", "<": "0"}, +} +dirpad = { + "^": {">": "A", "v": "v"}, + ">": {"^": "A", "<": "v"}, + "v": {"^": "^", ">": ">", "<": "<"}, + "<": {">": "v"}, + "A": {"v": ">", "<": "^"}, +} + + +silver = 0 +gold = 0 + + +@cache +def move(a, b, n): + pass + + +print(seqs) + +print("silver:", silver) +print("gold:", gold) diff --git a/2024/22/python/main.py b/2024/22/python.py index c290858..98d8898 100644..100755 --- a/2024/22/python/main.py +++ b/2024/22/python.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 + from collections import Counter, deque from fileinput import input from itertools import islice diff --git a/2024/22/python/pyproject.toml b/2024/22/python/pyproject.toml deleted file mode 100644 index 7bd23d0..0000000 --- a/2024/22/python/pyproject.toml +++ /dev/null @@ -1,6 +0,0 @@ -[project] -name = "aoc-2024-22" -version = "0.1.0" -description = "advent of code 2024-22" -requires-python = ">=3.13" -dependencies = [] |