ben
/
aoc
1
0
Fork 0
import aoc2019 aoc2020 and aoc2021 repos into one solution
move common stuff to AOC.Common and unify tests into AOC.Test
This commit is contained in:
Ben Harris 2022-10-27 11:42:05 -04:00
commit ac98b2ef88
196 changed files with 30050 additions and 0 deletions

454
.gitignore vendored Normal file
View File

@ -0,0 +1,454 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Mono auto generated files
mono_crash.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET
project.lock.json
project.fragment.lock.json
artifacts/
# Tye
.tye/
# ASP.NET Scaffolding
ScaffoldingReadMe.txt
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Coverlet is a free, cross platform Code Coverage Tool
coverage*.json
coverage*.xml
coverage*.info
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# BeatPulse healthcheck temp database
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
# Fody - auto-generated XML schema
FodyWeavers.xsd
##
## Visual studio for Mac
##
# globs
Makefile.in
*.userprefs
*.usertasks
config.make
config.status
aclocal.m4
install-sh
autom4te.cache/
*.tar.gz
tarballs/
test-results/
# Mac bundle stuff
*.dmg
*.app
# content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
# content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore
# Windows thumbnail cache files
Thumbs.db
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump
# Folder config file
[Dd]esktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp
# Windows shortcuts
*.lnk
# JetBrains Rider
.idea/
*.sln.iml
##
## Visual Studio Code
##
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

View File

@ -0,0 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

49
AOC.Common/Day.cs Normal file
View File

@ -0,0 +1,49 @@
using System.Diagnostics;
namespace AOC.Common;
public abstract class Day
{
protected Day(int dayNumber, string puzzleName)
{
DayNumber = dayNumber;
PuzzleName = puzzleName;
}
public static bool UseTestInput { get; set; }
public static int Year { get; set; }
public int DayNumber { get; }
public string PuzzleName { get; }
protected IEnumerable<string> Input =>
File.ReadLines(FileName);
public string FileName =>
Path.Combine(AppDomain.CurrentDomain.BaseDirectory,
$"input{Year}/{(UseTestInput ? "test" : "day")}{DayNumber,2:00}.in");
public abstract object Part1();
public abstract object Part2();
public void AllParts(bool verbose = true)
{
Console.WriteLine($"Day {DayNumber,2}: {PuzzleName}");
var s = Stopwatch.StartNew();
var part1 = Part1();
s.Stop();
Console.Write($"Part 1: {part1,-25} ");
Console.WriteLine(verbose ? $"{s.ScaleMilliseconds()}ms elapsed" : "");
s.Reset();
s.Start();
var part2 = Part2();
s.Stop();
Console.Write($"Part 2: {part2,-25} ");
Console.WriteLine(verbose ? $"{s.ScaleMilliseconds()}ms elapsed" : "");
Console.WriteLine();
}
}

15
AOC.Common/DayXX.cs.txt Normal file
View File

@ -0,0 +1,15 @@
namespace AOCYYYY;
/// <summary>
/// Day Q: <see href="https://adventofcode.com/YYYY/day/Q"/>
/// </summary>
public sealed class DayXX : Day
{
public DayXX() : base(Q, "Puzzle Name")
{
}
public override object Part1() => "";
public override object Part2() => "";
}

123
AOC.Common/Extensions.cs Normal file
View File

@ -0,0 +1,123 @@
using System.Diagnostics;
using System.Numerics;
namespace AOC.Common;
public static class Extensions
{
public static IEnumerable<string> Chunk(this string str, int chunkSize)
{
for (var i = 0; i < str.Length; i += chunkSize)
yield return str.Substring(i, chunkSize);
}
public static string ToDelimitedString<T>(this IEnumerable<T> enumerable, string delimiter = "")
{
return string.Join(delimiter, enumerable);
}
public static IEnumerable<T> Repeat<T>(this IEnumerable<T> sequence, int? count = null)
{
while (count == null || count-- > 0)
foreach (var item in sequence)
yield return item;
}
/// <summary>
/// increased accuracy for stopwatch based on frequency.
/// <see
/// href="http://geekswithblogs.net/BlackRabbitCoder/archive/2012/01/12/c.net-little-pitfalls-stopwatch-ticks-are-not-timespan-ticks.aspx">
/// blog
/// details here
/// </see>
/// </summary>
/// <param name="stopwatch"></param>
/// <returns></returns>
public static double ScaleMilliseconds(this Stopwatch stopwatch)
{
return 1_000 * stopwatch.ElapsedTicks / (double)Stopwatch.Frequency;
}
/// <summary>
/// Given an array, it returns a rotated copy.
/// </summary>
/// <param name="array">The two dimensional jagged array to rotate.</param>
public static T[][] Rotate<T>(this T[][] array)
{
var result = new T[array[0].Length][];
for (var i = 0; i < result.Length; i++)
result[i] = new T[array.Length];
for (var i = 0; i < array.Length; i++)
for (var j = 0; j < array[i].Length; j++)
result[i][j] = array[array.Length - j - 1][i];
return result;
}
/// <summary>
/// Given a jagged array, it returns a diagonally flipped copy.
/// </summary>
/// <param name="array">The two dimensional jagged array to flip.</param>
public static T[][] FlipHorizontally<T>(this IEnumerable<T[]> array) =>
array.Select(x => x.Reverse().ToArray()).ToArray();
/// <summary>
/// Does a <see cref="Range"/> include a given int?
/// </summary>
/// <param name="range"></param>
/// <param name="i"></param>
/// <returns></returns>
public static bool Contains(this Range range, int i) =>
i >= range.Start.Value && i <= range.End.Value;
/// <summary>
/// Creates a new BigInteger from a binary (Base2) string
/// <see href="https://gist.github.com/mjs3339/73042bc0e717f98796ee9fa131e458d4" />
/// </summary>
public static BigInteger BigIntegerFromBinaryString(this string binaryValue)
{
BigInteger res = 0;
if (binaryValue.Count(b => b == '1') + binaryValue.Count(b => b == '0') != binaryValue.Length) return res;
foreach (var c in binaryValue)
{
res <<= 1;
res += c == '1' ? 1 : 0;
}
return res;
}
public static IEnumerable<IEnumerable<T>> Permute<T>(this IEnumerable<T> list)
{
var array = list as T[] ?? list.ToArray();
return array.Length == 1
? new[] { array }
: array.SelectMany(t => Permute(array.Where(x => !x!.Equals(t))), (v, p) => p.Prepend(v));
}
public static int Pow(this int i, int power)
{
var pow = (uint)power;
var ret = 1;
while (pow != 0)
{
if ((pow & 1) == 1) ret *= i;
i *= i;
pow >>= 1;
}
return ret;
}
public static IEnumerable<KeyValuePair<int, T>> Indexed<T>(this IEnumerable<T> source)
{
return source.Select((t, i) => new KeyValuePair<int, T>(i, t));
}
public static IEnumerable<KeyValuePair<TKey, TValue>> WhereValue<TKey, TValue>(
this IEnumerable<KeyValuePair<TKey, TValue>> source, Func<TValue, bool> func)
{
return source.Where(pair => func(pair.Value));
}
}

110
AOC.Common/Trees.cs Normal file
View File

@ -0,0 +1,110 @@
namespace AOC.Common;
public class DefaultDict<TKey, TValue> : Dictionary<TKey, TValue> where TKey : notnull
{
public TValue? DefaultValue;
public new TValue? this[TKey key]
{
get => TryGetValue(key, out var t) ? t : DefaultValue;
set
{
if (value != null) base[key] = value;
}
}
}
public class Tree<T>
{
public class Node
{
public Node? Parent { get; private set; }
public T Data { get; set; }
private List<Node?> Children { get; }
public Node? Left
{
get => Children.Count >= 1 ? Children[0] : null;
set
{
if (value != null) value.Parent = this;
if (Children.Count >= 1) Children[0] = value;
else Children.Add(value);
}
}
public Node? Right
{
get => Children.Count >= 2 ? Children[1] : null;
set
{
if (value != null) value.Parent = this;
if (Children.Count >= 2) Children[1] = value;
else if (Children.Count == 0) Children.Add(null);
Children.Add(value);
}
}
public Node(Node? parent, T data)
{
Parent = parent;
Data = data;
Children = new();
}
public int DistanceToParent(Node parent)
{
var current = this;
var dist = 0;
while (current != parent)
{
dist++;
current = current?.Parent;
}
return dist;
}
}
public Node Root { get; }
public Tree(Node root) => Root = root;
}
public class Dijkstra<TCell, TMid> where TCell : notnull
{
public Func<TCell, IEnumerable<TMid>>? Neighbors;
public Func<TMid, int>? Distance;
public Func<TCell, TMid, TCell>? Cell;
public int ComputeFind(TCell start, TCell target, Func<TCell, bool>? valid = null)
{
valid ??= _ => true;
var dist = new DefaultDict<TCell, int> { DefaultValue = int.MaxValue, [start] = 0 };
var seen = new HashSet<TCell>();
var queue = new PriorityQueue<TCell, int>();
queue.Enqueue(start, 0);
while (queue.Count > 0)
{
var cell = queue.Dequeue();
if (seen.Contains(cell)) continue;
var current = dist[cell];
if (Equals(cell, target)) return current;
seen.Add(cell);
foreach (var neighbor in Neighbors!(cell))
{
var other = Cell!(cell, neighbor);
if (!valid(other)) continue;
var weight = Distance!(neighbor);
if (!seen.Contains(other)) queue.Enqueue(other, current + weight);
if (current + weight < dist[other])
{
dist[other] = current + weight;
}
}
}
return -1;
}
}

17
AOC.Common/Util.cs Normal file
View File

@ -0,0 +1,17 @@
namespace AOC.Common;
public static class Util
{
public static long Lcm(long a, long b) => a * b / Gcd(a, b);
public static long Gcd(long a, long b)
{
while (true)
{
if (b == 0) return a;
var a1 = a;
a = b;
b = a1 % b;
}
}
}

32
AOC.Common/getday.sh Normal file
View File

@ -0,0 +1,32 @@
#!/bin/sh
. ./session_cookie.txt
if [ -z "$session" ]; then
printf "missing session cookie\n"
fi
if [ -z "$1" ]; then
printf "missing year\n"
exit 1
else
year="$1"
fi
if [ -z "$2" ]; then
printf "missing day\n"
exit 1
else
day="$2"
fi
curl -s https://adventofcode.com/"$year"/day/"$day"/input \
--cookie "session=$session" \
-o "$(printf "input%s/day%02d.in" "$year" "$day")"
class=$(printf "Day%02d.cs" "$day")
longDay=$(printf "%02d" "$day")
if [ ! -f "$class" ]; then
sed -e "s/Q/$day/g" -e "s/XX/$longDay/g" -e "s/YYYY/$year/g" DayXX.cs.txt >"$class"
fi

30
AOC.Test/AOC.Test.csproj Normal file
View File

@ -0,0 +1,30 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.10" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.10" />
<PackageReference Include="coverlet.collector" Version="3.1.2" />
</ItemGroup>
<ItemGroup>
<Using Include="AOC.Common" />
<Using Include="Microsoft.VisualStudio.TestTools.UnitTesting" />
<Using Include="System.Diagnostics" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\AOC2019\AOC2019.csproj" />
<ProjectReference Include="..\AOC2020\AOC2020.csproj" />
<ProjectReference Include="..\AOC2021\AOC2021.csproj" />
</ItemGroup>
</Project>

63
AOC.Test/Test2019.cs Normal file
View File

@ -0,0 +1,63 @@
using AOC2019;
namespace AOC.Test;
[TestClass]
public class Test2019
{
[DataTestMethod]
[DataRow(typeof(Day01), "3394106", "5088280")]
[DataRow(typeof(Day02), "3085697", "9425")]
[DataRow(typeof(Day03), "1195", "91518")]
[DataRow(typeof(Day04), "1079", "699")]
[DataRow(typeof(Day05), "7692125", "14340395")]
[DataRow(typeof(Day06), "145250", "274")]
[DataRow(typeof(Day07), "19650", "35961106")]
[DataRow(typeof(Day08), "2413",
"\nxxx xx xxx xxxx xxx \nx x x x x x x x x \nxxx x x x x xxx \nx x x xxx x x x \nx x x x x x x x \nxxx xx x xxxx xxx ")]
[DataRow(typeof(Day09), "3409270027", "82760")]
[DataRow(typeof(Day10), "260", "608")]
[DataRow(typeof(Day11), "2054",
"\n # # ### #### #### ## ## # # ### \n # # # # # # # # # # # # # \n ## # # # ### # # # #### ### \n # # ### # # #### # # # # # \n # # # # # # # # # # # # # # \n # # # # #### #### # # ## # # ### ")]
[DataRow(typeof(Day12), "10635", "583523031727256")]
// [DataRow(typeof(Day13), "361", "after 7133 moves, the score is: 17590")] // this one takes a LONG time to run
[DataRow(typeof(Day14), "397771", "3126714")]
[DataRow(typeof(Day15), "280", "400")]
[DataRow(typeof(Day16), "90744714", "82994322")]
[DataRow(typeof(Day17), "2804", "")]
//[DataRow(typeof(Day18), "", "")]
[DataRow(typeof(Day19), "114", "10671712")]
//[DataRow(typeof(Day20), "", "")]
//[DataRow(typeof(Day21), "", "")]
//[DataRow(typeof(Day22), "", "")]
[DataRow(typeof(Day23), "23626", "19019")]
//[DataRow(typeof(Day24), "", "")]
//[DataRow(typeof(Day25), "", "")]
public void TestAllDays(Type dayType, string part1, string part2)
{
var s = Stopwatch.StartNew();
var day = Activator.CreateInstance(dayType) as Day;
s.Stop();
Assert.IsNotNull(day, "failed to instantiate day object");
Assert.IsTrue(File.Exists(day!.FileName));
Console.Write($"Day {day.DayNumber,2}: {day.PuzzleName,-15} ");
Console.WriteLine($"{s.ScaleMilliseconds()} ms elapsed in constructor");
// part 1
s.Reset();
s.Start();
var part1Actual = day.Part1();
s.Stop();
Console.Write($"Part 1: {part1Actual,-15} ");
Console.WriteLine($"{s.ScaleMilliseconds()} ms elapsed");
Assert.AreEqual(part1, part1Actual, $"Incorrect answer for Day {day.DayNumber} Part1");
// part 2
s.Reset();
s.Start();
var part2Actual = day.Part2();
s.Stop();
Console.Write($"Part 2: {part2Actual,-15} ");
Console.WriteLine($"{s.ScaleMilliseconds()} ms elapsed");
Assert.AreEqual(part2, part2Actual, $"Incorrect answer for Day {day.DayNumber} Part2");
}
}

58
AOC.Test/Test2020.cs Normal file
View File

@ -0,0 +1,58 @@
using AOC2020;
namespace AOC.Test;
[TestClass]
public class Test2020
{
[DataTestMethod]
[DataRow(typeof(Day01), "751776", "42275090")]
[DataRow(typeof(Day02), "556", "605")]
[DataRow(typeof(Day03), "189", "1718180100")]
[DataRow(typeof(Day04), "247", "145")]
[DataRow(typeof(Day05), "878", "504")]
[DataRow(typeof(Day06), "6273", "3254")]
[DataRow(typeof(Day07), "169", "82372")]
[DataRow(typeof(Day08), "1654", "833")]
[DataRow(typeof(Day09), "138879426", "23761694")]
[DataRow(typeof(Day10), "1980", "4628074479616")]
[DataRow(typeof(Day11), "2303", "2057")]
[DataRow(typeof(Day12), "1710", "62045")]
[DataRow(typeof(Day13), "171", "539746751134958")]
[DataRow(typeof(Day14), "17481577045893", "4160009892257")]
[DataRow(typeof(Day15), "257", "8546398")]
[DataRow(typeof(Day16), "19093", "5311123569883")]
// [DataRow(typeof(Day17), "293", "1816")] // this one takes too long and i don't want to bother optimizing it
[DataRow(typeof(Day18), "12918250417632", "171259538712010")]
[DataRow(typeof(Day19), "160", "357")]
[DataRow(typeof(Day20), "21599955909991", "2495")]
[DataRow(typeof(Day21), "2436", "dhfng,pgblcd,xhkdc,ghlzj,dstct,nqbnmzx,ntggc,znrzgs")]
[DataRow(typeof(Day22), "32856", "33805")]
[DataRow(typeof(Day23), "36542897", "562136730660")]
[DataRow(typeof(Day24), "282", "3445")]
[DataRow(typeof(Day25), "11707042", "")]
public void CheckAllDays(Type dayType, string part1, string part2)
{
// create day instance
var s = Stopwatch.StartNew();
var day = Activator.CreateInstance(dayType) as Day;
s.Stop();
Assert.IsNotNull(day, "failed to create day object");
Console.WriteLine($"{s.ScaleMilliseconds()}ms elapsed in constructor");
// part 1
s.Reset();
s.Start();
var part1Actual = day!.Part1();
s.Stop();
Console.WriteLine($"{s.ScaleMilliseconds()}ms elapsed in part1");
Assert.AreEqual(part1, part1Actual, $"Incorrect answer for Day {day.DayNumber} Part1");
// part 2
s.Reset();
s.Start();
var part2Actual = day.Part2();
s.Stop();
Console.WriteLine($"{s.ScaleMilliseconds()}ms elapsed in part2");
Assert.AreEqual(part2, part2Actual, $"Incorrect answer for Day {day.DayNumber} Part2");
}
}

133
AOC.Test/Test2021.cs Normal file
View File

@ -0,0 +1,133 @@
using AOC2021;
namespace AOC.Test;
[TestClass]
public class Test2021
{
private const string Day13Actual = @"
";
private const string Day13Test = @"
";
[DataTestMethod]
[DataRow(typeof(Day01), "1616", "1645")]
[DataRow(typeof(Day02), "2272262", "2134882034")]
[DataRow(typeof(Day03), "3009600", "6940518")]
[DataRow(typeof(Day04), "8580", "9576")]
[DataRow(typeof(Day05), "7318", "19939")]
[DataRow(typeof(Day06), "362740", "1644874076764")]
[DataRow(typeof(Day07), "345035", "97038163")]
[DataRow(typeof(Day08), "362", "1020159")]
[DataRow(typeof(Day09), "478", "1327014")]
[DataRow(typeof(Day10), "288291", "820045242")]
[DataRow(typeof(Day11), "1613", "510")]
[DataRow(typeof(Day12), "4549", "120535")]
[DataRow(typeof(Day13), "837", Day13Actual)]
[DataRow(typeof(Day14), "5656", "12271437788530")]
[DataRow(typeof(Day15), "702", "2955")]
[DataRow(typeof(Day16), "852", "19348959966392")]
[DataRow(typeof(Day17), "12090", "5059")]
[DataRow(typeof(Day18), "4289", "4807")]
// [DataRow(typeof(Day19), "338", "9862")] // takes too long and i don't feel like optimizing
[DataRow(typeof(Day20), "5306", "17497")]
[DataRow(typeof(Day21), "512442", "346642902541848")]
[DataRow(typeof(Day22), "658691", "1228699515783640")]
[DataRow(typeof(Day23), "15365", "52055")]
[DataRow(typeof(Day24), "99299513899971", "93185111127911")]
[DataRow(typeof(Day25), "417", "")]
public void CheckAllDays(Type dayType, string part1, string part2)
{
var s = Stopwatch.StartNew();
var day = Activator.CreateInstance(dayType) as Day;
s.Stop();
Assert.IsNotNull(day, "failed to instantiate day object");
Assert.IsTrue(File.Exists(day.FileName));
Console.Write($"Day {day.DayNumber,2}: {day.PuzzleName,-25} ");
Console.WriteLine($"{s.ScaleMilliseconds()} ms elapsed in constructor");
// part 1
s.Reset();
s.Start();
var part1Actual = day.Part1().ToString();
s.Stop();
Console.Write($"Part 1: {part1Actual,-25} ");
Console.WriteLine($"{s.ScaleMilliseconds()} ms elapsed");
Assert.AreEqual(part1, part1Actual, $"Incorrect answer for Day {day.DayNumber} Part1");
// part 2
s.Reset();
s.Start();
var part2Actual = day.Part2().ToString();
s.Stop();
Console.Write($"Part 2: {part2Actual,-25} ");
Console.WriteLine($"{s.ScaleMilliseconds()} ms elapsed");
Assert.AreEqual(part2, part2Actual, $"Incorrect answer for Day {day.DayNumber} Part2");
}
[DataTestMethod]
[DataRow(typeof(Day01), "7", "5")]
[DataRow(typeof(Day02), "150", "900")]
[DataRow(typeof(Day03), "198", "230")]
[DataRow(typeof(Day04), "4512", "1924")]
[DataRow(typeof(Day05), "5", "12")]
[DataRow(typeof(Day06), "5934", "26984457539")]
[DataRow(typeof(Day07), "37", "168")]
[DataRow(typeof(Day08), "26", "61229")]
[DataRow(typeof(Day09), "15", "1134")]
[DataRow(typeof(Day10), "26397", "288957")]
[DataRow(typeof(Day11), "1656", "195")]
[DataRow(typeof(Day12), "226", "3509")]
[DataRow(typeof(Day13), "17", Day13Test)]
[DataRow(typeof(Day14), "1588", "2188189693529")]
[DataRow(typeof(Day15), "40", "315")]
[DataRow(typeof(Day16), "16", "15")]
[DataRow(typeof(Day17), "45", "112")]
[DataRow(typeof(Day18), "4140", "3993")]
[DataRow(typeof(Day19), "79", "3621")]
[DataRow(typeof(Day20), "35", "3351")]
[DataRow(typeof(Day21), "739785", "444356092776315")]
[DataRow(typeof(Day22), "590784", "39769202357779")]
[DataRow(typeof(Day23), "12521", "44169")]
[DataRow(typeof(Day25), "58", "")]
public void CheckTestInputs(Type dayType, string part1, string part2)
{
Day.UseTestInput = true;
var s = Stopwatch.StartNew();
var day = Activator.CreateInstance(dayType) as Day;
s.Stop();
Assert.IsNotNull(day, "failed to instantiate day object");
Assert.IsTrue(File.Exists(day.FileName));
Console.Write($"Day {day.DayNumber,2}: {day.PuzzleName,-25} ");
Console.WriteLine($"{s.ScaleMilliseconds()} ms elapsed in constructor");
// part 1
s.Reset();
s.Start();
var part1Actual = day.Part1().ToString();
s.Stop();
Console.Write($"Part 1: {part1Actual,-25} ");
Console.WriteLine($"{s.ScaleMilliseconds()} ms elapsed");
Assert.AreEqual(part1, part1Actual, $"Incorrect answer for Day {day.DayNumber} Part1");
// part 2
s.Reset();
s.Start();
var part2Actual = day.Part2().ToString();
s.Stop();
Console.Write($"Part 2: {part2Actual,-25} ");
Console.WriteLine($"{s.ScaleMilliseconds()} ms elapsed");
Assert.AreEqual(part2, part2Actual, $"Incorrect answer for Day {day.DayNumber} Part2");
}
}

29
AOC2019/AOC2019.csproj Normal file
View File

@ -0,0 +1,29 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<None Update="input2019\*.in">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Using Include="AOC.Common" />
<Using Include="System.Collections.Generic" />
<Using Include="System.Collections.Immutable" />
<Using Include="System.Reflection" />
<Using Include="System.Text" />
<Using Include="System.Text.RegularExpressions" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\AOC.Common\AOC.Common.csproj" />
</ItemGroup>
</Project>

39
AOC2019/Day01.cs Normal file
View File

@ -0,0 +1,39 @@
namespace AOC2019;
public sealed class Day01 : Day
{
private readonly IEnumerable<int> _masses;
public Day01() : base(1, "The Tyranny of the Rocket Equation")
{
_masses = Input.Select(int.Parse);
}
private static int FuelCost(int weight)
{
return weight / 3 - 2;
}
private static int FullCost(int cost)
{
int total = 0, newCost, tmp = cost;
while ((newCost = FuelCost(tmp)) >= 0)
{
total += newCost;
tmp = newCost;
}
return total;
}
public override string Part1()
{
return $"{_masses.Sum(FuelCost)}";
}
public override string Part2()
{
return $"{_masses.Sum(FullCost)}";
}
}

43
AOC2019/Day02.cs Normal file
View File

@ -0,0 +1,43 @@
namespace AOC2019;
public sealed class Day02 : Day
{
private readonly IEnumerable<int> _input;
public Day02() : base(2, "1202 Program Alarm")
{
_input = Input.First().Split(',').Select(int.Parse);
}
private int RunIntCode(int noun, int verb)
{
var v = _input.ToList();
v[1] = noun;
v[2] = verb;
for (var i = 0; v[i] != 99; i += 4)
v[v[i + 3]] = v[i] switch
{
1 => v[v[i + 1]] + v[v[i + 2]],
2 => v[v[i + 1]] * v[v[i + 2]],
_ => throw new ArgumentOutOfRangeException(nameof(verb))
};
return v[0];
}
public override string Part1()
{
return $"{RunIntCode(12, 2)}";
}
public override string Part2()
{
for (var i = 0; i < 100; i++)
for (var j = 0; j < 100; j++)
if (RunIntCode(i, j) == 19690720)
return $"{100 * i + j}";
return string.Empty;
}
}

52
AOC2019/Day03.cs Normal file
View File

@ -0,0 +1,52 @@
namespace AOC2019;
public sealed class Day03 : Day
{
private readonly IEnumerable<(int, int)> _intersections;
private readonly List<Dictionary<(int, int), int>> _wires;
public Day03() : base(3, "Crossed Wires")
{
_wires = Input.Select(ParseWire).ToList();
_intersections = _wires[0].Keys.Intersect(_wires[1].Keys);
}
public override string Part1()
{
return $"{_intersections.Min(x => Math.Abs(x.Item1) + Math.Abs(x.Item2))}";
}
public override string Part2()
{
// add 2 to count (0, 0) on both lines
return $"{_intersections.Min(x => _wires[0][x] + _wires[1][x]) + 2}";
}
private static Dictionary<(int, int), int> ParseWire(string line)
{
var r = new Dictionary<(int, int), int>();
int x = 0, y = 0, c = 0;
foreach (var step in line.Split(','))
{
int i = 0, d = int.Parse(step[1..]);
switch (step[0])
{
case 'U':
for (; i < d; i++) r.TryAdd((x, ++y), c++);
break;
case 'D':
for (; i < d; i++) r.TryAdd((x, --y), c++);
break;
case 'R':
for (; i < d; i++) r.TryAdd((++x, y), c++);
break;
case 'L':
for (; i < d; i++) r.TryAdd((--x, y), c++);
break;
}
}
return r;
}
}

39
AOC2019/Day04.cs Normal file
View File

@ -0,0 +1,39 @@
namespace AOC2019;
public sealed class Day04 : Day
{
private readonly int _start, _end;
public Day04() : base(4, "Secure Container")
{
var range = Input.First().Split('-').Select(int.Parse).ToList();
_start = range[0];
_end = range[1];
}
private bool IsValid(int i)
{
var prev = 0;
var hasDup = false;
foreach (var curr in i.ToString().Select(c => c - '0'))
{
if (curr < prev) return false;
if (curr == prev) hasDup = true;
prev = curr;
}
return i >= _start && i <= _end && hasDup;
}
private bool HasOnePair(int i)
{
var s = i.ToString();
return IsValid(i) && s.Select(c => s.Count(j => j == c)).Any(c => c == 2);
}
public override string Part1() =>
$"{Enumerable.Range(_start, _end).Count(IsValid)}";
public override string Part2() =>
$"{Enumerable.Range(_start, _end).Count(HasOnePair)}";
}

73
AOC2019/Day05.cs Normal file
View File

@ -0,0 +1,73 @@
namespace AOC2019;
public sealed class Day05 : Day
{
private readonly IEnumerable<int> _tape;
private int _output;
public Day05() : base(5, "Sunny with a Chance of Asteroids")
{
_tape = Input.First().Split(',').Select(int.Parse);
}
private void RunIntCode(IList<int> v, int input)
{
var i = 0;
while (i < v.Count && v[i] != 99)
{
int Val(int mode, int val)
{
return mode != 0 ? val : v[val];
}
var mode1 = v[i] / 100 % 10;
var mode2 = v[i] / 1000;
switch (v[i] % 100)
{
case 1:
v[v[i + 3]] = Val(mode1, v[i + 1]) + Val(mode2, v[i + 2]);
i += 4;
break;
case 2:
v[v[i + 3]] = Val(mode1, v[i + 1]) * Val(mode2, v[i + 2]);
i += 4;
break;
case 3:
v[v[i + 1]] = input;
i += 2;
break;
case 4:
_output = Val(mode1, v[i + 1]);
i += 2;
break;
case 5:
i = Val(mode1, v[i + 1]) == 0 ? i + 3 : Val(mode2, v[i + 2]);
break;
case 6:
i = Val(mode1, v[i + 1]) != 0 ? i + 3 : Val(mode2, v[i + 2]);
break;
case 7:
v[v[i + 3]] = Val(mode1, v[i + 1]) < Val(mode2, v[i + 2]) ? 1 : 0;
i += 4;
break;
case 8:
v[v[i + 3]] = Val(mode1, v[i + 1]) == Val(mode2, v[i + 2]) ? 1 : 0;
i += 4;
break;
}
}
}
public override string Part1()
{
RunIntCode(_tape.ToList(), 1);
return $"{_output}";
}
public override string Part2()
{
RunIntCode(_tape.ToList(), 5);
return $"{_output}";
}
}

32
AOC2019/Day06.cs Normal file
View File

@ -0,0 +1,32 @@
namespace AOC2019;
public sealed class Day06 : Day
{
private readonly Dictionary<string, string> _input;
public Day06() : base(6, "Universal Orbit Map")
{
_input = Input.ToDictionary(i => i.Split(')')[1], i => i.Split(')')[0]);
}
private List<string> GetParents(string obj)
{
var res = new List<string>();
for (var curr = obj; curr != "COM"; curr = _input[curr])
res.Add(curr);
res.Add("COM");
return res;
}
public override string Part1() =>
$"{_input.Keys.Sum(o => GetParents(o).Count - 1)}";
public override string Part2()
{
var you = GetParents("YOU");
var san = GetParents("SAN");
var common = 1;
for (; you[^common] == san[^common]; common++) ;
return $"{you.Count + san.Count - common * 2}";
}
}

62
AOC2019/Day07.cs Normal file
View File

@ -0,0 +1,62 @@
namespace AOC2019;
public sealed class Day07 : Day
{
private readonly IntCodeVM[] _amplifiers = new IntCodeVM[5];
public Day07() : base(7, "Amplification Circuit")
{
for (var i = 0; i < 5; i++) _amplifiers[i] = new(Input.First());
}
public override string Part1()
{
var largest = 0L;
foreach (var phaseSeq in Enumerable.Range(0, 5).Permute())
{
var i = 0L;
foreach (var (vm, phase) in _amplifiers.Zip(phaseSeq))
{
vm.Reset();
vm.Run(phase, i);
i = vm.Result;
}
if (i > largest)
largest = i;
}
return $"{largest}";
}
public override string Part2()
{
var largest = 0L;
foreach (var phaseSeq in Enumerable.Range(5, 5).Permute())
{
var i = 0L;
foreach (var (vm, phase) in _amplifiers.Zip(phaseSeq))
{
vm.Reset();
vm.AddInput(phase);
}
var vms = new Queue<IntCodeVM>(_amplifiers);
while (vms.Count > 0)
{
var vm = vms.Dequeue();
var haltType = vm.Run(i);
if (haltType == IntCodeVM.HaltType.Waiting)
vms.Enqueue(vm);
i = vm.Result;
}
if (i > largest)
largest = i;
}
return $"{largest}";
}
}

32
AOC2019/Day08.cs Normal file
View File

@ -0,0 +1,32 @@
namespace AOC2019;
public sealed class Day08 : Day
{
private readonly List<List<char>> _photo;
public Day08() : base(8, "Space Image Format")
{
_photo = Input.First().Chunk(25 * 6).Select(s => s.ToList()).ToList();
}
public override string Part1()
{
var l = _photo.OrderBy(layer => layer.Count(pixel => pixel == '0')).First();
return $"{l.Count(p => p == '1') * l.Count(p => p == '2')}";
}
public override string Part2()
{
return "\n" + Enumerable.Range(0, 25 * 6)
.Select(p => Enumerable.Range(0, _photo.Count)
.Select(l => _photo[l][p])
.Aggregate('2', (acc, next) =>
acc != '2' ? acc : next == '0' ? ' ' : next
)
)
.ToDelimitedString()
.Chunk(25)
.ToDelimitedString("\n")
.Replace('1', 'x');
}
}

25
AOC2019/Day09.cs Normal file
View File

@ -0,0 +1,25 @@
namespace AOC2019;
public sealed class Day09 : Day
{
private readonly IntCodeVM _vm;
public Day09() : base(9, "Sensor Boost")
{
_vm = new(Input.First());
}
public override string Part1()
{
_vm.Reset();
_vm.Run(1);
return $"{_vm.Output.ToDelimitedString(",")}";
}
public override string Part2()
{
_vm.Reset();
_vm.Run(2);
return $"{_vm.Output.ToDelimitedString(",")}";
}
}

67
AOC2019/Day10.cs Normal file
View File

@ -0,0 +1,67 @@
namespace AOC2019;
public sealed class Day10 : Day
{
private readonly HashSet<(int x, int y)> _asteroids;
private (int x, int y) _best = (x: -1, y: -1);
private int _bestCanSee;
public Day10() : base(10, "Monitoring Station")
{
_asteroids = Input
.Select((r, y) => r.Select((c, x) => (x, y, isAsteroid: c == '#')).ToArray())
.SelectMany(r => r)
.Where(a => a.isAsteroid)
.Select(a => (a.x, a.y))
.ToHashSet();
}
public override string Part1()
{
foreach (var asteroid in _asteroids)
{
var canSee = _asteroids
.Except(new[] { asteroid })
.Select(a => (x: a.x - asteroid.x, y: a.y - asteroid.y))
.GroupBy(a => Math.Atan2(a.y, a.x))
.Count();
if (canSee > _bestCanSee)
{
_best = asteroid;
_bestCanSee = canSee;
}
}
return $"{_bestCanSee}";
}
public override string Part2()
{
static IEnumerable<(int x, int y, double angle, double dist)> GetValue(
Queue<(int x, int y, double angle, double dist)> q)
{
if (q.Count > 0) yield return q.Dequeue();
}
return _asteroids
.Where(a => a != _best)
.Select(a =>
{
var xDist = a.x - _best.x;
var yDist = a.y - _best.y;
var angle = Math.Atan2(xDist, yDist);
return (a.x, a.y, angle, dist: Math.Sqrt(xDist * xDist + yDist * yDist));
})
.ToLookup(a => a.angle)
.OrderByDescending(a => a.Key)
.Select(a => new Queue<(int x, int y, double angle, double dist)>(a.OrderBy(b => b.dist)))
.Repeat()
.SelectMany(GetValue)
.Skip(199)
.Take(1)
.Select(a => a.x * 100 + a.y)
.Single()
.ToString();
}
}

96
AOC2019/Day11.cs Normal file
View File

@ -0,0 +1,96 @@
namespace AOC2019;
public sealed class Day11 : Day
{
private readonly IntCodeVM _vm;
private Direction _heading;
private long _x, _y;
public Day11() : base(11, "Space Police")
{
_vm = new(Input.First());
}
private void Move()
{
switch (_heading)
{
case Direction.Up:
_y++;
break;
case Direction.Down:
_y--;
break;
case Direction.Left:
_x--;
break;
case Direction.Right:
_x++;
break;
}
;
}
private void Turn(long direction)
{
_heading = _heading switch
{
Direction.Up => direction == 0 ? Direction.Left : Direction.Right,
Direction.Down => direction == 0 ? Direction.Right : Direction.Left,
Direction.Left => direction == 0 ? Direction.Down : Direction.Up,
Direction.Right => direction == 0 ? Direction.Up : Direction.Down,
_ => _heading
};
Move();
}
private Dictionary<(long x, long y), long> PaintShip(int initialVal)
{
var map = new Dictionary<(long, long), long>();
_vm.Reset();
_heading = Direction.Up;
_x = 0;
_y = 0;
map[(_x, _y)] = initialVal;
var haltType = IntCodeVM.HaltType.Waiting;
while (haltType == IntCodeVM.HaltType.Waiting)
{
haltType = _vm.Run(map.GetValueOrDefault((x: _x, y: _y)));
map[(_x, _y)] = _vm.Result;
Turn(_vm.Result);
}
return map;
}
public override string Part1() => $"{PaintShip(0).Count}";
public override string Part2()
{
var map = PaintShip(1);
var minX = (int)map.Keys.Select(i => i.x).Min();
var maxX = (int)map.Keys.Select(i => i.x).Max();
var minY = (int)map.Keys.Select(i => i.y).Min();
var maxY = (int)map.Keys.Select(i => i.y).Max();
return "\n" + Enumerable.Range(minY, maxY - minY + 1)
.Select(j =>
Enumerable.Range(minX, maxX - minX + 1)
.Select(i => map.GetValueOrDefault((x: i, y: j)) == 0 ? ' ' : '#')
.ToDelimitedString()
)
.Reverse()
.ToDelimitedString("\n");
}
private enum Direction
{
Up,
Down,
Left,
Right
}
}

112
AOC2019/Day12.cs Normal file
View File

@ -0,0 +1,112 @@
namespace AOC2019;
public sealed class Day12 : Day
{
private readonly List<Position> _moons;
private int _step;
public Day12() : base(12, "The N-Body Problem")
{
_moons = Input
.Select(moon =>
moon
.TrimStart('<')
.TrimEnd('>')
.Split(",")
.Select(val => int.Parse(val.Split("=").Last()))
)
.Select(moon => new Position(moon.ToList()))
.ToList();
foreach (var moon in _moons)
moon.SetSiblings(_moons);
}
private void Step()
{
foreach (var moon in _moons)
moon.Gravitate();
foreach (var moon in _moons)
moon.Move();
_step++;
}
public override string Part1()
{
while (_step < 1000)
Step();
return $"{_moons.Sum(p => p.TotalEnergy)}";
}
public override string Part2()
{
int cycleX = 0, cycleY = 0, cycleZ = 0;
while (cycleX == 0 || cycleY == 0 || cycleZ == 0)
{
Step();
if (cycleX == 0 && _moons.All(m => m.Dx == 0)) cycleX = _step * 2;
if (cycleY == 0 && _moons.All(m => m.Dy == 0)) cycleY = _step * 2;
if (cycleZ == 0 && _moons.All(m => m.Dz == 0)) cycleZ = _step * 2;
}
return $"{Util.Lcm(cycleX, Util.Lcm(cycleY, cycleZ))}";
}
public class Position
{
public int Dx, Dy, Dz;
private List<Position> _siblings;
private int _x, _y, _z;
public Position(IList<int> moon)
{
_x = moon[0];
_y = moon[1];
_z = moon[2];
Dx = 0;
Dy = 0;
Dz = 0;
_siblings = new();
}
private int KineticEnergy =>
Math.Abs(_x) + Math.Abs(_y) + Math.Abs(_z);
private int PotentialEnergy =>
Math.Abs(Dx) + Math.Abs(Dy) + Math.Abs(Dz);
internal int TotalEnergy =>
KineticEnergy * PotentialEnergy;
public void SetSiblings(IEnumerable<Position> positions)
{
_siblings = positions.Where(p => p != this).ToList();
}
public override string ToString()
{
return $"pos=<x={_x}, y={_y}, z={_z}> vel=<x={Dx}, y={Dy}, z={Dz}>";
}
internal void Gravitate()
{
foreach (var m in _siblings)
{
if (_x != m._x) Dx += _x > m._x ? -1 : 1;
if (_y != m._y) Dy += _y > m._y ? -1 : 1;
if (_z != m._z) Dz += _z > m._z ? -1 : 1;
}
}
internal void Move()
{
_x += Dx;
_y += Dy;
_z += Dz;
}
}
}

80
AOC2019/Day13.cs Normal file
View File

@ -0,0 +1,80 @@
namespace AOC2019;
public sealed class Day13 : Day
{
private readonly Dictionary<(int x, int y), int> _board;
private readonly IntCodeVM _vm;
public Day13() : base(13, "Care Package")
{
_vm = new(Input.First());
_board = new Dictionary<(int, int), int>();
}
private void UpdateTiles(IEnumerable<long> queue)
{
var input = queue.Select(i => (int)i).ToList();
for (var i = 0; i < input.Count - 2; i += 3)
{
var x = input[i];
var y = input[i + 1];
var val = input[i + 2];
if (_board.ContainsKey((x, y)))
_board[(x, y)] = val;
else
_board.Add((x, y), val);
}
}
private void PrintBoard()
{
foreach (var ((x, y), value) in _board)
{
if (x < 0 || y < 0) continue;
Console.SetCursorPosition(x, y);
Console.Write(value switch
{
0 => " ",
1 => "|",
2 => "B",
3 => "_",
4 => ".",
_ => value
});
}
}
public override string Part1()
{
_vm.Reset();
_vm.Run();
return $"{_vm.Output.Where((v, i) => (i + 1) % 3 == 0 && v == 2).Count()}";
}
public override string Part2()
{
_vm.Reset();
_vm.Memory[0] = 2;
var printBoard = false;
var gameTicks = 0;
if (printBoard) Console.Clear();
var haltType = IntCodeVM.HaltType.Waiting;
while (haltType == IntCodeVM.HaltType.Waiting)
{
haltType = _vm.Run();
UpdateTiles(_vm.Output);
var (ball, _) = _board.First(t => t.Value == 4).Key;
var (paddle, _) = _board.First(t => t.Value == 3).Key;
_vm.AddInput(ball > paddle ? 1 : ball < paddle ? -1 : 0);
gameTicks++;
if (printBoard) PrintBoard();
}
return $"after {gameTicks} moves, the score is: {_board[(-1, 0)]}";
}
}

106
AOC2019/Day14.cs Normal file
View File

@ -0,0 +1,106 @@
namespace AOC2019;
public sealed class Day14 : Day
{
private readonly Dictionary<string, Reaction> _reactions;
private Dictionary<string, long> _available;
public Day14() : base(14, "Space Stoichiometry")
{
_reactions = Input
.Select(Reaction.Parse)
.ToDictionary(r => r.Product.Name);
_available = new();
}
private bool Consume(string chem, long quantity)
{
if (quantity <= 0)
throw new ArgumentOutOfRangeException(nameof(quantity));
if (!_available.ContainsKey(chem))
_available[chem] = 0;
if (_available[chem] < quantity && !Produce(chem, quantity - _available[chem]))
return false;
_available[chem] -= quantity;
return true;
}
private bool Produce(string chem, long quantity)
{
if (chem == "ORE")
return false;
var reaction = _reactions[chem];
var reactionCount = (long)Math.Ceiling((double)quantity / reaction.Product.Quantity);
if (reaction.Reactants.Any(reactant => !Consume(reactant.Name, reactionCount * reactant.Quantity)))
return false;
_available[chem] = _available.GetValueOrDefault(chem) + reactionCount * reaction.Product.Quantity;
return true;
}
public override string Part1()
{
_available = new() { { "ORE", long.MaxValue } };
Consume("FUEL", 1);
return $"{long.MaxValue - _available["ORE"]}";
}
public override string Part2()
{
const long capacity = 1_000_000_000_000;
_available = new() { { "ORE", capacity } };
Consume("FUEL", 1);
var oreConsumed = capacity - _available["ORE"];
while (Produce("FUEL", Math.Max(1, _available["ORE"] / oreConsumed)))
{
}
return $"{_available["FUEL"] + 1}";
}
private struct Component
{
public string Name { get; init; }
public int Quantity { get; init; }
}
private class Reaction
{
public readonly Component Product;
public readonly Component[] Reactants;
private Reaction(Component[] reactants, Component product)
{
Reactants = reactants;
Product = product;
}
public static Reaction Parse(string s)
{
var ss = s.Split(new[] { ", ", " => " }, StringSplitOptions.None);
return new(
ss.Take(ss.Length - 1).Select(ParseComponent).ToArray(),
ParseComponent(ss[^1])
);
static Component ParseComponent(string s)
{
var spl = s.Split(' ', 2);
return new()
{
Quantity = int.Parse(spl[0]),
Name = spl[1]
};
}
}
}
}

213
AOC2019/Day15.cs Normal file
View File

@ -0,0 +1,213 @@
namespace AOC2019;
public sealed class Day15 : Day
{
private readonly bool _verbose = false;
private readonly IntCodeVM _vm;
public Day15() : base(15, "Oxygen System")
{
_vm = new(Input.First());
}
public override string Part1()
{
_vm.Reset();
var currentLocation = new Location(0, 0);
var halt = IntCodeVM.HaltType.Waiting;
while (halt == IntCodeVM.HaltType.Waiting)
{
var direction = currentLocation!.NextDirection();
if (direction <= 4)
{
var (x, y) = currentLocation.Neighbor(direction);
if (Location.GetLocation(x, y) == null)
{
halt = _vm.Run(direction);
switch (_vm.Result)
{
case Location.Wall:
_ = new Location(x, y, Location.Opposites[direction], Location.Wall);
break;
case Location.Empty:
currentLocation = new(x, y, Location.Opposites[direction]);
break;
case Location.System:
currentLocation = new(x, y, Location.Opposites[direction], Location.System);
break;
default:
throw new($"Unknown IntCodeVM response: {_vm.Result}");
}
}
}
else
{
direction = currentLocation.PreviousDirection;
if (direction > 0)
{
halt = _vm.Run(direction);
currentLocation = _vm.Result switch
{
Location.Empty or Location.System => Location.GetLocation(currentLocation.Neighbor(direction)),
_ => throw new($"Unknown or unexpected response for previous room: {_vm.Result}")
};
}
else
{
if (_verbose)
{
// find extents of canvas
int xMin, xMax, yMin, yMax;
xMin = yMin = int.MaxValue;
xMax = yMax = int.MinValue;
foreach (var (x, y) in Location.AllLocations.Keys)
{
if (x < xMin) xMin = x;
if (x > xMax) xMax = x;
if (y < yMin) yMin = y;
if (y > yMax) yMax = y;
}
Console.WriteLine($"Canvas extends from ({xMin}, {yMin}) to ({xMax}, {yMax})");
// print board
for (var y = yMin; y <= yMax; y++)
{
var line = "";
for (var x = xMin; x <= xMax; x++)
if (Location.AllLocations.ContainsKey((x, y)))
line += Location.AllLocations[(x, y)].Image();
else
line += "@";
Console.WriteLine(line);
}
}
currentLocation = Location.OxygenLocation;
var distance = 0;
while (currentLocation?.PreviousDirection != 0)
{
distance++;
currentLocation = Location.GetLocation(currentLocation!.PreviousLocation());
}
return $"{distance}";
}
}
}
return "";
}
public override string Part2()
{
var changed = true;
while (changed)
{
changed = false;
foreach (var location in Location.AllLocations.Values)
changed = location.UpdateDistanceToOxygenSystem() || changed;
}
return Location.AllLocations.Values
.Where(l => !l.IsWall)
.Max(l => l.DistanceToOxygenSystem)
.ToString();
}
private class Location
{
public const int Wall = 0;
public const int Empty = 1;
public const int System = 2;
private static readonly int[] Dx = { 0, 0, 0, 1, -1 };
private static readonly int[] Dy = { 0, 1, -1, 0, 0 };
public static readonly int[] Opposites = { 0, 2, 1, 4, 3 };
public static readonly Dictionary<(int x, int y), Location> AllLocations = new();
private readonly int _currentType;
public int DistanceToOxygenSystem = int.MaxValue - 1;
private int _searchDirection = 1;
public Location(int x, int y, int prev = 0, int type = Empty)
{
PreviousDirection = prev;
_currentType = type;
X = x;
Y = y;
if (type == System)
{
OxygenLocation = this;
DistanceToOxygenSystem = 0;
// Console.WriteLine($"Found Oxygen System at ({x}, {y})");
}
AllLocations.Add((x, y), this);
}
public static Location? OxygenLocation { get; private set; }
public int PreviousDirection { get; }
private int X { get; }
private int Y { get; }
public bool IsWall => _currentType == Wall;
public string Image()
{
return _currentType switch
{
Wall => "\u2587",
Empty => X == 0 && Y == 0 ? "S" : " ",
System => "O",
_ => "?"
};
}
public bool UpdateDistanceToOxygenSystem()
{
if (_currentType != Empty) return false;
foreach (var direction in Enumerable.Range(1, 4))
{
var distance = GetLocation(Neighbor(direction))?.DistanceToOxygenSystem ?? int.MaxValue;
if (distance + 1 < DistanceToOxygenSystem)
{
DistanceToOxygenSystem = distance + 1;
return true;
}
}
return false;
}
public (int, int) Neighbor(int direction)
{
return (X + Dx[direction], Y + Dy[direction]);
}
public (int, int) PreviousLocation()
{
return Neighbor(PreviousDirection);
}
public int NextDirection()
{
return _searchDirection++;
}
public static Location? GetLocation(int x, int y)
{
return AllLocations.ContainsKey((x, y)) ? AllLocations[(x, y)] : null;
}
public static Location? GetLocation((int x, int y) coords)
{
return GetLocation(coords.x, coords.y);
}
}
}

58
AOC2019/Day16.cs Normal file
View File

@ -0,0 +1,58 @@
namespace AOC2019;
public sealed class Day16 : Day
{
private static readonly int[] BasePattern = { 0, 1, 0, -1 };
private readonly int[] _initialList;
public Day16() : base(16, "Flawed Frequency Transmission")
{
_initialList = Input.First().Select(c => int.Parse($"{c}")).ToArray();
}
public override string Part1()
{
const int phaseCount = 100;
var signal0 = _initialList.ToArray();
var signal1 = new int[signal0.Length];
for (var i = 0; i < phaseCount; i++)
CalculateSignal(i % 2 == 0 ? signal0 : signal1, i % 2 == 0 ? signal1 : signal0);
return new(
signal0.Take(8).Select(c => (char)(c + '0'))
.ToArray());
}
public override string Part2()
{
const int phaseCount = 100;
var messageOffset = _initialList.Take(7).Aggregate((n, i) => n * 10 + i);
var signal = _initialList.Repeat(10_000).Skip(messageOffset).ToArray();
for (var p = 0; p < phaseCount; p++)
{
signal[^1] %= 10;
for (var i = signal.Length - 2; i >= 0; i--)
signal[i] = (signal[i + 1] + signal[i]) % 10;
}
return new(signal.Take(8).Select(c => (char)(c + '0')).ToArray());
}
private static void CalculateSignal(IReadOnlyList<int> input, IList<int> output)
{
for (var outputIndex = 0; outputIndex < output.Count; outputIndex++)
output[outputIndex] =
Math.Abs(PatternValues(outputIndex, input.Count).Select((pv, i) => pv * input[i] % 10).Sum()) % 10;
}
private static IEnumerable<int> PatternValues(int index, int count)
{
return BasePattern
.SelectMany(v => Enumerable.Repeat(v, index + 1))
.Repeat(int.MaxValue)
.Skip(1)
.Take(count);
}
}

46
AOC2019/Day17.cs Normal file
View File

@ -0,0 +1,46 @@
namespace AOC2019;
public sealed class Day17 : Day
{
private readonly IntCodeVM _vm;
public Day17() : base(17, "Set and Forget")
{
_vm = new(Input.First());
}
public override string Part1()
{
_vm.Reset();
_vm.Run();
var sb = new StringBuilder();
while (_vm.Output.Any())
sb.Append((char)_vm.Result);
// Console.Write(sb);
var grid = sb.ToString().Trim().Split().Select(s => s.ToCharArray()).ToArray();
var sum = 0;
for (var y = 1; y < grid.Length - 1; y++)
for (var x = 1; x < grid[y].Length - 1; x++)
if (grid[y][x] == '#' &&
grid[y - 1][x] == '#' &&
grid[y + 1][x] == '#' &&
grid[y][x - 1] == '#' &&
grid[y][x + 1] == '#')
sum += x * y;
return $"{sum}";
}
public override string Part2()
{
//vm.Reset();
//vm.memory[0] = 2;
//var halt = IntCodeVM.HaltType.Waiting;
//while (halt == IntCodeVM.HaltType.Waiting)
//{
// halt = vm.Run();
//}
return "";
}
}

18
AOC2019/Day18.cs Normal file
View File

@ -0,0 +1,18 @@
namespace AOC2019;
public sealed class Day18 : Day
{
public Day18() : base(18, "Many-Worlds Interpretation")
{
}
public override string Part1()
{
return "";
}
public override string Part2()
{
return "";
}
}

45
AOC2019/Day19.cs Normal file
View File

@ -0,0 +1,45 @@
namespace AOC2019;
public sealed class Day19 : Day
{
private readonly long[,] _grid;
private readonly IntCodeVM _vm;
public Day19() : base(19, "Tractor Beam")
{
_vm = new(Input.First());
_grid = new long[50, 50];
}
public override string Part1()
{
for (var x = 0; x < 50; x++)
for (var y = 0; y < 50; y++)
{
_vm.Reset();
_vm.Run(x, y);
_grid[x, y] = _vm.Result;
}
return $"{_grid.Cast<long>().Sum()}";
}
public override string Part2()
{
for (int x = 101, y = 0; ; x++)
{
while (true)
{
_vm.Reset();
_vm.Run(x, y);
if (_vm.Result == 1) break;
y++;
}
_vm.Reset();
_vm.Run(x - 99, y + 99);
if (_vm.Result == 1)
return $"{(x - 99) * 1e4 + y}";
}
}
}

18
AOC2019/Day20.cs Normal file
View File

@ -0,0 +1,18 @@
namespace AOC2019;
public sealed class Day20 : Day
{
public Day20() : base(20, "Donut Maze")
{
}
public override string Part1()
{
return "";
}
public override string Part2()
{
return "";
}
}

23
AOC2019/Day21.cs Normal file
View File

@ -0,0 +1,23 @@
namespace AOC2019;
public sealed class Day21 : Day
{
private readonly IntCodeVM _vm;
public Day21() : base(21, "Springdroid Adventure")
{
_vm = new(Input.First());
}
public override string Part1()
{
_vm.Reset();
var halt = _vm.Run();
return "";
}
public override string Part2()
{
return "";
}
}

18
AOC2019/Day22.cs Normal file
View File

@ -0,0 +1,18 @@
namespace AOC2019;
public sealed class Day22 : Day
{
public Day22() : base(22, "Slam Shuffle")
{
}
public override string Part1()
{
return "";
}
public override string Part2()
{
return "";
}
}

86
AOC2019/Day23.cs Normal file
View File

@ -0,0 +1,86 @@
namespace AOC2019;
public sealed class Day23 : Day
{
public Day23() : base(23, "Category Six")
{
}
public override string Part1()
{
var vms = Enumerable.Range(0, 50)
.Select((_, i) =>
{
var vm = new IntCodeVM(Input.First());
vm.Run(i);
return vm;
}).ToList();
while (true)
foreach (var vm in vms)
{
while (vm.Output.Any())
{
var destination = (int)vm.Result;
var x = vm.Result;
var y = vm.Result;
if (destination == 255) return $"{y}";
vms[destination].Run(x, y);
}
vm.Run(-1);
}
}
public override string Part2()
{
var vms = Enumerable.Range(0, 50)
.Select((_, i) =>
{
var vm = new IntCodeVM(Input.First());
vm.Run(i);
return vm;
}).ToList();
long natX = 0, natY = 0, lastYSent = -1;
while (true)
{
var numIdle = 0;
foreach (var vm in vms)
{
var isIdle = true;
while (vm.Output.Any())
{
var destination = (int)vm.Result;
var x = vm.Result;
var y = vm.Result;
if (destination == 255)
{
natX = x;
natY = y;
}
else
{
vms[destination].Run(x, y);
}
isIdle = false;
}
vm.Run(-1);
if (isIdle) numIdle++;
}
if (numIdle == 50)
{
if (natY == lastYSent) return $"{natY}";
vms[0].Run(natX, natY);
lastYSent = natY;
}
}
}
}

18
AOC2019/Day24.cs Normal file
View File

@ -0,0 +1,18 @@
namespace AOC2019;
public sealed class Day24 : Day
{
public Day24() : base(24, "Planet of Discord")
{
}
public override string Part1()
{
return "";
}
public override string Part2()
{
return "";
}
}

18
AOC2019/Day25.cs Normal file
View File

@ -0,0 +1,18 @@
namespace AOC2019;
public sealed class Day25 : Day
{
public Day25() : base(25, "Cryostasis")
{
}
public override string Part1()
{
return "";
}
public override string Part2()
{
return "";
}
}

157
AOC2019/IntCodeVM.cs Normal file
View File

@ -0,0 +1,157 @@
namespace AOC2019;
public class IntCodeVM
{
public enum HaltType
{
Terminate,
Waiting
}
private readonly Queue<long> _input;
public readonly Queue<long> Output;
private readonly long[] _program;
private long _i;
public long[] Memory;
private long _relativeBase;
public IntCodeVM(string tape)
{
_i = 0;
_relativeBase = 0;
_program = tape.Split(',').Select(long.Parse).ToArray();
Memory = _program;
_input = new();
Output = new();
}
public long Result => Output.Dequeue();
public void Reset()
{
_i = 0;
_relativeBase = 0;
Memory = _program;
_input.Clear();
Output.Clear();
}
public void AddInput(params long[] values)
{
foreach (var v in values) AddInput(v);
}
public void AddInput(long value)
{
_input.Enqueue(value);
}
private long MemGet(long addr)
{
return addr < Memory.Length ? Memory[addr] : 0;
}
private void MemSet(long addr, long value)
{
if (addr < 0) addr = 0;
if (addr >= Memory.Length)
Array.Resize(ref Memory, (int)addr + 1);
Memory[addr] = value;
}
private long Mode(long idx)
{
var mode = MemGet(_i) / 100;
for (var s = 1; s < idx; s++)
mode /= 10;
return mode % 10;
}
private long Get(long idx)
{
var param = MemGet(_i + idx);
return Mode(idx) switch
{
0 => MemGet(param),
1 => param,
2 => MemGet(_relativeBase + param),
_ => throw new("invalid parameter mode")
};
}
private void Set(long idx, long val)
{
var param = MemGet(_i + idx);
switch (Mode(idx))
{
case 0:
MemSet(param, val);
break;
case 1: throw new("cannot set in immediate mode");
case 2:
MemSet(_relativeBase + param, val);
break;
default: throw new("invalid parameter mode");
}
}
public HaltType Run(params long[] additionalInput)
{
foreach (var s in additionalInput) AddInput(s);
return Run();
}
public HaltType Run()
{
while (_i < Memory.Length)
{
var op = MemGet(_i) % 100;
switch (op)
{
case 1:
Set(3, Get(1) + Get(2));
_i += 4;
break;
case 2:
Set(3, Get(1) * Get(2));
_i += 4;
break;
case 3:
if (!_input.Any())
return HaltType.Waiting;
Set(1, _input.Dequeue());
_i += 2;
break;
case 4:
Output.Enqueue(Get(1));
_i += 2;
break;
case 5:
_i = Get(1) == 0 ? _i + 3 : Get(2);
break;
case 6:
_i = Get(1) != 0 ? _i + 3 : Get(2);
break;
case 7:
Set(3, Get(1) < Get(2) ? 1 : 0);
_i += 4;
break;
case 8:
Set(3, Get(1) == Get(2) ? 1 : 0);
_i += 4;
break;
case 9:
_relativeBase += Get(1);
_i += 2;
break;
case 99:
return HaltType.Terminate;
default:
throw new($"unknown op {op} at {_i}");
}
}
return HaltType.Terminate;
}
}

21
AOC2019/Program.cs Normal file
View File

@ -0,0 +1,21 @@
Day.Year = 2019;
var days =
Assembly.GetExecutingAssembly().GetTypes()
.Where(t => t.BaseType == typeof(Day))
.Select(t => Activator.CreateInstance(t) as Day)
.OrderBy(d => d?.DayNumber);
if (args.Length == 1 && int.TryParse(args[0], out var dayNum))
{
var day = days.FirstOrDefault(d => d?.DayNumber == dayNum);
if (day != null)
day.AllParts();
else
Console.WriteLine($"{dayNum} invalid or not yet implemented");
}
else
{
foreach (var d in days) d?.AllParts();
}

100
AOC2019/input2019/day01.in Normal file
View File

@ -0,0 +1,100 @@
94735
80130
127915
145427
89149
91232
100629
97340
86278
87034
147351
123045
91885
85973
64130
113244
58968
76296
127931
98145
120731
98289
110340
118285
60112
57177
58791
59012
66950
139387
145378
86204
147082
84956
134161
148664
74278
96746
144525
81214
70966
107050
134179
138587
80236
139871
104439
64643
145453
94791
51690
94189
148476
79956
81760
149796
109544
57533
142999
126419
115434
57092
64244
109663
94701
109265
145851
95183
84433
53818
106234
127380
149774
59601
138851
54488
100877
136952
61538
67705
60299
130769
113176
106723
133280
111065
63688
139307
122703
60162
89567
63994
66608
126376
136052
112255
98525
134023
141479
98200

View File

@ -0,0 +1 @@
1,0,0,3,1,1,2,3,1,3,4,3,1,5,0,3,2,10,1,19,1,19,9,23,1,23,13,27,1,10,27,31,2,31,13,35,1,10,35,39,2,9,39,43,2,43,9,47,1,6,47,51,1,10,51,55,2,55,13,59,1,59,10,63,2,63,13,67,2,67,9,71,1,6,71,75,2,75,9,79,1,79,5,83,2,83,13,87,1,9,87,91,1,13,91,95,1,2,95,99,1,99,6,0,99,2,14,0,0

View File

@ -0,0 +1,2 @@
R1008,U336,R184,D967,R451,D742,L235,U219,R57,D439,R869,U207,L574,U670,L808,D675,L203,D370,L279,U448,L890,U297,R279,D613,L411,D530,L372,D88,R986,U444,R319,D95,L385,D674,R887,U855,R794,U783,R633,U167,L587,D545,L726,D196,R681,U609,R677,U881,R153,D724,L63,U246,R343,U315,R580,U872,L516,U95,R463,D809,R9,U739,R540,U670,L434,D699,L158,U47,L383,D483,L341,U61,R933,D269,R816,D589,R488,D169,R972,D534,L995,D277,L887,D657,R628,D322,R753,U813,L284,D237,R676,D880,L50,D965,L401,D619,R858,U313,L156,U535,R664,U447,L251,U168,L352,U881,L734,U270,L177,D903,L114,U998,L102,D149,R848,D586,L98,D157,R942,U496,R857,U362,R398,U86,R469,U358,L721,D631,R176,D365,L112,U472,L557,D153,R97,D639,L457,U566,R570,U106,R504,D292,L94,U499,R358,U653,L704,D627,R544,D24,L407,U513,R28,U643,L510,U579,R825,D376,L867,U999,R134,D734,R654,D989,L920,U872,R64,U626,R751,D425,R620,U274,L471,D83,R979,U577,L43,D320,R673,D187,R300,U134,L451,D717,R857,U576,R570,U988,R745,U840,R799,U809,R573,U354,L208,D976,L417,U473,L555,U563,L955,U823,R712,D869,L145,D735,L780,D74,R421,U42,L158,U689,R718,D455,L670,U128,L744,U401,R149,U102,L122,U832,R872,D40,R45,D325,L553,U980,L565,D497,L435,U647,L209,D822,L593,D28,R936,U95,R349,U511,L243,U895,R421,U336,L986,U264,R376,D183,R480,D947,R416,D706,R118,D799,R424,D615,R384,U185,L338,U14,R576,D901,L734,D417,L62,D254,R784,D973,R987,D848,R32,D72,L535,D633,L668,D664,R308,D474,L418,D39,L473,U388,L518,D544,R118,D948,L844,D956,R605,U14,L948,D78,L689,U443,L996,U932,R81,D879,R556,D633,R131
L993,U227,L414,U228,L304,U53,R695,U765,R162,D264,L530,U870,R771,D395,R27,D200,L235,D834,L559,D128,R284,U912,L959,U358,R433,U404,L539,U799,R271,D734,L104,U261,R812,D15,L474,U887,R606,U366,L694,U156,R385,D667,L329,D434,R745,U776,L319,U756,R208,D457,R705,U999,R284,U98,L657,U214,R639,D937,R675,U444,L891,D587,L914,D4,R294,D896,R534,D584,L887,U878,L807,U202,R505,U234,L284,D5,R667,U261,L127,D482,R777,D223,L707,D468,L606,U345,L509,D967,R437,U995,R28,D376,L2,D959,L814,U702,L38,D154,L79,D439,L259,U143,L376,U700,R894,U165,L300,D58,R631,D47,R684,U935,R262,D857,R797,D599,L705,U792,R439,D444,R398,D887,L81,D40,R671,U332,L820,U252,R691,U412,L794,D661,R810,U157,R858,U566,R892,D543,R10,D725,L653,D812,R733,D804,R816,U862,R994,U221,L33,U271,R766,D591,R575,D970,R152,D693,L916,U404,L658,D847,L605,D433,L583,U587,L129,D103,R407,U780,L901,D676,L846,D687,L9,D47,R295,D597,L808,U134,L186,D676,L62,U305,L73,D369,L468,U30,L472,U280,L413,U961,L98,D966,R308,D178,L21,D789,L871,D671,R665,U927,L906,U633,L135,D894,R110,D205,R324,D665,R143,D450,L978,U385,R442,D853,L518,U542,R211,U857,R119,D872,L246,U380,L874,U463,R153,U982,R832,D784,L652,U545,R71,U386,R427,D827,R986,U870,R959,U232,R509,U675,R196,U389,R944,U149,R152,U571,R527,U495,L441,U511,L899,D996,L707,D455,L358,D423,L14,D427,R144,D703,L243,U157,R876,D538,R26,D577,L385,U622,L149,D852,L225,U475,L811,D520,L226,U523,L338,D79,R565,U766,L609,U496,L189,D446,R63,U396,L629,U312,L841,D639,R466,U808,L60,D589,L146,U114,R165,U96,L809,D704,L61

View File

@ -0,0 +1 @@
245318-765747

View File

@ -0,0 +1 @@
3,225,1,225,6,6,1100,1,238,225,104,0,1002,114,46,224,1001,224,-736,224,4,224,1002,223,8,223,1001,224,3,224,1,223,224,223,1,166,195,224,1001,224,-137,224,4,224,102,8,223,223,101,5,224,224,1,223,224,223,1001,169,83,224,1001,224,-90,224,4,224,102,8,223,223,1001,224,2,224,1,224,223,223,101,44,117,224,101,-131,224,224,4,224,1002,223,8,223,101,5,224,224,1,224,223,223,1101,80,17,225,1101,56,51,225,1101,78,89,225,1102,48,16,225,1101,87,78,225,1102,34,33,224,101,-1122,224,224,4,224,1002,223,8,223,101,7,224,224,1,223,224,223,1101,66,53,224,101,-119,224,224,4,224,102,8,223,223,1001,224,5,224,1,223,224,223,1102,51,49,225,1101,7,15,225,2,110,106,224,1001,224,-4539,224,4,224,102,8,223,223,101,3,224,224,1,223,224,223,1102,88,78,225,102,78,101,224,101,-6240,224,224,4,224,1002,223,8,223,101,5,224,224,1,224,223,223,4,223,99,0,0,0,677,0,0,0,0,0,0,0,0,0,0,0,1105,0,99999,1105,227,247,1105,1,99999,1005,227,99999,1005,0,256,1105,1,99999,1106,227,99999,1106,0,265,1105,1,99999,1006,0,99999,1006,227,274,1105,1,99999,1105,1,280,1105,1,99999,1,225,225,225,1101,294,0,0,105,1,0,1105,1,99999,1106,0,300,1105,1,99999,1,225,225,225,1101,314,0,0,106,0,0,1105,1,99999,1107,226,677,224,102,2,223,223,1006,224,329,101,1,223,223,1108,226,677,224,1002,223,2,223,1005,224,344,101,1,223,223,8,226,677,224,102,2,223,223,1006,224,359,1001,223,1,223,1007,226,677,224,1002,223,2,223,1005,224,374,101,1,223,223,1008,677,677,224,1002,223,2,223,1005,224,389,1001,223,1,223,1108,677,226,224,1002,223,2,223,1006,224,404,1001,223,1,223,1007,226,226,224,1002,223,2,223,1005,224,419,1001,223,1,223,1107,677,226,224,1002,223,2,223,1006,224,434,101,1,223,223,108,677,677,224,1002,223,2,223,1005,224,449,1001,223,1,223,1107,677,677,224,102,2,223,223,1005,224,464,1001,223,1,223,108,226,226,224,1002,223,2,223,1006,224,479,1001,223,1,223,1008,226,226,224,102,2,223,223,1005,224,494,101,1,223,223,108,677,226,224,102,2,223,223,1005,224,509,1001,223,1,223,8,677,226,224,1002,223,2,223,1006,224,524,101,1,223,223,7,226,677,224,1002,223,2,223,1006,224,539,101,1,223,223,7,677,226,224,102,2,223,223,1006,224,554,1001,223,1,223,7,226,226,224,1002,223,2,223,1006,224,569,101,1,223,223,107,677,677,224,102,2,223,223,1006,224,584,101,1,223,223,1108,677,677,224,102,2,223,223,1006,224,599,1001,223,1,223,1008,677,226,224,1002,223,2,223,1005,224,614,1001,223,1,223,8,677,677,224,1002,223,2,223,1006,224,629,1001,223,1,223,107,226,677,224,1002,223,2,223,1006,224,644,101,1,223,223,1007,677,677,224,102,2,223,223,1006,224,659,101,1,223,223,107,226,226,224,1002,223,2,223,1006,224,674,1001,223,1,223,4,223,99,226

1110
AOC2019/input2019/day06.in Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1 @@
3,8,1001,8,10,8,105,1,0,0,21,46,59,84,93,110,191,272,353,434,99999,3,9,101,2,9,9,102,3,9,9,1001,9,5,9,102,4,9,9,1001,9,4,9,4,9,99,3,9,101,3,9,9,102,5,9,9,4,9,99,3,9,1001,9,4,9,1002,9,2,9,101,2,9,9,102,2,9,9,1001,9,3,9,4,9,99,3,9,1002,9,2,9,4,9,99,3,9,102,2,9,9,1001,9,5,9,1002,9,3,9,4,9,99,3,9,102,2,9,9,4,9,3,9,102,2,9,9,4,9,3,9,102,2,9,9,4,9,3,9,102,2,9,9,4,9,3,9,101,1,9,9,4,9,3,9,102,2,9,9,4,9,3,9,101,2,9,9,4,9,3,9,101,2,9,9,4,9,3,9,1001,9,1,9,4,9,3,9,101,2,9,9,4,9,99,3,9,102,2,9,9,4,9,3,9,1002,9,2,9,4,9,3,9,1002,9,2,9,4,9,3,9,1001,9,1,9,4,9,3,9,1001,9,2,9,4,9,3,9,101,1,9,9,4,9,3,9,1001,9,2,9,4,9,3,9,1002,9,2,9,4,9,3,9,1001,9,1,9,4,9,3,9,1001,9,2,9,4,9,99,3,9,101,1,9,9,4,9,3,9,1001,9,1,9,4,9,3,9,101,1,9,9,4,9,3,9,101,1,9,9,4,9,3,9,1002,9,2,9,4,9,3,9,1002,9,2,9,4,9,3,9,1002,9,2,9,4,9,3,9,1001,9,1,9,4,9,3,9,102,2,9,9,4,9,3,9,101,1,9,9,4,9,99,3,9,1001,9,1,9,4,9,3,9,102,2,9,9,4,9,3,9,101,1,9,9,4,9,3,9,1002,9,2,9,4,9,3,9,1001,9,2,9,4,9,3,9,101,1,9,9,4,9,3,9,1002,9,2,9,4,9,3,9,1002,9,2,9,4,9,3,9,1001,9,1,9,4,9,3,9,102,2,9,9,4,9,99,3,9,102,2,9,9,4,9,3,9,1002,9,2,9,4,9,3,9,1002,9,2,9,4,9,3,9,1001,9,1,9,4,9,3,9,101,1,9,9,4,9,3,9,102,2,9,9,4,9,3,9,1002,9,2,9,4,9,3,9,101,2,9,9,4,9,3,9,1002,9,2,9,4,9,3,9,1001,9,2,9,4,9,99

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
1102,34463338,34463338,63,1007,63,34463338,63,1005,63,53,1101,0,3,1000,109,988,209,12,9,1000,209,6,209,3,203,0,1008,1000,1,63,1005,63,65,1008,1000,2,63,1005,63,904,1008,1000,0,63,1005,63,58,4,25,104,0,99,4,0,104,0,99,4,17,104,0,99,0,0,1101,0,252,1023,1101,0,0,1020,1102,1,39,1013,1102,1,234,1029,1102,26,1,1016,1101,37,0,1005,1101,0,27,1011,1101,21,0,1000,1101,0,29,1019,1101,35,0,1003,1102,22,1,1007,1102,1,32,1001,1101,1,0,1021,1102,1,216,1027,1102,30,1,1012,1102,1,24,1009,1101,36,0,1002,1101,0,31,1010,1101,0,243,1028,1102,787,1,1024,1102,255,1,1022,1102,33,1,1017,1102,1,23,1004,1102,778,1,1025,1102,1,28,1008,1101,0,223,1026,1102,1,25,1015,1101,0,20,1006,1102,34,1,1014,1101,38,0,1018,109,-4,1202,5,1,63,1008,63,32,63,1005,63,203,4,187,1106,0,207,1001,64,1,64,1002,64,2,64,109,37,2106,0,-6,1001,64,1,64,1106,0,225,4,213,1002,64,2,64,109,3,2106,0,-8,4,231,1001,64,1,64,1105,1,243,1002,64,2,64,109,-12,2105,1,-1,1105,1,261,4,249,1001,64,1,64,1002,64,2,64,109,-13,2102,1,-3,63,1008,63,31,63,1005,63,285,1001,64,1,64,1106,0,287,4,267,1002,64,2,64,109,6,21102,40,1,0,1008,1017,40,63,1005,63,313,4,293,1001,64,1,64,1105,1,313,1002,64,2,64,109,-10,2107,31,-6,63,1005,63,331,4,319,1105,1,335,1001,64,1,64,1002,64,2,64,109,-6,2102,1,7,63,1008,63,28,63,1005,63,357,4,341,1105,1,361,1001,64,1,64,1002,64,2,64,109,2,21107,41,40,8,1005,1011,377,1106,0,383,4,367,1001,64,1,64,1002,64,2,64,109,-1,1201,2,0,63,1008,63,26,63,1005,63,403,1106,0,409,4,389,1001,64,1,64,1002,64,2,64,109,22,1205,-4,425,1001,64,1,64,1105,1,427,4,415,1002,64,2,64,109,-9,21101,42,0,3,1008,1018,39,63,1005,63,451,1001,64,1,64,1105,1,453,4,433,1002,64,2,64,109,3,21107,43,44,0,1005,1018,475,4,459,1001,64,1,64,1105,1,475,1002,64,2,64,109,-7,21101,44,0,0,1008,1011,44,63,1005,63,497,4,481,1105,1,501,1001,64,1,64,1002,64,2,64,109,17,1206,-7,513,1105,1,519,4,507,1001,64,1,64,1002,64,2,64,109,-24,1207,5,25,63,1005,63,537,4,525,1105,1,541,1001,64,1,64,1002,64,2,64,109,7,21108,45,43,2,1005,1013,557,1106,0,563,4,547,1001,64,1,64,1002,64,2,64,109,-5,1207,-3,34,63,1005,63,583,1001,64,1,64,1106,0,585,4,569,1002,64,2,64,109,5,21108,46,46,5,1005,1016,607,4,591,1001,64,1,64,1105,1,607,1002,64,2,64,109,-12,2108,20,8,63,1005,63,627,1001,64,1,64,1105,1,629,4,613,1002,64,2,64,109,24,1206,-3,647,4,635,1001,64,1,64,1105,1,647,1002,64,2,64,109,-30,2108,32,8,63,1005,63,665,4,653,1106,0,669,1001,64,1,64,1002,64,2,64,109,22,1208,-9,20,63,1005,63,691,4,675,1001,64,1,64,1106,0,691,1002,64,2,64,109,-4,21102,47,1,3,1008,1014,49,63,1005,63,715,1001,64,1,64,1105,1,717,4,697,1002,64,2,64,109,-10,2101,0,1,63,1008,63,36,63,1005,63,743,4,723,1001,64,1,64,1105,1,743,1002,64,2,64,109,16,1201,-9,0,63,1008,63,28,63,1005,63,769,4,749,1001,64,1,64,1105,1,769,1002,64,2,64,109,2,2105,1,5,4,775,1001,64,1,64,1106,0,787,1002,64,2,64,109,-5,1202,-6,1,63,1008,63,26,63,1005,63,807,1106,0,813,4,793,1001,64,1,64,1002,64,2,64,109,-16,2107,37,4,63,1005,63,833,1001,64,1,64,1105,1,835,4,819,1002,64,2,64,109,2,2101,0,1,63,1008,63,34,63,1005,63,855,1105,1,861,4,841,1001,64,1,64,1002,64,2,64,109,19,1205,2,875,4,867,1105,1,879,1001,64,1,64,1002,64,2,64,109,-2,1208,-8,23,63,1005,63,899,1001,64,1,64,1106,0,901,4,885,4,64,99,21101,0,27,1,21102,915,1,0,1106,0,922,21201,1,61455,1,204,1,99,109,3,1207,-2,3,63,1005,63,964,21201,-2,-1,1,21102,942,1,0,1105,1,922,22102,1,1,-1,21201,-2,-3,1,21102,1,957,0,1105,1,922,22201,1,-1,-2,1106,0,968,22101,0,-2,-2,109,-3,2105,1,0

View File

@ -0,0 +1,24 @@
##.##..#.####...#.#.####
##.###..##.#######..##..
..######.###.#.##.######
.#######.####.##.#.###.#
..#...##.#.....#####..##
#..###.#...#..###.#..#..
###..#.##.####.#..##..##
.##.##....###.#..#....#.
########..#####..#######
##..#..##.#..##.#.#.#..#
##.#.##.######.#####....
###.##...#.##...#.######
###...##.####..##..#####
##.#...#.#.....######.##
.#...####..####.##...##.
#.#########..###..#.####
#.##..###.#.######.#####
##..##.##...####.#...##.
###...###.##.####.#.##..
####.#.....###..#.####.#
##.####..##.#.##..##.#.#
#####..#...####..##..#.#
.##.##.##...###.##...###
..###.########.#.###..#.

View File

@ -0,0 +1 @@
3,8,1005,8,350,1106,0,11,0,0,0,104,1,104,0,3,8,1002,8,-1,10,101,1,10,10,4,10,1008,8,1,10,4,10,102,1,8,29,1006,0,82,1006,0,40,3,8,1002,8,-1,10,101,1,10,10,4,10,1008,8,0,10,4,10,1002,8,1,57,1,102,15,10,1,1005,14,10,1006,0,33,3,8,102,-1,8,10,101,1,10,10,4,10,1008,8,0,10,4,10,102,1,8,90,1,1008,14,10,2,3,19,10,1006,0,35,1006,0,21,3,8,102,-1,8,10,1001,10,1,10,4,10,108,1,8,10,4,10,1002,8,1,125,1,1105,11,10,2,1105,9,10,1,4,1,10,2,1,4,10,3,8,1002,8,-1,10,101,1,10,10,4,10,1008,8,0,10,4,10,101,0,8,164,1006,0,71,3,8,102,-1,8,10,101,1,10,10,4,10,1008,8,0,10,4,10,1002,8,1,189,1006,0,2,1,5,17,10,1006,0,76,1,1002,7,10,3,8,1002,8,-1,10,101,1,10,10,4,10,108,1,8,10,4,10,1001,8,0,224,1,3,5,10,3,8,1002,8,-1,10,101,1,10,10,4,10,108,1,8,10,4,10,101,0,8,250,1,1,20,10,1,102,13,10,2,101,18,10,3,8,1002,8,-1,10,101,1,10,10,4,10,108,0,8,10,4,10,102,1,8,284,2,105,0,10,1,105,20,10,3,8,1002,8,-1,10,101,1,10,10,4,10,1008,8,1,10,4,10,1002,8,1,315,1006,0,88,1,2,4,10,2,8,17,10,2,6,2,10,101,1,9,9,1007,9,1056,10,1005,10,15,99,109,672,104,0,104,1,21102,1,847069688728,1,21101,0,367,0,1106,0,471,21102,386577216404,1,1,21102,378,1,0,1105,1,471,3,10,104,0,104,1,3,10,104,0,104,0,3,10,104,0,104,1,3,10,104,0,104,1,3,10,104,0,104,0,3,10,104,0,104,1,21101,97952923867,0,1,21102,425,1,0,1106,0,471,21101,0,29033143319,1,21102,436,1,0,1105,1,471,3,10,104,0,104,0,3,10,104,0,104,0,21102,1,868410614628,1,21101,0,459,0,1105,1,471,21101,837896909672,0,1,21101,0,470,0,1105,1,471,99,109,2,22102,1,-1,1,21101,40,0,2,21102,502,1,3,21102,492,1,0,1106,0,535,109,-2,2105,1,0,0,1,0,0,1,109,2,3,10,204,-1,1001,497,498,513,4,0,1001,497,1,497,108,4,497,10,1006,10,529,1102,1,0,497,109,-2,2105,1,0,0,109,4,2101,0,-1,534,1207,-3,0,10,1006,10,552,21101,0,0,-3,22101,0,-3,1,22101,0,-2,2,21102,1,1,3,21101,571,0,0,1106,0,576,109,-4,2106,0,0,109,5,1207,-3,1,10,1006,10,599,2207,-4,-2,10,1006,10,599,21202,-4,1,-4,1105,1,667,21202,-4,1,1,21201,-3,-1,2,21202,-2,2,3,21102,1,618,0,1106,0,576,21201,1,0,-4,21101,0,1,-1,2207,-4,-2,10,1006,10,637,21102,0,1,-1,22202,-2,-1,-2,2107,0,-3,10,1006,10,659,21202,-1,1,1,21101,659,0,0,106,0,534,21202,-2,-1,-2,22201,-4,-2,-4,109,-5,2105,1,0

View File

@ -0,0 +1,4 @@
<x=1, y=4, z=4>
<x=-4, y=-1, z=19>
<x=-15, y=-14, z=12>
<x=-17, y=1, z=10>

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,61 @@
8 LHFV => 3 PMVMQ
2 ZXNM, 1 PSVLS, 4 GRDNT, 26 GLZH, 3 VHJX, 16 BGPF, 1 LHVTN => 4 BTQL
10 NKHSG, 20 FCPC, 11 GRDNT => 5 HDJB
6 WPZN, 1 LHFV => 7 BGPF
1 WDXT, 1 PLCNZ => 3 QHFKR
12 LCHZ => 1 TPXCK
11 LSNG => 4 XFGH
195 ORE => 4 GRNC
8 XFGQ => 1 GRDNT
1 FBRG => 5 LCHZ
7 XZBJ, 8 RSZF, 9 SVDX => 9 LWDP
20 WDXT => 5 RQFRT
1 LXQWG, 1 GLZH => 6 SDLJ
4 XFGH => 1 GCZLZ
1 WPZN => 1 FBRG
19 XZBJ => 5 WXGV
1 GDXC => 6 WDXT
1 WXGV, 1 NKHSG, 2 LWDP => 5 FCNPB
4 LWDP, 5 BGPF => 9 KLRB
1 GMRN => 4 GLZH
1 RQFRT => 5 SVDX
2 HWKG => 7 LHFV
2 LCHZ, 13 JTJT, 10 TPXCK => 3 RSZF
29 MZTVH => 6 TSGR
9 NRFLK, 1 SVDX => 5 NKHSG
123 ORE => 9 GDXC
1 PZPBV, 21 PMVMQ, 1 GCZLZ => 8 SKZGB
3 GRNC, 5 GDXC => 8 QZVM
6 VTDQ, 13 TCQW, 3 FCNPB, 48 PSVLS, 3 RLNF, 73 BTQL, 5 MHRVG, 26 BGPF, 26 HDJB, 5 XFGQ, 6 HTFL => 1 FUEL
5 QZVM, 2 JTJT => 1 PXKHG
3 LSNG, 1 PMVMQ => 8 VTDQ
31 XFGH => 1 FCPC
9 PSVLS => 8 FWGTF
1 GRNC => 3 WPZN
16 JBXDX, 4 GRNC => 6 HWKG
1 SKZGB, 5 RSZF => 4 XZBJ
134 ORE => 9 CTDRZ
1 SVDX, 2 TPXCK => 7 JTJT
6 RQFRT, 4 KBCW => 3 BGNLR
12 KLRB, 12 LHFV => 4 HTFL
2 GMRN => 6 XFGQ
16 WNSW, 12 SKZGB => 8 LXQWG
2 NRFLK, 2 CTDRZ => 9 JBXDX
1 PZPBV => 8 RLNF
2 JTJT, 5 GCZLZ => 3 WNSW
5 WXGV, 2 LCHZ => 2 SCDS
1 QHFKR => 3 GMRN
10 JTJT, 2 HRCG => 8 KBCW
7 HWKG => 4 PSVLS
7 WNSW, 1 PXKHG, 3 BGNLR => 9 MZTVH
15 TPXCK, 11 LHFV => 5 HRCG
1 LSNG, 1 HWKG => 3 PZPBV
7 BGPF => 9 PLCNZ
1 ZGWT => 6 ZXNM
26 NKHSG, 1 LHFV, 2 JTJT, 26 WXGV, 6 SDLJ, 1 KLRB, 1 TSGR => 8 TCQW
154 ORE => 4 NRFLK
1 GMRN => 3 VHJX
5 QZVM, 3 GDXC => 7 LSNG
5 WNSW => 5 ZGWT
6 QHFKR, 8 PZPBV, 10 FBRG, 13 FWGTF, 1 LHVTN, 4 SCDS, 8 VHJX, 7 TSGR => 6 MHRVG
12 GLZH => 5 LHVTN

View File

@ -0,0 +1 @@
3,1033,1008,1033,1,1032,1005,1032,31,1008,1033,2,1032,1005,1032,58,1008,1033,3,1032,1005,1032,81,1008,1033,4,1032,1005,1032,104,99,1002,1034,1,1039,1001,1036,0,1041,1001,1035,-1,1040,1008,1038,0,1043,102,-1,1043,1032,1,1037,1032,1042,1105,1,124,1001,1034,0,1039,102,1,1036,1041,1001,1035,1,1040,1008,1038,0,1043,1,1037,1038,1042,1105,1,124,1001,1034,-1,1039,1008,1036,0,1041,101,0,1035,1040,102,1,1038,1043,1001,1037,0,1042,1106,0,124,1001,1034,1,1039,1008,1036,0,1041,1001,1035,0,1040,102,1,1038,1043,1001,1037,0,1042,1006,1039,217,1006,1040,217,1008,1039,40,1032,1005,1032,217,1008,1040,40,1032,1005,1032,217,1008,1039,9,1032,1006,1032,165,1008,1040,5,1032,1006,1032,165,1101,0,2,1044,1105,1,224,2,1041,1043,1032,1006,1032,179,1102,1,1,1044,1106,0,224,1,1041,1043,1032,1006,1032,217,1,1042,1043,1032,1001,1032,-1,1032,1002,1032,39,1032,1,1032,1039,1032,101,-1,1032,1032,101,252,1032,211,1007,0,40,1044,1106,0,224,1101,0,0,1044,1106,0,224,1006,1044,247,102,1,1039,1034,101,0,1040,1035,101,0,1041,1036,1001,1043,0,1038,1001,1042,0,1037,4,1044,1106,0,0,26,29,83,66,1,36,14,44,33,12,3,15,20,56,9,35,51,55,6,20,13,71,15,23,94,38,45,15,47,30,89,39,11,55,5,9,47,29,41,36,78,12,4,65,48,66,36,94,76,30,63,41,32,1,73,1,35,65,87,46,18,90,11,44,30,73,87,8,38,46,17,78,51,34,19,53,37,26,20,24,46,64,17,6,26,41,10,62,14,88,23,94,13,55,5,45,10,39,83,99,32,34,72,30,58,33,71,47,21,38,97,38,46,41,18,39,37,8,86,55,35,4,92,19,21,53,61,6,55,69,16,85,62,26,63,17,80,33,10,53,91,2,37,94,37,93,7,97,18,55,54,36,17,62,89,12,92,32,69,4,46,47,19,89,25,12,51,91,9,1,71,35,56,39,98,48,7,49,24,95,15,45,2,1,93,82,19,7,11,70,30,64,28,27,58,4,39,30,94,72,33,43,90,98,26,32,70,1,81,25,35,47,17,31,92,15,73,13,27,72,65,30,67,2,22,89,77,30,47,12,58,26,79,22,37,74,41,3,42,30,39,67,24,18,62,98,19,59,95,25,6,67,42,35,85,51,48,7,63,17,67,53,45,13,25,43,1,54,4,65,55,20,73,32,70,1,33,39,93,88,19,35,56,21,13,53,73,31,21,44,73,31,13,69,30,42,26,51,25,90,16,49,9,93,50,28,60,24,18,61,23,11,98,19,45,77,12,61,31,3,66,56,4,77,24,59,87,31,38,65,67,7,9,23,71,9,59,35,55,83,22,12,94,17,67,87,96,63,8,29,32,34,15,55,39,60,41,74,39,81,47,51,25,26,57,28,18,60,84,20,16,66,42,14,25,16,94,2,22,74,85,19,63,32,9,19,11,91,44,34,21,1,56,12,87,8,52,18,56,7,90,5,86,81,24,98,21,9,80,59,68,10,80,53,18,75,50,9,14,43,26,29,57,86,39,41,93,3,69,55,16,84,15,22,84,30,72,19,13,15,19,80,97,79,32,68,77,82,30,19,4,71,45,67,14,95,17,54,80,88,25,13,80,41,37,96,15,28,26,33,73,32,45,79,21,52,23,98,82,21,16,13,64,32,39,93,17,33,95,61,36,12,21,3,84,4,88,22,26,59,80,27,82,2,85,79,29,33,52,17,23,95,8,64,16,56,23,42,43,18,41,11,9,84,42,62,4,67,17,98,76,99,1,16,72,72,10,79,19,76,4,54,9,99,34,33,7,97,85,19,76,93,38,6,90,37,90,2,83,61,19,43,39,2,91,17,60,21,79,2,32,94,38,32,7,64,8,14,7,68,23,28,75,24,73,50,29,63,22,89,4,51,66,2,7,33,82,13,23,84,81,23,55,68,15,27,9,97,27,79,42,86,75,56,13,95,74,5,88,25,44,99,33,14,24,29,21,78,4,15,75,32,92,74,11,56,24,57,10,28,73,8,10,90,77,30,96,8,60,3,71,20,41,9,33,89,38,74,95,4,95,35,13,18,55,10,81,9,60,17,67,7,34,48,48,15,54,79,37,66,43,22,64,28,28,4,91,5,9,92,30,64,37,98,66,15,92,2,3,25,70,25,33,61,56,25,70,58,30,41,97,18,54,10,49,45,3,1,30,57,30,46,8,55,79,39,58,46,35,19,38,80,86,4,36,75,29,62,39,71,2,41,6,66,36,99,21,61,39,72,3,48,29,43,31,59,84,71,12,52,61,82,11,56,23,51,30,60,88,65,35,48,24,58,76,49,93,51,33,72,0,0,21,21,1,10,1,0,0,0,0,0,0

View File

@ -0,0 +1 @@
59705379150220188753316412925237003623341873502562165618681895846838956306026981091618902964505317589975353803891340688726319912072762197208600522256226277045196745275925595285843490582257194963750523789260297737947126704668555847149125256177428007606338263660765335434914961324526565730304103857985860308906002394989471031058266433317378346888662323198499387391755140009824186662950694879934582661048464385141787363949242889652092761090657224259182589469166807788651557747631571357207637087168904251987880776566360681108470585488499889044851694035762709053586877815115448849654685763054406911855606283246118699187059424077564037176787976681309870931

View File

@ -0,0 +1 @@
1,330,331,332,109,3132,1102,1,1182,16,1101,1467,0,24,101,0,0,570,1006,570,36,101,0,571,0,1001,570,-1,570,1001,24,1,24,1105,1,18,1008,571,0,571,1001,16,1,16,1008,16,1467,570,1006,570,14,21102,58,1,0,1106,0,786,1006,332,62,99,21102,1,333,1,21102,73,1,0,1106,0,579,1101,0,0,572,1101,0,0,573,3,574,101,1,573,573,1007,574,65,570,1005,570,151,107,67,574,570,1005,570,151,1001,574,-64,574,1002,574,-1,574,1001,572,1,572,1007,572,11,570,1006,570,165,101,1182,572,127,1001,574,0,0,3,574,101,1,573,573,1008,574,10,570,1005,570,189,1008,574,44,570,1006,570,158,1105,1,81,21101,0,340,1,1106,0,177,21101,0,477,1,1105,1,177,21101,514,0,1,21102,176,1,0,1106,0,579,99,21102,1,184,0,1106,0,579,4,574,104,10,99,1007,573,22,570,1006,570,165,1002,572,1,1182,21102,1,375,1,21101,0,211,0,1106,0,579,21101,1182,11,1,21102,1,222,0,1106,0,979,21102,388,1,1,21102,233,1,0,1105,1,579,21101,1182,22,1,21101,244,0,0,1106,0,979,21102,1,401,1,21101,255,0,0,1105,1,579,21101,1182,33,1,21102,266,1,0,1105,1,979,21102,1,414,1,21102,1,277,0,1105,1,579,3,575,1008,575,89,570,1008,575,121,575,1,575,570,575,3,574,1008,574,10,570,1006,570,291,104,10,21102,1,1182,1,21101,313,0,0,1105,1,622,1005,575,327,1101,0,1,575,21102,1,327,0,1106,0,786,4,438,99,0,1,1,6,77,97,105,110,58,10,33,10,69,120,112,101,99,116,101,100,32,102,117,110,99,116,105,111,110,32,110,97,109,101,32,98,117,116,32,103,111,116,58,32,0,12,70,117,110,99,116,105,111,110,32,65,58,10,12,70,117,110,99,116,105,111,110,32,66,58,10,12,70,117,110,99,116,105,111,110,32,67,58,10,23,67,111,110,116,105,110,117,111,117,115,32,118,105,100,101,111,32,102,101,101,100,63,10,0,37,10,69,120,112,101,99,116,101,100,32,82,44,32,76,44,32,111,114,32,100,105,115,116,97,110,99,101,32,98,117,116,32,103,111,116,58,32,36,10,69,120,112,101,99,116,101,100,32,99,111,109,109,97,32,111,114,32,110,101,119,108,105,110,101,32,98,117,116,32,103,111,116,58,32,43,10,68,101,102,105,110,105,116,105,111,110,115,32,109,97,121,32,98,101,32,97,116,32,109,111,115,116,32,50,48,32,99,104,97,114,97,99,116,101,114,115,33,10,94,62,118,60,0,1,0,-1,-1,0,1,0,0,0,0,0,0,1,0,10,0,109,4,1202,-3,1,587,20102,1,0,-1,22101,1,-3,-3,21101,0,0,-2,2208,-2,-1,570,1005,570,617,2201,-3,-2,609,4,0,21201,-2,1,-2,1105,1,597,109,-4,2105,1,0,109,5,2102,1,-4,630,20102,1,0,-2,22101,1,-4,-4,21101,0,0,-3,2208,-3,-2,570,1005,570,781,2201,-4,-3,653,20101,0,0,-1,1208,-1,-4,570,1005,570,709,1208,-1,-5,570,1005,570,734,1207,-1,0,570,1005,570,759,1206,-1,774,1001,578,562,684,1,0,576,576,1001,578,566,692,1,0,577,577,21101,702,0,0,1105,1,786,21201,-1,-1,-1,1105,1,676,1001,578,1,578,1008,578,4,570,1006,570,724,1001,578,-4,578,21101,0,731,0,1106,0,786,1106,0,774,1001,578,-1,578,1008,578,-1,570,1006,570,749,1001,578,4,578,21101,0,756,0,1105,1,786,1105,1,774,21202,-1,-11,1,22101,1182,1,1,21102,1,774,0,1106,0,622,21201,-3,1,-3,1106,0,640,109,-5,2106,0,0,109,7,1005,575,802,21002,576,1,-6,20101,0,577,-5,1105,1,814,21101,0,0,-1,21101,0,0,-5,21102,1,0,-6,20208,-6,576,-2,208,-5,577,570,22002,570,-2,-2,21202,-5,45,-3,22201,-6,-3,-3,22101,1467,-3,-3,1201,-3,0,843,1005,0,863,21202,-2,42,-4,22101,46,-4,-4,1206,-2,924,21102,1,1,-1,1105,1,924,1205,-2,873,21101,0,35,-4,1105,1,924,2102,1,-3,878,1008,0,1,570,1006,570,916,1001,374,1,374,2102,1,-3,895,1102,2,1,0,1201,-3,0,902,1001,438,0,438,2202,-6,-5,570,1,570,374,570,1,570,438,438,1001,578,558,921,21001,0,0,-4,1006,575,959,204,-4,22101,1,-6,-6,1208,-6,45,570,1006,570,814,104,10,22101,1,-5,-5,1208,-5,37,570,1006,570,810,104,10,1206,-1,974,99,1206,-1,974,1102,1,1,575,21101,0,973,0,1106,0,786,99,109,-7,2105,1,0,109,6,21101,0,0,-4,21102,0,1,-3,203,-2,22101,1,-3,-3,21208,-2,82,-1,1205,-1,1030,21208,-2,76,-1,1205,-1,1037,21207,-2,48,-1,1205,-1,1124,22107,57,-2,-1,1205,-1,1124,21201,-2,-48,-2,1106,0,1041,21102,1,-4,-2,1105,1,1041,21101,0,-5,-2,21201,-4,1,-4,21207,-4,11,-1,1206,-1,1138,2201,-5,-4,1059,1202,-2,1,0,203,-2,22101,1,-3,-3,21207,-2,48,-1,1205,-1,1107,22107,57,-2,-1,1205,-1,1107,21201,-2,-48,-2,2201,-5,-4,1090,20102,10,0,-1,22201,-2,-1,-2,2201,-5,-4,1103,2101,0,-2,0,1106,0,1060,21208,-2,10,-1,1205,-1,1162,21208,-2,44,-1,1206,-1,1131,1106,0,989,21102,1,439,1,1105,1,1150,21101,0,477,1,1106,0,1150,21102,1,514,1,21102,1,1149,0,1105,1,579,99,21101,1157,0,0,1106,0,579,204,-2,104,10,99,21207,-3,22,-1,1206,-1,1138,1201,-5,0,1176,2102,1,-4,0,109,-6,2106,0,0,8,9,36,1,7,1,36,1,1,13,30,1,7,1,5,1,30,1,7,1,5,1,7,11,12,1,7,1,5,1,7,1,9,1,12,1,7,1,5,1,7,1,1,13,8,1,7,1,5,1,7,1,1,1,7,1,3,1,8,1,7,1,5,1,7,1,1,1,7,1,3,1,8,1,7,1,5,1,7,1,1,1,7,1,3,10,5,9,1,13,3,1,3,1,14,1,1,1,7,1,5,1,1,1,3,1,3,1,3,1,8,9,5,9,1,1,3,1,3,1,3,1,8,1,5,1,7,1,1,1,7,1,3,1,3,1,3,1,8,1,5,1,7,1,1,1,7,1,3,1,3,1,3,1,8,1,5,1,7,1,1,1,7,1,3,1,3,1,3,1,8,1,5,1,7,1,1,1,7,9,3,1,8,1,5,1,7,1,1,1,11,1,7,1,8,1,5,1,7,1,1,11,1,9,8,1,5,1,7,1,11,1,18,13,1,1,11,1,24,1,5,1,1,1,11,1,24,9,11,1,30,1,13,1,30,1,13,1,30,1,13,1,30,1,13,9,22,1,21,1,22,11,11,1,32,1,11,1,32,1,11,1,32,1,11,1,32,1,11,1,32,1,11,1,32,1,11,1,32,1,11,1,32,13,2

View File

@ -0,0 +1,81 @@
#################################################################################
#...#.................#...#.........#...#....j......................#.......#...#
#.###.###########.#####.#.###.###.#.###.#.###############.#########.#.###.#.#.#.#
#.#...#.....#...#.......#...#...#.#...#.#.#.........#...#...#...#...#.#...#...#.#
#.#.###.###.###.###########.#.###.###.#.#.#####.###.#.#.###.#.###.###.#.#######.#
#...#...#.#...#.....#...#...#.#...#.....#.#.....#.#.#.#.#...#...#.#p..#...#...#.#
#.#####.#.###.###.###.#.#.###.#.#######.#.#.#####.#.#.#.#.###.#.#.###.###.#.#.###
#...#...#.........#r..#...#...#.......#.#.#...#.M.#...#.#...#.#.....#...#.#.#...#
###.#.###########.#.#######.#########.#.#.###.#.#######.###.#######.#####.#.###.#
#...#.#....i..#...#.......#....e#...#.#.#.....#...#.......#.......#.......#...#.#
#.###.#.#####.#.#########.#####.#.#.#.###.#######.#.#######.#####.#.#########.#.#
#...#.#.#...#.#.....#.....#...#.#.#.#...#.#.....#.....#...#.#.....#.#.......#.#.#
###.#.#.#.#.#Y#####.#.#####.###.#.#.###.#.#.###.#######.#.###.###.###.#####.#.#.#
#d#...#.#.#.....#...#...#.....#...#.#...#.#.#...#...#...#...#.#...#...#...#...#.#
#.###.#.#######.###.###.#.###.###.###.#.###.#.###.#.#.#####.#.#####.###.#######.#
#...#.#.......#...#.#...#...#...#.#...#.#...#.....#...#...#...#...#.#.........#.#
#.#.#.#######.###.###.#####.#.###.#.###.#.###########.#.#.###.#.#.#.#####.#####.#
#.#.#.#.....#.#...#...#...#.#.....#.#...#.....#.......#.#.#...#.#...#...#.#..a..#
###.#.#####.#.#.###.###.#.#.#######.#####.###.#####.###.#.#####.#####.#.#.#.#####
#...#.......#.#...#.#...#.#.#.......#...#.#.#.....#...#.#.#...........#...#.....#
#.#########.#.###.#U###.###.#.###.###.#.#.#.#####.#####.#.#.#############.#####.#
#...#.......#q..#...#.#.....#.#...#...#.#.....#.#.#.....#...#.#...#.........#...#
#.#.#.#########.#####.#######.###.#.###.#####.#.#.#.#########.#.#.#.#######.#.#.#
#.#...#.......#.....#..v#...#...#.#...#.#...#g..#.#.#.......#.#.#.#...#...#.#.#.#
#.#####.#.#########.###.#.#.###.#####.#.#.#####.#.#.###.###.#.#.#.###.#.#.#.#.###
#.....#.#.#...#...#...#...#...#.#.....#.#.#...#.#...#...#.#.#.#.#.....#.#.#.#...#
#####.###.#.#.#.#.###.#######.#.#.#####.#.#.#.#.#####.###.#.#.###.#####.#.#.###.#
#.....#...#f#.H.#.......#...#n#...#.....#.#.#.#.......#...#.#...#.#.....#.#.#...#
#.#####.#.#.#########.###Z#.#.#.###.###.#.#.#.#########.###.###.#.#.#####.###.#.#
#...#.G.#.#.....#.....#...#...#...#...#.#...#.....#.........#..h#.#.#.....#...#.#
###.#.###.#####.###.###.#########.###.#.#.#####.#.#.#########.#####.###.###.###.#
#...#...#.#...#...#...#.#.#.....#...#.#.#.....#.#.#...#.......#...#...#.....#...#
#.#####.#.###.###.#####.#.#.###.###.#.#.#.#####.#.###.#.#######.#.#.#.#######.###
#.#...#.#.....#.#...#...#.....#.....#.#.#.#.....#.#...#.#.......#.#.#.#.........#
#.#.#.#.#####.#.###.#.###############.#.###.#####.#.###Q###.#.###.###.#########.#
#.#.#.#...#...#...#...#.......#...#...#.#...#...#.#.#.#...#.#...#...#.........#.#
#.#.#.###L#.###.#.#####.#.###.#.#.#.#####.###.#.###.#.###.#####.###.#.#######.###
#...#...#.#.#...#...#..t#...#...#.#.....#.....#...#.#...#.....#.#.#.#.#.....#..u#
#######.#.#.#.#####.#######.#####.#####.#.#######.#.###.#####.#.#.#.###.###.###.#
#.........#...#.............#...................#...........#...#......y#.......#
#######################################.@.#######################################
#.................#...........#.......................#.......#.....#.......#...#
#.###.#######.#####.#####.###.#.#######.#.#######.#####.#C###.#.#.#.#.#.#####.#.#
#.#...#...#...#.....#.#...#.#.#.#.......#.#.....#.......#.#.#.#.#.#.#.#.......#.#
#.#.###.#.#.###.#####.#.###.#.###.#####.#.#.###.#########.#.#.#.#.###.#########.#
#.#.....#.#...#.....#.#.#......c#.#.....#...#.#...#...#...#...#.#...#...#...#...#
#.#######.#########.#.#.#######.#.#####.#####.###.#.###.#.#####.###.###.#.#.#.###
#.#...#...#....x......#.......#...#...#.#.......#...#...#.#...#.#l....#.#.#.#...#
#.#.###.###.#########.#######.#####.#.###.###.#####.#.#####.#.#.#.###.#.#.#####.#
#.#...#...#.#.......#...#...#...#...#...#.#...#.....#.#.....#.#.#...#.#.#.#...#.#
#.###.###.#.#.#####.###.###.###.#.#####.#.#####.#####.#.#####.#.###.###.#.#.#.#.#
#.#.....#...#...#...#.#...#...#.....#.#.#.#.....#...#.T.....#.#...#.#...#.#.#...#
#.#.###########.#.###.###.#.#######.#.#.#.#.#####.#.#######.#.#X###.#.###.#.###W#
#.#.#.........#.#.#.....#.#.#.....#...#.#...#...#.#...#...#.#...#...#...#.#...#.#
#.#.#.#.###.###.#.#.#.#.#.#.#.###.#####.#.###.###.###.#.#.#####.#.#####.#.###.#.#
#.#..w#...#.#...#.#.#.#.#.#.#.#.#.#.....#.....#...#.#.#.#.....#.#..........s#.#.#
#.#######.###.###.#.#.###.#.#.#.#.#.###.#.#####.###.#.#.#####.#############.#D#.#
#...S...#...#.#.#.#.#.......#.#.....#.#.#.#.....#.....#.....#...#.....#.....#.#.#
#######.###.#.#.#.###########.#######.#.#.#.#######.###.###.###.#.###.#######.#.#
#...#.......#.#.#.#.........#...#.....#.#.#.......#.#.....#.#.....#...#.....#.#.#
#.#.#######.#.#.#.#.#######.###.#.#####.#########.#.#######.#######.###.###.#.###
#.#...#...#.#.#.#...#.....#.#...#.......#.....#...#...#.....#.K.#.......#...#...#
#.###.#.#.###.#.#########.#.#.###.#######.###.#.#####.#.###.###.#########.###.#.#
#.#.#.#.#.....#.E...#...#...#.#.#.......#z#.F...#...#...#.#...#...#.....#.#...#.#
#.#.#.#.#######.###.#.#.#####.#.#######.#.###.###.#.#####.#.#####.#.#.###.#.###.#
#...#...#.........#.#.#.......#.....#...#...#.#...#...#...I.#.....#.#.....#...#.#
###.#######.#####.#.#.#.#######.###.#.###.#.###.#####.#.#####.#####.###########.#
#.#.......#.#.....#.#.#.#.........#.#.#.#.#.#...#.....#.#...#.#...#...#.......#.#
#.#######.###.#####.###.#.#########.#.#.#.#.#.###.#####.#.#.#.###.###.###.###.#.#
#...#...#...#.#...#...#.#.#.....#...#.#.#.#...#.#.#...#...#.#k#.....#...#.#.....#
#.###.#A###.#.#.#####.#.#.#.#.#.#.###.#.#.#####.#.#.#.#.#####.#.#######.#.#######
#.#...#...#...#.....#...#.#.#.#.#.#...#.#.#.....#.#.#...#.B...#...#.....#.......#
#.#.#####.#######.#######.###.###.#.###.#.#.#####.#.#####.#######.#.#########.#.#
#.#.#...#.........#.....#...#...#.#.#...#...#.....#.#.....#.....R.#.........#.#.#
#.#.#.#######.#####.###.###.###.#.#.###J###.#.#######.#####.###.###########.###.#
#.#.#.#.......#.....#.#.#...#...#...#...#.#.#.V.....#b..#...#...#.........#.....#
#.#.#.#.#######.#####.#.#.###.#.#####.#.#.#.#######.###.#.#.#####.###.#.#######.#
#.#...#.......#.#.....#.#.#...#.#...#.#.#.#.....#..o#.O.#.#.....#.#...#.#...#...#
#.###.#######.#.#####.#.#.###.#.#.#.#.#.#.#####.#.###.###.#####.#.#.#####.#.#.###
#........m..#.........#.......#...#...#.#.N.....#.....#.......#...#.....P.#.....#
#################################################################################

View File

@ -0,0 +1 @@
109,424,203,1,21102,1,11,0,1106,0,282,21101,0,18,0,1106,0,259,1202,1,1,221,203,1,21101,0,31,0,1105,1,282,21102,38,1,0,1105,1,259,20102,1,23,2,21201,1,0,3,21102,1,1,1,21101,0,57,0,1105,1,303,2101,0,1,222,20102,1,221,3,21002,221,1,2,21101,0,259,1,21101,0,80,0,1106,0,225,21102,1,152,2,21101,91,0,0,1106,0,303,1201,1,0,223,21001,222,0,4,21101,0,259,3,21102,225,1,2,21101,0,225,1,21102,1,118,0,1105,1,225,20101,0,222,3,21102,61,1,2,21101,133,0,0,1106,0,303,21202,1,-1,1,22001,223,1,1,21102,148,1,0,1105,1,259,2101,0,1,223,21001,221,0,4,21001,222,0,3,21101,0,14,2,1001,132,-2,224,1002,224,2,224,1001,224,3,224,1002,132,-1,132,1,224,132,224,21001,224,1,1,21101,0,195,0,105,1,109,20207,1,223,2,20101,0,23,1,21102,-1,1,3,21102,214,1,0,1105,1,303,22101,1,1,1,204,1,99,0,0,0,0,109,5,2101,0,-4,249,21202,-3,1,1,21202,-2,1,2,21201,-1,0,3,21102,1,250,0,1106,0,225,22101,0,1,-4,109,-5,2106,0,0,109,3,22107,0,-2,-1,21202,-1,2,-1,21201,-1,-1,-1,22202,-1,-2,-2,109,-3,2105,1,0,109,3,21207,-2,0,-1,1206,-1,294,104,0,99,22102,1,-2,-2,109,-3,2105,1,0,109,5,22207,-3,-4,-1,1206,-1,346,22201,-4,-3,-4,21202,-3,-1,-1,22201,-4,-1,2,21202,2,-1,-1,22201,-4,-1,1,21202,-2,1,3,21101,343,0,0,1106,0,303,1105,1,415,22207,-2,-3,-1,1206,-1,387,22201,-3,-2,-3,21202,-2,-1,-1,22201,-3,-1,3,21202,3,-1,-1,22201,-3,-1,2,22101,0,-4,1,21101,0,384,0,1106,0,303,1105,1,415,21202,-4,-1,-4,22201,-4,-3,-4,22202,-3,-2,-2,22202,-2,-4,-4,22202,-3,-2,-3,21202,-4,-1,-2,22201,-3,-2,1,21201,1,0,-4,109,-5,2106,0,0

119
AOC2019/input2019/day20.in Normal file
View File

@ -0,0 +1,119 @@
C T N Z D C X P
Y L Z Z M V Z P
###################################.###########.#####.#.#######.###.#######.#.#######################################
#.#.#.#.#.#...#.......#...#.........#...#...........#.#.....#.....#.......#...............#.............#...#.......#
#.#.#.#.#.###.#.###.###.###.###.###.#.#.###.#.###.###.#.#.#####.#.#.###.#########.###.#####.#.###.###.#####.#####.###
#.....#...#.....#.#.........#...#.....#...#.#.#...#.#...#.#.....#.#.#.#.....#.......#...#...#...#...#.#.....#...#.#.#
#####.###.#######.###.#.#.###.###.#.###.#########.#.#.###.#.#########.###.#####.#####.#####.#########.###.###.###.#.#
#...........#.......#.#.#.#...#...#.#.......#.......#.#...#.......#.#.........#.#.#.....#.#.......#.#.#.......#.....#
#####.#.#.#######.#.###.#####.#####.#####.#######.###.###.###.#####.#.###.#####.#.###.###.#.#.#####.#####.#.###.#.###
#.....#.#.....#.#.#.#.#...#...#.....#.....#.#.#.....#...#...#...#.......#...#.#...#.#.......#...#.#...#...#.#...#...#
#.#.#.#.#####.#.###.#.###########.#######.#.#.###.#.#####.#####.###.#.###.#.#.#.###.#.###.#######.#.#####.#####.#####
#.#.#.#.#.#.#.........#...#...#...#.#.#...#...#.#.#...#...#...#...#.#...#.#.#.#...#.....#.....#.#.....#...#.#...#...#
#.#.#.#.#.#.#.###.#.#.###.###.#####.#.#.###.#.###.#.###.#.###.###.#.#########.#.#######.#.#.###.#.#.#####.#.#.#.###.#
#.#.#.#.#.....#.#.#.#.#.....#.......#.#.#...#.....#...#.#.#.....#.#.....#...#.........#.#.#...#...#.#...#.....#.#...#
#######.#######.#####.###.###.#####.#.#.###.###.#.#######.###.#.#.#.#####.###.#######.###.#####.#.###.###.#.#.###.#.#
#.#...#.#.#.#...#...#...#.#.#.#...#.#...#.....#.#.#...#...#.#.#...#...#...#.......#.....#.......#...#...#.#.#.#.#.#.#
#.###.###.#.#.#.#.###.###.#.#####.#.#.#.###.#######.#####.#.#.#.#.#.###.###.#############.#.###.#######.#.#####.###.#
#.#.....#.....#.................#.....#.#.#...#.....#.#.#.#...#.#.#.....#.#.#...#.....#...#.#.#.#...#.......#...#...#
#.###.#.###.#####.#.#.#.#####.###.#.#.###.#.#.###.#.#.#.#.#.#.#.#####.###.#.#.###.###########.#####.###.#######.###.#
#...#.#.#...#.....#.#.#.#...#.#...#.#.#.....#...#.#.....#.#.#.#...#...#...#...#.#.#.#.....#...#.....#.....#.#.....#.#
###.#.###.#.###.#.#########.#.###.#.###.###.#.#####.###.#.#.#######.#####.#.###.#.#.#.#######.#####.###.###.###.###.#
#...#.#.#.#.#...#.#...#.........#.#.#...#.#.#.#.......#.#.#.....#...#.....#...........#.#.#.#.#.#.....#...#.#.....#.#
###.#.#.#######.#####.#######.#####.#####.#.#########.#.#.###.#####.#.###.#.#.#.###.###.#.#.#.#.#.#.###.###.#.#####.#
#.........#...#...#.#.#.............#...#.......#.....#...#.......#.#.#...#.#.#...#.....#...#.#...#...#.#...#.#.#.#.#
#####.#.###.#######.#.#####.#######.#.###.#.#.###.#.#######.#######.#.#.###.#.#.#########.###.###.#####.#.###.#.#.#.#
#.....#...#.....#.#...#.....#.#.#.....#...#.#.#.#.#.......#...#...#.#.#.#.#.#.#...#...#...#.........#...#.#...#.#.#.#
#####.#.#####.###.#.#########.#.###.#####.#.###.#########.#.###.###.#.#.#.#.#########.###.###.#########.#.###.#.#.#.#
#...#.#.#.#.......#.#.#.....#.#.........#.#...#...#.......#.......#.#.#...#.#.#...#...#...........#...#.#.....#.....#
###.###.#.###.###.#.#.#.###.#.###.#.#######.###.###.#######.###.###.#.###.#.#.###.#.#.#######.#####.###.#.#.###.#.###
#.......#.#.#...#.#...#.#...#.#...#.#.....#.....#.#.....#.#...#.#.#.#.#.#.#...#...#.#.....#.....#.#.#...#.#...#.#...#
#####.#.#.#.#####.#.#######.#.#####.#.#####.#.###.###.#.#.#.#####.#.#.#.#.#.###.#####.#######.###.#.#.#####.###.#####
#...#.#.......#.......#...................#.#...#.....#.#.........#...#...#...........#.#.......#.#...#.#.....#...#.#
###.###.#######.###.#################.#####.###########.#######.#######.#####.#.#######.#.#####.#.###.#.###.###.#.#.#
#.#...#.#.#...#.#...#.#.....#.# G U U G Y P J #...#.....#.#.#.#...#.#.#.#.#.#
#.###.#.#.#.#.#####.#.###.###.# Y M C C O Y V ###.#####.#.#.#.###.#.#.#.###.#
UM....#...#.#.#.#...#.#.#.......# #.#.#.#...#.........#.........#
#.#####.#.#.#####.#.#.#.#.#.### #.###.#.#.#.#.#.###.#.###.#.###
#.............#...#.#.#.#.#.#..LM #.#...#.#.#.#.#...#.....#.#.#.#
#.###.#####.#####.#.#.#.#.###.# #.#.###.#.#.###.###.#.###.###.#
#...#.#...#.............#.....# TL..#.....#.....#.#...#.#...#.#.#
#########.###########.###.##### #.#####.#.###########.###.#.#.#
#...#...............#.#.#.#...# #.......#...#.......#.#........PY
#.###.#.###.#.###.#####.###.### #############.#.#.#############
YO......#.#...#...#.#.......#...# WH..#.#.#.#.#.#.#.#...#.#.......#
#.#.#.#.#.#.#####.#.#.#####.### #.#.#.#.#.#.#####.#.#.###.#.###
#.#.#.#.#.#.#.......#.#.#.#.#..AM #.#.#...#.#.#.....#.#.#...#....KK
#######.###.#####.###.#.#.#.#.# #.#.#.###.#.#####.#.#.#.###.###
#...#...#...#.#.....#.........# #.......#.....#.#.#.....#...#.#
#.###########.#############.### #####.#.###.#.#.#.###.###.#.#.#
#...#.#...#.#...#.........#.#..XI #...#.#.....#.....#.....#.#.#.#
#.###.#.###.###.#.###.#######.# ###.###.#####################.#
#.#...#.#...#.#.#.#.....#.....# #...#.#.#...#.#.........#.....#
#.#.###.#.#.#.#.#.#.#####.##### ###.#.###.###.#.#.#.###.#.###.#
AW..........#.......#...........# #.#.....#...#...#.#.#.....#...#
############################### #.#.###.#.#.#.#.###.###.###.###
#.......#.....................# CV..#...#...#...#...#...#.#.....#
###.###.#.###.###.#.#.###.###.# #.###.###.#.#.###.###########.#
#...#...#...#.#...#.#.#...#.#..HB #.....#...#.#.#.#.#.#.....#.#..CQ
###.#.#####.#.#####.#####.#.#.# #.###.###.#####.###.###.###.###
GL..#.#.....#.#.#...#.#...#...#.# #...#...#.#.#...#...#.#.......#
#.#.#.#.#.#.#####.###.######### ###########.###.#.#.#.#.#####.#
#...#.#.#.....#.#.......#.#...# #...#.#.........#.#...#.....#.#
###############.#.#######.#.### ###.#.#####.###.#####.#####.#.#
PN....#.................#.....#.# #.#.....#.#...#.#...........#..JV
#.#.#.###.#.#########.###.#.#.# #.###.###.#.#.#####.#.#.###.###
#.#.#...#.#.#.........#...#.#..NZ CY............#.......#.#.#.#.#.#
###.###.###.#.###.#######.#.#.# #######.#######.#########.###.#
#.....#...#.#.#.....#...#.#.#.# DM......#.#...#...#.#...#...#....AM
#.#.###.###########.#.#.#.#.#.# ###.#####.#.#####.#.###.#.#.#.#
#.#...........#.......#...#...# #.#.#...#.#...#.#.......#.#.#.#
###############.###########.#.# #.#.###.#.#.###.###.#.###.#.###
#.#.....#.....#.#.......#.#.#.# #...#.....#...#...#.#.#...#...#
#.#.#.###.#######.###.###.###.# #.#.###.###.#.###.#.###.#####.#
#...#.#.#...#.#.#...#.......#.# #.#.......#.#.........#.......#
#.###.#.#.###.#.###.#####.##### #######.#.#.###.#.#####.#.###.#
YF..#.#.........#...#...#...#....PN XZ......#.#.#.#.#.#.#.....#.#.#.#
#.#.#######.###.#.###.###.#.### #####.#####.#.#.###########.###
#.#.#.#.#.......#.......#.....# #.........#.#.#.#.#...........#
###.#.#.###.#######.#.######### #.###########.###.#.###.#######
#.......#...#.#...#.#...#.#....KY #.......#.#.....#...#.#.......#
#####.#.#####.#.#########.###.# #.#.###.#.###.###.###.#.#######
YA..#...#.....#.#...#...#.#.....# #.#...#.............#..........KY
#.###.###.###.#.#.#.#.#.#.##### #.#########.#.#.#####.#.#.#.#.#
#.......#.......#...#.........# #...#.......#.#.#.#...#.#.#.#.#
#.#######.###.###.#.#.#.#.###.# A K C G Y Y P #.#######.#.###.#.#######.#####
#.#.......#...#...#.#.#.#...#.# W K Q L A F P #...#.....#...#...#.#.#.......#
#.###.#####.###.#.#.#.#.#.###.#######.#######.###.#######.#######.#####.#####.#################.#.###.###.#.###.#.###
#.#...#...#.#...#.#.#.#.#...#.#.......#.........#.#.#.#.....#.#.#.....#.#.......#.....#...#.#...#...#.......#...#.#.#
#####.###.#######.#####.#.#######.#.#####.#####.#.#.#.#.#####.#.###.###.###.###.#.#.###.###.###.###.#.###.#####.###.#
#.........#...........#.#.......#.#.....#...#.#.#...#.#...........#.#.....#.#.....#.........#.....#.#.#.....#.#.#...#
#####.#######.#####.###.#.###.#####.#.#####.#.#####.#.###.#.#######.#.#.#####.###.#.###.###.#########.###.###.#.###.#
#.......#.....#...#...#.#...#.#...#.#.....#.....#.#.....#.#...#.....#.#.#.#.#.#.#.#...#.#...#...#.......#.....#.#.#.#
#.###.###.#.#.###.#.#####.#.###.#####.#.###.#.#.#.#.#.#####.#####.###.###.#.###.###.#.#####.###.#.###.###.###.#.#.#.#
#...#...#.#.#.#.....#.#...#.#.#...#...#...#.#.#.#...#...#.#.....#...#.#.#...#.......#...#.....#...#...#...#...#.....#
#.#########.#####.#.#.#.#.###.#.#######.#####.#######.###.#.#.###.###.#.###.#######.#.###.#.#.###.###.#####.#######.#
#.....#.......#...#...#.#.#...#...........#.......#.....#...#...#...#.......#.#...#.#.#...#.#.#.#.#.#...#...#.......#
###.#####.#.###.#.#####.#.###.###.#.#.#.#.###.#.#####.#####.#####.#####.###.#.###.#.#.###.#.###.#.#.#.#.###.###.###.#
#...#.#...#...#.#...#...#.#.#.....#.#.#.#.#...#.#.....#...#.#.......#...#.#...#.#.#.#.#.#.#.....#.#...#.#.#...#...#.#
#.###.###.#.#####.#.#######.#.###.#####.#####.#.#####.###.#.###.###.###.#.#.###.#.#.###.###.#######.#.###.#########.#
#.#.......#...#.#.#.#...#...#.#.#.#.......#...#.#.#.....#.....#...#...#.#.......#...#.#...#.....#.#.#...........#.#.#
#.#.###.#.#####.#.#.###.###.###.#.#.#.#.###.#####.###.###.#.#######.#.#####.#####.#.#.#.#########.###.###.#.#####.###
#.#.#...#.#...#.#.#...#.......#.#.#.#.#...#.....#...#.#.#.#.#.#.#...#...#.....#.#.#.......#.#...#.......#.#.........#
#####.#######.#.#######.###.###.#######.###.#.#####.#.#.###.#.#.###.#.#.###.###.###.#######.#.#####.###.#####.###.#.#
#.......#.........#...#.#.....#...#.#.....#.#.#.......#.#...#.......#.#.#...#...#...............#...#...#.....#...#.#
#####.#####.#.#.#.###.#####.#.#.###.###.#####.#.#######.#.#.#.###.#######.#.###.###.###.#######.#########.###.###.#.#
#.#...#.....#.#.#...#.#.#...#.............#...#.#.......#.#.#...#.#.....#.#.#.....#...#.....#.........#.....#...#.#.#
#.###.###.#########.#.#.#####.###.#.#.###.###.#.#.###.#.#.#####.###.#######.#.###.#.###.#.#.###.#####.###.#.#####.#.#
#.......#.#.................#.#.#.#.#.#...#...#.#.#.#.#.#...#.#.....#.#.....#.#.#.#...#.#.#...#...#...#...#.....#.#.#
###.#.###.###########.###.#####.#.#########.###.#.#.#.###.###.#####.#.#.###.#.#.#.#.#######.#.#############.#.#######
#.#.#...#.#.#.#...#.....#.#.............#.....#...#.#.#.....#.....#...#.#.#.#.#.#.......#.#.#.#.#.....#...#.#.......#
#.#########.#.#.#########.#.#####.#######.#.#.#######.#####.#.###.#.###.#.#.#.#.#.###.###.#####.###.###.#####.#.#.###
#.#.......#.....#.#.............#.....#...#.#.#.#...#.#.#...#...#...#...#.#.#.#.#...#.....#.#.............#.#.#.#...#
#.#######.#####.#.###.#####.#####.###########.#.#.###.#.###.###.#########.#.#.###.#.#.#####.#.#.#.###.#.###.###.#.#.#
#.#.......#.#.........#.#...#...#.#.#.#.....#.#.......#.....#.#...#.#.......#...#.#.#.........#.#...#.#.......#.#.#.#
#.#####.###.###.#.#.###.#.#####.#.#.#.###.###.#.#.###.#.#.#.#.#.###.###.###.#.#####.#.#.#.#.#.#####.#############.###
#...............#.#.#.....#.........#.........#.#.#...#.#.#.#.........#...#.#.....#.#.#.#.#.#.#.................#...#
###################################.#####.#####.###########.###.###.#####.###.#######################################
G H W U A X L G
Y B H C A I M C

File diff suppressed because one or more lines are too long

100
AOC2019/input2019/day22.in Normal file
View File

@ -0,0 +1,100 @@
deal with increment 30
cut 6056
deal into new stack
deal with increment 13
cut 495
deal with increment 58
deal into new stack
deal with increment 21
cut 8823
deal with increment 59
cut -9853
deal with increment 65
deal into new stack
cut -6597
deal with increment 59
cut 9239
deal with increment 4
deal into new stack
deal with increment 4
cut 8557
deal with increment 8
cut 115
deal with increment 22
cut 2088
deal with increment 65
deal into new stack
cut 8009
deal into new stack
cut -7132
deal with increment 59
cut 9091
deal into new stack
deal with increment 46
cut -5059
deal into new stack
deal with increment 30
cut -1320
deal into new stack
deal with increment 60
deal into new stack
cut -7889
deal with increment 60
deal into new stack
cut -5595
deal with increment 63
cut -2711
deal with increment 34
cut 6140
deal into new stack
cut 7103
deal with increment 15
cut -8216
deal with increment 61
cut -8159
deal with increment 19
cut 7942
deal with increment 10
cut -1116
deal with increment 16
cut -2714
deal into new stack
deal with increment 70
cut -7959
deal with increment 40
cut 6906
deal into new stack
deal with increment 65
cut 8120
deal with increment 70
cut -7770
deal with increment 12
cut -6563
deal with increment 62
cut 9205
deal with increment 17
cut 1949
deal with increment 72
cut -5249
deal with increment 6
cut 948
deal into new stack
cut 1155
deal into new stack
deal with increment 26
cut 5856
deal with increment 18
cut -7873
deal with increment 4
cut -7413
deal with increment 18
cut -7559
deal with increment 21
cut -2338
deal with increment 16
deal into new stack
cut 9644
deal with increment 16
cut -7319
deal with increment 34
cut -7603

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,5 @@
##.#.
##.#.
##.##
.####
.#...

File diff suppressed because one or more lines are too long

29
AOC2020/AOC2020.csproj Normal file
View File

@ -0,0 +1,29 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<None Update="input2020\*.in">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Using Include="AOC.Common" />
<Using Include="System.Collections.Generic" />
<Using Include="System.Collections.Immutable" />
<Using Include="System.Reflection" />
<Using Include="System.Text" />
<Using Include="System.Text.RegularExpressions" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\AOC.Common\AOC.Common.csproj" />
</ItemGroup>
</Project>

29
AOC2020/Day01.cs Normal file
View File

@ -0,0 +1,29 @@
namespace AOC2020;
/// <summary>
/// Day 1: <see href="https://adventofcode.com/2020/day/1" />
/// </summary>
public sealed class Day01 : Day
{
private readonly ImmutableHashSet<int> _entries;
public Day01() : base(1, "Report Repair") =>
_entries = Input.Select(int.Parse).ToImmutableHashSet();
public override string Part1()
{
var entry = _entries.First(e => _entries.Contains(2020 - e));
return $"{entry * (2020 - entry)}";
}
public override string Part2()
{
foreach (var i in _entries)
foreach (var j in _entries)
foreach (var k in _entries)
if (i + j + k == 2020)
return $"{i * j * k}";
return "";
}
}

46
AOC2020/Day02.cs Normal file
View File

@ -0,0 +1,46 @@
namespace AOC2020;
/// <summary>
/// Day 2: <see href="https://adventofcode.com/2020/day/1" />
/// </summary>
public sealed class Day02 : Day
{
private readonly ImmutableList<Password> _passwords;
public Day02() : base(2, "Password Philosophy") =>
_passwords = Input.Select(p => new Password(p)).ToImmutableList();
public override string Part1() =>
$"{_passwords.Count(p => p.IsValid)}";
public override string Part2() =>
$"{_passwords.Count(p => p.IsValidByIndex)}";
private class Password
{
public Password(string line)
{
var split = line.Split(": ", 2);
var split2 = split[0].Split(' ', 2);
var indices = split2[0].Split('-', 2);
I = int.Parse(indices[0]);
J = int.Parse(indices[1]);
C = char.Parse(split2[1]);
Value = split[1];
}
public bool IsValid =>
Count >= I && Count <= J;
public bool IsValidByIndex =>
(Value[I - 1] == C) ^ (Value[J - 1] == C);
private int Count =>
Value.Count(p => p == C);
private int I { get; }
private int J { get; }
private char C { get; }
private string Value { get; }
}
}

39
AOC2020/Day03.cs Normal file
View File

@ -0,0 +1,39 @@
namespace AOC2020;
/// <summary>
/// Day 3: <see href="https://adventofcode.com/2020/day/3" />
/// </summary>
public sealed class Day03 : Day
{
private readonly string[] _grid;
private readonly int _width;
public Day03() : base(3, "Toboggan Trajectory")
{
_grid = Input.ToArray();
_width = _grid[0].Length;
}
private long CountSlope(int dx, int dy)
{
long hits = 0;
for (int x = 0, y = 0; y < _grid.Length; y += dy, x = (x + dx) % _width)
if (_grid[y][x] == '#')
hits++;
return hits;
}
public override string Part1() => $"{CountSlope(3, 1)}";
public override string Part2()
{
var xSlopes = new[] { 1, 3, 5, 7, 1 };
var ySlopes = new[] { 1, 1, 1, 1, 2 };
return xSlopes.Zip(ySlopes)
.Select(s => CountSlope(s.First, s.Second))
.Aggregate((acc, i) => acc * i)
.ToString();
}
}

176
AOC2020/Day04.cs Normal file
View File

@ -0,0 +1,176 @@
namespace AOC2020;
/// <summary>
/// Day 4: <see href="https://adventofcode.com/2020/day/4" />
/// </summary>
public sealed class Day04 : Day
{
private readonly List<Passport> _passports;
public Day04() : base(4, "Passport Processing")
{
_passports = new List<Passport>();
var a = new List<string>();
foreach (var line in Input)
{
if (line == "")
{
_passports.Add(Passport.Parse(a));
a.Clear();
continue;
}
a.Add(line);
}
if (a.Any()) _passports.Add(Passport.Parse(a));
}
public override string Part1() => $"{_passports.Count(p => p.IsValid)}";
public override string Part2() => $"{_passports.Count(p => p.ExtendedValidation())}";
private class Passport
{
private string? _byr;
private string? _cid;
private string? _ecl;
private string? _eyr;
private string? _hcl;
private string? _hgt;
private string? _iyr;
private string? _pid;
public bool IsValid =>
_byr != null &&
_iyr != null &&
_eyr != null &&
_hgt != null &&
_hcl != null &&
_ecl != null &&
_pid != null;
public bool ExtendedValidation()
{
if (!IsValid) return false;
// birth year
if (int.TryParse(_byr, out var byr))
{
if (byr < 1920 || byr > 2002)
return false;
}
else
{
return false;
}
// issuance year
if (int.TryParse(_iyr, out var iyr))
{
if (iyr < 2010 || iyr > 2020)
return false;
}
else
{
return false;
}
// expiration year
if (int.TryParse(_eyr, out var eyr))
{
if (eyr < 2020 || eyr > 2030)
return false;
}
else
{
return false;
}
// height
if (_hgt!.EndsWith("cm"))
{
var h = _hgt[..3];
if (int.TryParse(h, out var hgt))
{
if (hgt < 150 || hgt > 193)
return false;
}
else
{
return false;
}
}
else if (_hgt.EndsWith("in"))
{
var h = _hgt[..2];
if (int.TryParse(h, out var hgt))
{
if (hgt < 59 || hgt > 76)
return false;
}
else
{
return false;
}
}
else
{
return false;
}
// hair color
if (!Regex.IsMatch(_hcl!, "#[0-9a-f]{6}"))
return false;
// eye color
if (!new[] { "amb", "blu", "brn", "gry", "grn", "hzl", "oth" }.Contains(_ecl))
return false;
// passport id
if (_pid != null && _pid.Length != 9)
return false;
return true;
}
public static Passport Parse(IEnumerable<string> list)
{
var passport = new Passport();
foreach (var entry in string.Join(' ', list).Split(' ', StringSplitOptions.TrimEntries))
{
var spl = entry.Split(':', 2);
switch (spl[0])
{
case "byr":
passport._byr = spl[1];
break;
case "iyr":
passport._iyr = spl[1];
break;
case "eyr":
passport._eyr = spl[1];
break;
case "hgt":
passport._hgt = spl[1];
break;
case "hcl":
passport._hcl = spl[1];
break;
case "ecl":
passport._ecl = spl[1];
break;
case "pid":
passport._pid = spl[1];
break;
case "cid":
passport._cid = spl[1];
break;
}
}
return passport;
}
}
}

22
AOC2020/Day05.cs Normal file
View File

@ -0,0 +1,22 @@
namespace AOC2020;
/// <summary>
/// Day 5: <see href="https://adventofcode.com/2020/day/5" />
/// </summary>
public sealed class Day05 : Day
{
private readonly ImmutableHashSet<int> _ids;
public Day05() : base(5, "Binary Boarding") =>
_ids = Input
.Select(s =>
Convert.ToInt32(s.Replace('F', '0').Replace('B', '1').Replace('L', '0').Replace('R', '1'), 2))
.OrderBy(i => i)
.ToImmutableHashSet();
public override string Part1() => $"{_ids.Last()}";
public override string Part2() =>
// arithmetic sum of full series
$"{(_ids.Count + 1) * (_ids.First() + _ids.Last()) / 2 - _ids.Sum()}";
}

44
AOC2020/Day06.cs Normal file
View File

@ -0,0 +1,44 @@
namespace AOC2020;
/// <summary>
/// Day 6: <see href="https://adventofcode.com/2020/day/6" />
/// </summary>
public sealed class Day06 : Day
{
private readonly int _countPart1;
private readonly int _countPart2;
public Day06() : base(6, "Custom Customs")
{
var alphabet = "abcedfghijklmnopqrstuvwxyz".ToCharArray();
_countPart1 = 0;
_countPart2 = 0;
var s = new HashSet<char>();
var lines = new HashSet<string>();
foreach (var line in Input)
{
if (line == "")
{
_countPart1 += s.Count;
_countPart2 += alphabet.Count(a => lines.All(l => l.Contains(a)));
s.Clear();
lines.Clear();
continue;
}
foreach (var c in line)
s.Add(c);
lines.Add(line);
}
if (s.Any())
{
_countPart1 += s.Count;
_countPart2 += alphabet.Count(a => lines.All(l => l.Contains(a)));
}
}
public override string Part1() => $"{_countPart1}";
public override string Part2() => $"{_countPart2}";
}

54
AOC2020/Day07.cs Normal file
View File

@ -0,0 +1,54 @@
namespace AOC2020;
/// <summary>
/// Day 7: <see href="https://adventofcode.com/2020/day/7" />
/// </summary>
public sealed class Day07 : Day
{
private readonly Dictionary<string, IEnumerable<(int Weight, string Name)?>> _rules;
public Day07() : base(7, "Handy Haversacks") =>
_rules = Input
.Select(rule =>
{
var spl = rule.Split(" bags contain ", 2);
var outer = string.Join(' ', spl[0].Split(' ').Take(2));
var inner = spl[1].Split(", ").Select(ParseQuantity).Where(i => i != null);
return (outer, inner);
})
.ToDictionary(t => t.outer, t => t.inner);
private static (int, string)? ParseQuantity(string arg)
{
if (arg == "no other bags.") return null;
var words = arg.Split(' ');
return (int.Parse(words[0]), string.Join(' ', words[1..3]));
}
private int Weight(string node) =>
1 + _rules[node]
.Where(i => i.HasValue)
.Select(i => i!.Value)
.Sum(i => i.Weight * Weight(i.Name));
public override string Part1()
{
// breadth-first search with Queue
var start = new Queue<string>(new[] { "shiny gold" });
var p = new HashSet<string>();
string node;
while (true)
{
node = start.Dequeue();
foreach (var (container, contained) in _rules)
if (contained.Any(i => i.HasValue && i.Value.Name == node) && p.Add(container))
start.Enqueue(container);
if (!start.Any()) break;
}
return $"{p.Count}";
}
public override string Part2() => $"{Weight("shiny gold") - 1}";
}

72
AOC2020/Day08.cs Normal file
View File

@ -0,0 +1,72 @@
namespace AOC2020;
/// <summary>
/// Day 8: <see href="https://adventofcode.com/2020/day/8" />
/// </summary>
public sealed class Day08 : Day
{
private readonly (string instruction, int value)[] _instructions;
private int _accumulator;
private int _currentInstruction;
public Day08() : base(8, "Handheld Halting") =>
_instructions = Input.Select(ParseLine).ToArray();
private static (string, int) ParseLine(string line)
{
var spl = line.Split(' ', 2);
return (spl[0], int.Parse(spl[1]));
}
private bool Halts()
{
_accumulator = 0;
_currentInstruction = 0;
var visited = new bool[_instructions.Length + 1];
while (!visited[_currentInstruction] && _currentInstruction < _instructions.Length)
{
visited[_currentInstruction] = true;
switch (_instructions[_currentInstruction].instruction)
{
case "acc":
_accumulator += _instructions[_currentInstruction].value;
break;
case "jmp":
_currentInstruction += _instructions[_currentInstruction].value;
continue;
}
_currentInstruction++;
}
return _currentInstruction == _instructions.Length;
}
public override string Part1()
{
Halts();
return $"{_accumulator}";
}
public override string Part2()
{
for (var i = 0; i < _instructions.Length; i++)
// swap each nop and jmp and check if the program halts
if (_instructions[i].instruction == "nop")
{
_instructions[i].instruction = "jmp";
if (Halts()) break;
_instructions[i].instruction = "nop";
}
else if (_instructions[i].instruction == "jmp")
{
_instructions[i].instruction = "nop";
if (Halts()) break;
_instructions[i].instruction = "jmp";
}
return $"{_accumulator}";
}
}

47
AOC2020/Day09.cs Normal file
View File

@ -0,0 +1,47 @@
namespace AOC2020;
/// <summary>
/// Day 9: <see href="https://adventofcode.com/2020/day/9" />
/// </summary>
public sealed class Day09 : Day
{
private readonly long[] _list;
private long _part1;
public Day09() : base(9, "Encoding Error") =>
_list = Input.Select(long.Parse).ToArray();
public override string Part1()
{
for (var i = 25; i < _list.Length - 25; i++)
{
var preamble = _list[(i - 25)..i];
if (!preamble.Any(num1 => preamble.Any(num2 => num1 + num2 == _list[i])))
{
_part1 = _list[i];
return $"{_part1}";
}
}
return "";
}
public override string Part2()
{
for (var i = 0; i < _list.Length; i++)
{
long sum = 0;
for (var j = i; j < _list.Length; j++)
{
sum += _list[j];
if (sum > _part1) break;
if (sum != _part1) continue;
var subset = _list[i..(j + 1)].ToArray();
return $"{subset.Min() + subset.Max()}";
}
}
return "";
}
}

52
AOC2020/Day10.cs Normal file
View File

@ -0,0 +1,52 @@
namespace AOC2020;
/// <summary>
/// Day 10: <see href="https://adventofcode.com/2020/day/10" />
/// </summary>
public sealed class Day10 : Day
{
private readonly int[] _adapters;
private readonly long[] _memo;
public Day10() : base(10, "Adapter Array")
{
var parsed = Input.Select(int.Parse).ToArray();
// add socket and device to the list
_adapters = parsed.Concat(new[] { 0, parsed.Max() + 3 }).OrderBy(i => i).ToArray();
_memo = new long[_adapters.Length];
}
private long Connections(int i)
{
if (i == _adapters.Length - 1) _memo[i] = 1;
if (_memo[i] > 0) return _memo[i];
for (var j = i + 1; j <= i + 3 && j < _adapters.Length; j++)
if (_adapters[j] - _adapters[i] <= 3)
_memo[i] += Connections(j);
return _memo[i];
}
public override string Part1()
{
var ones = 0;
var threes = 0;
for (var i = 0; i < _adapters.Length - 1; i++)
switch (_adapters[i + 1] - _adapters[i])
{
case 1:
ones++;
break;
case 3:
threes++;
break;
default: throw new Exception("something went wrong");
}
return $"{ones * threes}";
}
public override string Part2() => $"{Connections(0)}";
}

137
AOC2020/Day11.cs Normal file
View File

@ -0,0 +1,137 @@
namespace AOC2020;
/// <summary>
/// Day 11: <see href="https://adventofcode.com/2020/day/11" />
/// </summary>
public sealed class Day11 : Day
{
public Day11() : base(11, "Seating System")
{
}
public override string Part1()
{
var prev = new LifeGame(Input);
while (true)
{
var next = prev.StepPart1();
var same = true;
for (var i = 0; i < next.Grid.Length; i++)
if (!next.Grid[i].SequenceEqual(prev.Grid[i]))
{
same = false;
break;
}
if (same) break;
prev = next;
}
return $"{prev.TotalSeated}";
}
public override string Part2()
{
var prev = new LifeGame(Input);
while (true)
{
var next = prev.StepPart2();
var same = true;
for (var i = 0; i < next.Grid.Length; i++)
if (!next.Grid[i].SequenceEqual(prev.Grid[i]))
{
same = false;
break;
}
if (same) break;
prev = next;
}
return $"{prev.TotalSeated}";
}
private class LifeGame
{
private int _h, _w;
public char[][] Grid;
public LifeGame(IEnumerable<string> input)
{
Grid = input.Select(line => line.ToCharArray()).ToArray();
_h = Grid.Length;
_w = Grid[0].Length;
}
private LifeGame() => Grid = Array.Empty<char[]>();
public int TotalSeated =>
Grid.Sum(l => l.Count(c => c == '#'));
public LifeGame StepPart1()
{
var next = new LifeGame { _h = _h, _w = _w, Grid = Grid.Select(s => s.ToArray()).ToArray() };
for (var y = 0; y < _h; y++)
for (var x = 0; x < _w; x++)
next.Grid[y][x] = Grid[y][x] switch
{
'L' when CountAdjacent(y, x) == 0 => '#',
'#' when CountAdjacent(y, x) >= 4 => 'L',
_ => Grid[y][x]
};
// next.PrintBoard();
return next;
}
private char At(int y, int x) =>
x < 0 || y < 0 || x >= _w || y >= _h ? '.' : Grid[y][x];
private int CountAdjacent(int y, int x) =>
new[]
{
At(y - 1, x - 1), At(y - 1, x + 0), At(y - 1, x + 1),
At(y + 0, x - 1), At(y + 0, x + 1),
At(y + 1, x - 1), At(y + 1, x + 0), At(y + 1, x + 1)
}.Count(c => c == '#');
public LifeGame StepPart2()
{
var next = new LifeGame { _h = _h, _w = _w, Grid = Grid.Select(s => s.ToArray()).ToArray() };
for (var y = 0; y < _h; y++)
for (var x = 0; x < _w; x++)
next.Grid[y][x] = Grid[y][x] switch
{
'L' when CanSee(y, x) == 0 => '#',
'#' when CanSee(y, x) >= 5 => 'L',
_ => Grid[y][x]
};
// next.PrintBoard();
return next;
}
private int CanSee(int y, int x) =>
new[]
{
TraceRay(y, x, -1, -1), TraceRay(y, x, -1, +0), TraceRay(y, x, -1, +1),
TraceRay(y, x, +0, -1), TraceRay(y, x, +0, +1),
TraceRay(y, x, +1, -1), TraceRay(y, x, +1, +0), TraceRay(y, x, +1, +1)
}.Count(c => c == '#');
private char TraceRay(int y, int x, int dy, int dx)
{
y += dy;
x += dx;
while (y >= 0 && y < _h && x >= 0 && x < _w)
{
if (Grid[y][x] != '.') return Grid[y][x];
y += dy;
x += dx;
}
return '.';
}
}
}

86
AOC2020/Day12.cs Normal file
View File

@ -0,0 +1,86 @@
namespace AOC2020;
/// <summary>
/// Day 12: <see href="https://adventofcode.com/2020/day/12" />
/// </summary>
public sealed class Day12 : Day
{
public Day12() : base(12, "Rain Risk")
{
}
private static void Swap(ref int x, ref int y) => (y, x) = (x, y);
private (int x, int y, int sx, int sy) ProcessInstructions()
{
// start facing east
int x = 0, y = 0, dx = 1, dy = 0;
int sx = 0, sy = 0, waypointX = 10, waypointY = -1;
foreach (var instruction in Input)
{
var value = int.Parse(instruction[1..]);
switch (instruction[0])
{
case 'N':
y -= value;
waypointY -= value;
break;
case 'S':
y += value;
waypointY += value;
break;
case 'E':
x += value;
waypointX += value;
break;
case 'W':
x -= value;
waypointX -= value;
break;
case 'L':
for (var i = 0; i < value / 90; ++i)
{
Swap(ref dx, ref dy);
Swap(ref waypointX, ref waypointY);
dy *= -1;
waypointY *= -1;
}
break;
case 'R':
for (var i = 0; i < value / 90; ++i)
{
Swap(ref dx, ref dy);
Swap(ref waypointX, ref waypointY);
dx *= -1;
waypointX *= -1;
}
break;
case 'F':
x += dx * value;
y += dy * value;
sx += waypointX * value;
sy += waypointY * value;
break;
default: throw new InvalidOperationException(nameof(instruction));
}
}
return (x, y, sx, sy);
}
public override string Part1()
{
var (x, y, _, _) = ProcessInstructions();
return $"{Math.Abs(x) + Math.Abs(y)}";
}
public override string Part2()
{
var (_, _, sx, sy) = ProcessInstructions();
return $"{Math.Abs(sx) + Math.Abs(sy)}";
}
}

51
AOC2020/Day13.cs Normal file
View File

@ -0,0 +1,51 @@
namespace AOC2020;
/// <summary>
/// Day 13: <see href="https://adventofcode.com/2020/day/13" />
/// </summary>
public sealed class Day13 : Day
{
private readonly long[] _buses;
private readonly long _earliest;
private readonly string[] _fullSchedule;
public Day13() : base(13, "Shuttle Search")
{
_earliest = long.Parse(Input.First());
_fullSchedule = Input.Last().Split(',');
_buses = _fullSchedule.Where(c => c != "x").Select(long.Parse).ToArray();
}
public override string Part1()
{
for (var i = _earliest; ; i++)
if (_buses.Any(b => i % b == 0))
{
var bus = _buses.First(b => i % b == 0);
return $"{bus * (i - _earliest)}";
}
}
public override string Part2()
{
var i = 0;
long result = 1, multiplier = 1;
foreach (var id in _fullSchedule)
{
if (id != "x")
{
var increment = long.Parse(id);
while (((result += multiplier) + i) % increment != 0)
{
}
multiplier *= increment;
}
i++;
}
return $"{result}";
}
}

106
AOC2020/Day14.cs Normal file
View File

@ -0,0 +1,106 @@
namespace AOC2020;
/// <summary>
/// Day 14: <see href="https://adventofcode.com/2020/day/14" />
/// </summary>
public sealed class Day14 : Day
{
public Day14() : base(14, "Docking Data")
{
}
public override string Part1()
{
var writes = new Dictionary<ulong, ulong>();
ulong mask = 0, bits = 0;
foreach (var line in Input)
if (line.StartsWith("mask = "))
{
var str = line.Split("mask = ", 2)[1];
mask = bits = 0;
for (var i = 35; i >= 0; --i)
switch (str[35 - i])
{
case 'X':
mask |= 1UL << i;
break;
case '1':
bits |= 1UL << i;
break;
}
}
else
{
var spl = line.Split(new[] { '[', ']', '=' },
StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries)
.Skip(1)
.Select(ulong.Parse)
.ToArray();
writes[spl[0]] = (spl[1] & mask) | bits;
}
return $"{writes.Aggregate<KeyValuePair<ulong, ulong>, ulong>(0, (current, w) => current + w.Value)}";
}
public override string Part2()
{
var memory = new Dictionary<ulong, ulong>();
var mask = "";
foreach (var line in Input)
{
var spl = line.Split(' ', 3, StringSplitOptions.TrimEntries);
if (spl[0] == "mask")
{
mask = spl[2];
}
else
{
var value = ulong.Parse(spl[2]);
var addr = ulong.Parse(spl[0].Split(new[] { '[', ']' },
StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries)[1]);
var floats = new List<int>();
for (var i = 0; i < mask.Length; i++)
switch (mask[i])
{
case 'X':
floats.Add(i);
break;
case '1':
addr |= 1UL << (35 - i);
break;
}
if (floats.Any())
{
var combos = new List<ulong> { addr };
foreach (var i in floats)
{
var newCombos = new List<ulong>();
foreach (var c in combos)
{
newCombos.Add(c | (1UL << (35 - i)));
newCombos.Add(c & ~(1UL << (35 - i)));
}
combos = newCombos;
}
foreach (var c in combos)
memory[c] = value;
}
else
{
memory[addr] = value;
}
}
}
return $"{memory.Aggregate<KeyValuePair<ulong, ulong>, ulong>(0, (current, w) => current + w.Value)}";
}
}

45
AOC2020/Day15.cs Normal file
View File

@ -0,0 +1,45 @@
namespace AOC2020;
/// <summary>
/// Day 15: <see href="https://adventofcode.com/2020/day/15" />
/// </summary>
public sealed class Day15 : Day
{
private readonly int[] _turns;
private int _current;
private int _i;
public Day15() : base(15, "Rambunctious Recitation")
{
var initial = Input.First().Split(',').Select(int.Parse).ToArray();
_turns = new int[30_000_000];
// seed array with initial values
for (_i = 1; _i < initial.Length + 1; _i++)
_turns[initial[_i - 1]] = _i;
}
public override string Part1()
{
for (; _i != 2020; _i++)
{
var next = _turns[_current] > 0 ? _i - _turns[_current] : 0;
_turns[_current] = _i;
_current = next;
}
return $"{_current}";
}
public override string Part2()
{
for (; _i != 30_000_000; _i++)
{
var next = _turns[_current] > 0 ? _i - _turns[_current] : 0;
_turns[_current] = _i;
_current = next;
}
return $"{_current}";
}
}

86
AOC2020/Day16.cs Normal file
View File

@ -0,0 +1,86 @@
namespace AOC2020;
/// <summary>
/// Day 16: <see href="https://adventofcode.com/2020/day/16" />
/// </summary>
public sealed class Day16 : Day
{
private readonly Dictionary<string, List<Range>> _rules;
private readonly List<List<int>> _tickets;
public Day16() : base(16, "Ticket Translation")
{
_tickets = new();
_rules = new();
foreach (var line in Input)
{
var spl = line.Split(": ", 2, StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
if (spl.Length == 2)
{
var rule = spl[1].Split(" or ").Select(s =>
{
var r = s.Split('-').Select(int.Parse).ToList();
return new Range(r[0], r[1]);
}).ToList();
_rules.Add(spl[0], rule);
}
else
{
spl = line.Split(',');
if (spl.Length > 1)
_tickets.Add(spl.Select(int.Parse).ToList());
}
}
}
public override string Part1()
{
var allValues = _tickets.Skip(1).SelectMany(t => t);
var allRules = _rules.Values.SelectMany(r => r);
return
$"{allValues.Where(t => !allRules.Any(r => r.Contains(t))).Sum()}";
}
public override string Part2()
{
var ticketFields = _tickets
// valid tickets
.Where(ticket => ticket
.All(t => _rules.Values
.SelectMany(r => r)
.Any(r => r.Contains(t))))
// group by index
.SelectMany(inner => inner.Select((item, index) => new { item, index }))
.GroupBy(i => i.index, i => i.item)
.Select(g => g.ToList())
.Select((val, i) => new { Value = val, Index = i })
.ToList();
var matchedRules = _rules
// find matching rules and indices
.SelectMany(x => ticketFields
.Where(y => y.Value.All(z => x.Value.Any(r => r.Contains(z))))
.Select(y => (x.Key, y.Index))
.ToList())
.ToList();
matchedRules.Sort((a, b) =>
matchedRules.Count(x => x.Key == a.Key) - matchedRules.Count(x => x.Key == b.Key));
while (matchedRules.Any(x => matchedRules.Count(y => y.Key == x.Key) > 1))
foreach (var (key, index) in matchedRules.Where(y =>
matchedRules.Count(z => z.Key == y.Key) == 1 &&
matchedRules.Count(z => z.Index == y.Index) > 1))
// filter matches by index
matchedRules = matchedRules
.Where(x => x.Index != index || x.Key == key)
.ToList();
var departureFields = matchedRules.Where(r => r.Key.StartsWith("departure"));
return
$"{departureFields.Aggregate(1L, (l, match) => l * _tickets.First()[match.Index])}";
}
}

124
AOC2020/Day17.cs Normal file
View File

@ -0,0 +1,124 @@
namespace AOC2020;
/// <summary>
/// Day 17: <see href="https://adventofcode.com/2020/day/17" />
/// </summary>
public sealed class Day17 : Day
{
private readonly Dictionary<(int x, int y, int z), char> _plane = new();
private readonly Dictionary<(int x, int y, int z, int w), char> _plane4 = new();
public Day17() : base(17, "Conway Cubes")
{
var input = Input.ToList();
for (var x = 0; x < 32; x++)
for (var y = 0; y < 32; y++)
for (var z = 0; z < 32; z++)
_plane[(x, y, z)] = '.';
for (var x = 0; x < 32; x++)
for (var y = 0; y < 32; y++)
for (var z = 0; z < 32; z++)
for (var w = 0; w < 32; w++)
_plane4[(x, y, z, w)] = '.';
for (var y = 0; y < input.Count; y++)
for (var x = 0; x < input[y].Length; x++)
_plane[(x, y, 0)] = input[y][x];
for (var y = 0; y < input.Count; y++)
for (var x = 0; x < input[y].Length; x++)
_plane4[(x, y, 0, 0)] = input[y][x];
}
private static int Neighbors(IReadOnlyDictionary<(int x, int y, int z), char> plane, int x, int y, int z)
{
var neighbors = 0;
foreach (var i in new[] { -1, 0, 1 })
foreach (var j in new[] { -1, 0, 1 })
foreach (var k in new[] { -1, 0, 1 })
{
if (i == 0 && j == 0 && k == 0) continue;
if (plane[((x + i) & 31, (y + j) & 31, (z + k) & 31)] == '#') neighbors++;
}
return neighbors;
}
private static Dictionary<(int x, int y, int z), char> Iterate(
IReadOnlyDictionary<(int x, int y, int z), char> prev)
{
var next = new Dictionary<(int x, int y, int z), char>();
for (var z = 0; z < 32; z++)
for (var y = 0; y < 32; y++)
for (var x = 0; x < 32; x++)
{
var active = Neighbors(prev, x, y, z);
if (prev[(x, y, z)] == '#')
next[(x, y, z)] = active == 2 || active == 3 ? '#' : '.';
else
next[(x, y, z)] = active == 3 ? '#' : '.';
}
return next;
}
private static int Neighbors4(IReadOnlyDictionary<(int x, int y, int z, int w), char> plane, int x, int y,
int z, int w)
{
var neighbors = 0;
foreach (var i in new[] { -1, 0, 1 })
foreach (var j in new[] { -1, 0, 1 })
foreach (var k in new[] { -1, 0, 1 })
foreach (var l in new[] { -1, 0, 1 })
{
if (i == 0 && j == 0 && k == 0 && l == 0) continue;
if (plane[((x + i) & 31, (y + j) & 31, (z + k) & 31, (w + l) & 31)] == '#') neighbors++;
}
return neighbors;
}
private static Dictionary<(int x, int y, int z, int w), char> Iterate4(
IReadOnlyDictionary<(int x, int y, int z, int w), char> prev)
{
var next = new Dictionary<(int x, int y, int z, int w), char>();
for (var z = 0; z < 32; z++)
for (var y = 0; y < 32; y++)
for (var x = 0; x < 32; x++)
for (var w = 0; w < 32; w++)
{
var active = Neighbors4(prev, x, y, z, w);
if (prev[(x, y, z, w)] == '#')
next[(x, y, z, w)] = active == 2 || active == 3 ? '#' : '.';
else
next[(x, y, z, w)] = active == 3 ? '#' : '.';
}
return next;
}
public override string Part1()
{
var plane = _plane;
foreach (var _ in Enumerable.Range(0, 6))
plane = Iterate(plane);
return $"{plane.Values.Count(v => v == '#')}";
}
public override string Part2()
{
var plane = _plane4;
foreach (var _ in Enumerable.Range(0, 6))
plane = Iterate4(plane);
return $"{plane.Values.Count(v => v == '#')}";
}
}

69
AOC2020/Day18.cs Normal file
View File

@ -0,0 +1,69 @@
namespace AOC2020;
/// <summary>
/// Day 18: <see href="https://adventofcode.com/2020/day/18" />
/// </summary>
public sealed class Day18 : Day
{
private readonly List<string> _expressions;
public Day18() : base(18, "Operation Order") =>
_expressions = Input.Select(line => line.Replace(" ", "")).ToList();
private static long Calculate(string expr, Func<char, int> precedence)
{
var postfixNotation = new StringBuilder();
var postfixStack = new Stack<char>();
foreach (var c in expr)
if (char.IsDigit(c))
{
postfixNotation.Append(c);
}
else if (c == '(')
{
postfixStack.Push(c);
}
else if (c == ')')
{
while (postfixStack.Count > 0 && postfixStack.Peek() != '(')
postfixNotation.Append(postfixStack.Pop());
postfixStack.TryPop(out _);
}
else
{
while (postfixStack.Count > 0 && precedence(c) <= precedence(postfixStack.Peek()))
postfixNotation.Append(postfixStack.Pop());
postfixStack.Push(c);
}
while (postfixStack.Count > 0)
postfixNotation.Append(postfixStack.Pop());
var expressionStack = new Stack<long>();
foreach (var c in postfixNotation.ToString())
if (char.IsDigit(c))
{
expressionStack.Push((long)char.GetNumericValue(c));
}
else
{
var a = expressionStack.Pop();
var b = expressionStack.Pop();
if (c == '+') expressionStack.Push(a + b);
if (c == '*') expressionStack.Push(a * b);
}
return expressionStack.Pop();
}
public override string Part1() =>
$"{_expressions.Sum(expr => Calculate(expr, c => c == '+' || c == '*' ? 1 : 0))}";
public override string Part2() =>
$"{_expressions.Sum(expr => Calculate(expr, c => c switch { '+' => 2, '*' => 1, _ => 0 }))}";
}

53
AOC2020/Day19.cs Normal file
View File

@ -0,0 +1,53 @@
namespace AOC2020;
/// <summary>
/// Day 19: <see href="https://adventofcode.com/2020/day/19" />
/// </summary>
public sealed class Day19 : Day
{
private readonly string[] _messages;
private readonly Dictionary<string, string[][]> _rules;
private readonly Stack<string> _stack;
public Day19() : base(19, "Monster Messages")
{
_rules = Input.TakeWhile(l => !string.IsNullOrWhiteSpace(l))
.Select(l => l.Split(':'))
.Select(a => (key: a[0],
val: a[1].Split('|', StringSplitOptions.RemoveEmptyEntries)
.Select(s => s.Split(' ', StringSplitOptions.RemoveEmptyEntries)).ToArray()))
.ToDictionary(a => a.key, a => a.val);
_messages = Input.Skip(_rules.Count + 1).ToArray();
_stack = new();
}
private string MakeRegexExpression(string key)
{
if (_stack.Count(s => s == key) > 10) return "x";
_stack.Push(key);
var sub = string.Join("|", _rules[key].Select(test => test.Length switch
{
1 => test[0][0] == '"' ? test[0].Trim('"') : MakeRegexExpression(test[0]),
_ => string.Join(string.Empty, test.Select(MakeRegexExpression))
}));
_stack.Pop();
return _rules[key].Length > 1 ? $"({sub})" : sub;
}
public override string Part1()
{
var exp = new Regex($"^{MakeRegexExpression("0")}$");
return $"{_messages.Count(m => exp.IsMatch(m))}";
}
public override string Part2()
{
// fix rules 8 and 11
_rules["8"] = new[] { new[] { "42" }, new[] { "42", "8" } };
_rules["11"] = new[] { new[] { "42", "31" }, new[] { "42", "11", "31" } };
var exp = new Regex($"^{MakeRegexExpression("0")}$");
return $"{_messages.Count(m => exp.IsMatch(m))}";
}
}

258
AOC2020/Day20.cs Normal file
View File

@ -0,0 +1,258 @@
namespace AOC2020;
/// <summary>
/// Day 20: <see href="https://adventofcode.com/2020/day/20" />
/// </summary>
public sealed class Day20 : Day
{
public Day20() : base(20, "Jurassic Jigsaw")
{
}
public override string Part1()
{
var puzzlePieces = ParsePiecesFromInput(Input.ToArray());
var connections = FindConnections(puzzlePieces);
var cornerIds = connections
.Select(pair => (piece: pair.Key, nrConnections: pair.Value.Count))
.Where(connection => connection.nrConnections == 2)
.Select(connection => connection.piece.Id);
return $"{cornerIds.Aggregate((double)1, (curr, next) => curr * next)}";
}
public override string Part2()
{
var puzzlePieces = ParsePiecesFromInput(Input.ToArray());
var connections = FindConnections(puzzlePieces);
var puzzle = ComposePuzzle(connections);
var lines = ExtractImagesFromPuzzle(puzzle);
var numberSeaMonsters = TagSeaMonsters(lines);
var numberWaves = lines.Select(l => l.Count(c => c == '#')).Sum();
return $"{numberWaves - numberSeaMonsters * 15}";
}
private static IEnumerable<PuzzlePiece> ParsePiecesFromInput(string[] input)
{
var pieces = new List<PuzzlePiece>();
const int pieceHeight = 12;
for (var i = pieceHeight; i <= input.Length + 1; i += pieceHeight)
{
var lBound = i - pieceHeight;
var uBound = i - 1;
pieces.Add(PuzzlePiece.CreatePieceFromString(input[lBound..uBound]));
}
return pieces;
}
private static Dictionary<PuzzlePiece, List<PuzzlePiece>> FindConnections(IEnumerable<PuzzlePiece> puzzlePieces)
{
var sides = new Dictionary<string, PuzzlePiece>();
var connections = new Dictionary<PuzzlePiece, List<PuzzlePiece>>();
void AddConnection(PuzzlePiece p1, PuzzlePiece p2)
{
if (!connections.ContainsKey(p1)) connections.Add(p1, new List<PuzzlePiece>());
if (!connections.ContainsKey(p2)) connections.Add(p2, new List<PuzzlePiece>());
connections[p1].Add(p2);
connections[p2].Add(p1);
}
foreach (var piece in puzzlePieces)
foreach (var (original, flipped) in piece.SidesWithFlippedPaired.Value)
{
if (sides.ContainsKey(original))
{
var otherPiece = sides[original];
AddConnection(piece, otherPiece);
}
else if (sides.ContainsKey(flipped))
{
var otherPiece = sides[flipped];
AddConnection(piece, otherPiece);
}
else
{
sides.Add(original, piece);
sides.Add(flipped, piece);
}
}
return connections;
}
private static IEnumerable<PuzzlePiece[]> ComposePuzzle(Dictionary<PuzzlePiece, List<PuzzlePiece>> connections)
{
var sideSize = (int)Math.Sqrt(connections.Count);
var unprocessed = connections.Keys.ToHashSet();
// step 0: initialize puzzle array
var puzzle = new PuzzlePiece[sideSize][];
for (var i = 0; i < puzzle.Length; i++) puzzle[i] = new PuzzlePiece[sideSize];
// step1: take one of the angles (this will be our 0,0) and find its true orientation/side
var angle = connections.First(x => x.Value.Count == 2).Key;
puzzle[0][0] = RotatePieceToMatch00Position(angle, connections);
unprocessed.Remove(angle);
// step2: fill the first column
for (var i = 1; i < puzzle.Length; i++)
{
var previousPiece = puzzle[i - 1][0];
var bottomPiece = connections[previousPiece]
.Where(p => unprocessed.Contains(p))
.First(p => p.AllSidesWithFlipped.Value.Contains(previousPiece.BottomSide.Value));
puzzle[i][0] = bottomPiece.TransformSoTopMatchesWith(previousPiece.BottomSide.Value);
unprocessed.Remove(bottomPiece);
}
// step3: fill each row using the first value as starting point
foreach (var t in puzzle)
for (var c = 1; c < t.Length; c++)
{
var previousPiece = t[c - 1];
var rightPiece = connections[previousPiece]
.Where(p => unprocessed.Contains(p))
.First(p => p.AllSidesWithFlipped.Value.Contains(previousPiece.RightSide.Value));
t[c] = rightPiece.TransformSoLeftMatchesWith(previousPiece.RightSide.Value);
unprocessed.Remove(rightPiece);
}
return puzzle;
}
private static char[][] ExtractImagesFromPuzzle(IEnumerable<PuzzlePiece[]> puzzle)
{
const int pieceHeight = 10;
var lines = new List<string>();
foreach (var t in puzzle)
for (var line = 1; line < pieceHeight - 1; line++)
lines.Add(t.Aggregate("", (current, t1) => current + t1.GetLine(line)[1..^1]));
return lines.Select(line => line.ToCharArray()).ToArray();
}
private static PuzzlePiece RotatePieceToMatch00Position(
PuzzlePiece angle,
IReadOnlyDictionary<PuzzlePiece, List<PuzzlePiece>> connections)
{
var conn1 = connections[angle][0];
var conn2 = connections[angle][1];
var angleSides = angle.Sides.Value.ToHashSet();
var connectionsSides = conn1.SidesWithFlippedPaired.Value
.Concat(conn2.SidesWithFlippedPaired.Value)
.SelectMany(t => new[] { t.Item1, t.Item2 });
angleSides.ExceptWith(connectionsSides);
return angle.RotateUntilSidesCorrespondToTopLeft(angleSides);
}
private static int TagSeaMonsters(char[][] lines)
{
var images = new List<char[][]> { lines };
lines = lines.Rotate();
images.Add(lines);
lines = lines.Rotate();
images.Add(lines);
lines = lines.Rotate();
images.Add(lines);
lines = lines.FlipHorizontally();
images.Add(lines);
lines = lines.Rotate();
images.Add(lines);
lines = lines.Rotate();
images.Add(lines);
lines = lines.Rotate();
images.Add(lines);
return images.Select(CountSeaMonstersInImage).Sum();
}
private static int CountSeaMonstersInImage(char[][] lines)
{
const string pattern = @"(?<=#.{77})#.{4}#{2}.{4}#{2}.{4}#{3}(?=.{77}#.{2}#.{2}#.{2}#.{2}#.{2}#)";
var singleLine = lines.Aggregate("", (curr, next) => curr + new string(next));
var matches = Regex.Matches(singleLine, pattern);
return matches.Count;
}
private class PuzzlePiece
{
public readonly long Id;
private readonly char[][] _piece;
private readonly Lazy<string> _topSide;
public readonly Lazy<string> RightSide;
public readonly Lazy<string> BottomSide;
private readonly Lazy<string> _leftSide;
public readonly Lazy<string[]> Sides;
public readonly Lazy<HashSet<string>> AllSidesWithFlipped;
public readonly Lazy<(string, string)[]> SidesWithFlippedPaired;
public static PuzzlePiece CreatePieceFromString(string[] pieceWithId)
{
var id = long.Parse(pieceWithId[0][5..^1]);
var piece = pieceWithId[1..].Select(x => x.ToCharArray()).ToArray();
return new PuzzlePiece(id, piece);
}
private PuzzlePiece(long id, char[][] piece)
{
Id = id;
_piece = piece;
_topSide = new Lazy<string>(() => new string(piece[0]));
RightSide = new Lazy<string>(() => new string(piece.Select(line => line[^1]).ToArray()));
BottomSide = new Lazy<string>(() => new string(piece[^1].Reverse().ToArray()));
_leftSide = new Lazy<string>(() => new string(piece.Select(line => line[0]).Reverse().ToArray()));
Sides = new Lazy<string[]>(() => new[]
{ _topSide.Value, RightSide.Value, BottomSide.Value, _leftSide.Value });
SidesWithFlippedPaired = new Lazy<(string, string)[]>(() => CalculateSidesWithFlipped(this));
AllSidesWithFlipped = new Lazy<HashSet<string>>(() => CalculateAllSidesWithFlipped(this));
}
public override bool Equals(object? obj) => obj is PuzzlePiece piece && Id == piece.Id;
public override int GetHashCode() => HashCode.Combine(Id);
public override string ToString() => Id.ToString();
public PuzzlePiece TransformSoTopMatchesWith(string sideToMatch) =>
TransformSoSideMatchesWith(new string(sideToMatch.Reverse().ToArray()), p => p._topSide.Value);
public PuzzlePiece TransformSoLeftMatchesWith(string sideToMatch) =>
TransformSoSideMatchesWith(new string(sideToMatch.Reverse().ToArray()), p => p._leftSide.Value);
private PuzzlePiece TransformSoSideMatchesWith(string sideToMatch, Func<PuzzlePiece, string> getSide)
{
var side = getSide(this);
if (side == sideToMatch) return this;
return Sides.Value.ToHashSet().Contains(sideToMatch)
? Rotated().TransformSoSideMatchesWith(sideToMatch, getSide)
: Flipped().TransformSoSideMatchesWith(sideToMatch, getSide);
}
public PuzzlePiece RotateUntilSidesCorrespondToTopLeft(IReadOnlySet<string> sides) =>
sides.Contains(_leftSide.Value) && sides.Contains(_topSide.Value)
? this
: Rotated().RotateUntilSidesCorrespondToTopLeft(sides);
private PuzzlePiece Rotated() => new(Id, _piece.Rotate());
private PuzzlePiece Flipped() => new(Id, _piece.FlipHorizontally());
public string GetLine(int l) => new(_piece[l]);
private static (string, string)[] CalculateSidesWithFlipped(PuzzlePiece piece) =>
new (string, string)[]
{
(piece._topSide.Value, new string(piece._topSide.Value.Reverse().ToArray())),
(piece.RightSide.Value, new string(piece.RightSide.Value.Reverse().ToArray())),
(piece.BottomSide.Value, new string(piece.BottomSide.Value.Reverse().ToArray())),
(piece._leftSide.Value, new string(piece._leftSide.Value.Reverse().ToArray())),
};
private static HashSet<string> CalculateAllSidesWithFlipped(PuzzlePiece piece) =>
piece.Sides.Value.Concat(piece.Sides.Value.Select(s => new string(s.Reverse().ToArray()))).ToHashSet();
}
}

53
AOC2020/Day21.cs Normal file
View File

@ -0,0 +1,53 @@
namespace AOC2020;
/// <summary>
/// Day 21: <see href="https://adventofcode.com/2020/day/21" />
/// </summary>
public sealed class Day21 : Day
{
private readonly IEnumerable<(string[] Allergens, string[] Ingredients)> _parsedFoods;
private readonly IEnumerable<(string Allergen, string Ingredient)> _dangerousFoods;
public Day21() : base(21, "Allergen Assessment")
{
_parsedFoods = Input.Select(line => line.TrimEnd(')').Split(" (contains "))
.Select(split => (Allergens: split[1].Split(", "), Ingredients: split[0].Split(' ')));
_dangerousFoods = _parsedFoods
.SelectMany(i => i.Allergens.Select(allergen => (Allergen: allergen, i.Ingredients)))
.GroupBy(
pair => pair.Allergen,
pair => pair.Ingredients.Select(i => i),
// group by intersection of ingredients
(allergen, collection) =>
(Allergen: allergen, Ingredients: collection.Aggregate((acc, it) => acc.Intersect(it)))
)
.OrderBy(food => food.Ingredients.Count())
.Aggregate(
Enumerable.Empty<(string Allergen, string Ingredient)>(),
(poisons, pair) =>
poisons.Concat(new[] {(
allergen: pair.Allergen,
ingredient: pair.Ingredients.Except(poisons.Select(i => i.Ingredient)).First()
)})
);
}
public override string Part1()
{
var part1 = _parsedFoods
.SelectMany(i => i.Ingredients)
.Count(i => !_dangerousFoods.Select(t => t.Ingredient).Contains(i));
return $"{part1}";
}
public override string Part2()
{
var part2 = _dangerousFoods
.OrderBy(i => i.Allergen)
.Select(i => i.Ingredient);
return $"{string.Join(',', part2)}";
}
}

105
AOC2020/Day22.cs Normal file
View File

@ -0,0 +1,105 @@
namespace AOC2020;
/// <summary>
/// Day 22: <see href="https://adventofcode.com/2020/day/22" />
/// </summary>
public sealed class Day22 : Day
{
private readonly Queue<int> _deck1 = new();
private readonly Queue<int> _deck2 = new();
public Day22() : base(22, "Crab Combat")
{
Reset();
}
private void Reset()
{
_deck1.Clear();
_deck2.Clear();
int player = 0;
foreach (var line in Input)
{
if (line == "") continue;
if (line.StartsWith("Player"))
{
player++;
continue;
}
(player == 1 ? _deck1 : _deck2).Enqueue(int.Parse(line));
}
}
private (Queue<int> deck1, Queue<int> deck2) Play(Queue<int> deck1, Queue<int> deck2, bool recursive = false)
{
var seen1 = new HashSet<string>();
var seen2 = new HashSet<string>();
while (deck1.Any() && deck2.Any())
{
if (recursive)
{
var deck1Hash = string.Join(',', deck1);
var deck2Hash = string.Join(',', deck2);
if (seen1.Contains(deck1Hash) || seen2.Contains(deck2Hash))
{
// player1 wins
return (deck1, new Queue<int>());
}
else
{
seen1.Add(deck1Hash);
seen2.Add(deck2Hash);
}
}
var play1 = deck1.Dequeue();
var play2 = deck2.Dequeue();
int winner;
if (recursive && deck1.Count >= play1 && deck2.Count >= play2)
{
// play again
var (r1, r2) = Play(deck1.Take(play1), deck2.Take(play2), recursive);
winner = r1.Count > r2.Count ? 1 : 2;
}
else
winner = play1 > play2 ? 1 : 2;
if (winner == 1)
{
deck1.Enqueue(play1);
deck1.Enqueue(play2);
}
else
{
deck2.Enqueue(play2);
deck2.Enqueue(play1);
}
}
return (deck1, deck2);
}
private (Queue<int> deck1, Queue<int> deck2) Play(IEnumerable<int> enumerable1, IEnumerable<int> enumerable2, bool recursive) =>
Play(new Queue<int>(enumerable1), new Queue<int>(enumerable2), recursive);
private static int CalculateScore(Queue<int> deck) =>
deck.Reverse().Zip(Enumerable.Range(1, deck.Count), (a, b) => a * b).Sum();
public override string Part1()
{
var (deck1, deck2) = Play(_deck1, _deck2);
return $"{CalculateScore(deck1.Any() ? deck1 : deck2)}";
}
public override string Part2()
{
Reset();
var (deck1, deck2) = Play(_deck1, _deck2, recursive: true);
return $"{CalculateScore(deck1.Any() ? deck1 : deck2)}";
}
}

89
AOC2020/Day23.cs Normal file
View File

@ -0,0 +1,89 @@
namespace AOC2020;
/// <summary>
/// Day 23: <see href="https://adventofcode.com/2020/day/23" />
/// </summary>
public sealed class Day23 : Day
{
private readonly Dictionary<long, long> _cups = new();
private readonly ImmutableList<long> _initialCups;
private readonly long[] _move;
private long _current;
public Day23() : base(23, "Crab Cups")
{
_initialCups = Input.First().Select(c => long.Parse(c.ToString())).ToImmutableList();
_current = _initialCups.First();
_move = new long[3];
}
private void DoMoves(int turns)
{
for (var turn = 0; turn < turns; turn++)
{
var dest = _current - 1;
if (dest == 0) dest = _cups.Count;
for (var i = 0; i <= 2; i++)
{
var id = _cups[_current];
var removedNext = _cups[id];
_cups.Remove(id);
_cups[_current] = removedNext;
_move[i] = id;
}
while (_move.Contains(dest))
{
dest--;
if (dest == 0) dest = _cups.Count + 3;
}
for (var i = 0; i <= 2; i++)
{
var id = _cups[dest];
_cups[dest] = _move[i];
_cups.Add(_move[i], id);
dest = _cups[dest];
}
_current = _cups[_current];
}
}
public override string Part1()
{
for (var i = 0; i < _initialCups.Count; i++)
_cups[_initialCups[i]] = _initialCups[(i + 1) % _initialCups.Count];
DoMoves(100);
_current = 1;
var result = new StringBuilder();
while (_cups[_current] != 1)
{
result.Append(_cups[_current]);
_current = _cups[_current];
}
return result.ToString();
}
public override string Part2()
{
_cups.Clear();
for (var i = 0; i < _initialCups.Count; i++)
_cups[_initialCups[i]] = _initialCups[(i + 1) % _initialCups.Count];
// add a million cups
_cups[_initialCups.Last()] = 10;
for (var i = 10; i < 1_000_000; i++)
_cups.Add(i, i + 1);
_cups[1_000_000] = _current = _initialCups.First();
DoMoves(10_000_000);
return $"{(ulong)_cups[1] * (ulong)_cups[_cups[1]]}";
}
}

84
AOC2020/Day24.cs Normal file
View File

@ -0,0 +1,84 @@
namespace AOC2020;
/// <summary>
/// Day 24: <see href="https://adventofcode.com/2020/day/24" />
/// </summary>
public sealed class Day24 : Day
{
private static readonly Dictionary<string, (int q, int r, int s)> Directions = new()
{
{ "e", (1, 0, -1) },
{ "w", (-1, 0, 1) },
{ "se", (0, 1, -1) },
{ "sw", (-1, 1, 0) },
{ "nw", (0, -1, 1) },
{ "ne", (1, -1, 0) }
};
private Dictionary<(int q, int r, int s), Tile> _tiles;
public Day24() : base(24, "Lobby Layout")
{
_tiles = Input
.Select(Tile.FromLine)
.GroupBy(t => t.Location)
.Where(g => g.Count() % 2 == 1)
.Select(t => t.First())
.ToDictionary(t => t.Location);
}
public override string Part1() => $"{_tiles.Count}";
public override string Part2()
{
foreach (var _ in Enumerable.Range(0, 100))
{
_tiles = _tiles
.SelectMany(t => Directions.Select(d => t.Value + d.Value))
.Distinct()
.Where(t =>
{
var neighborCount = Directions
.Select(d => t + d.Value)
.Count(neighbor => _tiles.ContainsKey(neighbor.Location));
return neighborCount == 2 || _tiles.ContainsKey(t.Location) && neighborCount == 1;
})
.ToDictionary(t => t.Location);
}
return $"{_tiles.Count}";
}
private record Tile
{
public (int q, int r, int s) Location { get; private init; }
public static Tile FromLine(string route)
{
(int q, int r, int s) location = (0, 0, 0);
var direction = "";
foreach (var c in route)
{
if (c is 'n' or 's')
{
direction += c;
continue;
}
direction += c;
var (q, r, s) = Directions[direction];
location = (location.q + q, location.r + r, location.s + s);
direction = "";
}
return new Tile { Location = location };
}
public static Tile operator +(Tile t, (int q, int r, int s) direction) =>
t with
{
Location = (t.Location.q + direction.q, t.Location.r + direction.r, t.Location.s + direction.s)
};
}
}

43
AOC2020/Day25.cs Normal file
View File

@ -0,0 +1,43 @@
namespace AOC2020;
/// <summary>
/// Day 25: <see href="https://adventofcode.com/2020/day/25" />
/// </summary>
public sealed class Day25 : Day
{
public Day25() : base(25, "Combo Breaker")
{
}
public override string Part1()
{
var cardKey = int.Parse(Input.First());
var doorKey = int.Parse(Input.Last());
return $"{Transform(doorKey, FindLoopSize(7, cardKey))}";
}
public override string Part2() => "";
private static long Transform(long subject, int loopSize)
{
var value = 1L;
for (var i = 0; i < loopSize; i++)
{
value *= subject;
value %= 20201227;
}
return value;
}
private static int FindLoopSize(long subject, int target)
{
var value = 1L;
var loops = 0;
while (value != target)
{
value *= subject;
value %= 20201227;
loops++;
}
return loops;
}
}

17
AOC2020/Program.cs Normal file
View File

@ -0,0 +1,17 @@
Day.Year = 2020;
var days = Assembly.GetExecutingAssembly().GetTypes()
.Where(t => t.BaseType == typeof(Day))
.Select(t => (Activator.CreateInstance(t) as Day)!)
.OrderBy(d => d.DayNumber);
if (args.Length == 1 && int.TryParse(args[0], out var dayNum))
{
var day = days.FirstOrDefault(d => d.DayNumber == dayNum);
if (day != null) day.AllParts();
else Console.WriteLine($"Day {dayNum} invalid or not yet implemented");
}
else
{
foreach (var d in days) d.AllParts();
}

200
AOC2020/input2020/day01.in Normal file
View File

@ -0,0 +1,200 @@
1078
1109
1702
1293
1541
1422
1679
1891
1898
1455
1540
1205
1971
1582
1139
1438
1457
1725
1907
1872
1101
1403
1557
1597
1619
1974
1287
292
1647
1444
1241
879
1761
1067
1178
1510
1110
1233
1121
1299
1796
1124
1768
1466
1871
1279
1344
1485
1258
1179
1147
492
1234
1843
1421
1819
1964
1671
1793
1302
1731
1886
1686
1150
1806
1960
1841
1936
1845
1520
1779
1102
1323
1892
1742
1941
1395
1525
1165
715
1829
1448
1906
1191
1981
1115
1716
1644
1310
1836
1105
1517
1790
1950
1741
1256
1467
1677
1372
1838
1637
1143
1763
1222
1291
1835
1602
1927
1933
1952
1692
1662
1967
1791
1984
1176
1324
1460
1416
562
1862
1273
1518
1535
1093
1977
1923
1246
1570
1674
1861
1811
1431
47
1158
1912
1322
1062
1407
1528
1068
1868
1997
1930
959
1676
1759
2000
1993
1722
1738
1264
1361
1542
1187
1735
1405
1745
1753
1833
1493
1311
1547
1180
1553
1513
1812
1951
1948
1834
1925
1726
1326
1931
1962
1947
1173
1633
1901
1781
1483
1789
1417
1929
1859
1760
1347
1996
1328
1798
1230
1298
1877
1840
1607
1253
1057
1650
1171
1593

1000
AOC2020/input2020/day02.in Normal file

File diff suppressed because it is too large Load Diff

323
AOC2020/input2020/day03.in Normal file
View File

@ -0,0 +1,323 @@
.....#.........#...#..##....#..
.#........#...#........#.......
......#......#..#...#....#.#..#
...#.#####.#.......##.#........
...........#......#..#.....#...
#.#..#...#.#...#.##.....#.....#
....#..#....#...#.#...#.##.....
##...#..........##..######.....
.....#...#......#.............#
........##....#...##..#....#...
...#...#.........#.#..........#
..#.#.....##..........#........
##.......................#.....
#..#...##...##.#.........##....
.#....#.#####....#...#...#.....
#......#......###..#........#.#
.#....##..##.###.#.......#.....
.#..#.........##....#.#....#...
........#..................#...
.......#..#..#............#....
........#...................##.
.#......#......#.####......#...
..###.#..#..#.........#........
..#...........###..#.....#.##..
...#.##.#....#................#
#.....#.............#.#........
.#..............#.........#....
##.................#..........#
.#..#....#.###....##..#..#...#.
##........#......##.....#....##
#......#..#........#......#.#..
....#.##.#.............#...##..
.#...#...#..#............##...#
.#..#...#..#..#....##..#.#.#...
#....#...##.#.#......#........#
#..#..#...#.#.....#..##.#......
.....#..#.#..#.##.......#..###.
#......#......#...#............
.....#......#......#..#.##..#.#
......#..##..#.....#....#......
..#..#...#..#...#....###.#.#...
.................#..#..........
......#...##..#.....#...##.....
..#...............#...#.#.....#
.#....#.##.##..#.........##....
...###....##...#......#......##
....#...#.....#.........#..##..
..###.........#..#..#...#......
...##.....#.........#.......#..
.....#.................#.#.....
.#.###.#..#...#..##....#....##.
....#.....##.........#.#.......
.#.#....#..#................#..
..#.#......#......#........#...
#........#....#..#..#..#....#.#
#...........##..#....#..####...
.....#.......#.#...#.#....###..
.......#....#.......#..........
.............#.....#...........
#....#......#...#..##.#........
....#.......#.#.......#....###.
.####.#...........#.#.#...#.#..
#..##....##.#......#...........
...##...#.#.....#.....#........
...#.............#.....#...#...
...#.....#..#.....##...###..#.#
....##..#..##..#..#...#.....#..
........#...................##.
....#.......#.....#.......#....
....##.........#.#.............
......#..#........#.#...#......
.#..#...#...........#......#..#
.#....#.#........#............#
......#...................#...#
##...#.......................#.
........###.......#.......#..#.
...........##.............#....
..##...#.....#....#......#....#
................###...##...#.#.
..#.#.....#....##...#..##......
.....................#.#......#
.......#....##.#..#........##..
.##....#......#....#.........#.
#............#.........#..#.#..
....#...........#..#....#....##
.......#..#.....##.........#...
.##..........#.#.#....#..#.....
........#....##.##.#......#....
....##..##......##.....#.###...
......##.#....##.#.#....#......
..#..#..........#.....##.....##
#........#.##...#.#....#....###
........##............#........
##.##..##.#..#...##............
....#..#....#...........#....#.
..#.......#.#.......#...#......
.#..........##.....#..#...#...#
.................##.#...#...##.
##.............#......#....#...
..........#.#....#.............
...##..#.#.....#.....#.#.......
...##...##.#......#.#...#......
..#..#.....##..##..........##..
......##........##.......#....#
....#..####..#...##........#...
#.......#....#.......##.......#
........#..........#.........#.
.....#....#.........#.#.#.....#
..##.....#....#....#..#......#.
....#..#.##...#..#.....#......#
........###.........#..###...#.
.....#.......#.....#.#.#.......
...##.....#....##.....#.#.#...#
#.##....#.##.....#.#.#........#
.##..#.......#...#.#.......#...
.#..........#.............#....
.#...#...#......#..##..........
.......................#.#....#
............###....#..##.#..#..
...#.#......##....#..#.........
..#...#....#....#.#............
..#.#..###...............##....
.....##...#.....#........#..#.#
...........#......#..#...#.##.#
#...##......##...#..#...#..#...
..##....#............#......#.#
.#.#..#...#...#.#...#...##..##.
..#.#....#.......#.#.#.#.#.##..
....###.##..#...##....#........
.#...............#........#....
...#..#........##...#.##.......
........#..#..#......##........
##....#....#............#......
#....#...#.###.#.###.......#...
...#.###.##....#.........#...##
..#......##.#.....#..#.......#.
##.............#..#..##....#.#.
#...#...##........#.#.......#..
........#..#.....#.#..#..#.#...
#..##.........#.#.#.##...#....#
............#...#....#..#....#.
.....#.......#......##..#......
.#.....................#......#
...................#....#.#....
.....#....#.....##.............
#....##.#....##..#....##....#..
....#..........#..........#....
.....#.#...............#..##...
...#......###.......#..##......
#.#.#....##..#......#.##.#.....
.#...###..#.....##.........#.#.
..#...#.............#....#.....
#..#.............#.....#.....#.
.#.........#.#...#..#....#...#.
#....#......#....#.#..........#
.........................#.....
...................#...........
#.#...#......#....#............
.#..#........#...##....#....#..
..#......#..#..........##......
#.#....#....##....#.........#..
...#.#.#.#..#....##..#....#..#.
..#..............#.....##......
....#.........#...#.....#..#...
..#..................#.#.......
.....##.##........#.#....#..###
..#.#...#.....#..##..##.#.#.#..
.....#......#............#.....
.#.......#....##...............
...#.................#.....#...
...#.#..#.#...##........#....##
..........##...................
#........#..........#.#........
................#..##.##.#....#
....##..#.#.#...#...#....#.#.#.
..#.........#......##....#.....
.##.........#.....#.#..........
...##...###...........#......##
..#........#......#.....##.#...
###.....#.#.#...#.......#....#.
..##...#....###..##.#.#..##....
..###...##.......#.#..#....#..#
..#...............###....#..#..
...........#....#.##..#........
.#...#..#.#...##..#....#...#..#
..#............#......#.....#..
.#...#...#.#...#.#.............
...####.........#....##....#.#.
.....##...#........#.#......#..
...####...#.#..#.#.#.#.........
........#.##.#..#.......#......
......##......#.........#.#....
..#.#...#....#.....###.....##..
#.#.##..........#...##..#..#.#.
.....#................#.#..#..#
.........#........#.....#..#..#
......#...........#...........#
..#........#.#.........#...##..
.....####.....#....##.#........
....#...#........#.......#...#.
...#..#....#.....##....###.....
........#..#..#.#.#............
#..#......#..#....#....#.#.#..#
.........#...#......##.........
..#....#............#..#.....#.
#............#.#...#......#...#
..#..##...#........#.........##
.#...#....##...#.......#..##...
#..#.##......#........##...#...
...#..........#...#..#..#....#.
##..#........##..##...#..###.#.
............##...............#.
#......#...#....#.........#...#
................#..#.#.........
.....#...#...#...##.......#...#
..##.###...#...#.#..##.#.#...#.
#...##..........#....##.#.#.#..
.#.........#..........#........
.......#.#...............#.....
...#...#............#..........
.........#..#..........#.......
.........#..#...#....#.##....#.
..#............#......#....#.##
...#...#.#........#......#..#.#
........#......##...##...#..#.#
.......###......#............#.
#.....#...##.#.#...#.......#.#.
..#......#..............##....#
..#............##.......#.#.#.#
...#.#.....#.#.#........####...
...#................#..........
..#...#....#....#......#..#...#
.###......#..............#.#..#
......#......#..........##..#..
...##.#...........#.#.....##.#.
.#...#......#..........#.......
....#...#....#..........#.#....
..................##..#.....#.#
###.................#......##..
.....#.....#............#.#..#.
.....#........#...#....#.#.....
#.#...#........................
.#...#.......#..#.......#......
.......#.#.....###.#...#.#.....
#...#.#...........##...#.......
.#.......#.....#..#..#....#....
...#..##.....#..#..#.....#.....
...#................###......#.
#..#...##.###..#..##.......#...
.#.#.#........#.#.............#
#.......#..#.......#.....##...#
.#.#.#............#..#....#.#..
...#.#.##.#......##.....#....##
#............###...#....#......
.....#..#..#.#.........##.#....
.#.##........#.#.#...#.......#.
..###..#..#.#...#.##...###.....
#............#.............#...
.#.##.....#..#.......#...#...#.
.#...#........###...####.......
.#.#..##..#.....#.#..#.........
....#.#.#............##..#...#.
###.##......#.#.....#.....#....
.........#...##.....##....#....
..#................#.........#.
#.......###..##..##............
.....#...#.............#..#..#.
..........#...................#
....#....#...........#.........
.##.......##.##.........##.....
#......#.#....#....#...#.#.#...
..#.##..#.###.#.##....#..#.....
#....##.#...#..................
.......#...#...........#...#...
....###.#...#..#...............
##.#.#..#.#......#.#......#...#
.............#.....#.##....#...
#.............###....#...#.##.#
#..#.##.............#.##...#...
.#.#......#.........#...#......
.#.........#.#.#.....##.#.#....
.................#........#....
....##.#.#..#.........#........
#...##......##....#.#..#......#
..........##...##..#......##...
..........#..#.#..##..#..#.....
..#..#.....##........#...#.#...
#..........#.#.#..............#
#..........##.....#.#...##....#
.....#...#..#..#...##.#.......#
.##.#...............#.#...#....
..........#.....#......#.......
.....#.#......##...#.......#...
...........#.#...#.....#....#.#
.###.#........##....#.##...#...
#....#.##....#.###..##.#.......
##...........#..##.........#...
....#.##...#...#.....#.#..#....
........#.#.#..#.#...........##
..........#.##...#....#......#.
.##.....#.#.....##.#.......#.#.
.#..#....#.#.....#.##.#....#..#
#.......#..#..........##....#..
.#........#...#..#.#...#....#..
#......##...#...##..#.#.......#
.#......#.##.#............##.#.
.#....#.....##..##..........#..
..###..#..#...#...#.#.#..##....
.#.#.##...#..#...........#....#
....#......#.......##...#.#.#..
.......#..#...##..#.........#..
....#..#.#.......##........#..#
........#.#....#.##..#.......#.
.....#.......#.#...#.#.........
........#...#....#.#....###..#.
......#..#.##..##..#...#.#.....
.#.#.....#.....#....#...#...#..
...#..#...#..#......#..#.#.....
...##...#...........#..#......#
..#...#####..#.#.##....##......
...........#......#.#..#.......
..#....##..#.##.......#.#.#..#.
..#..#........#...#.......#....

1169
AOC2020/input2020/day04.in Normal file

File diff suppressed because it is too large Load Diff

824
AOC2020/input2020/day05.in Normal file
View File

@ -0,0 +1,824 @@
FFBBBFBLRL
BFFFBFBRRR
BFFFBFBLRL
BFFBFBBLRR
BBFFBFFRLL
BFFFBFBRLR
FFFFBBBRLR
BBFFFBBRRR
BBFBFBBRRR
BFFBBBFLRR
FFBBFBBRLR
BBFFBFFLLL
BFFFBFBLLR
FBBFFBFLRR
FBBFBBFRRL
BFFBBBBRRR
BFBBBBFLLL
BFFBFBFLRR
FBBFFBFRRR
FFBFBFBLRL
BFFFFBFLRR
FBBFFFFLRR
BFFFBBBLLL
BFBFFFBRLL
FFBBBBBRLL
FFBBFFBLLR
FBFFBBFLRL
FFBFFBBRRL
BFBBBBFLLR
BFFFFBFRRL
BFFBFFFLLL
FBFFFBFLRL
FBBBFFFLLL
FFBFBBFRLR
FBBBFBFRRL
BFBBBFBLLL
FBFFFBFLRR
FBFBFFBLRR
BFFFFBFLRL
FBFBFFFRRL
FBBFBFBLRL
FBBFFBFLLL
FBFBBBBRRR
FBBBBBFLRR
FBBBFBBLLR
FFFBFBFRLL
FFFBBFFLRR
BFBBFFBRRL
FFBFBFBRRL
FBFBBBBLRR
BFFBBFFLLL
FFFBFBBRRL
BFBBFFFLRR
FBFBFBFLRL
BFBFFBFLLL
FBBBFBFRLR
FBBBFBFLLL
BFBFFFBLRR
BFFBFBFLRL
BFBBFFFRRR
FFFBFFFRLR
FFFBBBBRLL
FFBBBBBLLL
BFBBBFBRLL
FFFBBBFLLR
BBFFFFFRRL
FBFBBFFRLL
BFFBFBFRLR
FBFBBFFRRL
FBFBBFFLLL
FBFBBBBRLL
FBBFFBFLRL
BFFBFBBRRL
FBBFBFBRRL
FFFBBFBLRR
BFFBBBFRLL
FBFFFFFRRR
BFFFFBBLRR
FBBFFFBRRL
FBBBBBBRRR
FFFBBFFLLR
BBFBFFFRRL
BBFFFFBRRL
FBBBFBFLRL
FFBFBBFRRR
FFBBBFFLRL
BFFBFFFLRL
BFBFBFBRRR
BFBBFFBRLL
BFFFFBBLLR
FBBBFBBLRR
BFFBFFFLRR
BFFFBFBLLL
FBBBBBFRRR
BFFBFBFLLL
FBFFBFFRRL
BFBBFBBRRR
FBFFFBFRRL
BFBBBFBLLR
BFBBBBBRRR
FFFBFBFRRL
BFFFBFFLLL
BFFFFFFLRR
FFBBFFFRLL
BFFBFFFRRR
BBFFBBFLRL
FBFBBBBLLR
FFFBFFBLRL
FFBBBBBRLR
FBFFBFFRRR
BFBBFBBRLR
FBFBBBBLRL
BFBBFFFLLR
FBBBFBBLRL
BFFBBBFLLR
FFFBBBBRRR
BBFBFFFLRL
FBFBBFFLLR
BBFFFFBLRR
FFBBFFBRRR
FFBBBFBRLL
BFFFFBFLLL
BBFFBFBRLR
FBFBBFBRRL
FFFBBBFRRR
FBBBFBBRRL
FFFBFBBRRR
FBFFBBBRLL
FFBFBBBRLR
BFFFBBBRLL
FBBFBBBRLL
FBBBBBBLLR
FBFBBFBLRR
BFBFBFBLRL
FFFBFFBRLR
BFFFFFFRLL
BFFBFBBLRL
FBFFBFFLRR
FBFBBBBRLR
BBFFFBBLRL
FBBBFBBRRR
BBFBFBFRRR
FBFBFFFLRR
BBFBFFBLLL
FBBBFFFLLR
BFBFFBFRRL
BFBBBBFRLL
FFBFBFFLRL
FBBBBFBLRR
FBBBBFFLLR
FFBBFFBLLL
FBFFFBBRRR
FFBBBBFLLR
BFBFBFFRRL
FFBBBBBLRR
BFFFFFFRRL
BBFBFFFLRR
BFFBFBFRRL
BBFFBBBRRR
BBFFBFFLRL
FFFBFFBRRR
BFBFBBFRLR
BBFBFBBLRR
BFBBBBBRLL
FBBBFFBRRL
FBBBBBBRLL
FBBFBBFRLR
FBBFFFFRRL
BFBFFBFRRR
BFBBFFFLLL
FBFFBFFLLR
BFBBBFBLRR
BFFBBBBRLL
FBBBBBBLRR
FFBFFBFRRL
BBFFFBBRLL
FBFFFBBRLL
FFBBFFFLRL
BFBBBBFRRL
FFBFFBBRRR
BFFBBFBRLL
FFBFFFBLLR
FFBFFFFLLL
FBBBBBFLLR
FBFBFBBLLR
FBFBBFBRRR
BFBFFFFLRR
BFBBFFBRRR
FBFBFFFRRR
FFBFBBBRLL
BFBBBFBRRL
BFFBBBFLRL
BBFBFFFRLR
BBFBBFFLRR
FBBFFBBRRL
FBFBBBFLRL
FFBFBBFRRL
BFBFFBFLRL
BFFFBFFRLR
BBFBBFFRLR
FFBFBFBLLL
BFBFFBBRRR
BBFFBBBRRL
FBBBFBBLLL
FFFBFFFLRL
BBFFBFBLLL
BFBBFFFRLR
FBBBBFBLRL
BFBFBBBLRL
FFFBFBFRLR
FBFFFFBRRL
BFFBBFFLLR
FBFFFFFRRL
FBBFFBFRLR
FBBBFBBRLL
FBFFFFFLLR
BFBFBBBLLR
FFBBBBBRRR
BFFFBBFLLR
FBFBBFBLLL
FBBFFFFLLR
FBFFFFBLRL
FBBBFBBRLR
FBBFBBFLRR
FBBBBBBRRL
BBFBFBFLRL
FFBBBBFRRL
BFBBFBFLRL
BFFFFFFRRR
BBFBFBBLRL
BFBFFFFRLL
BBFFBFBRRR
BFBFFBBLLR
FBFBFFBRRL
FFBBFBFLLL
BFBFBBBRLR
FFBBFBFLRL
BBFFFFFRRR
FBFFFFFLRL
FFBFBFBRLL
BBFFFFFLRR
BBFFFBBRLR
FBFBBFBRLR
FBBBBBFLRL
FBBFFFBLRR
FFFBBFBLLL
BBFBFFBRLL
FFBFBFBLLR
BFBBFBBRRL
BFFBFFBLLL
BBFFBFFRLR
BBFFBBFLLR
BFFFFFBLRL
FBBFFFBLLL
FBFFFFBLLR
FBBFBFFRRL
BFBBBFFRRL
BBFFFBFLRL
FBFBFBFLLR
FBFFFBBRLR
BBFFBFBRLL
BBFFBFFRRL
BBFFBBFRLR
FBFFBFBRLL
BFBFBBFRRR
BFBBFBBLRL
FFBBFFBRLL
FBFFBFBRLR
BBFBFBBLLR
BFBBBFFRLL
FFBFFBFLLL
BFBFFBFRLR
BFFFBBFLRL
BFFFBBBLRL
BFBBBFFLLR
FBBFBBFRRR
BFFBFFBRRL
BFBFFBBRRL
BFBBFBFRLL
FBBFFBFRLL
FFBBBBFRLL
FBBBFFBRLL
BBFFBFBLRL
BBFFFFFLLL
BBFFFFBRRR
FBBBBFBRLR
BFFBFFBRRR
FFBFBFFRLL
FFFFBBFRRR
BBFBBFFLRL
FFFBBBFLRR
BFFBFBBLLL
BFBBFFFLRL
BFFBFFFRLL
BFBFFBBRLL
FFBBBBFLLL
BFFBFBBRRR
BFBBBBFRRR
FFBFFFFRLR
BFBFBFFRRR
BFBFBBBLRR
FBBBFFFLRR
FFBFFFBRRL
FBBFFFBRLR
FFFBFFBRLL
BFBBFFBLLR
FFBBFBBLRL
FFBFFFBRLR
BFBBFFFRLL
FBBFBBBLLL
FBBFFFFLLL
FFBFBBBRRR
FFFBBBFLRL
BBFFBBFLRR
FFFBFFFRLL
FFBBFBFRRR
FBFFBFBRRR
BFFBBFBLRL
FFFBBBFRLL
FBBBFFBRRR
FFBBBBFLRL
FFBFBBBRRL
FBFBFFBRRR
FBFFFBBLLL
FBBFFFFLRL
BFFFFBBRLR
BFBBBBBRLR
BBFFFBBRRL
BBFBFBFRLR
FBFFFFFLLL
FBFBBBBRRL
BFBFFFBLRL
FFFFBBBLLR
FFBBBFBRLR
FBBFFFFRRR
BBFBFFBLRL
BBFFFFBLRL
BFBFFBFLRR
FFFBBBBLRR
FBBBBBBLRL
FBBFFBFRRL
FBFFBBBRRL
FBFFBBFRRL
FFFBFBFLLR
BBFFFFFRLL
FFFBBBBLLR
BBFFBBBLRR
FBFBFFBLLR
BFBBFBBRLL
BFFFFFBRLR
FFFBFBBLRR
BFFBBBBLLL
BFFBBFBLLR
FBBBBBFRLR
BBFBFFBRLR
FBFFBFFLLL
FBBFBBBLLR
FFFFBBBRRL
FBBFBBFRLL
BFBFFFFRLR
FFFFBBBRLL
BFBBBFFLLL
BFBFBFFRLR
FBFBFFBRLL
FBBBFFFRLL
FBFBFFBRLR
FBBBBFFRLR
BBFBFFFRLL
BFFBBBBRLR
BFBFFFFRRL
FBBBFFFRRR
FFBFFBBRLR
FFBBBBFLRR
BBFBBFBRRL
BFFBFFBLLR
BBFBBFBRLL
FBFFBFBLLR
BBFBFBFLLR
FBFBFBBRLR
BBFBBFFRRL
BFBFFFBLLR
BFBFFBBLLL
FBFFBFBLRR
BFBBBBBLLL
BFFFBFFRRL
BFBBBFBRLR
BBFFFBFRLL
BFFBFFBRLL
BBFBBFFLLL
BFBBBBBLRR
FFFBFFBLLL
BBFFBBBRLL
FFFBBBBLRL
FFBBBFBLLR
FFBBFFBLRL
FFBBFFBLRR
FBBBBBBRLR
BFFFBBBLLR
FBBFBFBLRR
FBFBFBFRLR
FFBFBBBLRR
FFFFBBBLRL
FFFBBFFRLL
FFFBFFFLRR
BBFFFFBLLR
BFBFBFFLLL
FFBBBFFRLR
FBBFBFBRLL
FFBBBFBLLL
FBBFFFBLLR
BBFBFFBLRR
BFFFFBBLLL
FBBBFBFLLR
FFBBBFFLRR
BFFBBBFRRR
FFBFFFBLRR
FBBFFBBRLR
BFBBFBFLRR
FFFBBFFRRR
FFBFFFFRLL
FFFBFBFRRR
FFBFFFFRRR
FBBFBBBLRL
FFFBFBBRLR
FBBFFFBRLL
FFBFBFFRLR
FBBBBFFRRR
BFBFFBBLRR
FBFFBBBLRL
FBBFBBFLLR
BBFFFFFLRL
BFBBFBFRLR
BFFBFFBLRR
FFBFFFBRLL
FBFBFFBLLL
BFFFFFBLLL
FBFFBBFLLL
BFBFFBBRLR
FBFBBFBRLL
FFBBFBBRLL
BFFFBBBRLR
BFFFFFFLRL
BBFFFBBLLR
BFBFBBFLRL
FFBBBFFRRL
BBFFFBFLLL
BBFFBBBLLL
BBFFBFBLLR
FBFBBBFRLL
FFBBBBBRRL
FFBBBFFLLR
FFBFBBBLRL
BFFBFFBLRL
BFFFBFFRRR
BFBFFFBRRR
FFFBBBFRLR
FFBBFBBLLR
BFFFBBFLRR
FFBBBBFRRR
BFBFBBFLRR
FFFBBBBRRL
BFBFFBFRLL
FBFFBFFRLR
FBBFFFFRLR
BFBBBBBLRL
FFBBFBBLLL
FFBFBBFLLR
BFFBBBBLRL
BFBFFFFLRL
BBFFFBFRRL
FFBFFBBLRR
FBFBFBFRRR
BBFFFBFRLR
BFBBBFFLRR
BBFBFFBLLR
BBFBBFBLLR
FBFFFBFRLL
BFBFBBBLLL
FBBFBFFLRL
BFFFBBBLRR
BBFBFFBRRR
FBBFFFFRLL
BFFFBBBRRL
FBBFBBBRRR
FBBFFBFLLR
BFFFFFBRRL
FBFFFFBRLR
FBFBFBBRRR
FBFBFBFRLL
BFFBFFFRRL
FFFBBFFRRL
BFBFFFBRLR
FBBFBFFLRR
BFFFBFBRRL
FBFBBBFLLR
FBFBBBFRRR
FBFFBFBLRL
FFFFBBBRRR
FFBBBFFRRR
FFFBFBFLLL
BFBBFFBLRR
FBBFBFBRRR
BBFFBBFRRL
BBFFBFFRRR
BBFFBFFLRR
FBBFFBBLRR
BFBFFFFRRR
BFFBFBBRLR
BFFFBBFRLL
BFBFBBBRLL
BBFFFBBLRR
FFBBFBFLRR
FBFBBBFLLL
BBFFBBBLLR
FFBBFFFLRR
FBFFFBFRRR
BFBBFBBLLR
FFBBFBFRLR
BFBFFFFLLR
FBBBFBFRRR
BFBBFBFRRR
BFFBFBFRRR
FFBFBBBLLR
FBFBFFFRLR
FBBFBFBLLL
BFFBBFFRLL
FBBBBFBLLR
FFFBBBFLLL
BFBFBBFRLL
FFFBFBFLRR
FBBBBFBLLL
FFBBFBFRLL
BBFFBBFRRR
FFBFFBFRLL
FBFBFBBLLL
FBFFBBBLLR
FFFBFBBLRL
FFFBBFBRRR
FBFFBFFLRL
FBBFBFBLLR
BFBBBBFRLR
FBBFBFBRLR
FFFBFFBRRL
FBFBBFBLLR
BFFBFFFRLR
FFBFBFBLRR
BFBFBBBRRL
FBFFFFFLRR
FFFBBFFLLL
BFFFBBFRLR
FFBFFBFRLR
BBFFFFBRLR
BFFBFFBRLR
BFBFBFBRLR
FFBFFBBRLL
FBBBFFBLLL
BFBBBBBLLR
BFFFFBFRLL
FBBFFFBRRR
FFFFBBBLLL
FBFBFBBRRL
FBFFFFFRLR
FBFFBBFRRR
BFFBBFFLRL
BFBFBBBRRR
FBBFBFFRLR
BFFBBFBRRL
BFBBFBFRRL
FBFFFBBRRL
FBBFFBBLLL
FBFBFBBRLL
BFFFFBFRRR
FBBBFFBLLR
FBBFBBBLRR
FFBFBFFLLR
FBFFBFFRLL
FBBBFFBRLR
FBFFBBBLLL
FBFBFBFRRL
BBFBBFBLLL
FFBFBFFRRL
FBBBFFFRRL
FBFFBBFLRR
FBFBFFFLLR
BFFFFBBLRL
BFBFBFFLRL
FBFFFFBLLL
FBBBFFFLRL
BFFBBBBLLR
BFFBBBFLLL
BFFBBFBRRR
FBBBFBFRLL
BBFBFFFRRR
BFBBBFFRLR
FFBFBFBRRR
FBFFBBFRLL
FFFBBBBLLL
FBFFBFBRRL
BFFFFFBLLR
BFBFFFBLLL
FBFBBBBLLL
BFFBBFFRRL
BBFFBFBRRL
FBBFBFFRRR
BFBBFFBLLL
BFBFFBBLRL
BBFFFFFLLR
FFBFBBFRLL
FFBFFBFLLR
FBBFFBBLRL
BBFFFFBLLL
BFFFBFFLLR
FBFFFBFLLL
BBFBFBFLLL
FFBFFBBLRL
FBFFBBBRLR
BFFFFBBRRL
FFBBBBBLLR
FFBBFBFRRL
FFBFBBFLRL
FFBFBFFLRR
FFFBFFBLLR
BBFBFBBRLL
BFBBBBBRRL
FBFBBBFRLR
FBFBFFFRLL
BFFFFFFLLR
FBBBBFFLLL
FBBBFFBLRR
BFFFBFBLRR
FBBBFFFRLR
BFFFFFBRLL
FBBBBFBRRL
BFBBBFBLRL
FFBBFBBLRR
BFFBBFBLLL
BFBBFFFRRL
FBBBBFFRRL
BFFFBBFRRR
FFFBFFFRRR
FBFBBFBLRL
BFBBFFBLRL
BBFBBFBRLR
BBFBBFBLRL
FFBFBFFRRR
BBFFBBFLLL
FBBBFFBLRL
FBBFFBBRRR
BFFBFBFLLR
FBFBFBBLRR
BFFFBBBRRR
FBBFBFFLLL
FBFBBFFLRR
FFBBFFBRLR
FFBBBBBLRL
FFBBBFBRRL
BFBFBFBLRR
FBFFFFFRLL
BFBFBBFLLL
BBFBFBBRRL
FBFBFBFLLL
FFBFFBBLLR
FFFBFFFLLR
BFFFBFBRLL
FBBFFBBRLL
FBBFBFFLLR
BFFFFBFLLR
BFFFFFBLRR
BBFFFBFLRR
FBFBBFFRLR
BFBBFBFLLL
BFFBBBFRLR
BBFBFBBRLR
FFBBFBFLLR
BBFBFBFRRL
FBFBFBBLRL
FBFFFBBLRR
FBFBBFFRRR
BFFFFBFRLR
FBFFFBFLLR
FFBBBFFRLL
FBFBFFFLRL
BFFFBBFLLL
FFFBBFBRLL
FFBBBFFLLL
BFBBFBFLLR
FFBFBBFLLL
BFFBBBBRRL
BBFFBBBLRL
FBFFFFBLRR
BFBBFBBLRR
BFBBBFBRRR
BBFBFFFLLL
BFFBBFFRLR
BFFFBFFLRL
FBBBBFFRLL
FBFFBBFLLR
FBFBFFFLLL
BFFBBFFLRR
FFBBFBBRRL
BFBFBBFLLR
FFFBBFBLRL
FFBBFFFRRR
BBFFFBFRRR
FBBBBFFLRL
FFFBFBBLLL
FFFBBFFRLR
FBFFFBBLRL
BBFBFBFRLL
BBFFBBBRLR
FFFBBFBRLR
BBFBBFFRLL
BBFFFFFRLR
BFBFBFBLLL
BBFBFFFLLR
FBFFBFBLLL
BBFFFBBLLL
FBFFFFBRLL
BBFFFFBRLL
FFBFFFBRRR
BFFFFFFRLR
BBFFBBFRLL
BFBFFFBRRL
FFBBBBFRLR
FFBFFBFRRR
BBFBFBFLRR
FFBFFBFLRL
BFBFBFFLLR
FBBBBBFLLL
FFBFFFBLLL
FFBBBFBLRR
FFFFBBFRRL
FBFBBBFLRR
BFFBBFFRRR
FBFBBBFRRL
BFFFFFBRRR
BFBFBBFRRL
BFBFBFBRLL
BFBFFFFLLL
FBBBBBFRRL
BFBBBBFLRR
BBFBBFFRRR
BFFBFFFLLR
BFBBFBBLLL
FBFFFFBRRR
FBFFFBFRLR
BFFBFBBRLL
FFBBBFBRRR
FFBBFFFLLR
BBFBBFFLLR
BFBBFFBRLR
FFFBBFFLRL
BFFFFFFLLL
FFBBFFFRLR
BFFBFBFRLL
FFBFFBBLLL
BFFFBFFLRR
FFBFFFFLRR
FBBBBFBRLL
BFBFFBFLLR
FFBBFFBRRL
BFFBBFBLRR
FFBFFBFLRR
BFFBFBBLLR
FBBFBBFLLL
FBFFBBBLRR
BBFFBFFLLR
BFBBBFFRRR
FFFBFFFRRL
FBBFBBBRRL
FFFBFBBLLR
BFFFBFFRLL
BBFBFFBRRL
FFBFFFFRRL
FFBFBFBRLR
FBBFBFFRLL
FFFBBFBLLR
FFFBBBFRRL
FBBBBBFRLL
BFFFBBFRRL
BFBFBFBRRL
FBBBBFFLRR
FFFBBFBRRL
BFFBBFBRLR
BBFBFBBLLL
FFBFFFFLLR
FFBFFFFLRL
FFFFBBBLRR
BBFBBFBLRR
FBBBFBFLRR
FFFBFBBRLL
FBFFBBFRLR
FFBFBBFLRR
FFFBFBFLRL
FFFBBBBRLR
FBBFBBBRLR
FBFBFFBLRL
BFBBBBFLRL
BFFFFBBRRR
BFFBBBFRRL
BFFFFBBRLL
BFBFBFFLRR
BBFFBFBLRR
FBBFBBFLRL
FFFBFFFLLL
FBBBBFBRRR
FBFFFBBLLR
FBBFFBBLLR
FFBBFFFLLL
FFBFBFFLLL
FBFBFBFLRR
BBFFFBFLLR
BFFBBBBLRR
FBBFFFBLRL
FFFBFFBLRR
BFBFBFBLLR
FBFBBFFLRL
BFBFBFFRLL
FFBFBBBLLL
FBFFBBBRRR
FFBBFFFRRL
FFBBFBBRRR
FFBFFFBLRL
BFBBBFFLRL

2061
AOC2020/input2020/day06.in Normal file

File diff suppressed because it is too large Load Diff

594
AOC2020/input2020/day07.in Normal file
View File

@ -0,0 +1,594 @@
wavy green bags contain 1 posh black bag, 1 faded green bag, 4 wavy red bags.
dotted chartreuse bags contain 1 light beige bag.
dark white bags contain 2 dotted white bags.
clear aqua bags contain 4 posh orange bags, 4 pale blue bags.
faded green bags contain 2 plaid orange bags, 4 drab green bags, 4 pale aqua bags, 4 drab coral bags.
drab lavender bags contain 2 shiny white bags, 2 muted orange bags, 1 mirrored crimson bag, 1 dotted aqua bag.
dull maroon bags contain 1 plaid plum bag, 5 plaid orange bags, 4 posh maroon bags.
pale lavender bags contain no other bags.
plaid cyan bags contain 2 posh violet bags, 5 dim turquoise bags, 2 dark tomato bags.
dull plum bags contain 5 muted red bags, 4 dotted salmon bags, 1 dull maroon bag.
bright turquoise bags contain 2 dotted chartreuse bags, 3 dull tan bags, 4 light gray bags, 3 mirrored red bags.
posh violet bags contain no other bags.
faded coral bags contain 1 wavy teal bag, 4 wavy cyan bags.
striped turquoise bags contain 3 bright gray bags, 4 bright bronze bags.
muted magenta bags contain 5 light teal bags.
dull lavender bags contain 3 clear orange bags, 3 pale cyan bags, 4 vibrant orange bags, 1 dim chartreuse bag.
pale silver bags contain 3 faded olive bags.
dull turquoise bags contain 4 light gray bags, 4 clear green bags, 2 dull aqua bags, 5 dim white bags.
dim cyan bags contain 4 pale cyan bags, 2 dotted beige bags, 4 drab lime bags, 2 muted silver bags.
wavy plum bags contain 2 drab bronze bags, 3 mirrored yellow bags, 3 vibrant beige bags.
drab lime bags contain 5 muted plum bags.
striped yellow bags contain 3 dark fuchsia bags, 1 clear lime bag, 5 faded turquoise bags.
shiny cyan bags contain 4 clear maroon bags, 1 dim yellow bag, 5 drab red bags.
bright maroon bags contain 2 shiny gray bags, 2 faded indigo bags, 5 muted tan bags.
striped crimson bags contain 5 posh brown bags.
pale green bags contain 1 pale red bag.
shiny blue bags contain 2 clear red bags, 2 dark black bags, 3 dotted silver bags.
mirrored lime bags contain 2 drab violet bags.
mirrored maroon bags contain 4 faded salmon bags, 2 shiny blue bags, 1 pale coral bag.
light bronze bags contain 2 clear red bags, 3 posh lavender bags, 1 clear purple bag, 5 plaid lavender bags.
bright salmon bags contain 2 faded cyan bags, 1 striped blue bag, 1 faded crimson bag.
faded red bags contain 4 dotted purple bags, 1 bright brown bag, 1 pale tan bag, 1 drab teal bag.
pale indigo bags contain 3 pale orange bags, 5 muted bronze bags, 2 pale tan bags, 3 posh fuchsia bags.
pale orange bags contain 2 dotted magenta bags, 5 clear plum bags, 3 dim olive bags, 1 mirrored yellow bag.
drab gold bags contain 4 dotted cyan bags, 4 muted plum bags, 1 vibrant white bag, 4 dull green bags.
mirrored teal bags contain 5 posh turquoise bags, 4 striped purple bags, 5 mirrored blue bags.
dark chartreuse bags contain 1 striped crimson bag, 3 dull purple bags.
posh olive bags contain 2 clear brown bags, 1 faded lavender bag.
muted tan bags contain 1 striped red bag.
drab olive bags contain 2 dim plum bags, 4 mirrored violet bags.
faded lime bags contain 3 dark tomato bags.
dim black bags contain 2 wavy purple bags, 5 mirrored fuchsia bags, 5 drab beige bags.
dotted plum bags contain 2 shiny gold bags, 4 shiny beige bags, 1 clear red bag.
striped red bags contain 5 pale tan bags, 5 pale lavender bags.
drab green bags contain 1 faded silver bag, 3 vibrant plum bags, 2 wavy purple bags, 1 plaid blue bag.
dull orange bags contain no other bags.
posh tomato bags contain 5 dim gold bags, 2 drab coral bags, 4 drab maroon bags, 2 pale indigo bags.
light turquoise bags contain 2 shiny violet bags, 1 dull violet bag.
muted salmon bags contain 2 mirrored teal bags, 1 mirrored bronze bag.
bright red bags contain 1 dotted orange bag, 2 faded gray bags, 2 dim white bags, 4 plaid tomato bags.
dotted tan bags contain 3 clear red bags, 5 pale coral bags, 3 clear turquoise bags, 2 muted beige bags.
muted gold bags contain 2 drab turquoise bags.
pale magenta bags contain 3 dotted cyan bags, 4 mirrored lime bags, 2 shiny cyan bags.
pale brown bags contain 2 dull silver bags, 3 wavy tomato bags.
shiny lime bags contain 1 mirrored gold bag, 5 dull magenta bags, 5 shiny fuchsia bags.
dark bronze bags contain 2 light green bags.
light magenta bags contain 4 pale crimson bags, 3 drab plum bags.
dark gray bags contain 5 light maroon bags.
plaid orange bags contain 5 plaid gray bags, 1 dark tomato bag, 2 drab chartreuse bags, 4 clear red bags.
posh purple bags contain 2 posh blue bags.
drab turquoise bags contain 3 clear brown bags, 2 mirrored red bags, 2 muted green bags.
dark fuchsia bags contain 4 light orange bags.
dim lime bags contain 1 dotted olive bag, 5 posh blue bags, 3 dim gold bags, 2 drab lime bags.
drab tan bags contain 4 clear violet bags.
posh fuchsia bags contain 5 drab black bags, 4 plaid purple bags, 3 dim white bags.
clear orange bags contain 5 muted tomato bags, 1 dotted white bag, 5 bright fuchsia bags.
posh crimson bags contain 1 mirrored chartreuse bag, 4 pale gray bags.
plaid tan bags contain 1 light orange bag.
posh brown bags contain 1 clear lavender bag, 4 clear yellow bags.
mirrored salmon bags contain 2 dotted plum bags, 5 plaid lavender bags, 4 drab olive bags, 5 shiny violet bags.
striped bronze bags contain 5 light blue bags.
dotted black bags contain 4 plaid coral bags, 2 drab maroon bags, 4 dotted red bags.
light gray bags contain 3 posh magenta bags, 5 wavy coral bags, 2 vibrant red bags, 2 wavy olive bags.
pale turquoise bags contain 2 light olive bags, 1 dark silver bag, 5 plaid yellow bags.
striped fuchsia bags contain 3 wavy aqua bags.
light teal bags contain 5 dotted turquoise bags, 5 muted tomato bags, 1 dotted gray bag, 1 pale lavender bag.
wavy beige bags contain 5 dim gray bags, 4 bright aqua bags.
light salmon bags contain 2 clear plum bags.
shiny magenta bags contain 4 dim fuchsia bags.
clear white bags contain 4 dim white bags.
wavy gray bags contain 1 vibrant beige bag.
plaid bronze bags contain 5 plaid plum bags, 3 drab olive bags, 2 drab green bags.
drab plum bags contain 5 drab chartreuse bags, 5 plaid purple bags, 2 drab teal bags, 1 drab coral bag.
dotted salmon bags contain 4 dim fuchsia bags, 4 striped cyan bags, 3 dotted white bags, 4 mirrored violet bags.
striped magenta bags contain 1 faded teal bag, 1 drab red bag.
posh magenta bags contain 4 faded green bags, 2 dull magenta bags.
striped lavender bags contain 1 striped black bag, 4 wavy turquoise bags, 5 dull purple bags, 4 posh violet bags.
mirrored lavender bags contain 1 wavy turquoise bag.
dim violet bags contain 3 muted green bags, 1 striped plum bag, 4 dull coral bags, 4 wavy chartreuse bags.
shiny tomato bags contain 3 bright red bags, 5 wavy beige bags, 5 faded blue bags, 3 muted black bags.
wavy indigo bags contain 2 dull brown bags.
dark tomato bags contain 2 drab olive bags.
vibrant red bags contain 1 plaid tomato bag, 1 muted tomato bag.
vibrant brown bags contain 4 shiny violet bags, 2 mirrored violet bags, 2 dark salmon bags, 5 faded turquoise bags.
dim lavender bags contain 4 dim plum bags, 5 drab maroon bags, 3 dark black bags.
dull lime bags contain 5 bright turquoise bags, 3 vibrant chartreuse bags, 1 pale gray bag.
muted plum bags contain 4 plaid plum bags, 3 dim beige bags, 5 wavy magenta bags.
wavy tan bags contain 3 wavy chartreuse bags, 5 clear orange bags, 2 light blue bags, 2 pale yellow bags.
dim maroon bags contain 2 dull yellow bags, 4 shiny orange bags.
clear violet bags contain 2 clear red bags, 1 plaid blue bag.
dim orange bags contain 4 posh red bags, 3 posh plum bags.
plaid crimson bags contain 5 posh brown bags, 4 vibrant indigo bags, 5 drab teal bags, 1 dotted gray bag.
clear yellow bags contain 1 plaid gray bag.
dotted fuchsia bags contain 2 plaid plum bags, 1 drab chartreuse bag.
dim brown bags contain 1 faded silver bag, 1 faded brown bag, 2 striped cyan bags.
striped aqua bags contain 2 faded purple bags.
striped gold bags contain 3 dotted lime bags.
bright yellow bags contain 2 drab bronze bags, 2 dotted gray bags.
wavy blue bags contain 5 drab olive bags.
wavy turquoise bags contain 3 dotted indigo bags, 2 vibrant plum bags.
dotted purple bags contain 4 light blue bags, 4 wavy gray bags, 5 pale lavender bags.
mirrored gold bags contain 5 wavy silver bags, 3 clear white bags.
dull purple bags contain 3 dim fuchsia bags, 3 clear indigo bags, 4 dotted purple bags.
bright gold bags contain 5 shiny silver bags, 5 dark olive bags, 2 muted yellow bags, 3 vibrant magenta bags.
faded gray bags contain 3 dotted magenta bags, 5 clear lavender bags, 2 faded tomato bags.
dark olive bags contain 1 drab tan bag, 2 striped crimson bags.
light silver bags contain 3 dark teal bags, 4 posh crimson bags, 2 wavy olive bags, 2 dotted fuchsia bags.
light yellow bags contain 3 wavy silver bags.
dotted teal bags contain 3 vibrant orange bags, 2 clear maroon bags.
drab coral bags contain 5 mirrored violet bags.
dim salmon bags contain 4 faded silver bags, 2 plaid cyan bags.
dotted coral bags contain 3 faded gray bags.
vibrant bronze bags contain 4 faded tomato bags, 3 light brown bags, 5 posh lavender bags.
light blue bags contain 3 clear brown bags, 3 posh violet bags, 3 bright brown bags.
plaid fuchsia bags contain 4 striped white bags, 1 mirrored cyan bag.
plaid indigo bags contain 5 bright cyan bags.
dull magenta bags contain 5 muted tomato bags, 4 plaid tomato bags, 1 faded silver bag.
shiny orange bags contain 3 dark coral bags.
wavy white bags contain 2 striped indigo bags, 1 faded orange bag, 2 dull fuchsia bags, 2 vibrant silver bags.
dotted bronze bags contain 5 shiny fuchsia bags, 5 dotted aqua bags, 1 faded aqua bag.
light chartreuse bags contain 3 dull chartreuse bags.
dull salmon bags contain 2 vibrant plum bags.
clear bronze bags contain 1 shiny tomato bag.
faded lavender bags contain 5 pale lavender bags, 2 dull maroon bags, 3 drab beige bags.
dark black bags contain 2 dim fuchsia bags, 3 plaid tomato bags, 3 dull orange bags.
dull violet bags contain 1 striped red bag.
mirrored indigo bags contain 3 mirrored violet bags, 4 faded plum bags, 1 pale tan bag, 2 dotted white bags.
shiny crimson bags contain 2 dim purple bags, 2 dotted purple bags, 2 bright bronze bags.
plaid aqua bags contain 1 plaid tan bag, 1 mirrored orange bag.
drab beige bags contain 1 dull yellow bag.
clear purple bags contain 1 vibrant cyan bag, 2 dim brown bags, 1 dark lavender bag.
dim olive bags contain 5 light blue bags, 1 dull gold bag, 5 faded red bags, 1 dotted purple bag.
mirrored green bags contain 4 wavy beige bags.
dotted silver bags contain 5 wavy fuchsia bags.
dotted blue bags contain 5 pale blue bags.
pale crimson bags contain 1 dim tan bag.
plaid gold bags contain 5 wavy magenta bags, 2 dotted gray bags.
dim crimson bags contain 4 dark lavender bags.
pale tomato bags contain 3 muted red bags, 1 clear lavender bag, 1 clear orange bag, 3 pale red bags.
drab fuchsia bags contain 3 faded red bags, 1 muted silver bag, 2 drab aqua bags.
pale maroon bags contain 5 vibrant lime bags, 1 light crimson bag, 1 posh white bag.
wavy lavender bags contain 3 muted red bags, 2 posh violet bags.
vibrant salmon bags contain 1 dark beige bag.
dark blue bags contain 5 dim brown bags, 3 dark red bags, 1 light fuchsia bag, 5 shiny gold bags.
dark plum bags contain 1 muted aqua bag.
drab crimson bags contain 2 drab turquoise bags, 3 shiny violet bags.
vibrant tomato bags contain 1 light tomato bag, 5 vibrant gold bags.
drab maroon bags contain 2 faded tomato bags, 5 clear olive bags, 3 plaid gray bags.
clear green bags contain 5 striped lavender bags, 4 dim gray bags.
plaid green bags contain 2 shiny blue bags, 1 drab fuchsia bag, 5 dotted black bags, 1 dim plum bag.
mirrored yellow bags contain 2 mirrored violet bags, 5 clear brown bags.
dull aqua bags contain 2 faded tomato bags.
shiny olive bags contain 4 light teal bags, 2 bright white bags.
plaid lime bags contain 3 drab red bags, 2 light crimson bags.
dull green bags contain 5 drab green bags, 4 dotted red bags, 4 shiny olive bags, 4 plaid plum bags.
dull beige bags contain 2 faded tan bags.
light indigo bags contain 3 dotted white bags.
shiny silver bags contain 3 vibrant cyan bags, 1 dim teal bag, 1 striped beige bag, 5 wavy chartreuse bags.
plaid yellow bags contain 3 light beige bags.
striped orange bags contain 1 dotted maroon bag, 5 bright red bags, 3 shiny red bags.
posh indigo bags contain 2 dotted bronze bags.
drab orange bags contain 1 striped crimson bag, 3 dark yellow bags, 3 light turquoise bags, 3 light silver bags.
mirrored chartreuse bags contain 2 dotted magenta bags.
plaid silver bags contain 5 wavy aqua bags, 3 vibrant plum bags, 1 dark black bag.
striped indigo bags contain 2 dotted salmon bags, 1 vibrant beige bag, 1 wavy cyan bag, 5 striped salmon bags.
muted coral bags contain 5 vibrant brown bags, 4 light fuchsia bags.
shiny brown bags contain 2 vibrant violet bags, 3 drab gray bags.
shiny indigo bags contain 5 muted bronze bags.
striped cyan bags contain 3 dim fuchsia bags, 3 dark coral bags, 1 faded red bag, 5 plaid brown bags.
shiny tan bags contain 5 plaid white bags.
clear gold bags contain 3 plaid purple bags, 4 striped black bags, 5 dim turquoise bags, 1 plaid plum bag.
vibrant violet bags contain 2 posh violet bags, 2 pale tomato bags.
muted olive bags contain 2 dark tomato bags.
mirrored tomato bags contain 5 pale black bags.
clear crimson bags contain 1 dim crimson bag, 5 striped blue bags.
drab blue bags contain 1 bright indigo bag.
drab teal bags contain 1 plaid brown bag.
striped brown bags contain 4 dotted orange bags, 4 wavy blue bags.
posh lavender bags contain 4 bright indigo bags, 4 faded bronze bags.
light fuchsia bags contain 1 shiny crimson bag, 2 clear brown bags, 2 striped crimson bags.
dotted violet bags contain 4 dull crimson bags.
vibrant lavender bags contain 2 faded olive bags, 5 shiny tomato bags.
wavy gold bags contain 5 dotted black bags, 2 drab beige bags, 3 dull gold bags.
faded brown bags contain 1 wavy gray bag, 3 plaid teal bags.
bright purple bags contain 1 faded tomato bag.
shiny plum bags contain 2 dim silver bags.
posh beige bags contain 3 bright crimson bags.
posh coral bags contain 4 light chartreuse bags, 5 drab bronze bags, 2 striped aqua bags.
shiny black bags contain 2 posh black bags, 5 clear white bags.
posh white bags contain 1 plaid violet bag.
vibrant chartreuse bags contain 5 clear aqua bags, 4 dotted magenta bags.
faded olive bags contain 2 mirrored fuchsia bags, 5 plaid brown bags.
drab purple bags contain 1 dim olive bag, 5 drab lime bags.
dull yellow bags contain 2 dark coral bags, 3 clear brown bags.
vibrant turquoise bags contain 5 plaid orange bags.
wavy tomato bags contain 3 faded olive bags, 3 bright white bags, 5 dull gray bags.
pale plum bags contain 4 pale coral bags, 4 bright cyan bags, 3 dim brown bags.
faded indigo bags contain 1 clear beige bag, 2 vibrant beige bags.
shiny violet bags contain 4 shiny tomato bags, 2 striped lavender bags.
mirrored purple bags contain 5 dotted red bags, 1 mirrored fuchsia bag, 2 mirrored yellow bags.
faded cyan bags contain 4 drab red bags, 5 wavy purple bags, 2 dim beige bags, 5 faded red bags.
shiny salmon bags contain 5 muted tomato bags, 5 striped olive bags.
clear maroon bags contain 1 dotted magenta bag.
faded black bags contain 5 wavy fuchsia bags, 2 dim olive bags, 1 dark lavender bag.
posh green bags contain 3 mirrored coral bags, 2 drab aqua bags, 4 wavy orange bags.
faded crimson bags contain 1 mirrored cyan bag, 2 dim gray bags, 5 light blue bags, 5 posh maroon bags.
striped tomato bags contain 4 drab lime bags, 2 wavy teal bags, 4 plaid cyan bags, 2 muted fuchsia bags.
light olive bags contain 2 dotted red bags, 2 pale coral bags.
faded gold bags contain 4 shiny green bags, 1 clear beige bag, 2 wavy brown bags, 2 dull tomato bags.
pale bronze bags contain 1 dim lime bag.
dotted gray bags contain 5 mirrored yellow bags.
dark beige bags contain 4 clear turquoise bags, 3 vibrant plum bags, 5 drab maroon bags, 5 clear red bags.
drab magenta bags contain 1 drab maroon bag, 1 clear magenta bag.
vibrant beige bags contain 3 bright fuchsia bags, 1 dull gold bag.
dark teal bags contain 5 clear turquoise bags, 5 dark maroon bags, 4 dotted magenta bags, 3 shiny crimson bags.
mirrored blue bags contain 5 dark black bags, 5 vibrant brown bags, 5 dark aqua bags.
wavy cyan bags contain 4 clear aqua bags, 4 dark aqua bags.
dark turquoise bags contain 1 striped gold bag.
drab silver bags contain 3 plaid bronze bags.
faded beige bags contain 5 wavy cyan bags, 3 dull white bags, 5 dim purple bags, 4 faded brown bags.
faded purple bags contain 3 light white bags, 4 faded brown bags, 4 posh maroon bags.
dotted magenta bags contain 3 posh violet bags.
muted green bags contain 2 dim gray bags, 1 vibrant indigo bag, 4 dotted indigo bags.
bright beige bags contain 1 wavy teal bag, 4 bright cyan bags, 1 clear green bag, 1 posh brown bag.
bright violet bags contain 2 plaid indigo bags.
dim purple bags contain 1 posh maroon bag, 2 drab beige bags, 5 clear brown bags.
clear magenta bags contain 4 pale white bags, 5 dotted chartreuse bags, 2 bright turquoise bags, 4 mirrored red bags.
faded magenta bags contain 1 dull gray bag.
mirrored white bags contain 4 dotted purple bags, 2 plaid purple bags, 2 pale tan bags.
clear salmon bags contain 2 mirrored lavender bags.
light maroon bags contain 1 plaid tomato bag, 5 pale aqua bags.
vibrant tan bags contain 3 bright coral bags, 4 striped turquoise bags, 3 wavy aqua bags, 2 shiny gold bags.
shiny lavender bags contain 2 drab tomato bags, 1 drab plum bag.
dark crimson bags contain 2 pale purple bags, 2 dotted white bags, 3 shiny orange bags, 1 dotted bronze bag.
faded aqua bags contain 3 wavy purple bags.
striped blue bags contain 3 plaid bronze bags, 1 clear yellow bag, 2 clear white bags, 3 wavy teal bags.
mirrored silver bags contain 5 striped salmon bags, 4 drab blue bags, 1 vibrant green bag, 1 muted cyan bag.
drab white bags contain 2 wavy salmon bags.
dull brown bags contain 5 pale plum bags, 3 plaid tomato bags.
bright cyan bags contain 2 clear lavender bags.
faded chartreuse bags contain 4 wavy aqua bags, 5 plaid orange bags, 5 dotted indigo bags, 4 clear yellow bags.
dotted tomato bags contain 4 muted purple bags, 4 dotted black bags.
dim white bags contain 5 mirrored cyan bags, 2 dim fuchsia bags, 2 dark tomato bags, 1 dotted purple bag.
posh orange bags contain 5 drab olive bags, 5 vibrant beige bags.
light coral bags contain 5 light purple bags, 2 wavy tomato bags.
wavy lime bags contain 4 clear brown bags.
mirrored magenta bags contain 2 faded silver bags, 2 dark coral bags.
wavy coral bags contain 4 dull purple bags, 1 dark white bag, 4 posh orange bags.
vibrant gray bags contain 5 dotted aqua bags, 2 dark salmon bags, 2 bright blue bags, 1 dotted white bag.
mirrored olive bags contain 3 dark coral bags, 3 wavy gray bags.
light gold bags contain 2 striped lime bags, 2 dark orange bags.
light cyan bags contain 2 dim turquoise bags, 3 dotted tan bags, 4 shiny crimson bags.
shiny gray bags contain 5 plaid cyan bags, 1 wavy purple bag.
bright plum bags contain 3 muted tomato bags, 1 dim chartreuse bag, 3 dotted indigo bags, 4 shiny olive bags.
vibrant blue bags contain 2 shiny orange bags.
clear lavender bags contain 5 faded red bags, 2 wavy gray bags.
dim yellow bags contain 2 drab aqua bags, 3 dim lavender bags, 1 bright plum bag.
posh gray bags contain 3 light lavender bags.
dull tan bags contain 1 dim gold bag, 2 bright bronze bags, 5 dim plum bags.
plaid brown bags contain 3 dull orange bags, 3 dim plum bags.
muted purple bags contain 5 dark black bags, 1 vibrant lime bag.
shiny coral bags contain 4 dim green bags, 4 dim maroon bags, 2 dim chartreuse bags.
pale gold bags contain 2 dim beige bags.
dim beige bags contain 2 mirrored yellow bags, 5 clear brown bags.
dull chartreuse bags contain 2 faded red bags, 5 posh maroon bags, 5 clear lavender bags.
muted bronze bags contain 5 dim plum bags.
vibrant coral bags contain 1 faded black bag, 3 light green bags, 1 wavy chartreuse bag.
clear turquoise bags contain 2 shiny beige bags, 5 mirrored fuchsia bags.
wavy silver bags contain 5 dim tan bags.
muted red bags contain 4 dull gold bags, 1 plaid brown bag, 1 wavy gray bag.
light tan bags contain 4 dotted yellow bags, 1 dull maroon bag, 1 light beige bag.
bright tomato bags contain 1 muted beige bag.
striped coral bags contain 3 bright coral bags.
dotted lime bags contain 2 dull salmon bags.
mirrored plum bags contain 1 bright fuchsia bag, 1 drab yellow bag, 2 dark plum bags, 2 posh purple bags.
plaid blue bags contain 5 dull gold bags, 4 wavy gray bags, 5 mirrored violet bags.
plaid salmon bags contain 4 dim salmon bags, 1 dotted lavender bag.
clear chartreuse bags contain 5 muted teal bags, 4 clear gold bags, 2 plaid tomato bags.
muted blue bags contain 3 faded tomato bags, 5 striped chartreuse bags.
dim tan bags contain 4 clear lavender bags, 2 clear violet bags, 1 wavy plum bag, 4 pale gold bags.
bright chartreuse bags contain 2 posh silver bags, 1 vibrant plum bag.
plaid white bags contain 1 striped red bag, 3 dim beige bags, 3 plaid bronze bags, 2 dim turquoise bags.
bright coral bags contain 3 shiny gold bags, 2 striped chartreuse bags, 4 light salmon bags, 2 vibrant aqua bags.
clear indigo bags contain 4 posh orange bags, 4 dull gold bags.
bright aqua bags contain 1 shiny orange bag.
faded bronze bags contain 2 pale gray bags, 3 dull gold bags.
shiny green bags contain 1 drab chartreuse bag, 4 light salmon bags, 4 striped gold bags.
drab black bags contain 4 dark black bags, 1 dotted turquoise bag, 3 wavy gray bags, 3 shiny fuchsia bags.
pale yellow bags contain 2 dim green bags, 3 vibrant aqua bags.
dull indigo bags contain 2 striped aqua bags, 4 clear chartreuse bags, 4 dark orange bags, 3 posh magenta bags.
mirrored cyan bags contain 2 dotted purple bags, 5 mirrored violet bags, 2 dotted white bags, 3 bright brown bags.
dark yellow bags contain 4 faded tan bags, 3 dim turquoise bags, 5 muted fuchsia bags, 5 clear salmon bags.
wavy yellow bags contain 2 dim bronze bags, 4 drab bronze bags.
muted white bags contain 1 dotted black bag, 5 bright plum bags, 1 striped cyan bag, 2 clear turquoise bags.
dotted gold bags contain 3 shiny fuchsia bags, 5 muted tan bags, 2 clear fuchsia bags.
light aqua bags contain 5 faded brown bags, 3 pale blue bags, 2 mirrored green bags.
plaid violet bags contain 3 bright yellow bags.
bright silver bags contain 1 drab violet bag, 4 light teal bags.
wavy red bags contain 3 dotted gray bags, 5 drab fuchsia bags, 1 posh blue bag.
mirrored tan bags contain 5 light green bags, 2 plaid gray bags, 4 pale orange bags, 1 shiny violet bag.
muted tomato bags contain 1 wavy purple bag.
faded blue bags contain 3 shiny crimson bags, 1 clear indigo bag.
shiny purple bags contain 5 clear blue bags, 1 vibrant red bag.
posh aqua bags contain 4 striped olive bags, 3 pale maroon bags, 1 dim yellow bag, 1 clear red bag.
striped white bags contain 1 bright cyan bag, 3 dotted orange bags.
striped lime bags contain 1 striped brown bag, 3 dotted chartreuse bags, 3 wavy fuchsia bags, 4 faded magenta bags.
striped tan bags contain 1 pale gray bag, 1 light indigo bag, 2 dark coral bags.
shiny red bags contain 4 dotted gray bags, 1 drab bronze bag, 4 shiny fuchsia bags.
shiny beige bags contain 3 vibrant beige bags, 2 vibrant indigo bags, 3 plaid blue bags.
dim fuchsia bags contain 5 pale tan bags.
plaid tomato bags contain 4 clear red bags.
dull blue bags contain 4 pale turquoise bags.
dull red bags contain 5 posh brown bags, 2 dotted tomato bags, 2 striped gold bags.
pale red bags contain 3 plaid brown bags.
striped maroon bags contain 3 pale cyan bags, 1 dotted cyan bag, 1 dim tomato bag.
light lime bags contain 3 light cyan bags, 4 light olive bags, 4 bright salmon bags, 3 shiny orange bags.
drab brown bags contain 3 dim tomato bags, 2 dark gray bags.
faded yellow bags contain 3 dotted beige bags, 2 muted blue bags, 2 wavy fuchsia bags, 1 dark magenta bag.
bright green bags contain 2 pale cyan bags, 5 plaid bronze bags, 5 wavy orange bags.
wavy bronze bags contain 3 wavy red bags.
dull gold bags contain no other bags.
plaid olive bags contain 4 muted white bags, 4 plaid red bags, 5 wavy red bags, 3 posh indigo bags.
dotted aqua bags contain 3 dim indigo bags, 3 drab coral bags.
pale purple bags contain 1 dotted magenta bag, 3 clear indigo bags, 1 dim turquoise bag, 3 pale blue bags.
faded teal bags contain 3 drab maroon bags, 3 clear tan bags, 1 pale gray bag, 4 bright tomato bags.
drab chartreuse bags contain 2 drab aqua bags, 4 clear indigo bags.
light lavender bags contain 4 faded bronze bags, 1 plaid chartreuse bag.
dim tomato bags contain 2 dull orange bags, 5 shiny cyan bags, 2 muted purple bags, 2 dotted black bags.
faded maroon bags contain 2 faded white bags, 3 dim maroon bags.
pale cyan bags contain 2 plaid brown bags.
muted indigo bags contain 4 mirrored red bags, 1 dotted indigo bag, 4 mirrored maroon bags.
wavy orange bags contain 3 plaid bronze bags.
dull teal bags contain 5 drab red bags, 4 dim green bags, 3 dotted olive bags, 5 pale maroon bags.
dull gray bags contain 5 dark tomato bags, 4 dull magenta bags, 4 dotted red bags, 5 faded brown bags.
vibrant gold bags contain 3 striped beige bags, 5 clear bronze bags.
posh bronze bags contain 3 pale turquoise bags, 4 posh blue bags.
striped plum bags contain 3 pale orange bags, 5 clear tomato bags, 1 light salmon bag.
shiny chartreuse bags contain 4 dim yellow bags, 4 mirrored yellow bags, 2 clear orange bags, 2 bright red bags.
vibrant yellow bags contain 4 clear yellow bags, 2 vibrant olive bags, 5 drab salmon bags, 5 light tomato bags.
dark coral bags contain 1 pale tan bag, 3 dull orange bags, 4 clear brown bags.
dotted cyan bags contain 5 faded aqua bags, 2 dotted lime bags, 1 dim gray bag.
light purple bags contain 5 dotted indigo bags, 2 pale violet bags.
bright bronze bags contain 1 dim turquoise bag.
wavy brown bags contain 5 dotted silver bags.
plaid black bags contain 1 clear magenta bag, 2 faded plum bags.
posh cyan bags contain 5 muted beige bags, 1 clear brown bag, 3 wavy beige bags.
dotted green bags contain 4 faded lavender bags, 2 muted blue bags.
vibrant orange bags contain 1 dark aqua bag.
dark violet bags contain 1 striped fuchsia bag.
dark green bags contain 2 dark white bags, 3 vibrant chartreuse bags, 3 mirrored maroon bags.
shiny aqua bags contain 2 light salmon bags, 5 pale turquoise bags, 1 pale silver bag.
mirrored gray bags contain 2 dim salmon bags, 4 striped chartreuse bags, 5 dull gray bags, 2 bright white bags.
bright black bags contain 1 dark aqua bag, 5 dark red bags, 4 faded tomato bags.
dark purple bags contain 3 striped brown bags.
vibrant plum bags contain 5 dim fuchsia bags, 1 posh orange bag, 1 dotted purple bag, 1 light blue bag.
pale gray bags contain 1 plaid cyan bag, 2 dim white bags, 1 dotted magenta bag, 4 shiny gold bags.
striped green bags contain 2 pale crimson bags, 3 dotted lime bags, 5 posh turquoise bags.
shiny bronze bags contain 5 dark olive bags, 2 vibrant magenta bags, 4 striped silver bags.
muted fuchsia bags contain 5 drab fuchsia bags.
bright olive bags contain 4 pale blue bags, 5 shiny crimson bags.
posh lime bags contain 1 dim plum bag, 3 dim magenta bags, 1 mirrored tomato bag, 2 light lavender bags.
light crimson bags contain 3 clear turquoise bags, 5 dim brown bags, 3 bright cyan bags, 4 plaid tomato bags.
dull silver bags contain 5 wavy silver bags.
clear coral bags contain 5 muted aqua bags.
pale salmon bags contain 3 dark gold bags, 5 wavy orange bags.
pale lime bags contain 3 dim cyan bags, 4 striped turquoise bags, 2 muted aqua bags.
wavy fuchsia bags contain 2 drab beige bags, 1 faded olive bag, 1 dim beige bag, 3 pale orange bags.
clear blue bags contain 1 pale black bag, 2 plaid fuchsia bags, 2 mirrored chartreuse bags, 2 bright brown bags.
muted teal bags contain 5 pale black bags.
muted orange bags contain 4 dim olive bags.
dotted indigo bags contain 3 drab lime bags.
drab yellow bags contain 1 dim beige bag.
muted brown bags contain 2 striped red bags, 4 muted green bags, 3 drab chartreuse bags, 4 dark aqua bags.
posh red bags contain 1 wavy beige bag, 1 wavy tomato bag, 1 faded bronze bag, 1 clear coral bag.
posh gold bags contain 1 dim chartreuse bag, 1 clear lavender bag, 1 bright fuchsia bag, 3 bright magenta bags.
posh salmon bags contain 5 plaid red bags, 1 dim purple bag, 1 bright yellow bag.
wavy black bags contain 5 faded white bags, 3 faded chartreuse bags.
mirrored crimson bags contain 2 plaid gray bags, 2 vibrant tomato bags, 1 dim bronze bag.
light white bags contain 4 dim turquoise bags.
pale violet bags contain 5 dim beige bags.
dim magenta bags contain 4 striped teal bags.
striped teal bags contain 5 drab lime bags, 5 mirrored yellow bags.
dotted brown bags contain 4 shiny gold bags, 3 wavy brown bags, 4 clear brown bags, 1 clear teal bag.
bright orange bags contain 2 plaid violet bags, 3 posh aqua bags, 1 clear tan bag.
shiny gold bags contain 3 dotted magenta bags, 2 shiny beige bags, 3 plaid brown bags, 5 clear indigo bags.
clear olive bags contain 4 drab red bags.
plaid purple bags contain 3 plaid gray bags, 3 dim olive bags, 4 dotted purple bags.
pale teal bags contain 4 wavy cyan bags, 4 posh bronze bags.
muted cyan bags contain 2 light blue bags, 3 shiny purple bags, 3 dotted white bags.
plaid chartreuse bags contain 4 clear lime bags, 4 pale red bags.
wavy crimson bags contain 1 pale gray bag, 3 striped tan bags, 5 muted purple bags.
bright tan bags contain 1 posh purple bag, 1 light chartreuse bag, 3 dark white bags.
dark lavender bags contain 1 dotted beige bag, 2 dark tomato bags.
plaid coral bags contain 5 dotted red bags, 1 dim white bag.
faded plum bags contain no other bags.
dark indigo bags contain 4 drab beige bags, 5 clear red bags, 5 pale red bags, 4 pale blue bags.
striped gray bags contain 5 drab teal bags, 4 muted red bags.
light red bags contain 2 light gray bags, 3 vibrant aqua bags, 1 dotted aqua bag.
clear tan bags contain 5 dull gold bags, 3 dim gray bags, 3 dim white bags, 2 light green bags.
pale aqua bags contain 5 dotted purple bags, 1 drab lime bag, 2 clear orange bags.
vibrant fuchsia bags contain 5 clear turquoise bags, 3 clear red bags, 5 faded green bags.
clear lime bags contain 3 striped red bags, 1 dull maroon bag.
muted gray bags contain 4 muted yellow bags, 4 dotted silver bags, 4 clear orange bags, 5 faded turquoise bags.
dull fuchsia bags contain 1 dark aqua bag.
wavy purple bags contain 4 drab teal bags, 3 light blue bags, 3 mirrored violet bags.
vibrant teal bags contain 2 striped white bags, 4 dull red bags, 3 plaid chartreuse bags, 5 dotted salmon bags.
dotted lavender bags contain 4 dim purple bags, 4 clear orange bags, 4 vibrant beige bags.
clear gray bags contain 4 dotted tan bags, 1 dull gold bag, 4 dull gray bags.
wavy violet bags contain 3 bright blue bags, 3 shiny purple bags, 2 bright fuchsia bags.
dull cyan bags contain 4 clear green bags.
dim blue bags contain 1 light brown bag, 3 faded indigo bags.
bright magenta bags contain 1 dim brown bag, 4 wavy purple bags, 3 dotted red bags.
dark cyan bags contain 4 vibrant maroon bags, 2 wavy salmon bags.
vibrant magenta bags contain 4 plaid orange bags, 1 faded red bag.
bright gray bags contain 5 dotted magenta bags, 3 clear olive bags, 1 bright fuchsia bag, 2 muted silver bags.
wavy maroon bags contain 5 mirrored violet bags, 4 clear orange bags, 5 drab olive bags.
dotted maroon bags contain 5 pale purple bags, 5 faded silver bags, 5 dotted lime bags.
drab indigo bags contain 5 light chartreuse bags.
dark brown bags contain 4 bright red bags.
bright blue bags contain 2 shiny cyan bags.
bright brown bags contain 5 dark coral bags, 5 dim fuchsia bags.
dotted orange bags contain 5 bright fuchsia bags, 2 dull gold bags.
mirrored red bags contain 4 dotted salmon bags, 3 dark red bags, 3 drab teal bags, 4 pale blue bags.
plaid red bags contain 2 light maroon bags, 3 drab tomato bags.
drab violet bags contain 2 vibrant cyan bags.
vibrant olive bags contain 1 clear maroon bag, 3 clear green bags, 5 drab aqua bags.
plaid plum bags contain 3 vibrant plum bags.
dim coral bags contain 2 dull aqua bags, 3 vibrant tan bags, 5 muted fuchsia bags, 1 plaid silver bag.
vibrant green bags contain 4 pale gray bags, 4 posh fuchsia bags, 3 bright lime bags, 5 faded blue bags.
muted beige bags contain 5 drab fuchsia bags.
vibrant maroon bags contain 1 faded aqua bag.
muted yellow bags contain 3 clear maroon bags, 2 striped crimson bags, 4 mirrored maroon bags, 3 vibrant olive bags.
faded salmon bags contain 4 faded olive bags, 1 muted purple bag, 3 dotted yellow bags, 3 dim silver bags.
pale beige bags contain 3 mirrored tan bags.
plaid lavender bags contain 2 bright magenta bags, 4 bright indigo bags, 1 posh tomato bag.
drab aqua bags contain 4 wavy magenta bags, 3 mirrored olive bags, 1 muted tomato bag, 3 posh orange bags.
bright indigo bags contain 3 pale violet bags, 3 dark lavender bags, 4 muted plum bags, 3 striped crimson bags.
clear black bags contain 4 wavy aqua bags, 3 light yellow bags.
drab gray bags contain 1 muted aqua bag, 3 plaid fuchsia bags.
striped beige bags contain 1 vibrant blue bag, 5 dotted tomato bags.
faded orange bags contain 2 mirrored maroon bags.
dark orange bags contain 1 muted maroon bag, 5 drab indigo bags.
mirrored coral bags contain 3 faded aqua bags, 2 drab lime bags.
dim red bags contain 5 muted fuchsia bags.
dark aqua bags contain 3 shiny gold bags, 4 pale blue bags, 3 dull magenta bags.
dim gold bags contain 1 plaid blue bag, 1 posh fuchsia bag.
striped black bags contain 2 shiny gold bags.
shiny turquoise bags contain 4 pale purple bags, 5 faded blue bags.
dim chartreuse bags contain 2 pale coral bags.
drab red bags contain 5 mirrored olive bags, 5 vibrant beige bags.
posh chartreuse bags contain 3 pale violet bags, 3 muted beige bags.
light black bags contain 3 mirrored maroon bags, 5 dull tan bags, 5 posh crimson bags, 3 dark gray bags.
vibrant aqua bags contain 2 plaid coral bags.
pale olive bags contain 5 wavy lavender bags, 2 posh olive bags, 4 dim black bags, 3 drab cyan bags.
mirrored aqua bags contain 3 mirrored violet bags.
muted lime bags contain 4 mirrored cyan bags, 1 drab turquoise bag, 5 wavy fuchsia bags.
dull coral bags contain 4 muted lime bags, 4 dim white bags.
faded tomato bags contain 3 pale violet bags, 4 faded brown bags.
mirrored fuchsia bags contain 3 dotted purple bags, 4 pale lavender bags.
plaid magenta bags contain 3 light plum bags, 3 striped orange bags.
clear teal bags contain 4 plaid blue bags.
faded fuchsia bags contain 1 dull purple bag, 2 bright brown bags.
mirrored brown bags contain 4 faded bronze bags, 5 faded beige bags.
muted silver bags contain 2 dull gold bags, 4 clear orange bags, 2 dotted purple bags, 5 dim olive bags.
dull bronze bags contain 4 shiny cyan bags, 1 posh cyan bag.
dark silver bags contain 1 shiny olive bag, 2 drab aqua bags, 2 striped fuchsia bags, 4 mirrored tan bags.
bright white bags contain 4 dark aqua bags, 5 plaid tomato bags, 5 drab green bags, 4 muted red bags.
dark gold bags contain 2 dim teal bags, 4 shiny fuchsia bags.
dull olive bags contain 5 mirrored orange bags, 3 drab gray bags, 1 shiny turquoise bag, 5 dull cyan bags.
wavy olive bags contain 1 wavy cyan bag.
dotted white bags contain no other bags.
plaid gray bags contain 3 dim beige bags, 2 dotted magenta bags, 5 vibrant indigo bags.
dim bronze bags contain 5 dark aqua bags.
dotted yellow bags contain 2 wavy blue bags.
muted lavender bags contain 2 faded aqua bags.
dim teal bags contain 5 pale gold bags.
posh teal bags contain 1 muted plum bag, 5 clear tomato bags, 1 clear white bag.
faded turquoise bags contain 1 wavy teal bag, 1 plaid red bag.
vibrant lime bags contain 4 vibrant beige bags, 5 drab lime bags.
clear plum bags contain 1 vibrant beige bag.
mirrored black bags contain 5 wavy white bags.
mirrored orange bags contain 1 wavy turquoise bag.
vibrant purple bags contain 2 faded crimson bags, 2 dull red bags, 3 plaid blue bags.
posh maroon bags contain 5 clear orange bags, 5 vibrant indigo bags, 2 drab lime bags, 5 posh orange bags.
plaid maroon bags contain 2 pale silver bags, 5 dotted salmon bags, 1 dotted plum bag, 3 bright olive bags.
posh blue bags contain 1 dark coral bag, 2 vibrant lime bags, 4 pale orange bags, 1 plaid blue bag.
muted black bags contain 2 dim gold bags.
clear red bags contain 5 pale lavender bags, 1 bright brown bag, 5 muted red bags, 4 dull orange bags.
plaid teal bags contain 1 dark coral bag, 3 dull orange bags.
light tomato bags contain 4 dotted white bags, 1 pale blue bag, 1 dull coral bag.
mirrored turquoise bags contain 1 shiny green bag, 1 wavy plum bag, 1 dull orange bag.
pale coral bags contain 2 shiny fuchsia bags, 1 dull gold bag, 5 dim plum bags, 5 dark black bags.
muted aqua bags contain 5 posh maroon bags, 4 dim gray bags, 3 pale aqua bags, 1 light crimson bag.
shiny yellow bags contain 2 faded plum bags.
faded tan bags contain 2 dark maroon bags.
clear fuchsia bags contain 4 light white bags, 5 posh maroon bags.
light brown bags contain 4 dim olive bags, 5 drab chartreuse bags, 5 posh maroon bags, 3 pale violet bags.
muted maroon bags contain 2 wavy silver bags.
wavy aqua bags contain 4 pale purple bags.
mirrored beige bags contain 4 posh brown bags.
drab salmon bags contain 3 striped red bags, 1 dull gray bag, 3 posh white bags.
dotted crimson bags contain 2 light teal bags, 4 bright black bags, 3 drab teal bags.
muted violet bags contain 3 bright coral bags.
dim green bags contain 1 drab violet bag, 5 dotted beige bags.
striped salmon bags contain 4 dull chartreuse bags, 2 dark indigo bags.
dull black bags contain 3 dotted silver bags.
shiny maroon bags contain 3 vibrant lavender bags, 3 clear lavender bags, 4 dull teal bags, 5 wavy maroon bags.
faded white bags contain 1 plaid silver bag, 3 pale gold bags.
light orange bags contain 3 pale red bags, 3 dull purple bags, 3 bright cyan bags, 4 dim lavender bags.
posh plum bags contain 1 clear silver bag, 2 clear maroon bags.
vibrant indigo bags contain 3 pale lavender bags, 5 dotted purple bags, 5 dotted white bags, 2 wavy magenta bags.
dotted beige bags contain 3 muted tomato bags, 3 clear brown bags, 1 plaid gray bag, 2 faded olive bags.
dim plum bags contain no other bags.
pale white bags contain 3 vibrant beige bags.
wavy salmon bags contain 1 dim black bag, 4 faded gray bags, 5 dim maroon bags.
pale chartreuse bags contain 5 mirrored white bags, 4 posh teal bags, 2 muted plum bags.
pale tan bags contain no other bags.
vibrant black bags contain 4 vibrant tan bags.
mirrored bronze bags contain 5 pale aqua bags, 2 wavy olive bags, 1 posh olive bag.
bright teal bags contain 2 dark lavender bags, 5 muted fuchsia bags.
striped silver bags contain 5 dull cyan bags, 5 striped teal bags, 2 posh blue bags.
shiny white bags contain 3 shiny violet bags, 3 dotted cyan bags, 3 dotted purple bags.
dark salmon bags contain 5 dotted lime bags, 1 pale orange bag, 1 vibrant red bag, 5 wavy purple bags.
vibrant crimson bags contain 4 clear red bags, 4 faded gray bags.
pale blue bags contain 5 striped cyan bags.
drab bronze bags contain 1 drab teal bag.
wavy magenta bags contain 4 vibrant beige bags, 4 bright fuchsia bags, 1 mirrored yellow bag, 4 dim fuchsia bags.
faded violet bags contain 4 wavy gray bags.
drab cyan bags contain 1 light gray bag, 5 plaid bronze bags, 5 dull aqua bags, 2 vibrant gray bags.
dotted turquoise bags contain 2 mirrored indigo bags, 4 plaid plum bags, 4 faded red bags, 3 dim gray bags.
dotted olive bags contain 4 vibrant beige bags.
posh turquoise bags contain 1 light fuchsia bag, 5 plaid red bags, 5 bright coral bags.
dull tomato bags contain 5 light blue bags, 2 plaid plum bags, 3 dotted lime bags.
pale fuchsia bags contain 3 drab orange bags, 4 bright lime bags, 3 pale tan bags.
drab tomato bags contain 2 posh magenta bags, 3 vibrant fuchsia bags, 3 dim fuchsia bags.
vibrant silver bags contain 1 posh turquoise bag.
pale black bags contain 3 dark coral bags, 3 dim plum bags, 4 shiny beige bags.
wavy chartreuse bags contain 3 drab violet bags, 1 vibrant orange bag, 2 dim gray bags.
dull crimson bags contain 3 mirrored plum bags, 2 dotted orange bags, 3 faded brown bags.
clear beige bags contain 4 wavy tomato bags, 1 muted lavender bag, 5 bright magenta bags, 3 dotted indigo bags.
shiny teal bags contain 3 drab red bags.
bright lavender bags contain 4 drab fuchsia bags, 4 vibrant olive bags, 2 clear olive bags.
posh tan bags contain 5 drab crimson bags, 5 bright lavender bags.
dim turquoise bags contain 2 dim fuchsia bags.
light violet bags contain 4 wavy tomato bags, 5 dark green bags, 1 vibrant violet bag.
bright crimson bags contain 2 posh white bags.
striped olive bags contain 3 light indigo bags.
muted crimson bags contain 1 wavy magenta bag, 1 mirrored fuchsia bag.
muted chartreuse bags contain 5 faded tan bags.
dull white bags contain 5 faded red bags, 5 dim plum bags.
bright lime bags contain 5 posh blue bags, 2 pale aqua bags, 3 light red bags.
shiny fuchsia bags contain 4 faded olive bags, 2 dim turquoise bags, 1 plaid blue bag.
faded silver bags contain 2 muted red bags, 5 pale purple bags.
light plum bags contain 1 vibrant aqua bag.
dark magenta bags contain 4 striped purple bags, 5 bright lime bags, 2 dull magenta bags, 2 dim black bags.
clear cyan bags contain 3 bright brown bags, 3 mirrored gold bags, 2 faded plum bags, 5 shiny purple bags.
plaid turquoise bags contain 5 posh orange bags, 4 light gray bags.
clear brown bags contain 1 plaid brown bag, 5 posh violet bags.
posh black bags contain 3 dark coral bags, 1 pale cyan bag, 2 faded gray bags.
mirrored violet bags contain no other bags.
bright fuchsia bags contain no other bags.
striped chartreuse bags contain 4 pale lavender bags, 2 wavy gray bags, 2 pale violet bags.
dark tan bags contain 3 dotted white bags.
dim gray bags contain 5 dim beige bags.
plaid beige bags contain 4 wavy lavender bags, 4 clear lime bags, 3 posh magenta bags, 3 dotted crimson bags.
dim aqua bags contain 3 wavy cyan bags.
wavy teal bags contain 5 drab aqua bags, 5 vibrant beige bags, 1 plaid tomato bag.
dark red bags contain 1 drab fuchsia bag, 1 pale gold bag, 5 dark tomato bags, 5 shiny beige bags.
vibrant white bags contain 5 wavy aqua bags, 2 muted cyan bags.
muted turquoise bags contain 2 faded crimson bags.
dark maroon bags contain 4 vibrant orange bags.
dotted red bags contain 4 dark coral bags.
striped violet bags contain 4 drab teal bags, 1 pale gray bag.
light green bags contain 1 pale orange bag, 3 dim fuchsia bags.
striped purple bags contain 4 pale black bags.
clear tomato bags contain 4 dark white bags.
dim indigo bags contain 3 pale tan bags, 2 mirrored cyan bags, 5 dotted crimson bags, 4 wavy lavender bags.
posh silver bags contain 4 mirrored orange bags, 5 dotted lavender bags.
dim silver bags contain 5 faded purple bags, 5 striped olive bags, 5 striped tan bags.
light beige bags contain 2 bright plum bags, 2 dull salmon bags.
posh yellow bags contain 4 dotted crimson bags, 5 dark salmon bags, 4 pale yellow bags.
dark lime bags contain 3 posh crimson bags, 5 posh purple bags, 1 light black bag.
clear silver bags contain 3 faded olive bags, 3 drab turquoise bags, 4 drab purple bags.
vibrant cyan bags contain 5 vibrant plum bags.

626
AOC2020/input2020/day08.in Normal file
View File

@ -0,0 +1,626 @@
nop +346
acc +44
acc +15
jmp +473
acc +29
acc -13
jmp +525
acc +22
acc +13
nop +265
jmp +397
jmp +39
acc +39
nop -1
acc +36
acc +25
jmp +153
nop +374
jmp +27
jmp +282
jmp +1
jmp +1
jmp +15
acc +33
acc -3
jmp +533
acc +25
acc -14
acc -16
jmp +245
nop +567
acc +7
jmp +147
acc +26
acc +40
acc -9
jmp +295
acc +14
nop +388
acc -1
jmp -21
nop +524
nop +166
nop +515
jmp +18
jmp +214
acc +42
nop -35
acc +7
jmp +492
acc +14
acc +48
jmp +326
acc +48
acc -18
acc -5
jmp +343
jmp +81
acc +18
acc +16
acc +21
jmp +355
acc +48
nop +358
acc +49
acc -2
jmp +89
acc +4
jmp +171
acc +6
jmp +299
acc -8
jmp +150
acc +41
acc -9
acc +48
jmp +73
jmp +523
nop +471
jmp +493
acc -16
nop +440
acc +2
acc +33
jmp +117
acc +3
acc +34
jmp +310
acc +8
jmp +197
acc +26
acc +47
jmp +194
nop +115
jmp +259
nop +456
jmp +420
nop +398
jmp +235
acc +44
acc +47
jmp +218
jmp +1
jmp +275
acc +12
jmp +434
acc +50
acc +10
nop +361
jmp +367
acc -16
acc +44
jmp +96
acc +9
acc +38
acc -15
nop -31
jmp -55
nop +421
acc +50
acc +12
jmp -64
acc +33
acc +25
jmp +382
acc +7
jmp -22
jmp +95
acc +44
acc +32
acc +23
jmp +1
jmp +456
acc +49
jmp +15
jmp +312
acc +6
jmp +216
acc +7
jmp +458
jmp +465
nop +372
acc +35
acc +32
acc +13
jmp -35
acc +50
nop +32
jmp +143
jmp +327
acc +0
nop -82
nop -62
acc +41
jmp -81
acc -10
nop -106
jmp +82
acc +1
acc +11
jmp +124
acc +25
acc +17
jmp -73
nop +8
acc +29
acc +33
acc +10
jmp +123
jmp +236
acc +41
jmp +370
acc +17
acc -13
acc +35
jmp -47
nop +287
acc +22
jmp +38
jmp +1
nop -52
nop -9
acc +22
jmp +253
acc +12
acc -18
acc +21
nop -69
jmp +28
acc +16
jmp +392
jmp +325
jmp -74
acc +34
acc +47
acc +41
jmp +201
nop +361
acc +50
jmp +30
jmp -127
nop -171
jmp +349
acc +11
nop +156
acc +1
acc -18
jmp +393
acc -8
jmp +1
acc -17
nop +188
jmp +134
acc -9
acc -14
jmp +206
jmp -209
jmp +1
acc +49
nop +112
acc -4
jmp -20
acc +41
jmp -145
acc +8
jmp +276
acc +48
jmp -5
jmp -143
acc +0
jmp -161
jmp +238
acc +8
jmp -134
acc +34
acc +10
jmp +1
nop +109
jmp -100
acc +41
acc -4
jmp -12
acc +42
acc +46
acc -7
acc +28
jmp +85
jmp +216
jmp +364
acc +0
acc -6
nop +331
acc +33
jmp +163
acc +37
acc +20
acc +33
acc +45
jmp -159
acc +34
acc +10
acc +48
acc +10
jmp +358
acc -9
jmp +276
acc +27
acc +45
nop +129
acc +32
jmp +243
acc +0
acc -5
jmp -24
acc +44
nop +307
acc -18
acc +13
jmp +37
acc +5
nop -125
nop -126
acc -18
jmp +186
jmp -87
jmp -262
nop -20
jmp -108
acc +26
acc +20
jmp +193
nop +185
jmp +129
acc +26
jmp +122
acc -8
nop +143
nop +166
jmp -236
acc +33
jmp -139
acc +38
jmp +1
acc +21
acc +31
jmp -79
acc -13
jmp -78
acc +29
jmp +160
acc +48
acc -8
acc +28
acc +15
jmp -284
jmp +25
acc +24
jmp +1
jmp -92
acc +22
jmp +169
acc -15
acc +16
acc +4
jmp -85
acc -18
acc -19
acc -2
jmp -278
acc +48
jmp -195
jmp -40
jmp -110
acc +47
jmp -26
acc +26
nop -187
acc +40
acc +42
jmp +167
acc +50
acc +36
acc -14
jmp -313
nop -203
jmp +227
acc -15
acc +22
jmp -23
acc +6
acc +30
acc +12
jmp +69
nop -212
nop -105
acc +12
jmp -155
nop +69
acc -16
jmp -68
acc -18
acc +35
acc +34
acc +6
jmp -80
acc +7
acc +19
acc -8
jmp -94
acc +12
nop -148
acc +33
nop -41
jmp -107
acc +25
acc +9
nop +107
jmp -44
jmp +1
jmp -254
acc +10
acc +0
acc +37
acc +33
jmp +137
nop +136
jmp -225
acc -4
acc -17
acc +39
jmp -286
jmp +150
nop -380
acc +34
acc +16
nop +146
jmp +105
jmp +119
jmp -190
acc +0
nop +205
nop -302
jmp -17
acc -4
jmp -7
jmp -14
jmp -394
acc +34
acc -1
acc +37
acc -17
jmp -312
nop -180
nop -139
acc +21
jmp -378
acc +24
acc +38
jmp +129
acc +26
jmp +19
acc +31
jmp -190
acc +29
acc -5
jmp +14
nop +186
acc +12
acc +9
acc -16
jmp +9
acc +2
nop -382
nop -284
nop -377
jmp -169
jmp +129
acc +49
jmp -297
acc +48
acc +18
acc +8
jmp +170
acc +12
acc -4
acc +28
jmp -20
acc -11
jmp -363
jmp +1
acc +9
acc +31
jmp +31
acc +36
acc +42
acc +2
nop -131
jmp -322
acc +35
acc +44
acc +11
acc +14
jmp -213
acc -16
acc -15
acc -5
jmp -277
acc -17
jmp -252
acc -19
acc +31
acc -16
acc -5
jmp +48
jmp +1
jmp -97
acc +5
jmp -382
acc +26
acc +41
acc +31
acc -2
jmp -392
acc +41
jmp -124
acc +45
acc +24
acc +10
jmp -339
acc +29
acc -10
acc -10
acc +3
jmp -456
jmp -25
acc +37
acc +39
acc -11
acc -1
jmp +106
jmp -328
jmp -489
nop -111
nop -458
acc +31
jmp -100
acc -18
jmp -258
acc -17
nop -46
acc +43
acc +45
jmp -127
jmp +34
acc +33
jmp -200
nop -90
acc +20
jmp -271
acc +41
jmp -189
acc -16
nop -321
acc +25
acc -12
jmp -62
acc -1
jmp +1
acc +35
acc +39
jmp -184
jmp -236
nop -331
acc +12
jmp +78
acc +15
jmp -30
acc -11
jmp -117
jmp -8
jmp +9
acc +2
jmp -497
acc +10
acc +0
acc -6
jmp -155
jmp -148
jmp -95
jmp -96
jmp -249
nop -277
nop -411
acc -13
acc -2
jmp -383
acc -13
jmp -110
acc +13
acc +16
acc +5
acc -2
jmp -67
acc +37
jmp -491
acc +35
acc +34
acc +32
acc -2
jmp -546
acc -19
jmp -322
acc +48
acc +18
acc +35
acc +8
jmp -448
acc +41
acc -15
acc +34
acc +46
jmp -50
acc +12
nop -184
acc +14
acc +38
jmp -370
jmp +10
acc -14
acc -16
nop -259
nop -300
jmp -400
acc +38
acc +29
acc +27
jmp -175
jmp -456
acc +30
jmp -308
jmp -538
jmp +1
acc -16
nop -127
jmp -407
acc +5
jmp -57
acc +21
acc +3
acc +42
acc +43
jmp -521
acc -9
acc +20
nop -217
jmp -15
acc +37
acc -12
acc -18
jmp +1
jmp -465
acc +37
nop -577
acc +8
acc +43
jmp +1

Some files were not shown because too many files have changed in this diff Show More