Skip to content

Instantly share code, notes, and snippets.

A = [
-0.016, 0.4, -0.705, -0.717,
0.386, -0.147, 0.933, -0.693,
0.643, -0.617, 0.634, -0.689,
0.464, -0.411, 0.364, 0.444];
Q = [
-0.016, 0.1, -0.705, -0.717,
0.3, -0.147, 0.933, -0.693,
0.643, -0.67, 0.634, -0.689,
data = readline("input.txt")
function Expand(data)
out = Vector{Int}()
id = 0
for i ∈ eachindex(data)
c = data[i]
if (i-1) % 2 == 0
out = vcat(out, fill(id, parse(Int, c)))
@andrea993
andrea993 / day7.jl
Last active December 7, 2024 18:35
U = readlines("input")
ctc(a, b) = parse(Int, string(a)*string(b))
ops_list = [*, +, ctc]
function validate(vals, res)
if length(vals[1]) == 1
any(x -> x == [res], vals)
else
U = readlines("input")
ctc(a, b) = parse(Int, string(a)*string(b))
ops_list = [*, +, ctc]
function validate(vals, res)
if isempty(vals)
false
elseif length(vals[1]) == 1
@andrea993
andrea993 / .jl
Last active December 6, 2024 18:43
using LinearAlgebra
using Distributed
U = hcat(collect.(readlines("input.txt"))...) |> permutedims
M = copy(U)
startidx = findfirst(isequal('^'), U)
dir = CartesianIndex(-1, 0)
nextDir = Dict(
U = readlines("input.txt")
sep = findfirst(isempty, U)
rules_str = U[1:sep-1]
updates_str = U[sep+1:end]
rules = let d = Dict()
for r in rules_str
a, b = parse.(Int, split(r, "|"))
get!(d, a, Set())
U = readlines("input.txt")
sep = findfirst(isempty, U)
rules_str = U[1:sep-1]
updates_str = U[sep+1:end]
rules = let d = Dict()
for r in rules_str
a, b = parse.(Int, split(r, "|"))
get!(d, a, Set())