Skip to content

Instantly share code, notes, and snippets.

import streamlit as st
css = """
[data-testid="stVerticalBlock"].red [data-testid="stText"] {
color: red;
}
[data-testid="stVerticalBlock"].big [data-testid="stText"] {
font-size: 2em;
}
@kung-foo
kung-foo / day24.py
Last active December 24, 2020 08:11
#!/usr/bin/env python3
import os
import sys
import random
import re
import numpy as np
from collections import defaultdict
src = open("input.txt", "r").readlines()
#!/usr/bin/env python3
import os
import sys
import random
src = open("input.txt", "r").readlines()
src2 = """
Player 1:
9
@kung-foo
kung-foo / day19.py
Last active December 19, 2020 20:03
#!/usr/bin/env python3
import re
import sys
# sys.setrecursionlimit(10000)
src = open("input.txt", "r").readlines()
src = [r.strip() for r in src if r.strip()]
This file has been truncated, but you can view the full file.
^(((a(b(b(a(((aa|ab)a|(aa)b)a)|b(((ab)b|(a(b|a)|bb)a)b|((ba|ab)a|(ab)b)a))|a(b(b(a(aa)|b(bb|ab))|a(a(bb|ab)|b(ab|b(b|a))))|a((a(aa|ba)|b(ab))b|((bb|(b|a)a)a|(ba|a(b|a))b)a)))|a(b(a(a((ba|ab)b|(ab)a)|b(b(ba|bb)|a(aa|ab)))|b(b((aa|bb)a|((b|a)(b|a))b)|a((bb|ab)b|(aa|ab)a)))|a((((bb|(b|a)a)b|(ab)a)b|(b(aa|ab)|a(ab))a)a|(a(((b|a)(b|a))b|(aa|ba)a)|b((ba|ab)a|(aa|ab)b))b)))|b(b(((a((aa)b|(a(b|a)|bb)a)|b((bb)b|((b|a)(b|a))a))a|(b((bb)b|((b|a)(b|a))a)|a((ba|bb)a))b)b|(a(((ab)b|(a(b|a)|bb)a)b|((bb|(b|a)a)a|(ba|ab)b)a)|b(b(a(bb|ab)|b(a(b|a)|bb))|a((ab)b|(a(b|a)|bb)a)))a)|a(a(a(((ba|bb)a|(bb)b)b|(a((b|a)(b|a))|b(ba|ab))a)|b(b(b(bb)|a((b|a)(b|a)))|a((ab|b(b|a))a|(ab)b)))|b(a((b(ba|ab)|a(ba|bb))b|(a(ab|b(b|a))|b(bb))a)|b(((a(b|a)|bb)a)a|((bb)a|(a(b|a)|bb)b)b)))))|(a(b(b(a(((aa|ab)a|(aa)b)a)|b(((ab)b|(a(b|a)|bb)a)b|((ba|ab)a|(ab)b)a))|a(b(b(a(aa)|b(bb|ab))|a(a(bb|ab)|b(ab|b(b|a))))|a((a(aa|ba)|b(ab))b|((bb|(b|a)a)a|(ba|a(b|a))b)a)))|a(b(a(a((ba|ab)b|(ab)a)|b(b(ba|bb)|a(aa|ab)))|b(b((aa|bb)a|((b|a)(b|a))b)|a((bb|ab)b|(aa|ab)
#!/usr/bin/env python3
import regex as re
bg = re.compile(r"\([^)(]*+(?:(?R)[^)(]*)*+\)", re.VERSION1)
src = open("input.txt", "r").readlines()
src2 = """
1 + 2 * 3 + 4 * 5 + 6
#!/usr/bin/env python3
from itertools import product
from copy import deepcopy
src = open("input.txt", "r").readlines()
# src = """
# .#.
# ..#
# ###""".splitlines()
#!/usr/bin/env python3
import os
import sys
import random
from collections import defaultdict
import re
src = open("input.txt", "r").readlines()
# src = """
@kung-foo
kung-foo / day15.py
Last active December 15, 2020 08:27
#!/usr/bin/env python3
from collections import defaultdict
src = open("input.txt", "r").read()
# src = "0,3,6"
# src = "3,1,2"
src = [int(x) for x in src.split(",")]
#!/usr/bin/env python3
import os
import sys
import random
import re
from collections import defaultdict
from itertools import permutations, product
src = open("input.txt", "r").readlines()