This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import annotations | |
from dataclasses import dataclass | |
import operator | |
from typing import Any, Callable | |
@dataclass(frozen=True) | |
class _Args: | |
args: tuple[Any, ...] | |
kwargs: dict[str, Any] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import annotations | |
import functools | |
import json | |
from devtools import debug | |
from bidict import FrozenOrderedBidict, frozenbidict | |
from collections import defaultdict | |
from dataclasses import dataclass, field | |
from enum import Enum | |
from typing import Any, Iterable, List, Union |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#define NUMBERS 1000000 | |
#define ROUNDS 10000000 | |
#define NUMBERS_1 NUMBERS + 1 | |
int main(int argc, char const *argv[]) | |
{ | |
unsigned int suc[NUMBERS_1]; | |
unsigned int fixed[] = {7, 1, 2, 6, 4, 3, 5, 8, 9}; | |
unsigned int removed[5]; | |
unsigned int current = fixed[0]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from parse import parse | |
store = {} | |
zeroer, orer = None, None | |
with open("data/14.txt") as fn: | |
for line in fn.readlines(): | |
line = line.strip() | |
r = parse("mem[{}] = {}", line) | |
if r: | |
i, v = map(int, r) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from parse import parse | |
store = {} | |
zeroer, orer = None, None | |
with open("data/14.txt") as fn: | |
for line in fn.readlines(): | |
line = line.strip() | |
r = parse("mem[{}] = {}", line) | |
if r: | |
i, v = map(int, r) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from parse import parse | |
store = {} | |
zeroer, orer = None, None | |
with open("data/14.txt") as fn: | |
for line in fn.readlines(): | |
line = line.strip() | |
r = parse("mem[{}] = {}", line) | |
if r: | |
i, v = map(int, r) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from parse import parse | |
store = {} | |
zeroer, orer = None, None | |
with open("data/14.txt") as fn: | |
for line in fn.readlines(): | |
line = line.strip() | |
r = parse("mem[{}] = {}", line) | |
if r: | |
i, v = map(int, r) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from parse import parse | |
store = {} | |
zeroer, orer = None, None | |
with open("data/14.txt") as fn: | |
for line in fn.readlines(): | |
line = line.strip() | |
r = parse("mem[{}] = {}", line) | |
if r: | |
i, v = map(int, r) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from parse import parse | |
store = {} | |
def looper(ander, orer, child): | |
if not len(child): | |
yield tuple(int("0b" + x, 2) for x in (ander, orer)) | |
return | |
letter, rest = child[0], child[1:] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with open("data/17.txt") as fn: | |
r = fn.read().strip() | |
dim = 5 | |
cubes = { | |
(x, y) + tuple([0] * (dim - 2)) | |
for x, row in enumerate(r.split("\n")) | |
for y, col in enumerate(row) | |
if col == "#" | |
} |
NewerOlder