This file contains hidden or 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
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, |
This file contains hidden or 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
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))) |
This file contains hidden or 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
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 |
This file contains hidden or 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
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 |
This file contains hidden or 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
using LinearAlgebra | |
using Distributed | |
U = hcat(collect.(readlines("input.txt"))...) |> permutedims | |
M = copy(U) | |
startidx = findfirst(isequal('^'), U) | |
dir = CartesianIndex(-1, 0) | |
nextDir = Dict( |
This file contains hidden or 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
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()) |
This file contains hidden or 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
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()) |