diff --git a/2019/d03/ex2/ex2.py b/2019/d03/ex2/ex2.py index 077f2e3..a0abfac 100755 --- a/2019/d03/ex2/ex2.py +++ b/2019/d03/ex2/ex2.py @@ -2,7 +2,7 @@ import sys from fractions import Fraction -from typing import List, NamedTuple, Optional +from typing import Dict, List, NamedTuple, Optional class Point(NamedTuple): diff --git a/2019/d05/ex1/ex1.py b/2019/d05/ex1/ex1.py index fe46167..09dac02 100755 --- a/2019/d05/ex1/ex1.py +++ b/2019/d05/ex1/ex1.py @@ -1,5 +1,7 @@ #!/usr/bin/env python +import sys +from copy import deepcopy from enum import IntEnum from typing import List, NamedTuple diff --git a/2019/d07/ex2/ex2.py b/2019/d07/ex2/ex2.py index 8f5e209..c239eaa 100755 --- a/2019/d07/ex2/ex2.py +++ b/2019/d07/ex2/ex2.py @@ -5,7 +5,7 @@ import sys from copy import deepcopy from dataclasses import dataclass, field from enum import IntEnum -from typing import List, NamedTuple +from typing import Callable, List, NamedTuple class ParameterMode(IntEnum): diff --git a/2019/d09/ex1/ex1.py b/2019/d09/ex1/ex1.py index 9a2df1e..6f54dec 100755 --- a/2019/d09/ex1/ex1.py +++ b/2019/d09/ex1/ex1.py @@ -1,10 +1,11 @@ #!/usr/bin/env python +import itertools import sys from copy import deepcopy from dataclasses import dataclass, field from enum import IntEnum -from typing import List, NamedTuple +from typing import Callable, List, NamedTuple class ParameterMode(IntEnum): diff --git a/2019/d09/ex2/ex2.py b/2019/d09/ex2/ex2.py index 7c8be67..598f628 100755 --- a/2019/d09/ex2/ex2.py +++ b/2019/d09/ex2/ex2.py @@ -1,10 +1,11 @@ #!/usr/bin/env python +import itertools import sys from copy import deepcopy from dataclasses import dataclass, field from enum import IntEnum -from typing import List, NamedTuple +from typing import Callable, List, NamedTuple class ParameterMode(IntEnum): diff --git a/2019/d10/ex2/ex2.py b/2019/d10/ex2/ex2.py index 480234e..60f115a 100755 --- a/2019/d10/ex2/ex2.py +++ b/2019/d10/ex2/ex2.py @@ -4,6 +4,7 @@ import sys from cmath import phase from itertools import groupby from math import gcd, pi +from pprint import pprint from typing import NamedTuple, Set, Tuple diff --git a/2019/d13/ex1/ex1.py b/2019/d13/ex1/ex1.py index 924ffb7..1bf7e8c 100755 --- a/2019/d13/ex1/ex1.py +++ b/2019/d13/ex1/ex1.py @@ -3,7 +3,7 @@ import sys from dataclasses import dataclass, field from enum import IntEnum -from typing import Iterable, List, NamedTuple, Tuple, TypeVar +from typing import Dict, Iterable, List, NamedTuple, Tuple, TypeVar class ParameterMode(IntEnum): diff --git a/2019/d13/ex2/ex2.py b/2019/d13/ex2/ex2.py index af0d24f..9fb669f 100755 --- a/2019/d13/ex2/ex2.py +++ b/2019/d13/ex2/ex2.py @@ -3,7 +3,7 @@ import sys from dataclasses import dataclass, field from enum import IntEnum -from typing import Iterable, List, NamedTuple, Tuple, TypeVar +from typing import Dict, Iterable, List, NamedTuple, Tuple, TypeVar class ParameterMode(IntEnum): diff --git a/2019/d16/ex2/ex2.py b/2019/d16/ex2/ex2.py index 317d157..a13a0bf 100755 --- a/2019/d16/ex2/ex2.py +++ b/2019/d16/ex2/ex2.py @@ -2,6 +2,8 @@ import sys from functools import reduce +from itertools import chain, cycle +from typing import Iterable, List def main() -> None: diff --git a/2019/d19/ex2/ex2.py b/2019/d19/ex2/ex2.py index 8dd132c..138e45b 100755 --- a/2019/d19/ex2/ex2.py +++ b/2019/d19/ex2/ex2.py @@ -4,7 +4,7 @@ import sys from copy import deepcopy from dataclasses import dataclass, field from enum import IntEnum -from typing import List, NamedTuple +from typing import Iterator, List, NamedTuple, Tuple class ParameterMode(IntEnum): diff --git a/2020/d07/ex2/ex2.py b/2020/d07/ex2/ex2.py index a955087..107d737 100755 --- a/2020/d07/ex2/ex2.py +++ b/2020/d07/ex2/ex2.py @@ -2,6 +2,8 @@ import re import sys +from collections import defaultdict +from copy import deepcopy from dataclasses import dataclass from typing import Dict, List, Set, Tuple diff --git a/2020/d18/ex2/ex2.py b/2020/d18/ex2/ex2.py index a83161c..94f13ed 100755 --- a/2020/d18/ex2/ex2.py +++ b/2020/d18/ex2/ex2.py @@ -1,7 +1,7 @@ #!/usr/bin/env python import sys -from typing import List +from typing import Callable, Dict, List """ E : T [ * T ]* diff --git a/2020/d20/ex2/ex2.py b/2020/d20/ex2/ex2.py index c9e06a7..e923806 100755 --- a/2020/d20/ex2/ex2.py +++ b/2020/d20/ex2/ex2.py @@ -5,6 +5,7 @@ import itertools import math import sys from collections import defaultdict +from copy import deepcopy from typing import Dict, Iterator, List, Set, Tuple Tile = List[List[str]] diff --git a/2020/d23/ex1/ex1.py b/2020/d23/ex1/ex1.py index 2d7ff20..faae133 100755 --- a/2020/d23/ex1/ex1.py +++ b/2020/d23/ex1/ex1.py @@ -2,7 +2,7 @@ import itertools import sys -from typing import List +from typing import List, Tuple def solve(circle: List[int]) -> int: diff --git a/2020/d23/ex2/ex2.py b/2020/d23/ex2/ex2.py index 8993dcb..90c8c81 100755 --- a/2020/d23/ex2/ex2.py +++ b/2020/d23/ex2/ex2.py @@ -2,7 +2,7 @@ import itertools import sys -from typing import List +from typing import List, Tuple def solve(circle: List[int]) -> int: diff --git a/2020/d24/ex2/ex2.py b/2020/d24/ex2/ex2.py index ef749f9..17728b2 100755 --- a/2020/d24/ex2/ex2.py +++ b/2020/d24/ex2/ex2.py @@ -3,6 +3,7 @@ import itertools import sys from collections import defaultdict +from copy import deepcopy from typing import Dict, Iterator, List, Tuple Offset = Tuple[int, int] diff --git a/2021/d01/ex1/ex1.py b/2021/d01/ex1/ex1.py index 3853ce4..24cc5d1 100755 --- a/2021/d01/ex1/ex1.py +++ b/2021/d01/ex1/ex1.py @@ -1,5 +1,6 @@ #!/usr/bin/env python +import itertools import sys from typing import List diff --git a/2021/d02/ex1/ex1.py b/2021/d02/ex1/ex1.py index f891b43..f28dd77 100755 --- a/2021/d02/ex1/ex1.py +++ b/2021/d02/ex1/ex1.py @@ -1,5 +1,6 @@ #!/usr/bin/env python +import itertools import sys from typing import List diff --git a/2021/d02/ex2/ex2.py b/2021/d02/ex2/ex2.py index 8843639..b48215c 100755 --- a/2021/d02/ex2/ex2.py +++ b/2021/d02/ex2/ex2.py @@ -1,5 +1,6 @@ #!/usr/bin/env python +import itertools import sys from typing import List diff --git a/2021/d03/ex1/ex1.py b/2021/d03/ex1/ex1.py index 7519004..ed2eeb7 100755 --- a/2021/d03/ex1/ex1.py +++ b/2021/d03/ex1/ex1.py @@ -1,5 +1,6 @@ #!/usr/bin/env python +import itertools import sys from typing import List diff --git a/2021/d03/ex2/ex2.py b/2021/d03/ex2/ex2.py index acf0ff2..9c6515b 100755 --- a/2021/d03/ex2/ex2.py +++ b/2021/d03/ex2/ex2.py @@ -1,5 +1,6 @@ #!/usr/bin/env python +import itertools import sys from copy import deepcopy from typing import List diff --git a/2021/d06/ex1/ex1.py b/2021/d06/ex1/ex1.py index 65abb44..5eec9ce 100755 --- a/2021/d06/ex1/ex1.py +++ b/2021/d06/ex1/ex1.py @@ -3,6 +3,7 @@ import itertools import sys from collections import Counter +from dataclasses import dataclass from typing import Iterator, List, TypeVar T = TypeVar("T") diff --git a/2021/d06/ex2/ex2.py b/2021/d06/ex2/ex2.py index bb40805..2e64423 100755 --- a/2021/d06/ex2/ex2.py +++ b/2021/d06/ex2/ex2.py @@ -3,6 +3,7 @@ import itertools import sys from collections import Counter +from dataclasses import dataclass from typing import Iterator, List, TypeVar T = TypeVar("T") diff --git a/2021/d07/ex1/ex1.py b/2021/d07/ex1/ex1.py index 2b8a8a9..4205009 100755 --- a/2021/d07/ex1/ex1.py +++ b/2021/d07/ex1/ex1.py @@ -1,5 +1,6 @@ #!/usr/bin/env python +import itertools import sys from typing import List diff --git a/2021/d07/ex2/ex2.py b/2021/d07/ex2/ex2.py index 8eec5ef..56b818c 100755 --- a/2021/d07/ex2/ex2.py +++ b/2021/d07/ex2/ex2.py @@ -1,5 +1,6 @@ #!/usr/bin/env python +import itertools import sys from math import ceil, floor from typing import List diff --git a/2021/d08/ex2/ex2.py b/2021/d08/ex2/ex2.py index c22b23b..1553e29 100755 --- a/2021/d08/ex2/ex2.py +++ b/2021/d08/ex2/ex2.py @@ -1,5 +1,6 @@ #!/usr/bin/env python +import itertools import sys from dataclasses import dataclass from typing import Dict, List, Set diff --git a/2021/d09/ex1/ex1.py b/2021/d09/ex1/ex1.py index e84e893..cf7d7d6 100755 --- a/2021/d09/ex1/ex1.py +++ b/2021/d09/ex1/ex1.py @@ -1,5 +1,6 @@ #!/usr/bin/env python +import itertools import sys from typing import Iterator, List, Tuple diff --git a/2021/d09/ex2/ex2.py b/2021/d09/ex2/ex2.py index 0311995..451883a 100755 --- a/2021/d09/ex2/ex2.py +++ b/2021/d09/ex2/ex2.py @@ -1,5 +1,6 @@ #!/usr/bin/env python +import itertools import sys from typing import Iterator, List, Tuple diff --git a/2021/d10/ex1/ex1.py b/2021/d10/ex1/ex1.py index 6770222..4667d43 100755 --- a/2021/d10/ex1/ex1.py +++ b/2021/d10/ex1/ex1.py @@ -1,5 +1,6 @@ #!/usr/bin/env python +import itertools import sys from typing import List, Optional, cast diff --git a/2021/d10/ex2/ex2.py b/2021/d10/ex2/ex2.py index d100b0f..27de8ac 100755 --- a/2021/d10/ex2/ex2.py +++ b/2021/d10/ex2/ex2.py @@ -1,5 +1,6 @@ #!/usr/bin/env python +import itertools import sys from typing import Iterator, List, Optional diff --git a/2021/d11/ex1/ex1.py b/2021/d11/ex1/ex1.py index c6bf0be..619bd27 100755 --- a/2021/d11/ex1/ex1.py +++ b/2021/d11/ex1/ex1.py @@ -2,6 +2,7 @@ import itertools import sys +from copy import deepcopy from typing import Iterator, List, Set, Tuple Grid = List[List[int]] diff --git a/2021/d11/ex2/ex2.py b/2021/d11/ex2/ex2.py index 8f95f55..d4ce118 100755 --- a/2021/d11/ex2/ex2.py +++ b/2021/d11/ex2/ex2.py @@ -2,6 +2,7 @@ import itertools import sys +from copy import deepcopy from typing import Iterator, List, Set, Tuple Grid = List[List[int]] diff --git a/2021/d12/ex1/ex1.py b/2021/d12/ex1/ex1.py index 6108876..1887c7d 100755 --- a/2021/d12/ex1/ex1.py +++ b/2021/d12/ex1/ex1.py @@ -1,5 +1,6 @@ #!/usr/bin/env python +import itertools import sys from collections import defaultdict from typing import Dict, List, Set diff --git a/2021/d12/ex2/ex2.py b/2021/d12/ex2/ex2.py index b30d9b8..bc5a527 100755 --- a/2021/d12/ex2/ex2.py +++ b/2021/d12/ex2/ex2.py @@ -1,5 +1,6 @@ #!/usr/bin/env python +import itertools import sys from collections import defaultdict from typing import Dict, List, Set diff --git a/2021/d15/ex1/ex1.py b/2021/d15/ex1/ex1.py index 4399aba..d7c5e88 100755 --- a/2021/d15/ex1/ex1.py +++ b/2021/d15/ex1/ex1.py @@ -1,8 +1,9 @@ #!/usr/bin/env python import heapq +import itertools import sys -from typing import Iterator, List, NamedTuple, Set +from typing import Iterator, List, NamedTuple, Set, Tuple class Point(NamedTuple): diff --git a/2021/d15/ex2/ex2.py b/2021/d15/ex2/ex2.py index c2bbd30..0fa89b8 100755 --- a/2021/d15/ex2/ex2.py +++ b/2021/d15/ex2/ex2.py @@ -1,8 +1,9 @@ #!/usr/bin/env python import heapq +import itertools import sys -from typing import Iterator, List, NamedTuple, Set +from typing import Iterator, List, NamedTuple, Set, Tuple class Point(NamedTuple): diff --git a/2021/d16/ex1/ex1.py b/2021/d16/ex1/ex1.py index 1978196..d65fec5 100755 --- a/2021/d16/ex1/ex1.py +++ b/2021/d16/ex1/ex1.py @@ -5,7 +5,7 @@ import functools import itertools import sys from dataclasses import dataclass -from typing import Iterable, Iterator, List, Tuple +from typing import Iterable, Iterator, List, Tuple, TypeVar RawPacket = List[bool] diff --git a/2021/d16/ex2/ex2.py b/2021/d16/ex2/ex2.py index bb9ad4e..7ecb73a 100755 --- a/2021/d16/ex2/ex2.py +++ b/2021/d16/ex2/ex2.py @@ -6,7 +6,7 @@ import itertools import math import sys from dataclasses import dataclass -from typing import Callable, Dict, Iterable, Iterator, List, Tuple +from typing import Callable, Dict, Iterable, Iterator, List, Tuple, TypeVar RawPacket = List[bool] diff --git a/2021/d17/ex1/ex1.py b/2021/d17/ex1/ex1.py index 00bbca2..d58a72e 100755 --- a/2021/d17/ex1/ex1.py +++ b/2021/d17/ex1/ex1.py @@ -1,6 +1,7 @@ #!/usr/bin/env python import itertools +import math import sys from typing import Iterator, List, NamedTuple diff --git a/2021/d17/ex2/ex2.py b/2021/d17/ex2/ex2.py index bc7dab1..e2beb9a 100755 --- a/2021/d17/ex2/ex2.py +++ b/2021/d17/ex2/ex2.py @@ -1,5 +1,7 @@ #!/usr/bin/env python +import itertools +import math import sys from typing import Iterator, List, NamedTuple diff --git a/2021/d18/ex2/ex2.py b/2021/d18/ex2/ex2.py index c0a37a7..56c8d48 100755 --- a/2021/d18/ex2/ex2.py +++ b/2021/d18/ex2/ex2.py @@ -1,5 +1,6 @@ #!/usr/bin/env python +import functools import itertools import sys from copy import deepcopy diff --git a/2021/d19/ex1/ex1.py b/2021/d19/ex1/ex1.py index e42af3c..922e709 100755 --- a/2021/d19/ex1/ex1.py +++ b/2021/d19/ex1/ex1.py @@ -1,5 +1,6 @@ #!/usr/bin/env python +import functools import itertools import sys from dataclasses import dataclass diff --git a/2021/d19/ex2/ex2.py b/2021/d19/ex2/ex2.py index ff4f6ad..1ad850a 100755 --- a/2021/d19/ex2/ex2.py +++ b/2021/d19/ex2/ex2.py @@ -1,5 +1,6 @@ #!/usr/bin/env python +import functools import itertools import sys from dataclasses import dataclass diff --git a/2021/d22/ex1/ex1.py b/2021/d22/ex1/ex1.py index dac1513..662dd49 100755 --- a/2021/d22/ex1/ex1.py +++ b/2021/d22/ex1/ex1.py @@ -3,7 +3,7 @@ import functools import itertools import sys -from typing import List, NamedTuple, Optional, Set, Tuple +from typing import Iterator, List, NamedTuple, Optional, Set, Tuple, cast class Point(NamedTuple): diff --git a/2021/d22/ex2/ex2.py b/2021/d22/ex2/ex2.py index 3c7d2c5..4753b54 100755 --- a/2021/d22/ex2/ex2.py +++ b/2021/d22/ex2/ex2.py @@ -3,7 +3,7 @@ import functools import itertools import sys -from typing import List, NamedTuple, Optional, Set, Tuple +from typing import Iterator, List, NamedTuple, Optional, Set, Tuple, cast class Point(NamedTuple): diff --git a/2021/d23/ex1/ex1.py b/2021/d23/ex1/ex1.py index 0b99d71..4d585cd 100755 --- a/2021/d23/ex1/ex1.py +++ b/2021/d23/ex1/ex1.py @@ -3,7 +3,7 @@ import enum import functools import sys -from typing import Iterator, List, NamedTuple, Optional, Tuple +from typing import Iterator, List, NamedTuple, Optional, Tuple, cast class Point(NamedTuple): diff --git a/2021/d23/ex2/ex2.py b/2021/d23/ex2/ex2.py index 8c077d9..1ea1d8f 100755 --- a/2021/d23/ex2/ex2.py +++ b/2021/d23/ex2/ex2.py @@ -3,7 +3,7 @@ import enum import functools import sys -from typing import Iterator, List, NamedTuple, Optional, Tuple +from typing import Iterator, List, NamedTuple, Optional, Tuple, cast class Point(NamedTuple): diff --git a/2021/d25/ex1/ex1.py b/2021/d25/ex1/ex1.py index 5d6f612..fe8132c 100755 --- a/2021/d25/ex1/ex1.py +++ b/2021/d25/ex1/ex1.py @@ -1,8 +1,9 @@ #!/usr/bin/env python +import enum import itertools import sys -from typing import List, NamedTuple, Set +from typing import Iterable, Iterator, List, NamedTuple, Set class Point(NamedTuple): diff --git a/2022/d18/ex2/ex2.py b/2022/d18/ex2/ex2.py index 57f8b5a..6f7bfcb 100755 --- a/2022/d18/ex2/ex2.py +++ b/2022/d18/ex2/ex2.py @@ -2,6 +2,7 @@ import itertools import sys +from collections import deque from collections.abc import Iterator from typing import NamedTuple diff --git a/2022/d21/ex1/ex1.py b/2022/d21/ex1/ex1.py index e9c4727..7c12836 100755 --- a/2022/d21/ex1/ex1.py +++ b/2022/d21/ex1/ex1.py @@ -25,7 +25,7 @@ class Operator(str, enum.Enum): class Monkey: def get_value(self, monkeys: dict[str, "Monkey"]) -> int: - raise NotImplementedError + raise NotImplemented @dataclasses.dataclass diff --git a/2022/d21/ex2/ex2.py b/2022/d21/ex2/ex2.py index 386a187..ec9ca8d 100755 --- a/2022/d21/ex2/ex2.py +++ b/2022/d21/ex2/ex2.py @@ -93,7 +93,7 @@ class MathObserver: class Monkey: def get_value(self, monkeys: dict[str, "Monkey"]) -> Num: - raise NotImplementedError + raise NotImplemented @dataclasses.dataclass diff --git a/2023/d02/ex2/ex2.py b/2023/d02/ex2/ex2.py index 32c3a34..309753e 100755 --- a/2023/d02/ex2/ex2.py +++ b/2023/d02/ex2/ex2.py @@ -1,6 +1,8 @@ #!/usr/bin/env python +import functools import math +import operator as op import sys from collections import Counter from enum import StrEnum diff --git a/2023/d14/ex2/ex2.py b/2023/d14/ex2/ex2.py index b7b0222..090724f 100755 --- a/2023/d14/ex2/ex2.py +++ b/2023/d14/ex2/ex2.py @@ -1,5 +1,6 @@ #!/usr/bin/env python +import dataclasses import itertools import sys from enum import StrEnum diff --git a/2023/d17/ex2/ex2.py b/2023/d17/ex2/ex2.py index f4cfc6e..a643534 100755 --- a/2023/d17/ex2/ex2.py +++ b/2023/d17/ex2/ex2.py @@ -2,6 +2,7 @@ import functools import heapq +import itertools import sys from collections.abc import Iterator from enum import Enum