diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..46df115 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.gradle/ +out/ diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 0000000..a55e7a1 --- /dev/null +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..b589d56 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 0000000..2947f0f --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,19 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml new file mode 100644 index 0000000..fdc392f --- /dev/null +++ b/.idea/jarRepositories.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml new file mode 100644 index 0000000..b1077fb --- /dev/null +++ b/.idea/kotlinc.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..87a20fc --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000..a778363 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,24 @@ +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + +plugins { + kotlin("jvm") version "1.7.10" +} + +group = "me.gergo" +version = "1.0-SNAPSHOT" + +repositories { + mavenCentral() +} + +dependencies { + testImplementation(kotlin("test")) +} + +tasks.test { + useJUnitPlatform() +} + +tasks.withType { + kotlinOptions.jvmTarget = "17" +} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..7fc6f1f --- /dev/null +++ b/gradle.properties @@ -0,0 +1 @@ +kotlin.code.style=official diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..249e583 Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..60c76b3 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists \ No newline at end of file diff --git a/gradlew b/gradlew new file mode 100755 index 0000000..1b6c787 --- /dev/null +++ b/gradlew @@ -0,0 +1,234 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit + +APP_NAME="Gradle" +APP_BASE_NAME=${0##*/} + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..107acd3 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,89 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 0000000..d66b8b5 --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,3 @@ + +rootProject.name = "aoc2022" + diff --git a/src/main/kotlin/me/gergo/Aoc01.kt b/src/main/kotlin/me/gergo/Aoc01.kt new file mode 100644 index 0000000..59df70e --- /dev/null +++ b/src/main/kotlin/me/gergo/Aoc01.kt @@ -0,0 +1,28 @@ +package me.gergo + +import java.io.File + +fun main() { + val lines = File("src/main/resources/input01.txt").readLines() + + val elves = mutableListOf() + var lastElf = Elf() + elves.add(lastElf) + for (line in lines) { + if (line.isBlank()) { + lastElf = Elf() + elves.add(lastElf) + } else { + lastElf.calories += line.toInt() + } + } + + println(elves + .sortedByDescending { it.calories } + .take(3) + .sumOf { it.calories }) +} + +class Elf { + var calories = 0; +} \ No newline at end of file diff --git a/src/main/kotlin/me/gergo/Aoc02.kt b/src/main/kotlin/me/gergo/Aoc02.kt new file mode 100644 index 0000000..76511c9 --- /dev/null +++ b/src/main/kotlin/me/gergo/Aoc02.kt @@ -0,0 +1,40 @@ +package me.gergo + +import me.gergo.Choice.* +import java.io.File + +fun main() { + val guide = File("src/main/resources/input02.txt").readLines().map(::parseGuide) + + val score = guide.map(Guide::score).sum() + println(score) +} + +enum class Choice { Rock, Paper, Scissors } +data class Guide(val opponent: Choice, val my: Choice) { + fun score(): Int = scoreFor(my) + scoreForOutcomeOf(opponent, my) + + private fun scoreFor(c: Choice): Int = c.ordinal + 1 + private fun scoreForOutcomeOf(o: Choice, m: Choice): Int { + return if (o.ordinal == m.ordinal) 3 + else if (m == Scissors && o == Rock) 0 + else if (m == Rock && o == Scissors) 6 + else if (m.ordinal < o.ordinal) 0 + else 6 + } +} + +fun parseGuide(line: String): Guide { + val tokens = line.split(" ") + val opponent = when (tokens[0]) { + "A" -> Rock + "B" -> Paper + else -> Scissors + } + val my = when (tokens[1]) { + "X" -> Rock + "Y" -> Paper + else -> Scissors + } + return Guide(opponent, my) +} \ No newline at end of file diff --git a/src/main/kotlin/me/gergo/Aoc02b.kt b/src/main/kotlin/me/gergo/Aoc02b.kt new file mode 100644 index 0000000..84e2b78 --- /dev/null +++ b/src/main/kotlin/me/gergo/Aoc02b.kt @@ -0,0 +1,47 @@ +package me.gergo + +import me.gergo.Choice.* +import me.gergo.Result.* +import java.io.File + +fun main() { + val guide = File("src/main/resources/input02.txt").readLines().map(::parseGuide2) + + val score = guide.map(Guide2::score).sum() + println(score) +} + +private val Choices = Choice.values() + +enum class Result { Lose, Draw, Win } +data class Guide2(val opponent: Choice, val result: Result) { + fun score(): Int = scoreFor(pickChoiceFor(opponent, result)) + scoreFor(result) + + private fun scoreFor(r: Result): Int = when (r) { + Lose -> 0 + Win -> 6 + else -> 3 + } + + private fun scoreFor(c: Choice): Int = c.ordinal + 1 + private fun pickChoiceFor(o: Choice, r: Result): Choice = when (r) { + Lose -> Choices[Math.floorMod(o.ordinal - 1, 3)] + Win -> Choices[Math.floorMod(o.ordinal + 1, 3)] + else -> o + } +} + +fun parseGuide2(line: String): Guide2 { + val tokens = line.split(" ") + val opponent = when (tokens[0]) { + "A" -> Rock + "B" -> Paper + else -> Scissors + } + val result = when (tokens[1]) { + "X" -> Lose + "Y" -> Draw + else -> Win + } + return Guide2(opponent, result) +} \ No newline at end of file diff --git a/src/main/kotlin/me/gergo/Aoc03.kt b/src/main/kotlin/me/gergo/Aoc03.kt new file mode 100644 index 0000000..a76a743 --- /dev/null +++ b/src/main/kotlin/me/gergo/Aoc03.kt @@ -0,0 +1,34 @@ +package me.gergo + +import java.io.File + +fun main() { + val guide = File("src/main/resources/input03.txt").readLines() + .map(::parseRucksack) + .chunked(3) // For Part Two + + // val results = guide.map(Rucksack::priorityOfSharedType).sum() // For Part One + val results = guide.map(::priorityOfSharedType).sum() // For Part Two + println(results) +} + +data class Rucksack(val c1: String, val c2: String) { + fun priorityOfSharedType() = priorityOf(sharedType()) // For Part One + + private fun sharedType(): Char = c1.toCharArray().intersect(c2.toCharArray().toSet()).first() +} + +fun parseRucksack(line: String): Rucksack { + return Rucksack(line.substring(0, line.length / 2), line.substring(line.length / 2)) +} + +fun priorityOfSharedType(group: Iterable): Int { + val sharedType = group.map { (it.c1 + it.c2).toCharArray().toSet() }.reduce { acc, r -> acc.intersect(r) }.first() + return priorityOf(sharedType) +} + +fun priorityOf(type: Char): Int { + val d = type.code + return if (d >= 'a'.code && d <= 'z'.code) d - 'a'.code + 1 + else d - 'A'.code + 27 +} diff --git a/src/main/kotlin/me/gergo/Aoc04.kt b/src/main/kotlin/me/gergo/Aoc04.kt new file mode 100644 index 0000000..d74bad3 --- /dev/null +++ b/src/main/kotlin/me/gergo/Aoc04.kt @@ -0,0 +1,25 @@ +package me.gergo + +import java.io.File + +fun main() { + val assignments = File("src/main/resources/input04.txt").readLines() + .map(::parseAssignment) + + // val results = assignments.count(Assignment::fullyContains) // Part One + val results = assignments.count(Assignment::overlaps) // Part Two + println(results) +} + +data class Assignment(val first: IntRange, val second: IntRange) { + fun fullyContains() = first.minus(second).isEmpty() || second.minus(first).isEmpty() + fun overlaps() = first.minus(second).size < first.count() || second.minus(first).size < second.count() +} + +fun parseAssignment(line: String): Assignment { + val ranges = line.split(",").map { + val range = it.split("-").map(String::toInt) + range[0]..range[1] + } + return Assignment(ranges[0], ranges[1]) +} diff --git a/src/main/kotlin/me/gergo/Aoc05.kt b/src/main/kotlin/me/gergo/Aoc05.kt new file mode 100644 index 0000000..de7d9ae --- /dev/null +++ b/src/main/kotlin/me/gergo/Aoc05.kt @@ -0,0 +1,47 @@ +package me.gergo + +import java.io.File +import java.util.* + +fun main() { + val (stacks, instructions) = parseStacksAndInstructions(File("src/main/resources/input05.txt").readLines()) + + println(stacks) + for (instruction in instructions) { + // Part One and Two - moving in bulk, the only difference is drop ordering + val crates = (1..instruction.quantity).map { stacks[instruction.fromStack - 1].pop()!! } + stacks[instruction.toStack - 1].addAll(crates.reversed()) // Uncomment .reversed() for Part One + } + + stacks.forEach { print(it.peek()) } +} + +typealias CrateStack = Stack + +data class Instruction(val quantity: Int, val fromStack: Int, val toStack: Int) {} + +fun parseStacksAndInstructions(lines: List): Pair, List> { + val stacks = parseStacks(lines.subList(0, lines.indexOf("") - 1)) + val instructions = lines.subList(lines.indexOf("") + 1, lines.size).map(::parseInstruction) + return Pair(stacks, instructions) +} + +fun parseStacks(lines: List): List { + val stackCount = (lines[0].length + 1) / 4 + val result = List(stackCount) { Stack() } + for (i in lines.size - 1 downTo 0) { + val line = lines[i] + for (s in result.indices) { + val crate = line[s * 4 + 1] + if (crate != ' ') { + result[s].add(crate) + } + } + } + return result +} + +fun parseInstruction(line: String): Instruction { + val m = Regex("move (\\d+) from (\\d+) to (\\d+)").matchEntire(line)!! + return Instruction(m.groupValues[1].toInt(), m.groupValues[2].toInt(), m.groupValues[3].toInt()) +} diff --git a/src/main/kotlin/me/gergo/Aoc06.kt b/src/main/kotlin/me/gergo/Aoc06.kt new file mode 100644 index 0000000..7472230 --- /dev/null +++ b/src/main/kotlin/me/gergo/Aoc06.kt @@ -0,0 +1,11 @@ +package me.gergo + +import java.io.File + +fun main() { + val chars = File("src/main/resources/input06.txt").readLines()[0] + + val windowSize = 14 // Make it 4 for Part One + val result = chars.windowed(windowSize).indexOfFirst { it.toSet().size == windowSize } + windowSize + println(result) +} diff --git a/src/main/kotlin/me/gergo/Aoc07.kt b/src/main/kotlin/me/gergo/Aoc07.kt new file mode 100644 index 0000000..ec09ac2 --- /dev/null +++ b/src/main/kotlin/me/gergo/Aoc07.kt @@ -0,0 +1,82 @@ +package me.gergo + +import java.io.File + +fun main() { + val commandLines = File("src/main/resources/input07.txt").readLines() + .map(::parseCommandLine) + + val root = FileNode("/", 0, null, mutableListOf()) + var currentDir = root + for (commandLine in commandLines) { + when (commandLine) { + is Ls -> continue + is Cd -> { + currentDir = if (commandLine.dirName == "..") currentDir.parent!! + else if (commandLine.dirName == "/") root + else currentDir.children.find { it.name == commandLine.dirName }!! + } + + is DirectoryOutput -> currentDir.children.add(FileNode(commandLine.name, 0, currentDir, mutableListOf())) + is FileOutput -> currentDir.children.add(FileNode(commandLine.name, commandLine.size, currentDir, mutableListOf())) + } + } + + // Part One + val result = root.walk() + .filter(FileNode::isDirectory) + .filter { it.totalSize() <= 100000 } + .sumOf(FileNode::totalSize) + println("Sum sizes of dirs < 100000: $result") + + // Part Two + val free = 70000000 - root.totalSize() + val target = 30000000 - free + println("Target to free up: $target") + val toDelete = root.walk() + .filter(FileNode::isDirectory) + .filter { it.totalSize() >= target } + .minBy { it.totalSize() } + println("To delete: $toDelete, totalSize=${toDelete.totalSize()}") +} + +fun parseCommandLine(line: String): CommandLine { + return if (line == "$ ls") Ls + else if (line.startsWith("$ cd")) Cd(line.substring(5)) + else if (line.startsWith("dir ")) DirectoryOutput(line.substring(4)) + else { + val tokens = line.split(" ") + FileOutput(tokens[1], tokens[0].toInt()) + } +} + +sealed interface CommandLine +object Ls : CommandLine {} +data class Cd(val dirName: String) : CommandLine {} +data class DirectoryOutput(val name: String) : CommandLine {} +data class FileOutput(val name: String, val size: Int) : CommandLine {} + +data class FileNode(val name: String, val size: Int, var parent: FileNode?, val children: MutableList) { + + fun isDirectory() = children.size > 0 + + fun walk(): Sequence { + return if (isDirectory()) sequenceOf(this) + children.flatMap(FileNode::walk) + else sequenceOf(this) + } + + fun aggregate(transform: (FileNode) -> R, sum: (R, R) -> R): R { + if (isDirectory()) { + return (sequenceOf(transform(this)) + children.map { it.aggregate(transform, sum) }).reduce(sum) + } else { + return transform(this) + } + } + + fun totalSize() = aggregate(FileNode::size, Int::plus) + + override fun toString(): String { + return if (isDirectory()) "$name (dir)" + else "$name (file, size=$size)" + } +} diff --git a/src/main/kotlin/me/gergo/Aoc08.kt b/src/main/kotlin/me/gergo/Aoc08.kt new file mode 100644 index 0000000..6886873 --- /dev/null +++ b/src/main/kotlin/me/gergo/Aoc08.kt @@ -0,0 +1,77 @@ +package me.gergo + +import java.io.File +import java.lang.Integer.min + +fun main() { + val trees = Trees(File("src/main/resources/input08.txt").readLines()) + +// println(trees) + println("Visible trees: ${trees.visibleTrees()}") // Part One + println("Max scenic score: ${trees.maxScenicScore()}") // Part Two +} + +class Trees(lines: List) { + private val forest: Array + private val width: Int + private val height: Int + + init { + forest = lines.map { it.toCharArray().map(Char::digitToInt).toIntArray() }.toTypedArray() + width = forest[0].size + height = forest.size + } + + fun visibleTrees(): Int { + return forest.mapIndexed { r, row -> + row.filterIndexed { c, _ -> + isVisible(r, c) + }.count() + }.sum() + } + + fun maxScenicScore(): Int { + return forest.flatMapIndexed() { r, row -> + row.mapIndexed { c, _ -> + scenicScore(r, c) + } + }.max() + } + + private fun scenicScore(r: Int, c: Int): Int { + val tree = forest[r][c] + val leftVD = viewDistance(row(r, 0, c).reversed(), tree) + val rightVD = viewDistance(row(r, c + 1, width).asIterable(), tree) + val upVD = viewDistance(col(c, 0, r).reversed(), tree) + val downVD = viewDistance(col(c, r + 1, height).asIterable(), tree) + return upVD * leftVD * rightVD * downVD + } + + private fun viewDistance(trees: Iterable, fromTree: Int): Int { + var count = 0 + for (tree in trees) { + count++ + if (tree >= fromTree) break + } + return count + } + + private fun isVisible(r: Int, c: Int): Boolean { + // Trees in the before/after the specified tree have a maximum height less than the tree's + val tree = forest[r][c] + return maxInRow(r, 0, c) < tree + || maxInRow(r, c + 1, width) < tree + || maxInCol(c, 0, r) < tree + || maxInCol(c, r + 1, height) < tree + } + + override fun toString(): String { + return forest.joinToString("\n") { it.joinToString(transform = Int::toString) } + } + + private fun maxInRow(r: Int, fromColumn: Int, toColumn: Int) = row(r, fromColumn, toColumn).maxOrNull() ?: -1 + + private fun maxInCol(c: Int, fromRow: Int, toRow: Int) = col(c, fromRow, toRow).maxOrNull() ?: -1 + private fun row(r: Int, fromColumn: Int, toColumn: Int) = forest[r].sliceArray(fromColumn until min(toColumn, width)) + private fun col(c: Int, fromRow: Int, toRow: Int) = (fromRow until min(toRow, height)).map(forest::get).map { it[c] }.toIntArray() +} \ No newline at end of file diff --git a/src/main/resources/input01.txt b/src/main/resources/input01.txt new file mode 100644 index 0000000..51d7adf --- /dev/null +++ b/src/main/resources/input01.txt @@ -0,0 +1,2255 @@ +5104 +6131 +3553 +4496 +5847 +3253 +1828 +1045 +6369 +5544 +2756 +7382 + +6879 +9715 +10122 + +14438 +1135 +13406 +4888 + +67712 + +1965 +4515 +4150 +3583 +3007 +4852 +6397 +6237 +5505 +3106 +6357 +2504 +4074 + +1689 +5612 +5531 +3138 +1203 +4821 +3468 +2424 +3425 +5566 +4374 +5233 +5452 +3049 +2260 + +3933 +6073 +2260 +2376 +7298 +3397 +3479 +5316 +6750 +4800 + +14581 +6385 +18287 +14353 + +44790 + +66296 + +3368 +1373 +9644 +1682 +11146 +6876 + +2544 +5471 +3632 +1837 +2272 +2956 +4989 +1754 +4574 +5076 +3201 +2199 +5688 +1161 +3326 + +4897 +3510 +4961 +2747 +3931 +2722 +4021 +2231 +5466 +6371 +4691 +2851 +1846 +4720 + +13096 +5576 +5765 +3715 +8851 + +3339 +6453 +4991 +3935 +5900 +2326 +4731 +3323 +6270 +7505 + +2208 +3058 +6908 +6343 +6513 +5383 +6087 +5836 +4824 +5588 +5039 +6138 +1077 + +9045 +6898 +8327 +4103 +4006 +6797 +8591 +6515 +5228 + +39541 + +33536 +7614 + +4637 +7862 +3038 +6682 +8880 +2784 +7924 +5589 +2107 + +33278 +18120 + +1005 +3479 +4129 +2799 +5324 +7799 +5380 +6998 +1877 + +31663 +9259 + +1009 +3987 +1254 +6449 +5134 +6090 +6341 +3229 +5902 +4492 +4025 + +10079 +16006 +19943 +1970 + +3428 +5671 +1030 +2461 +6073 +2875 +3493 +3103 +1476 +4305 +2664 +5017 +4210 +3629 + +45170 + +11282 +8209 +10075 +1366 +13841 +3412 + +9981 +7808 +1565 +3171 +6684 +1905 +1087 + +14447 +11220 +3519 +10317 +14174 + +7518 +3810 +12824 +3137 +2272 +2616 + +7827 +29197 + +8799 +12459 +16530 +16661 + +1965 +10267 +11399 +11562 +13367 +10223 + +6410 +2536 +7255 +2151 +3190 +5786 +4114 +6875 +4013 +2381 +6020 + +1751 +6262 +5190 +5091 +6453 +3652 +2929 +3411 +4954 +1275 +1468 +2689 +1200 +4362 + +4928 +5282 +6845 +5328 +2101 +6522 +3929 +3276 +4740 +4493 +4003 +6797 + +6529 +11489 +1696 +12922 +8959 +10927 + +13381 +5921 +5375 +10424 +9279 +10031 + +3800 +2166 +1964 +4182 +3395 +5956 +6024 +2473 +2780 +3686 +5791 +1449 +2698 +4430 +1008 + +37175 +26191 + +2863 +1329 +6266 +5911 +6331 +5211 +2420 +6006 +2259 +4125 +1885 +2284 +6213 + +3560 +4007 +5585 +4484 +1828 +7935 +5895 +3139 +6413 + +1201 +3350 +3763 +1920 +4653 +1662 +2559 +1918 +6378 +6688 +2569 +3180 + +4347 +1526 +7318 +3860 +4250 +6191 +10198 + +8179 +5824 +4470 +7569 +3163 +1859 +2541 +3433 +1851 +7360 + +1028 +3103 +3166 +2025 +5630 +5067 +1819 +1590 +2290 +3636 +2411 +2856 +1918 +3050 + +3582 +4564 +3311 +4695 +4780 +5863 +3626 +5304 +4009 +1499 +1528 +2261 +2743 +3992 + +6432 +4354 +1747 +3799 +7415 +6951 +4928 +7862 +6082 +1010 +3586 + +11375 +14308 +7595 +18952 + +23213 +18972 + +15795 +17712 +5850 + +4756 +3643 +3397 +6067 +5206 +1658 +2436 +4293 +2352 +5096 +2038 +3780 +2620 +3124 +2525 + +8776 +3372 +2945 +7681 +7636 +1851 +2755 +2058 +7856 + +9353 +5890 +3167 +2211 +6056 +4894 +10709 +2793 + +3477 +7013 +4750 +7568 +7135 +4165 +7490 +5932 +1434 +6230 +7262 + +2988 +3138 +6692 +5152 +6590 +7063 +5578 +3263 +2918 +4021 +6292 +3340 + +8043 +7625 +3391 +6085 +6245 +4824 +5767 +6627 +2367 +2729 + +1520 +6438 +2132 +1601 +4488 +5254 +2935 +2368 +1569 +3680 +5772 +6031 +6288 +5836 + +5254 +4257 +6075 +5658 +6032 +6121 +5074 +4844 +3709 +4521 +5464 +1705 +6448 +6340 + +14988 +3400 +15846 +12040 +6216 + +45130 + +4014 +2376 +2115 +3132 +5487 +6934 +5925 +2810 +4421 +6486 +2346 +5692 + +12105 +2383 +9893 +5469 +7597 +5977 +7022 + +2795 +6488 +20406 + +12538 +3692 +3757 +12964 +15776 + +1139 +2432 +1346 +1249 +1454 +5679 +2131 +1057 +6395 +2604 +6336 +1444 +6703 + +1499 +6392 +4154 +1207 +3827 +4646 +4283 +2106 +2958 +1327 +3760 +2575 +3961 + +11023 +7199 +6134 +12194 +10621 + +6715 +5245 +4073 +5978 +3950 +5613 +3517 +3845 +5611 +2993 +4704 +4468 +4833 + +25207 +18060 +8124 + +3263 +2985 +6577 +3964 +1392 +2316 +5224 +3923 +1392 +5569 +4833 +5873 +1627 + +1347 +5148 +4046 +3618 +3677 +6767 +3809 +1979 +8779 +2274 + +15152 +5482 +5835 +4176 + +1191 +5296 +1107 +7245 +4121 +2598 +4148 +2388 +5949 +1851 +3747 +3829 + +1942 +6426 +4916 +4572 +2965 +3453 +7020 +8067 +1144 +5931 +2985 + +3315 +1989 +1609 +2161 +5836 +3243 +3901 +2795 +4187 +2790 +2083 +3164 +4843 +5887 + +16209 +2858 +2586 +15877 +13993 + +8898 +4191 +1864 +9272 +9284 +5581 +4912 +1084 +6000 + +3410 +5934 +1609 +4699 +5008 +3104 +6016 +3130 +7286 +1906 + +7381 +4765 +2427 +2044 +6493 +2845 +1431 +5109 +7242 +3930 +1350 +4999 + +10119 +12971 +5407 +6448 +14453 + +5647 +5083 +3317 +6707 +1586 +2179 +1468 +1214 +5992 +5732 +5813 + +1260 +3272 +11607 +3794 +4599 +2890 + +16930 +16192 + +3140 +6499 +4094 +5617 +4379 +6309 +4400 +4764 +1143 +2004 +4451 +3034 +4209 + +2653 +5514 +3335 +8021 +7656 +7956 +9425 +5902 +7280 + +23692 + +1097 +8621 +2372 +4381 +10625 +6138 +7127 + +1719 +5845 +3170 +4103 +5550 +3430 +2824 + +2489 +13880 +7484 +4617 + +11152 +2300 +2349 +9548 +7018 + +5745 +2571 +5758 +1580 +1411 +3944 +4867 +2541 +1998 +3769 +5598 +5138 +4369 +5419 + +10223 +10283 +2268 + +5604 +4701 +2054 +3920 +4925 +5118 +3707 +1838 +2159 +4192 +5164 +4419 +5630 +3127 +5255 + +3686 +1791 +3543 +6111 +4260 +3612 +4021 +3316 +3100 +5383 +1962 +3323 +5630 + +2391 +6494 +3948 +3811 +2101 +4075 +3030 +4553 +1170 +1604 +6209 +1122 +3951 +3447 + +4687 +1165 +2511 +2316 +4002 +3832 +4968 +1082 +5374 +1960 +2355 +1975 +4569 +2324 + +4285 +3885 +2613 +1102 +4284 +3439 +5074 +1279 +6287 + +3501 +10232 +9878 +10401 +5166 +9221 +2356 +7718 + +17368 +8643 +12092 +3319 + +7510 +4438 +8329 +4973 +6213 +6441 +1801 +7936 +7802 + +6491 +4569 +4130 +3144 +2275 +1831 +2833 +6234 +5260 +5476 +5066 +4356 +1835 + +3842 +19003 +9012 +7301 + +1596 +8020 + +5794 +6031 +4868 +5488 +3633 +5019 +1113 +4435 +1258 +2866 +6007 +4006 +4164 +4748 +1899 + +5388 +7788 +1063 +3566 +3185 +3839 +6396 +6052 +4822 +1345 +4405 + +5048 +8412 +11211 +10874 +11580 +9113 + +2921 +9381 +5501 +5959 +3511 +6107 + +3827 +2400 +1465 +4592 +1070 +5953 +1252 +5820 +4496 +6461 +4105 +5273 + +7867 + +7212 +2869 +4893 +5449 +1790 +4027 +4863 +6804 +4589 +4431 +2978 +5646 + +6820 +1830 +5561 +11648 +2836 + +3711 +7705 +8802 +1093 +10308 +1310 +4998 +9163 + +6599 +6302 +1817 +5460 +1686 +1639 +6831 +2245 +2026 +1250 +1521 +6664 +4326 + +8495 +15655 +1144 +6597 +13967 + +5998 +4313 +5903 +3692 +8234 +2692 +10457 +3100 + +1861 + +14744 +4779 +12847 +5418 + +1755 +11466 +4824 +3036 +2407 +3799 + +3703 +5199 +4767 +3220 +4703 +1618 +2408 +6934 +6244 + +10247 +6489 +6234 +2992 +8650 +2238 + +4281 +13678 +15074 +6788 +6291 + +8999 +10740 +12070 +5488 +1840 +6026 +8971 + +1663 +9127 +3582 +5593 +1469 +7933 +3315 +8614 +8179 + +31510 +20867 + +3135 +4978 +2113 +3443 +2488 +2805 +5385 +2765 +2443 +5948 +4798 +2685 +3580 +5153 +3035 + +7786 +5488 +6868 +6016 +8457 +3381 +1057 +3370 + +5493 +5175 +4669 +3522 +6305 +2560 +5075 +4445 +3881 +6694 +4367 +6287 +3496 + +10356 +13146 +10433 +7922 +5423 +6508 + +17729 +30047 + +1564 +8859 +7596 +10579 +7432 +7320 +4046 + +4402 +4813 +7497 +8596 +8944 + +9946 +3497 +4322 +1990 +6240 +9993 +8309 + +24706 +3277 +22881 + +6766 +1997 +3845 +6791 +5254 +2251 +5959 +5030 +7267 +6440 +3457 +4772 + +8589 +5044 +9480 +10563 +8685 +7787 +9630 +9199 + +9423 +2006 +5708 +4116 +14214 + +18376 +3635 +11243 + +6763 +4005 +1430 +3727 +1574 +4517 +1253 +5880 +4091 +1499 +6714 +6510 +6452 + +5479 +4798 +6197 +3737 +6874 +2965 +5032 +4024 +5051 +8053 + +34588 +18765 + +6659 +7468 +3910 +7243 +5199 +6073 +4412 +7824 +3338 +3599 +7017 + +3490 +2272 +2824 +5088 +6335 +1716 +2386 +3356 +2055 +2013 +2983 +5382 +1507 +4581 + +19218 +16697 +9274 + +22122 +13616 +2703 + +1794 +4376 +2241 +2705 +2104 +1658 +3543 +2607 +3770 +4622 +3370 +2443 +4444 +5476 +3714 + +53258 + +11510 +15672 +12872 +8622 + +5586 +15502 +3056 +3890 +14551 + +1608 +4148 +3884 +4981 +8494 +6494 +6595 +6983 +2298 +1599 + +22767 +5219 +2814 + +1034 +1031 +4757 +7276 +7064 +5309 +7766 +8161 + +9332 + +21322 +13644 +17204 + +52338 + +4741 +11019 +9823 +11376 +12363 +7345 + +13565 +12029 +6517 +4188 +11311 +3153 + +3172 +2579 +2147 +6643 +6720 +1518 +3920 +3744 +4907 +3887 +5811 +2260 +3640 + +2065 +4288 +2840 +3551 +2354 +3243 +5448 +2120 +2476 +3959 +2807 +5822 +1824 +6027 + +13354 +13217 +9371 +10773 +12933 + +4706 +3934 +8085 +3861 +3474 +4037 +4333 +1915 +7439 +4724 +1584 + +5587 +3880 +5972 +1568 +2925 +6189 +5112 +1034 +5146 +4456 +3302 +5930 +6509 +2232 + +10574 +13136 +19197 +12598 + +3319 +5343 +6042 +15163 +7853 + +2549 +9485 +3150 +3717 +4202 +8582 +9314 +1959 + +1651 +3584 +2353 +4100 +4642 +4105 +2675 +3241 +1441 +1093 +1012 +4275 +3727 +4598 +2407 + +9617 +2108 +4265 +5498 +2914 +7770 +5898 +9319 +2295 + +8587 + +2644 +3717 +4921 +2297 +4454 +5287 +2479 +4581 +1824 +3108 +4297 +1055 +4726 +1859 + +2170 +16319 +2974 + +3092 +4627 +5913 +4495 +3009 +4501 +4341 +4668 +4858 +3240 +1347 +3448 +3748 +5811 + +4644 +4571 +2358 +5466 +2255 +5075 +5466 +4229 +2211 +4262 +2900 +1966 +2627 +4728 + +7682 +9016 +4473 +8449 +9257 +2068 +10641 + +1499 +6224 +7304 +5201 +3451 +4984 +7737 +1728 +5302 +1062 +2178 + +30845 +12424 + +3483 +1244 +1700 +8543 +12788 + +2430 +9187 +9178 +3168 +10377 +8889 + +15000 +12965 +10098 +5507 +13346 + +5401 +2056 +7490 +9384 +3312 +7124 +7199 +5571 +6029 + +1218 +10456 +6922 +1815 +12092 +11303 +2461 + +1766 +5195 +4704 +1476 +4579 +1104 +3018 +6172 +3826 +6543 +1323 +6306 +6367 + +17963 +2012 +1664 +15479 + +32869 + +9473 +3761 +6631 +2522 +2878 +2435 +9087 +3261 +6032 + +4461 +1087 +4793 +1273 +1848 +2882 +1662 +4454 +1347 +5600 +2619 + +2300 +8563 +3317 +2462 +1118 +6131 +5801 +4281 +7292 + +3848 +13902 +7899 +10164 +12727 +8578 + +1076 +6192 +3308 +2648 +1919 +6489 +6050 +1639 +6490 +2768 +1169 +4718 +5799 +2658 + +12611 +18417 +13289 +16060 + +1806 +6019 +1058 +13468 +8292 +9682 + +13648 +24310 +6025 + +10030 +7199 +5366 +6080 +8944 +3416 +3746 +3597 + +8809 +10699 +5362 +8302 +3712 +2911 +2598 +5279 + +23190 +15323 +2535 + +2663 +10325 +9513 +2403 +6443 +6731 +8188 +9559 + +15302 + +4544 +6035 +4595 +5512 +7162 +1160 +2866 +5003 +6449 +3936 +2083 +1154 + +16473 + +4333 +2861 +2754 +5775 +5774 +3313 +1763 +3326 +3888 +2639 +3981 +1788 +6272 +2151 + +3830 +11759 +9430 +7412 +5190 +5926 +9828 + +19524 +15948 +5297 +16516 + +8073 +9705 +7872 +5308 +10279 +3645 +7983 +3467 + +12230 +22031 +6843 + +15329 +6540 + +4960 +5485 +1829 +5062 +4777 +4193 +4594 +5705 +1282 +4546 +6063 +4304 +2533 + +51798 + +11965 +12511 +2156 +13850 +10025 +12395 + +3476 +1232 +7227 +2031 +4457 +5152 +3616 +5374 +4576 +2413 + +1045 +24929 + +13068 +14356 +9552 +3897 +4369 + +3172 +3437 +2380 +5542 +4850 +4325 +1065 +1051 +3385 +5905 +1182 +6138 +6487 +2307 + +11847 +9674 +1409 +16351 +3793 + +1567 +6941 +2520 +6617 +4815 +4700 +2297 +2336 +3626 +8035 +1777 + +7380 +6231 +1464 +5680 +4298 +8018 +5861 +5967 +2799 +6888 +1401 + +1944 +3424 +4104 +5697 +2082 +1829 +4128 +3775 +3450 +5312 +3475 +4868 +4857 +1469 +4757 + +22339 +15143 + +4573 +5384 +2968 +6696 +2208 +3068 +3104 +2654 +5539 +7329 +6127 +3874 + +6693 +6878 +3318 +5526 +2042 +4895 +3809 +3718 +5881 +2444 +2448 + +6304 +5014 +1337 +5766 +9098 +4456 +6604 +1722 +4674 + +2403 +5059 +2439 +2113 +3879 +2289 +6524 +3707 +5199 +2908 +4624 +3742 +6077 + +2717 +3042 +1843 +2403 +5750 +2473 +3017 +3407 +4392 +2513 +6913 +6585 + +1996 +1118 +5230 +6283 +2639 +3324 +1236 +3483 +5270 +3399 +3111 +6098 + +6418 +3395 +3771 +5816 +2494 +1049 +5846 +4483 +3137 +4445 +2248 +1216 +2499 +3556 + +20769 +22782 +15068 + +2645 +3388 +2219 +6061 +6664 +4330 +5003 +4035 +6370 +2023 +6309 +5013 + +1222 +6095 +7410 +7957 +4087 +5677 +6829 +7151 +8731 +8168 + +11570 +27420 + +14541 +3035 +10295 +14965 + +4122 +5939 +8715 +1188 +4674 +4654 +7742 +4976 + +5269 +3341 +7796 +8918 + +9598 +2036 +10718 +9696 +8890 +2709 +4114 +1940 + +5054 +3311 +2306 +2633 +1810 +4733 +2133 +2185 +2322 +2396 +2992 +2202 +2671 +1932 +3398 + +4357 +1706 +3417 +2442 +5608 +5032 +6296 +5015 +1874 +5295 +3812 +4698 + +18153 +16982 +6152 + +16245 + +3048 +3827 +3394 +2137 +2364 +5478 +5992 +2396 +6139 +2323 +4458 +2292 +4003 + +1561 +1154 +1545 +1144 +2206 +4454 +5640 +4697 +1908 +3175 +5130 +2386 +6358 +4169 + +5785 +6697 +5246 +3215 +9759 +10601 +5507 + +4892 +7629 +4323 +3881 +4247 +2154 +1352 +3468 +3053 + +6710 +2117 +4776 +3991 +4021 +7543 +4268 +3355 +4701 +4663 +1015 + +13221 +14163 +11213 + +9488 +7173 +3708 +3524 +9290 +3390 +1272 +3325 +4864 + +3098 +6656 +1387 +4710 +1962 +7262 +7442 +2097 +4544 +1976 +6250 +1974 + +5122 +1843 +2929 +4066 +2403 +1020 +2723 +5914 +3821 +2189 +1047 +3334 +5773 +4396 +2777 + +2073 +2094 +4901 +1093 +5029 +5458 +5963 +4011 +3454 +3174 +2086 +1451 +5640 +2311 +2511 + +4243 +7521 +5018 +1914 +6762 +8155 + +19726 +11376 +6504 +4086 + +4150 +7015 +3007 +5002 +5151 +8346 +8024 +6498 +1696 + +5404 +5249 +1474 +2284 +1642 +3323 +4110 +1796 +5132 +1940 +1266 +2679 +4027 +2289 + +10301 +7013 +1666 +7987 +10426 +6423 +10008 +10015 + +6115 +6361 +1902 +8036 +5703 +2771 +7330 +8606 +6447 + +8917 +1183 +8966 +1255 +5988 +5233 +7358 +3806 +9333 diff --git a/src/main/resources/input02.txt b/src/main/resources/input02.txt new file mode 100644 index 0000000..81ef8e3 --- /dev/null +++ b/src/main/resources/input02.txt @@ -0,0 +1,2500 @@ +A X +A X +B Y +B Y +A Y +A X +A Y +A X +A X +B Y +A X +A X +A X +A X +C X +C Z +A X +B Y +A X +A X +C X +C Y +A X +A Z +B Y +A X +C X +A X +B Y +A X +A X +A X +A Z +C X +C X +C X +B Y +B X +B Z +B Y +C X +A Y +A X +A X +B X +A X +A X +B Y +C X +B Y +A X +A X +A X +C X +B Y +C X +B Y +A X +C X +B Y +B X +B Y +C Z +A X +A Y +C Z +C X +A X +C X +A X +A X +C Z +B Y +C X +B X +B X +C X +A X +A X +A X +C Z +C X +B Y +A X +C X +B Z +A X +C Z +C Z +A X +A X +A X +A Y +A X +A X +B Y +A X +C Z +C Z +A X +A X +C X +A Y +A Y +A X +A X +A X +B Z +A X +A Z +A X +A X +A X +C Z +C Z +A X +B Y +C Z +A X +A X +A X +A X +A Y +B Y +A Z +A X +A X +A X +A Z +A X +C Z +C Z +C X +C Z +A X +B Y +C Y +A X +B Y +A X +A X +A X +A X +A X +C X +A X +A X +B X +A X +B Y +A X +B Y +A X +B Y +B Y +C X +A X +A X +A X +A Z +C X +A Y +C X +C X +B Y +A X +A X +C Z +A X +C X +B Y +A Y +A X +A X +B Y +A X +A X +C X +A Z +A X +A X +A X +B Y +B Y +B Z +A Z +A X +B Y +B Y +A X +A X +A X +B Z +C Z +A X +A Y +A X +A X +A X +A X +C X +A Y +A X +B Z +C Z +C Z +A X +C X +B Y +A X +A X +B Y +A X +B Y +B Y +A X +A X +A X +A X +A X +B Y +B Y +A X +B X +C X +A X +B Y +A X +A X +A X +B Y +B Y +A Z +C Z +B X +C X +A X +A X +B Y +A Y +A X +A X +A X +A Z +B Y +A X +A Y +A X +A X +A X +A Z +A X +B Y +A X +A X +C X +B Y +B Y +B Y +A X +A Y +B Y +B Y +A X +B Y +A Y +A Y +A X +A X +B Y +A X +A X +A X +A Y +B Y +A Z +A X +C Z +A X +A Y +A Z +A X +A Z +A X +A X +A X +A Z +C X +A X +A X +C Z +A X +A X +C X +C Z +B Y +B Y +C Z +C X +A X +C Z +A Z +B Y +B Y +C Z +C X +A X +C Z +A X +A X +A Y +A X +B Y +B Y +C Y +A X +C X +A X +C X +A X +A Y +A X +C X +C Z +C X +B Y +A X +A X +A Z +C Z +A X +B Y +A X +B X +C Z +C Z +B Z +B Y +A X +A X +A X +A X +C Z +C Z +A X +A X +A X +C X +A X +A X +A X +B Y +A Y +A X +C X +C Z +A X +C Z +B Y +A X +A X +A Y +A X +B Y +C X +A X +A Y +A Y +B X +A Y +C Z +B Y +A X +C Z +C X +B Y +B Y +B Y +A X +A X +A X +A X +A X +A X +A X +A Y +A X +B Z +A X +A X +A X +C Z +A X +A X +A X +A X +A X +A X +B Y +C X +B Y +A X +A X +A X +A X +C Z +A X +A X +C X +A X +A X +B Y +A X +B X +A X +A X +A X +A Y +B X +B Y +B Y +A X +C X +A X +A Y +B Z +A Y +A Z +B Y +B Y +A X +A Y +A X +B Y +A X +B Z +A X +A X +A X +A X +A X +B Y +B Y +A X +A X +B Y +A Y +A X +B Z +A X +A X +A X +A X +B Z +B Y +A X +C X +A X +A X +A X +B Y +C Z +C Z +B Y +B Y +A X +B Y +A Y +C X +A X +A X +A X +A Y +C Z +A X +A Z +B Y +B Y +B Y +A X +B Z +C Z +A X +A Y +C Z +A X +B Y +A X +B Y +A Z +A X +A X +A X +A Y +A X +A X +B Y +A X +C X +C Z +A X +A X +C Z +A X +C X +A X +A X +A X +C Z +A X +A X +B Y +A X +C X +B Y +A X +B Y +A X +A X +A X +A X +C Z +B Y +A X +A X +A X +A X +A X +A X +C X +A X +A X +B Y +A X +B Y +A X +A X +C X +A X +A X +A X +A X +C Z +B Y +C Z +C X +A Y +A X +A X +A X +C X +A Y +A X +A X +A X +A X +A X +C Z +A X +A X +A X +B Y +A Z +A X +A X +C Z +B X +A Z +A X +B Y +B Y +B Y +B Y +B Y +A X +B Y +A X +A X +A Z +B X +B Y +A X +C Y +A X +A X +A X +A X +B Y +C X +A Y +A X +A X +B Z +A X +B Y +A Z +A Y +A X +A X +C X +A Y +C X +A X +A Y +A X +B Y +C X +A X +C Z +A X +A X +A X +A X +A X +B X +C Y +B Y +A X +C X +C X +A X +C X +C Z +A X +A X +A X +B Y +C X +B Y +B Y +A X +A X +C X +A X +C Z +A X +A Y +A X +B Y +A X +A X +A X +A X +C Z +A X +B Y +B Y +A X +B Y +A X +A Z +A X +C Y +B Y +A X +A X +C X +B Y +B Y +A Y +A X +C Y +B Y +A Y +A X +A Z +C Y +A X +A X +A Y +C X +C Y +A X +B Y +A X +A X +C Z +A Z +C Z +A Y +A X +A X +C X +C Z +A Z +B Y +B Y +B Y +A X +A Z +C X +A X +A X +B Y +A X +A X +C Z +A Y +A Y +C Z +A X +A X +C Y +B Z +A Y +A Z +A X +C X +A X +A X +A X +A X +B Y +B Y +C Z +A X +C X +B Y +A X +A X +A X +A X +A X +A X +A X +A X +C Z +A Y +C X +C Z +A X +A X +A Y +A X +A X +C X +C X +B Y +A X +B Y +B Y +A Z +A X +A Y +A Y +A X +A X +A X +B Y +B X +A X +B Y +B Y +A X +A Y +A Y +A X +C Z +A X +A X +A Z +C Z +B Z +A X +A X +A X +A Y +C X +A X +B Y +A X +B Z +A Y +A X +B Y +A X +C X +A X +B Y +A X +C X +C X +C Z +A X +A X +C Y +A X +B Y +A X +B X +A X +B X +A X +A Y +A X +C X +C X +A X +A X +A Y +A X +A X +C X +A X +B Y +A X +A X +C Y +A X +A X +A X +C X +A X +B Z +A X +A Z +A X +A X +A Z +A X +A X +A X +A Y +B Y +A X +A X +A X +B Z +B Y +A Z +B X +B Y +A X +C X +B Y +A X +A X +B Y +A X +C X +A Z +A X +A Z +A Z +B Y +A X +C X +C Z +A X +B Y +A X +B Y +C Z +A X +C Z +B Y +C X +C X +C Z +B Y +A X +B Y +C X +C X +A X +B Y +A X +A X +A Y +C Z +B Y +A X +A Z +A Y +A X +A Y +C X +A X +A X +A X +C X +A X +A X +A X +B Y +C Y +B Y +A X +B Y +B Y +A X +A X +A X +A X +A X +C Z +B Y +B X +B Y +A X +A Z +A X +A X +B Y +B Y +C X +C Z +A X +C Z +B Y +A Z +A X +A X +A X +A X +B Z +B Y +A X +A X +A X +A X +A X +B Y +B X +B Y +C X +B Y +C X +B Y +A X +A X +B Y +A X +C Z +B Y +C X +A Z +B Y +B Y +A X +B Y +A X +A Y +B Y +B Y +B Z +C Z +A X +C X +A Y +B X +A X +A X +A X +C Z +B Y +B Y +A Y +B Y +A X +B Y +A X +C X +A X +A X +A X +A Y +A Y +A Z +A X +B Y +A X +A X +A X +A X +A X +A X +A Z +A X +A X +B Y +C Z +C X +C Z +B Y +A X +A Z +A Z +A Y +B X +A X +A X +C Y +A Z +A X +A X +B Y +A X +B X +A Z +A X +A X +A X +A X +A Y +A X +A Z +A X +B Y +B Z +C Z +A Y +B Y +A Y +C X +B Y +B Y +A Z +A X +A X +A Y +A X +A X +A X +A X +C Z +B X +A X +B Y +C X +A X +A X +C X +B Y +C Z +C Z +B Y +C X +A X +C Z +B Y +A X +C Z +A Y +B Y +A X +A Z +A Z +B Z +A X +A Z +A X +C Z +C X +A X +C X +A Y +C X +A X +A X +A Z +B Z +B Y +B Y +A X +A X +A X +A Z +A X +B Y +C Z +A X +A X +A Z +A X +B Y +B Y +C X +A X +A X +A X +C Z +C X +B Y +A X +A X +B Y +C Z +B Y +A Y +A X +C X +A Z +A X +A X +A X +C X +A X +A X +A X +A X +C Z +B Y +A X +A X +C Z +C X +B Y +B Y +C X +B Y +A X +A X +A X +C X +A X +A X +A Z +A X +A X +B Z +A X +C X +B Y +A Z +B Y +A X +A X +B Z +A X +A X +A X +B Y +A X +A X +A X +A X +B Y +A Y +A X +B X +A X +A X +A X +A X +C Z +B Y +A X +C Z +C Z +B Y +C Z +A X +A Y +B Y +B Y +A X +A X +A X +A X +A X +A X +B Y +A Y +B Y +A X +B Y +B Y +B Z +A Y +B Y +C Z +A X +A X +B Y +A X +A X +A X +A Y +A X +A X +B Y +A Y +A X +A X +A X +B Y +A X +C X +A X +C X +B Y +C X +A X +B Y +A Z +A X +A X +B Y +A X +A X +A X +B X +A X +A X +A X +B Y +A Z +B Y +B Y +C X +C X +B Y +A Y +A X +B Y +A X +B Z +A X +A X +B Y +A Y +A X +A Y +A X +C Z +A X +C Z +B Y +A Y +B Y +A X +A Z +A X +B Y +B X +B Y +A X +A Y +A X +A X +A X +A X +C X +A X +B Y +C X +A Y +B Y +B Y +A X +A X +C Z +A X +C X +B Y +A X +A X +B Y +A Y +A X +A Z +A X +C X +B Y +B Y +C X +A X +B Y +A X +B Y +C X +A X +B Y +A X +A Z +A X +C X +A Z +A X +A X +A Y +A X +A X +A X +A Y +A X +A X +A X +A X +A X +B Y +C X +C Z +C X +A X +B Y +C Z +B X +A X +A X +B Y +A X +A X +C Z +C X +C X +A X +A Y +B Y +A Y +C X +B Y +A X +A X +A Y +A X +A X +B X +C X +A Y +B Y +B Y +A X +B Y +A X +A Y +A X +A X +B Y +B Y +A X +B Y +A X +C X +C X +C Z +A X +A X +A X +B Y +C X +A X +A X +B Y +A X +C X +A Y +A X +A X +A X +C X +A X +A Z +A X +A X +A X +A Y +C Z +A Y +A X +B Z +A X +A X +B Y +C Z +A X +B Y +B Y +A X +B Y +A Y +A X +B Y +B Y +A X +C Z +B Y +A X +B Z +C Z +B Y +A X +C Z +A X +A X +A Z +A X +A X +A X +A X +A X +A X +C Z +A X +A X +B X +A X +A X +A X +A Z +A X +C X +A X +C Y +A X +B X +C X +A X +B Y +B Y +A X +C X +A X +A X +A X +A Y +A X +B Y +C Z +B Y +A Z +A X +A X +A Z +C Z +C X +C X +B Y +C X +A X +A X +A X +A X +B Y +A X +A X +A Y +C X +A X +C X +A X +A X +A X +C X +C X +A X +A X +B Y +A X +A X +A X +A Y +B Y +A X +A X +C X +A X +B Y +C X +C Y +C X +B Y +B Z +A X +A X +A Z +C X +A X +A X +A X +A X +A X +B Z +A Z +A X +A X +A X +A X +A Y +A X +C X +A Z +A X +A Z +C X +A X +A X +A X +A Z +A Y +A X +C Z +A X +A X +B Y +A X +A X +A X +A Y +B Y +A X +B Y +B Y +C Z +B Y +A X +A X +A X +A X +A X +A X +A Y +A X +A X +B Y +A Y +A X +A X +C X +A X +B Y +A X +B Y +A X +A X +C X +A Y +A X +C X +B Y +C X +A X +A X +A X +C X +A X +A X +A X +C Z +A X +A X +B Y +A X +A X +A X +A X +C Z +A X +C Z +B Y +C X +A X +A Y +A X +A Z +A X +C X +C Z +A X +C X +A X +A X +A X +A X +C Z +B Y +A X +C X +B Y +C X +C Z +C Z +C X +C Z +C Z +A Y +A Z +C Z +A X +A Y +A Y +A X +A X +B Y +A X +B Y +A X +A Y +C X +A X +A X +A X +C Z +C Z +B Y +A X +B Y +C X +A X +A X +A X +A Y +B Y +A X +C X +C Y +C X +A X +A X +C Z +B Y +A X +B Y +A X +A X +C Z +B Y +A X +A Z +C Y +A Z +A X +C X +A Y +A X +C Z +C X +A X +A X +A X +A X +A X +A X +A X +A Y +A X +A X +A X +C X +C X +B Y +B Y +A X +B Y +A X +C X +C Z +C X +B Y +C X +B Y +B Y +A X +B X +C Z +A X +A X +B Y +A X +B Y +A X +B Y +A X +A X +A X +A X +A X +A X +A X +A X +A X +C Z +A X +A X +A X +A X +B Y +A X +B Y +B Y +C Y +B Y +A X +B Y +B Y +C X +C Z +C X +C Z +A X +C X +A X +A X +A Y +A X +B Y +A X +B Y +B Y +B Y +A X +A X +A X +A X +A X +B Y +A X +C X +B Y +C X +A X +A X +C X +B Y +C Z +C X +B Y +A X +A X +B Y +A X +A X +A Y +C Z +A X +B Y +B Y +A X +B Y +C Z +A Z +A Y +A X +B Y +A Y +B Y +B Y +C Z +A Y +A X +A Y +B Y +A X +A X +C Z +A X +B Y +A X +B Y +B Y +A X +A X +A X +B Y +B Y +A X +A X +C X +B Z +A X +B X +B Y +C Z +B Y +C Z +C Z +A X +A Z +A X +A X +A X +A X +A X +B Z +B Y +C X +A X +A X +B Y +C X +C Z +B Y +C X +B Y +A X +A X +C Z +A X +A Y +B Y +A X +A X +A X +A X +A X +A X +A X +B Y +A Y +B Y +B Y +A X +B Y +A Z +B Y +A X +A X +A X +C Z +C X +C X +B Y +A X +C Z +C X +A X +A X +C Z +A X +A X +A Z +C Z +B Y +C X +A X +A X +B Y +A Y +A X +A Z +C Z +A X +C Y +A X +B Y +A X +B Z +A X +A X +A X +A Y +C X +A X +A Z +B Y +A X +A X +B Y +C X +C Z +A Y +C Z +A Z +B Y +A X +A X +C Z +A Z +C X +A X +A Y +A X +A X +A Y +A X +A X +A Z +A X +A X +A Y +C X +A X +A X +A Y +B Y +A X +B Y +B Y +A X +C X +A X +A X +C X +A Y +A X +A X +B Y +A X +C X +C Z +B Y +C X +A Y +A Y +A X +A X +A X +B Y +B Z +A X +A X +B Y +B Y +B Y +C Z +B Y +B Y +A X +B Z +A X +A X +A X +A X +B Y +A X +C X +B Y +B Y +A X +A X +B Y +B Y +B X +A X +A X +A X +A X +C Z +A X +A X +B Y +A X +A X +B Y +C X +B Y +A X +A X +B Y +A X +A X +A X +C Z +B Y +B Y +A Y +B X +A X +B Y +C Z +A X +A X +C Z +A X +A X +A Y +C X +A X +C X +A Y +A Y +A X +A Z +A X +C X +C Z +C X +B Y +A X +C Z +A Z +B X +B Y +C Z +C X +C X +B Y +A Y +B Y +A X +A X +A Z +B Y +A X +A X +A Y +A X +A X +B Y +B Z +B Y +A X +A X +A Y +A X +A X +A Y +B Y +C Z +C Z +C Z +B Y +A X +A X +B Y +C X +A X +A X +A Y +A X +B Y +B X +A X +C Z +A X +A X +A X +A Y +A X +C X +A X +A X +C Z +A X +A X +A X +A X +A Z +B Y +A X +A X +C X +C X +C X +B Y +A X +A X +A X +B Y +B Y +A X +C X +C Y +A X +A X +A X +B Y +B Y +A X +A X +A Z +A X +A Y +A X +B Y +A Z +B Y +C X +A Z +C X +B Y +A X +A X +B Y +A X +C Z +B Y +B Y +A X +B X +A X +B Y +B Y +A X +A X +A X +A X +A Y +B Y +A Y +B Y +B Y +C X +A Z +A X +A X +A X +A X +C Z +A X +A X +C X +C X +A Z +A X +A Z +C X +C Z +B Y +B Y +A Z +B Y +B Y +B Y +A X +C X +C X +A Y +B Y +A X +A X +A X +B Y +C Z +C X +A Z +A X +C Z +A X +A X +C X +A X +B Y +A X +A Z +B Y +A X +A X +A X +C X +A X +A X +A X +A X +A X +A X +B Y +B Y +B Y +B X +A X +A Z +C X +A X +B Y +A X +A X +C Z +C X +B Y +A X +A X +A X +C X +A X +A X +B Y +A X +C Y +A Y +A Z +B Y +A Y +B Y +B Y +A X +A X +A X +A X +A X +A X +A Y +A X +C X +C X +C X +C Z +A Z +A X +B Z +B Y +B Y +A Z +A X +A X +C Z +B Y +B Y +C X +A X +B Y +B Y +A X +C X +C Z +B Y +B Y +B Y +A X +B Y +B Y +A X +A X +A X +A X +B Y +B Y +B Y +A X +A X +A X +B Y +B Y +A X +A X +C X +A Y +B Z +C X +A X +A Y +A X +A X +C Z +A X +C X +B Y +A X +C Z +C Y +A X +C Z +A Z +C Z +C X +B Y +B Y +A X +B Z +A X +A X +B X +A X +A X +A X +A X +C Z +C X +A X +B Y +A X +C X +A X +B Y +C Z +A X +C X +A Y +A X +A X +A X +A X +A X +B Y +B Y +A X +A X +B Y +B Y +C Z +C X +A X +A X +B Z +A X +A X +A Z +A X +A X +A X +A X +C X +A X +A X +A X +B Z +C Z +B Y +B Y +C Z +C X +A X +A X +B Y +A X +A X +B Y +A X +A Y +C X +B Y +A X +C X +A X +B Y +C X +B Y +A X +C X +A X +A X +C X +A X +C X +A X +C X +A X +A X +B Y +A X +A X +A X +A X +A X +A X +A X +A Y +A X +A X +C X +B Y +C Z +A X +B Y +A X +B Y +C Z +C Z +B Y +A X +A X +A X +A X +A Y +A X +A Z +A X +C Y +C X +C Z +A X +A X +A X +A X +A X +C Z +C X +A X +A X +B Z +A X +C X +A Z +B Y +C Z +A X +A X +A Z +B Y +A X +B Z +A X +A X +A Y +A X +A X +C Z +A X +B Y +B X +A X +C X +A X +C X +B Y +A X +A X +B Z +A X +A X +B Y +B Y +A Z +C X +A X +A X +A Z +A X +A Z +A X +A X +A X +B Y +A X +C X +C X +A Z +B Y +B Y +A X +A X +A X +A X +A X +A X +C X +A X +A Y +C X +A X +A X +A X +C X +A X +A X +A X +A X +A X +B Z +A X +A X +C Y +B Y +C X +A X +A X +A X +A X +A X +C X +A Y +B Y +A X +A X +A X +A Y +A X +C X +A Z +A X +C Z +C X +A X +A X +A X +A X +C X +C X +B Y +A Z +A Y +B Y +C X +C Z +B Y +B Y +A X +C X +A X +A Y +B Y +A X +C X +C X +B Y +A X +B Y +A Y +A X +B X +A X +A X +B Y +A X +B X +B Y +A X +C Z +A X +A Z +A X +A X +C X +A Y +A X +C X +A X +A X +A X diff --git a/src/main/resources/input03.txt b/src/main/resources/input03.txt new file mode 100644 index 0000000..e5e3940 --- /dev/null +++ b/src/main/resources/input03.txt @@ -0,0 +1,300 @@ +DPstqDdrsqdDtqrFDJDDrmtsJHflSJCLgCphgHHgRHJCRRff +BcBGcQzVBVZcvznTTTvZcGTpCRRRfRCggLflHlhhCZpZCj +vGQnQvnzTzNTTbVnzGBqMqwqDLdPtMmbwqqLLM +wLRFRqvFsFRjfrHddbdbjzdH +lcsnSJPSSVVlGmGrHzbbrGNrdzbz +mSmlnnPlmJmncVDSlSZSlmLBCvtwBvtLCqqsws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HNJCHVvvFFbfFlHHnCQQDhLnhhhPZrZnPZPn +mSMszWRMQmhqrnZL +GjtzjSSdRGSjsRtdRMttgGgsqqFNfFcGVvVVvlbHFFGFVFwb diff --git a/src/main/resources/input04.txt b/src/main/resources/input04.txt new file mode 100644 index 0000000..f5b4544 --- /dev/null +++ b/src/main/resources/input04.txt @@ -0,0 +1,1000 @@ +71-71,42-72 +27-28,27-99 +15-79,14-78 +3-36,4-36 +5-67,32-57 +7-85,5-86 +2-97,97-97 +10-73,41-55 +34-99,34-55 +80-80,25-80 +50-76,50-79 +42-70,43-70 +95-96,81-96 +6-7,6-94 +37-39,17-38 +39-95,26-96 +52-77,53-76 +2-99,9-95 +23-94,79-91 +19-78,44-77 +47-47,1-48 +4-88,3-52 +51-60,50-52 +49-90,21-89 +76-95,97-99 +78-96,79-95 +90-90,77-90 +8-73,9-72 +54-54,54-74 +20-40,19-40 +7-96,7-7 +16-73,54-77 +8-30,33-59 +71-99,71-72 +22-74,21-74 +58-94,93-95 +92-96,34-94 +5-60,6-61 +2-78,41-79 +63-63,54-64 +21-55,78-88 +1-97,6-95 +14-52,14-73 +5-30,6-30 +4-82,3-91 +9-98,8-97 +1-99,9-95 +35-46,34-79 +2-3,2-45 +2-78,2-78 +11-57,56-57 +78-79,54-78 +17-81,18-43 +76-79,77-88 +4-90,11-91 +1-94,94-95 +57-93,56-92 +13-13,14-99 +42-50,10-50 +34-86,33-85 +2-25,1-95 +6-95,3-95 +5-31,8-30 +3-13,4-19 +10-97,9-60 +13-94,12-14 +9-93,8-93 +18-96,18-97 +53-94,53-74 +33-33,11-74 +58-76,76-77 +7-66,8-82 +38-76,37-77 +1-2,1-96 +24-98,23-99 +2-67,2-66 +30-84,1-30 +8-99,7-99 +89-94,78-89 +11-13,12-66 +75-83,12-75 +2-34,1-92 +36-38,36-93 +4-94,2-93 +6-95,6-99 +19-52,20-52 +49-95,48-94 +5-45,45-46 +3-96,4-84 +21-37,30-83 +33-67,67-67 +30-87,86-87 +73-73,7-73 +4-89,1-88 +5-60,60-61 +51-69,52-68 +3-92,2-3 +3-95,2-95 +13-73,70-71 +7-83,8-60 +62-94,94-94 +23-36,32-39 +17-52,45-53 +53-72,67-68 +48-95,49-49 +14-17,11-16 +70-97,70-96 +13-14,13-30 +9-9,8-97 +2-12,3-43 +79-79,37-79 +3-97,1-96 +56-77,55-77 +34-34,33-91 +2-80,81-81 +17-94,49-95 +25-84,13-85 +23-88,24-24 +1-35,2-23 +30-92,29-92 +37-37,37-38 +63-80,78-80 +4-83,1-83 +9-97,8-79 +2-98,3-88 +17-87,17-89 +37-38,38-60 +79-84,77-89 +5-96,96-97 +3-57,4-56 +50-91,46-50 +7-21,7-76 +79-96,25-79 +1-65,55-65 +16-93,15-97 +12-13,15-99 +68-97,18-61 +7-91,7-91 +16-89,15-90 +8-8,8-99 +28-28,10-29 +17-82,83-83 +17-74,19-73 +17-88,87-89 +11-31,10-32 +85-89,47-76 +34-61,34-35 +82-99,92-99 +14-41,13-42 +46-97,97-99 +3-51,4-51 +40-88,41-68 +58-64,55-63 +87-90,14-87 +7-39,8-9 +15-67,14-68 +21-95,20-92 +27-99,28-60 +50-87,50-88 +39-95,38-39 +67-67,66-67 +30-75,30-75 +54-89,53-90 +10-46,2-45 +30-90,12-94 +29-58,30-57 +22-22,21-73 +31-57,11-54 +10-65,10-89 +17-45,29-35 +43-58,44-73 +8-94,8-93 +26-43,8-26 +22-37,37-37 +26-57,13-56 +47-86,86-87 +89-89,58-89 +5-76,4-5 +96-96,30-97 +8-44,43-44 +22-78,22-77 +35-69,35-70 +7-93,6-59 +3-3,3-99 +23-99,23-98 +75-89,90-90 +13-97,97-97 +93-97,22-94 +36-46,45-46 +16-28,17-28 +26-78,78-91 +6-99,5-6 +55-94,40-94 +2-80,3-71 +13-13,12-94 +77-79,6-78 +1-80,5-74 +54-95,67-96 +23-89,80-89 +6-36,2-50 +2-3,3-65 +39-98,27-98 +59-66,35-78 +9-83,1-8 +41-66,58-67 +4-67,4-68 +9-77,77-78 +65-85,32-99 +43-94,31-44 +1-33,1-33 +5-50,5-19 +39-71,14-70 +1-99,53-99 +6-71,5-70 +17-88,18-88 +41-63,13-63 +4-4,3-89 +3-95,2-2 +15-21,6-21 +22-99,27-96 +1-87,56-71 +73-73,74-89 +65-95,66-94 +5-69,25-69 +21-86,21-55 +14-88,15-87 +20-33,19-34 +14-50,63-85 +7-23,22-55 +56-90,55-89 +60-85,60-61 +82-85,79-84 +66-66,99-99 +1-1,2-63 +6-61,1-6 +26-97,26-26 +36-81,76-82 +49-78,49-79 +17-99,12-98 +1-92,91-91 +11-97,99-99 +33-96,42-44 +8-71,3-76 +67-71,67-68 +49-72,49-71 +28-28,13-29 +38-68,67-67 +15-48,14-88 +16-37,16-36 +76-84,76-76 +5-96,26-97 +35-36,4-35 +1-96,2-97 +71-71,3-70 +37-87,37-86 +29-52,52-53 +12-79,16-80 +46-88,8-87 +8-91,8-84 +21-96,21-95 +17-97,7-96 +51-77,36-77 +13-21,6-13 +64-77,63-64 +4-8,2-44 +63-80,64-66 +51-90,52-89 +34-34,34-73 +3-81,1-81 +19-19,19-53 +68-73,14-51 +4-58,59-59 +8-30,12-30 +4-82,5-81 +26-99,27-99 +27-89,26-88 +38-62,55-85 +6-95,7-94 +18-56,17-55 +44-81,44-74 +16-20,14-19 +37-68,14-78 +6-11,7-10 +24-86,25-99 +10-97,1-97 +52-80,53-81 +28-64,28-63 +67-69,68-69 +3-5,3-5 +12-64,64-64 +3-4,4-71 +34-34,5-34 +29-36,28-74 +3-60,2-97 +36-93,35-92 +51-81,52-80 +13-80,10-96 +17-97,96-98 +90-92,19-91 +76-77,77-98 +42-42,48-73 +88-97,16-85 +70-75,37-74 +55-89,55-65 +38-73,41-72 +74-75,27-74 +32-43,41-43 +39-98,21-97 +43-71,42-43 +93-93,72-94 +19-45,19-44 +45-46,46-70 +2-70,2-69 +16-97,15-97 +26-63,25-62 +19-21,19-20 +7-98,10-98 +21-22,22-88 +51-93,49-92 +14-87,86-86 +37-50,36-72 +14-71,14-91 +27-29,28-73 +98-98,44-97 +20-41,19-24 +42-81,81-81 +54-55,10-55 +56-66,67-67 +46-77,46-78 +6-7,7-72 +74-95,69-76 +10-88,2-87 +45-84,44-84 +43-89,18-93 +19-77,19-76 +12-93,11-93 +60-61,18-60 +1-29,4-29 +39-52,25-51 +5-86,5-88 +3-95,5-90 +78-80,9-79 +29-56,29-55 +24-96,23-96 +19-93,92-94 +91-91,8-92 +53-58,22-67 +46-48,25-49 +22-28,29-29 +7-87,7-90 +14-94,13-14 +2-98,3-99 +14-80,13-81 +6-99,7-35 +3-86,2-87 +41-98,42-88 +15-15,11-15 +32-75,31-32 +11-45,16-26 +4-79,80-98 +90-92,91-93 +2-2,1-98 +24-65,23-23 +7-69,7-70 +76-84,77-83 +38-63,63-79 +11-11,10-46 +10-89,10-99 +16-73,16-72 +22-77,17-78 +99-99,25-99 +6-96,95-96 +52-90,52-62 +76-76,76-77 +14-88,14-88 +26-81,25-96 +53-81,81-81 +38-97,37-73 +16-81,15-15 +30-58,30-58 +61-89,5-89 +14-60,13-15 +22-93,23-94 +19-43,18-31 +6-87,1-87 +1-99,2-98 +3-84,75-84 +70-76,71-72 +15-15,15-39 +6-92,5-93 +3-32,2-31 +30-83,56-83 +78-78,79-98 +7-98,6-42 +18-57,18-57 +8-76,3-91 +12-97,13-98 +36-51,37-83 +3-95,1-97 +25-67,25-25 +14-79,14-33 +91-92,91-91 +3-80,2-81 +38-92,91-92 +93-98,93-97 +21-22,22-36 +31-89,27-30 +14-95,13-13 +25-36,24-36 +43-71,30-79 +37-37,36-83 +2-94,3-98 +2-89,60-88 +7-98,6-8 +66-70,65-70 +11-71,97-99 +9-95,8-94 +4-77,5-76 +38-85,37-86 +18-51,17-19 +13-13,6-13 +71-81,70-80 +46-81,47-47 +69-69,68-76 +37-56,37-56 +96-97,6-96 +53-59,54-58 +45-50,2-49 +5-33,6-6 +16-61,16-61 +13-51,3-51 +5-82,4-53 +5-81,54-81 +2-18,18-19 +29-29,5-29 +12-81,13-81 +2-71,16-71 +48-92,32-42 +8-12,8-75 +47-86,86-86 +5-97,4-96 +75-75,16-74 +13-95,8-97 +10-90,9-91 +48-62,47-63 +3-18,2-2 +1-18,17-81 +45-83,25-84 +36-91,37-92 +85-99,15-85 +39-85,2-96 +24-96,11-94 +12-89,11-58 +47-72,59-73 +31-91,30-81 +33-43,34-41 +16-83,15-83 +22-55,21-54 +39-82,26-97 +10-95,11-96 +2-98,4-79 +17-37,16-41 +76-76,25-77 +65-73,74-77 +9-82,82-83 +30-57,31-76 +4-74,5-34 +31-87,86-87 +65-74,15-73 +36-36,35-36 +1-99,1-2 +31-79,78-79 +6-88,7-96 +73-86,74-93 +31-49,49-85 +2-98,1-3 +14-57,15-58 +83-96,96-97 +6-92,6-93 +6-95,3-94 +16-96,26-92 +6-85,2-85 +38-39,38-92 +96-97,33-93 +12-13,13-51 +5-5,4-4 +1-95,1-95 +69-71,69-73 +27-98,26-99 +5-25,4-26 +43-68,68-69 +8-56,15-56 +3-99,4-98 +5-5,5-96 +17-71,18-32 +53-53,53-99 +12-18,14-19 +20-94,20-93 +15-62,14-63 +59-59,59-73 +99-99,11-96 +47-98,46-47 +4-86,86-86 +1-1,3-64 +19-45,18-84 +1-86,9-87 +45-45,32-46 +41-63,63-64 +3-5,5-38 +34-70,33-70 +34-91,3-92 +12-45,11-45 +29-30,34-86 +24-55,55-56 +6-41,7-99 +87-88,5-87 +5-63,6-6 +63-63,63-68 +2-95,96-98 +17-25,33-98 +40-99,41-82 +21-41,42-46 +50-86,12-91 +11-64,10-63 +21-21,21-39 +10-96,10-95 +18-95,18-94 +73-79,80-93 +14-69,15-70 +25-83,26-26 +83-94,61-82 +16-90,64-96 +2-3,3-21 +7-45,7-57 +6-85,5-84 +22-94,21-21 +5-64,5-63 +96-99,70-96 +18-87,17-18 +6-99,6-11 +49-49,2-48 +7-64,65-69 +41-46,14-47 +92-92,8-92 +6-96,5-24 +57-85,57-84 +39-99,40-99 +80-86,86-86 +52-91,94-98 +67-88,15-66 +15-39,40-40 +22-92,23-23 +31-84,74-84 +43-43,25-43 +16-90,15-85 +5-36,7-36 +53-58,52-59 +14-96,99-99 +3-94,2-95 +97-99,49-97 +7-67,54-67 +12-72,72-73 +69-76,75-75 +59-79,60-64 +72-99,78-92 +80-80,80-86 +25-26,25-88 +27-43,27-44 +27-76,18-75 +22-23,5-23 +52-69,53-70 +16-64,16-98 +3-51,5-96 +3-72,2-20 +26-26,27-37 +58-91,90-91 +14-20,11-44 +5-99,5-6 +31-32,31-99 +9-93,93-93 +21-81,20-80 +47-99,49-50 +28-89,27-28 +30-77,30-30 +91-93,59-92 +4-78,40-89 +38-95,39-78 +27-58,26-58 +32-92,24-32 +69-91,35-69 +31-95,13-94 +8-8,7-99 +14-93,8-93 +36-78,16-79 +7-53,10-52 +98-99,5-98 +9-15,10-14 +1-98,2-98 +2-60,3-60 +33-70,32-32 +83-97,82-89 +92-92,32-91 +1-97,1-96 +85-95,48-77 +3-26,4-4 +14-14,13-88 +13-90,14-91 +28-67,27-66 +69-75,76-76 +31-97,16-96 +21-47,46-47 +50-51,40-51 +17-97,8-97 +3-98,4-97 +58-97,59-92 +8-15,7-15 +94-95,4-94 +45-56,44-50 +21-44,22-43 +16-72,15-71 +65-84,65-84 +18-46,63-72 +61-71,41-54 +10-36,9-66 +3-68,3-69 +19-19,18-20 +69-70,4-69 +72-72,71-73 +30-95,30-31 +76-77,76-86 +21-71,21-66 +36-36,37-47 +17-98,98-98 +38-74,39-39 +1-95,3-94 +9-17,11-18 +1-93,1-94 +49-75,67-76 +83-91,90-91 +8-71,37-62 +31-51,22-50 +45-99,46-98 +8-32,6-32 +50-50,50-78 +75-80,75-81 +1-68,14-83 +13-90,6-95 +3-47,3-85 +25-47,25-25 +15-77,5-57 +7-69,48-69 +21-74,22-73 +48-84,83-84 +14-14,13-65 +41-96,20-98 +73-93,24-92 +14-45,15-15 +98-98,6-99 +34-63,33-34 +10-93,92-94 +2-97,31-97 +30-99,30-86 +6-89,89-90 +65-94,42-64 +38-40,39-74 +1-1,1-40 +9-26,25-25 +2-95,95-96 +14-93,10-92 +84-86,4-84 +21-21,20-92 +56-98,31-97 +4-31,3-31 +2-20,21-21 +12-91,13-91 +1-90,2-79 +3-4,4-80 +12-89,13-88 +6-88,88-88 +22-90,22-22 +18-87,19-35 +28-71,29-49 +39-52,52-53 +73-82,72-74 +70-98,30-99 +31-40,37-40 +10-28,15-86 +48-92,65-91 +10-96,9-11 +22-98,21-23 +2-98,3-21 +34-34,33-72 +23-42,2-58 +26-98,49-97 +65-95,29-94 +48-48,47-49 +23-66,22-65 +97-98,83-98 +32-47,31-53 +24-26,15-25 +82-88,89-89 +85-96,85-98 +22-76,24-77 +84-85,84-86 +26-27,26-98 +10-88,14-71 +73-81,1-72 +79-88,15-88 +74-86,64-87 +27-56,28-55 +37-38,36-89 +1-47,17-48 +50-94,45-76 +35-90,34-90 +7-98,6-6 +2-95,5-96 +60-95,60-98 +94-96,5-93 +25-97,28-98 +9-9,9-98 +6-15,15-83 +11-32,12-75 +7-97,7-99 +17-17,17-58 +46-95,45-94 +10-86,11-11 +41-43,40-43 +7-74,34-75 +8-97,9-97 +72-82,82-98 +19-20,19-38 +7-94,6-95 +9-48,10-97 +47-73,48-48 +32-93,8-99 +12-65,11-13 +43-51,27-50 +35-67,34-66 +9-28,9-28 +25-86,18-85 +92-92,11-93 +66-66,36-66 +59-60,12-59 +5-21,4-4 +40-93,40-93 +56-86,57-87 +2-97,1-2 +61-94,60-93 +36-64,35-65 +62-94,62-95 +27-99,27-27 +36-52,35-36 +31-91,30-31 +35-93,92-94 +2-98,1-3 +74-74,6-74 +46-79,80-80 +19-95,17-94 +15-16,16-83 +1-94,3-93 +79-79,10-79 +10-75,9-74 +2-84,1-83 +19-83,19-82 +13-14,14-34 +33-57,33-58 +3-7,4-91 +25-25,24-48 +46-47,44-46 +85-86,19-85 +40-42,37-42 +72-88,64-84 +25-68,25-25 +88-88,89-89 +3-14,4-15 +12-98,12-92 +5-90,38-91 +41-58,42-59 +24-63,64-84 +47-48,29-47 +30-62,62-77 +43-80,44-97 +90-99,5-90 +12-58,58-58 +18-66,6-87 +30-89,65-83 +23-93,93-93 +7-19,6-18 +12-99,13-57 +5-27,27-30 +3-4,4-75 +14-26,14-23 +91-95,34-94 +52-83,53-53 +16-24,13-23 +56-70,70-71 +10-80,80-81 +58-97,91-99 +16-82,46-83 +15-16,15-83 +26-81,27-80 +65-65,46-65 +23-93,24-92 +42-92,6-91 +25-65,25-25 +9-72,8-77 +36-94,35-37 +44-86,43-45 +51-89,50-90 +69-71,68-77 +10-36,28-37 +22-75,74-74 +38-38,37-94 +42-70,41-70 +3-92,2-72 +18-89,89-95 +82-89,6-89 +75-76,11-75 +12-26,19-27 +21-83,21-84 +2-97,3-99 +13-97,13-97 +89-92,89-89 +29-73,2-5 +41-60,50-59 +12-68,11-67 +26-59,26-58 +22-64,22-72 +31-74,30-75 +41-49,41-49 +26-92,19-92 +53-65,52-52 +47-54,53-55 +81-99,80-81 +22-81,23-81 +15-40,14-40 +5-96,4-96 +21-98,2-97 +13-57,6-56 +13-47,12-31 +66-66,58-65 +2-39,10-39 +11-82,10-81 +94-96,11-66 +5-61,4-60 +35-88,89-98 +58-80,58-81 +15-98,14-16 +33-99,32-34 +4-97,77-98 +14-15,40-47 +31-51,30-52 +28-97,29-97 +79-84,79-85 +19-64,19-63 +3-3,3-75 +36-72,37-92 +6-26,4-75 +4-4,3-13 +44-44,44-69 +3-93,4-93 +47-96,47-96 +15-54,16-41 +78-98,77-97 +53-55,32-55 +88-89,76-88 +16-84,15-95 +82-82,3-83 +43-44,28-43 +66-66,65-81 +6-96,5-95 +83-90,30-84 +61-72,39-61 +2-51,1-52 +11-18,10-24 +65-66,63-65 +7-97,1-96 +6-33,6-6 +50-89,51-51 +22-53,14-52 +49-97,48-98 +5-98,6-44 +15-85,14-84 +29-95,30-96 +75-76,42-75 +37-53,37-52 +3-84,3-3 +33-97,33-69 +49-98,63-99 +77-84,75-83 +3-77,1-76 +60-94,59-85 +79-80,3-79 +32-35,32-36 +30-31,31-89 +15-16,16-86 +8-98,8-97 +42-87,43-88 +34-64,20-63 +7-97,46-98 +4-19,19-67 +39-90,41-90 +40-78,78-79 +50-73,14-92 +58-87,59-60 +4-82,3-4 +61-63,60-68 +1-6,6-61 +17-19,17-18 +5-62,10-36 +15-40,14-39 +59-70,60-69 +93-95,37-92 +14-97,7-99 +91-92,55-91 +38-88,26-42 +6-72,5-7 +77-96,77-97 +5-84,84-84 +29-47,22-32 +53-54,52-53 +11-95,95-96 +7-40,21-95 +99-99,47-99 +18-76,18-82 +1-93,26-93 +37-37,2-41 +71-71,4-71 +26-97,26-26 +68-69,3-68 +96-96,24-97 +41-80,40-65 +54-99,67-95 +80-90,81-93 +35-59,35-59 +16-44,16-44 +2-78,19-79 +16-16,16-97 +2-38,2-2 +8-16,2-16 +47-72,48-73 +15-28,14-29 +4-90,5-5 +46-99,19-95 +66-86,66-77 +61-97,61-96 +30-93,47-93 +59-81,60-80 +21-22,21-22 +36-78,35-77 +35-93,35-35 +34-34,33-49 +24-69,1-68 +9-84,15-84 +11-11,10-94 +3-59,3-4 +25-69,68-68 +93-94,3-93 +72-98,85-98 +36-95,36-94 +36-85,36-86 +9-39,9-40 +97-98,34-97 +24-84,77-85 +37-85,38-38 +92-93,34-91 +44-69,43-78 +2-83,82-84 +19-37,40-62 +56-79,54-78 +60-60,60-97 +46-66,46-67 +18-76,19-86 +40-67,20-67 +13-98,14-97 +63-65,62-64 +22-88,21-89 +45-77,46-78 +14-52,14-53 +38-59,38-60 +1-21,21-21 +62-70,61-62 +50-56,23-99 +4-96,53-97 +68-69,19-68 +35-76,34-76 +29-76,30-77 +12-91,13-90 +7-94,96-99 +5-85,5-81 +56-57,57-58 +26-26,27-98 +12-28,11-58 +11-32,10-32 +10-42,10-56 +46-63,38-62 +31-95,3-94 +76-82,41-75 +87-88,4-88 +21-33,20-32 diff --git a/src/main/resources/input05.txt b/src/main/resources/input05.txt new file mode 100644 index 0000000..7cb8cf9 --- /dev/null +++ b/src/main/resources/input05.txt @@ -0,0 +1,514 @@ + [B] [B] [S] + [M] [P] [L] [B] [J] + [D] [R] [V] [D] [Q] [D] + [T] [R] [Z] [H] [H] [G] [C] + [P] [W] [J] [B] [J] [F] [J] [S] +[N] [S] [Z] [V] [M] [N] [Z] [F] [M] +[W] [Z] [H] [D] [H] [G] [Q] [S] [W] +[B] [L] [Q] [W] [S] [L] [J] [W] [Z] + 1 2 3 4 5 6 7 8 9 + +move 3 from 5 to 2 +move 5 from 3 to 1 +move 4 from 4 to 9 +move 6 from 1 to 4 +move 6 from 8 to 7 +move 5 from 2 to 7 +move 1 from 5 to 4 +move 11 from 9 to 7 +move 1 from 1 to 9 +move 6 from 4 to 6 +move 12 from 6 to 7 +move 1 from 9 to 2 +move 2 from 4 to 6 +move 1 from 8 to 9 +move 1 from 9 to 4 +move 1 from 6 to 1 +move 2 from 7 to 5 +move 2 from 6 to 7 +move 2 from 1 to 6 +move 2 from 4 to 7 +move 1 from 5 to 4 +move 1 from 5 to 6 +move 1 from 6 to 1 +move 1 from 1 to 3 +move 1 from 4 to 1 +move 1 from 1 to 4 +move 1 from 4 to 5 +move 1 from 3 to 9 +move 1 from 5 to 1 +move 4 from 2 to 1 +move 20 from 7 to 8 +move 24 from 7 to 3 +move 3 from 6 to 4 +move 1 from 1 to 9 +move 1 from 9 to 3 +move 2 from 1 to 2 +move 2 from 4 to 1 +move 2 from 2 to 1 +move 14 from 3 to 6 +move 6 from 1 to 6 +move 10 from 3 to 2 +move 1 from 2 to 3 +move 6 from 6 to 5 +move 2 from 3 to 4 +move 13 from 8 to 4 +move 1 from 9 to 7 +move 1 from 6 to 3 +move 10 from 4 to 2 +move 1 from 3 to 6 +move 2 from 8 to 7 +move 1 from 7 to 2 +move 11 from 6 to 8 +move 2 from 6 to 1 +move 2 from 1 to 3 +move 1 from 8 to 6 +move 1 from 3 to 9 +move 3 from 8 to 2 +move 1 from 3 to 6 +move 2 from 6 to 4 +move 1 from 6 to 5 +move 11 from 2 to 9 +move 2 from 4 to 6 +move 1 from 6 to 1 +move 1 from 1 to 5 +move 11 from 2 to 7 +move 12 from 7 to 5 +move 1 from 6 to 2 +move 10 from 8 to 7 +move 6 from 5 to 3 +move 4 from 5 to 4 +move 11 from 9 to 7 +move 7 from 4 to 9 +move 4 from 9 to 6 +move 12 from 7 to 3 +move 1 from 8 to 9 +move 1 from 5 to 1 +move 1 from 1 to 2 +move 1 from 6 to 9 +move 3 from 4 to 1 +move 1 from 9 to 7 +move 8 from 7 to 2 +move 3 from 6 to 1 +move 8 from 2 to 3 +move 1 from 7 to 4 +move 2 from 7 to 2 +move 1 from 5 to 2 +move 8 from 5 to 1 +move 3 from 9 to 6 +move 1 from 6 to 2 +move 1 from 4 to 5 +move 1 from 5 to 4 +move 2 from 9 to 3 +move 1 from 8 to 6 +move 1 from 4 to 5 +move 1 from 5 to 1 +move 1 from 6 to 8 +move 1 from 8 to 1 +move 7 from 1 to 5 +move 11 from 3 to 7 +move 1 from 1 to 9 +move 4 from 2 to 1 +move 5 from 1 to 3 +move 1 from 5 to 9 +move 1 from 6 to 3 +move 6 from 2 to 1 +move 5 from 7 to 3 +move 1 from 6 to 8 +move 1 from 8 to 4 +move 6 from 7 to 9 +move 4 from 9 to 8 +move 2 from 8 to 9 +move 2 from 5 to 8 +move 13 from 3 to 7 +move 1 from 3 to 8 +move 2 from 1 to 9 +move 3 from 1 to 5 +move 1 from 4 to 1 +move 6 from 5 to 9 +move 8 from 9 to 8 +move 2 from 7 to 3 +move 1 from 9 to 7 +move 1 from 5 to 2 +move 5 from 9 to 8 +move 1 from 8 to 7 +move 1 from 2 to 9 +move 7 from 1 to 2 +move 4 from 7 to 5 +move 6 from 2 to 3 +move 1 from 2 to 1 +move 10 from 8 to 9 +move 3 from 8 to 9 +move 4 from 5 to 1 +move 2 from 8 to 6 +move 9 from 9 to 8 +move 1 from 9 to 6 +move 8 from 8 to 4 +move 12 from 3 to 5 +move 1 from 4 to 2 +move 3 from 8 to 1 +move 3 from 9 to 7 +move 1 from 3 to 2 +move 1 from 6 to 9 +move 8 from 3 to 8 +move 6 from 4 to 5 +move 1 from 7 to 6 +move 1 from 8 to 1 +move 6 from 8 to 7 +move 1 from 3 to 6 +move 7 from 1 to 5 +move 1 from 4 to 9 +move 4 from 6 to 5 +move 13 from 7 to 5 +move 1 from 8 to 2 +move 2 from 9 to 3 +move 4 from 7 to 2 +move 1 from 3 to 8 +move 1 from 3 to 4 +move 4 from 1 to 2 +move 1 from 5 to 7 +move 23 from 5 to 6 +move 1 from 8 to 6 +move 1 from 9 to 4 +move 5 from 2 to 6 +move 1 from 4 to 9 +move 1 from 9 to 3 +move 1 from 7 to 8 +move 1 from 4 to 3 +move 1 from 3 to 7 +move 1 from 7 to 5 +move 1 from 8 to 7 +move 12 from 6 to 1 +move 1 from 2 to 5 +move 1 from 3 to 1 +move 20 from 5 to 2 +move 14 from 2 to 4 +move 11 from 2 to 6 +move 1 from 7 to 8 +move 13 from 1 to 8 +move 9 from 8 to 4 +move 3 from 8 to 6 +move 10 from 6 to 8 +move 6 from 6 to 4 +move 4 from 8 to 5 +move 26 from 4 to 2 +move 2 from 5 to 2 +move 5 from 8 to 1 +move 1 from 8 to 3 +move 2 from 1 to 3 +move 2 from 3 to 7 +move 27 from 2 to 7 +move 2 from 8 to 1 +move 1 from 3 to 7 +move 6 from 6 to 2 +move 4 from 6 to 1 +move 4 from 6 to 4 +move 2 from 5 to 4 +move 4 from 2 to 1 +move 3 from 1 to 8 +move 1 from 2 to 8 +move 8 from 4 to 3 +move 1 from 2 to 8 +move 5 from 8 to 6 +move 1 from 4 to 2 +move 1 from 2 to 1 +move 6 from 3 to 1 +move 13 from 7 to 1 +move 1 from 2 to 8 +move 1 from 8 to 2 +move 1 from 6 to 2 +move 1 from 2 to 8 +move 1 from 8 to 2 +move 14 from 7 to 1 +move 5 from 6 to 3 +move 2 from 3 to 1 +move 3 from 3 to 2 +move 3 from 7 to 4 +move 1 from 4 to 9 +move 1 from 9 to 7 +move 2 from 3 to 6 +move 5 from 2 to 7 +move 1 from 7 to 6 +move 5 from 7 to 6 +move 2 from 6 to 7 +move 1 from 6 to 8 +move 1 from 4 to 7 +move 4 from 6 to 9 +move 35 from 1 to 8 +move 3 from 7 to 2 +move 1 from 2 to 5 +move 24 from 8 to 3 +move 1 from 5 to 8 +move 13 from 3 to 6 +move 2 from 2 to 6 +move 6 from 6 to 4 +move 11 from 1 to 6 +move 12 from 6 to 1 +move 1 from 8 to 1 +move 2 from 1 to 3 +move 5 from 4 to 1 +move 1 from 6 to 4 +move 1 from 8 to 3 +move 13 from 3 to 9 +move 3 from 8 to 2 +move 3 from 2 to 7 +move 1 from 3 to 6 +move 3 from 7 to 8 +move 14 from 1 to 3 +move 1 from 1 to 9 +move 6 from 3 to 8 +move 17 from 8 to 6 +move 1 from 3 to 7 +move 1 from 7 to 8 +move 26 from 6 to 7 +move 1 from 1 to 9 +move 3 from 4 to 1 +move 2 from 3 to 8 +move 1 from 8 to 4 +move 14 from 9 to 7 +move 12 from 7 to 3 +move 2 from 1 to 4 +move 2 from 7 to 8 +move 2 from 8 to 3 +move 4 from 9 to 8 +move 1 from 4 to 7 +move 1 from 1 to 3 +move 2 from 4 to 2 +move 24 from 7 to 6 +move 1 from 8 to 1 +move 1 from 7 to 2 +move 1 from 7 to 9 +move 3 from 2 to 9 +move 1 from 1 to 6 +move 5 from 8 to 2 +move 5 from 3 to 4 +move 1 from 2 to 5 +move 3 from 9 to 8 +move 2 from 4 to 9 +move 16 from 6 to 3 +move 14 from 3 to 8 +move 1 from 7 to 9 +move 8 from 6 to 9 +move 4 from 8 to 5 +move 8 from 8 to 3 +move 1 from 5 to 8 +move 1 from 2 to 4 +move 4 from 8 to 7 +move 1 from 5 to 6 +move 12 from 9 to 5 +move 15 from 5 to 8 +move 1 from 6 to 1 +move 2 from 2 to 6 +move 3 from 4 to 2 +move 4 from 2 to 7 +move 8 from 7 to 3 +move 1 from 1 to 4 +move 3 from 6 to 9 +move 16 from 8 to 3 +move 3 from 9 to 4 +move 1 from 8 to 9 +move 2 from 9 to 4 +move 24 from 3 to 8 +move 19 from 8 to 7 +move 2 from 8 to 7 +move 7 from 4 to 5 +move 13 from 7 to 5 +move 4 from 7 to 8 +move 7 from 8 to 1 +move 3 from 5 to 3 +move 3 from 7 to 2 +move 1 from 1 to 4 +move 1 from 7 to 2 +move 3 from 2 to 4 +move 8 from 3 to 1 +move 11 from 1 to 3 +move 12 from 3 to 4 +move 1 from 2 to 5 +move 18 from 3 to 8 +move 3 from 1 to 9 +move 1 from 3 to 5 +move 15 from 5 to 4 +move 4 from 5 to 1 +move 23 from 4 to 6 +move 3 from 1 to 6 +move 13 from 8 to 3 +move 25 from 6 to 2 +move 1 from 9 to 5 +move 5 from 3 to 8 +move 17 from 2 to 8 +move 4 from 4 to 1 +move 1 from 9 to 7 +move 5 from 2 to 6 +move 2 from 2 to 4 +move 1 from 9 to 4 +move 6 from 3 to 9 +move 16 from 8 to 3 +move 2 from 1 to 8 +move 1 from 7 to 4 +move 5 from 4 to 7 +move 1 from 5 to 3 +move 2 from 7 to 1 +move 9 from 8 to 4 +move 3 from 7 to 2 +move 2 from 8 to 3 +move 10 from 4 to 1 +move 1 from 2 to 3 +move 5 from 3 to 7 +move 2 from 8 to 9 +move 2 from 9 to 8 +move 1 from 2 to 1 +move 3 from 9 to 6 +move 2 from 2 to 8 +move 4 from 7 to 3 +move 4 from 8 to 6 +move 1 from 7 to 1 +move 1 from 4 to 8 +move 4 from 3 to 4 +move 4 from 4 to 2 +move 6 from 1 to 2 +move 1 from 4 to 3 +move 5 from 3 to 8 +move 6 from 3 to 8 +move 2 from 2 to 8 +move 3 from 2 to 9 +move 8 from 1 to 6 +move 3 from 2 to 7 +move 2 from 7 to 2 +move 13 from 6 to 5 +move 7 from 5 to 9 +move 3 from 2 to 7 +move 1 from 2 to 9 +move 2 from 5 to 2 +move 3 from 8 to 5 +move 5 from 3 to 4 +move 2 from 2 to 1 +move 9 from 8 to 7 +move 1 from 1 to 8 +move 6 from 5 to 2 +move 4 from 2 to 8 +move 4 from 7 to 1 +move 1 from 2 to 6 +move 5 from 1 to 6 +move 1 from 8 to 2 +move 1 from 2 to 9 +move 13 from 6 to 5 +move 2 from 7 to 2 +move 1 from 8 to 7 +move 4 from 4 to 7 +move 1 from 4 to 1 +move 4 from 8 to 4 +move 6 from 5 to 9 +move 2 from 1 to 4 +move 1 from 8 to 6 +move 11 from 9 to 5 +move 1 from 7 to 8 +move 1 from 8 to 1 +move 1 from 1 to 3 +move 6 from 4 to 8 +move 1 from 8 to 4 +move 1 from 1 to 6 +move 6 from 9 to 7 +move 1 from 4 to 5 +move 3 from 2 to 1 +move 1 from 8 to 2 +move 1 from 3 to 2 +move 20 from 5 to 6 +move 3 from 1 to 6 +move 2 from 2 to 9 +move 3 from 8 to 3 +move 5 from 3 to 8 +move 1 from 1 to 6 +move 2 from 8 to 9 +move 7 from 9 to 5 +move 3 from 5 to 4 +move 3 from 8 to 3 +move 9 from 7 to 9 +move 1 from 8 to 5 +move 7 from 7 to 9 +move 2 from 5 to 2 +move 9 from 9 to 2 +move 1 from 7 to 3 +move 2 from 9 to 1 +move 2 from 5 to 9 +move 2 from 1 to 4 +move 2 from 3 to 7 +move 18 from 6 to 7 +move 7 from 9 to 1 +move 7 from 6 to 8 +move 4 from 4 to 9 +move 4 from 8 to 3 +move 2 from 8 to 2 +move 1 from 8 to 5 +move 1 from 4 to 7 +move 1 from 5 to 1 +move 2 from 9 to 3 +move 12 from 2 to 5 +move 6 from 5 to 6 +move 5 from 7 to 2 +move 3 from 6 to 4 +move 1 from 4 to 7 +move 1 from 4 to 1 +move 2 from 5 to 8 +move 1 from 8 to 2 +move 2 from 9 to 7 +move 8 from 1 to 8 +move 11 from 7 to 1 +move 5 from 8 to 2 +move 7 from 7 to 5 +move 1 from 9 to 4 +move 1 from 7 to 5 +move 7 from 5 to 7 +move 2 from 6 to 1 +move 1 from 8 to 2 +move 12 from 1 to 7 +move 2 from 1 to 2 +move 3 from 8 to 5 +move 3 from 5 to 2 +move 8 from 7 to 3 +move 1 from 3 to 1 +move 3 from 6 to 4 +move 4 from 5 to 6 +move 14 from 2 to 9 +move 3 from 6 to 9 +move 3 from 4 to 2 +move 1 from 1 to 7 +move 1 from 7 to 1 +move 3 from 3 to 5 +move 8 from 7 to 4 +move 1 from 5 to 9 +move 3 from 2 to 4 +move 1 from 3 to 4 +move 4 from 2 to 6 +move 2 from 6 to 7 +move 3 from 5 to 4 +move 16 from 4 to 1 +move 7 from 9 to 8 +move 1 from 5 to 1 +move 3 from 7 to 9 +move 3 from 9 to 4 +move 7 from 1 to 7 +move 6 from 7 to 1 +move 5 from 3 to 1 +move 11 from 9 to 2 +move 3 from 4 to 6 +move 9 from 2 to 8 +move 6 from 3 to 5 +move 2 from 8 to 6 +move 5 from 5 to 3 +move 2 from 7 to 1 +move 3 from 3 to 9 +move 1 from 2 to 4 +move 1 from 5 to 1 +move 13 from 1 to 2 +move 5 from 8 to 6 +move 2 from 3 to 9 +move 2 from 4 to 7 +move 5 from 6 to 9 +move 7 from 9 to 1 +move 3 from 7 to 2 +move 6 from 8 to 6 +move 5 from 6 to 2 +move 2 from 8 to 3 +move 2 from 9 to 4 +move 6 from 2 to 5 +move 1 from 3 to 7 diff --git a/src/main/resources/input06.txt b/src/main/resources/input06.txt new file mode 100644 index 0000000..c8dffdd --- /dev/null +++ b/src/main/resources/input06.txt @@ -0,0 +1 @@ +grvrnvrnnjljbjqjpqjjvhhzwwrbwwbblrltrrpbbbbqnnqbbbbsvbvmbvmbbrsrqrzrllwbbbqzqrqnqrnrjnnjccdggwqqhrrjcjmjmllgrlglhlclmlvlvsshwwsggmfmdfddgdfftrrczrcczhzppgdgrdggghmmdwwqgggslglfgfcgccmjcjwjrwjrjcrjjsgjjvddpwpgpbbgwbgwwhnhfftbffhpfphhfqfrqfrfnfpprvrsrhrfrllfhhrsrhssvfsvsnvsnsswtwtlthllrjjwddtggzczgcchwcwppfbbdvdrdzrdrvrwwsbsfbssqfsfjsjcscttlztllgjjlbbdsdtssvvvwlvlqqnhqqtdqtddjcdcjjpbphhgtgtqtzqqzhqqtgtvtmvtvrvqrvvfmfmppzzbwwnddzttfpfrrlddbppfqppnwnswwdhwdwjjqljqqthtnhnddgmgcmgcmgcmmfmfttrzzfdzztllmjlllgcgbbcqcvccpnndbdjbjmmzbztzptzpprpddptpprhhvlvmlmpmmljjnnjsjfjjvgjjvzzfgfzfbftbftttgstgstgtpggflfcfqqtctltgltldlzdlzzmmlddnvddzfddppmnpptzptpvttwstwswvwrvvbfbjjjbmjjdvdvrvdddrwrhrzrqqhghhrwhwhrrmppsgpsgszzdfdfwwmtwtvwvgvffmqqqtqntqnnjcncbnbwnnzggrdrqqjbqjjwjqqqwlqwlwzlljhhfsfsqsrqqhwqqwbbqbvvlflrrlglbbjhhjmhjjcmcjcgczcfcgcqqczcnnvjnnlddmpmcppgvgjgddvrrnsnmnqmqgmmnppwgwcgwgssbddgtdgdgmdgmgvvmjmvmjmvvsfssdgdghdggbfbqbdbjbsbmmrpmrprggbllwrwpwtppzvppzsssdnsdnnvnhvvvzvfzfqqnnmlnltldtdvdbdblddsmmlccmlmvlmvmmcsctctrtsrstsbsrshsddlmddmppgsscttnrtrqqcvcwwlnlznnnvcnvvtnvnbnmbmvmppjgjdjtddmpdmdvvmgvvdqdlqlhhzccsggjdjsdsttctjctjtfjttppdzpzzbjbwwmwbblslzslzszlzrrcbrrfggvcczjjtbbdnnggbwblwlbwlwqqfvfqfddrrfccvlllhmhhhrthrthrrnbnzbbpzplphprrrnbbghhnshnhbblqqqvwwffnmnmhhtccpqpvqvbvnvvfnfsnffdjdllwffcddgcgrgjrggchcpcddtbbdtdmtdmmhhtphtpppclcpcvcjvcjjfqfzqqphpnhnrnhhpdhhtfhhbbmqmfmsmvssgqqfssqgglnnqmnmbnmbbllrdrgdrdvrdvdsvvnddgtgddcdqdsqdqbqqlhhwdhdgdcgcdchchrchhpvvpgvgrrfggwfwgmpddbhfngtrwswfszgsggnpsntjpslrpjqsffzrlnbnzdtqpqtjzwlhhgrsrbvnccnsjmzcbqgcbtbqlzhnpnhhrrvqwjwzzvrlcrmjhcscrqhpqmfzbnvcwwqhcjjlnggmpbwztzfswmsbjshnsgfmdlzvzczhrdwgwbghszpnbfpctrshbfhspsczcqcrrqcpwwpfzhjqtpqgjbztrpzrlgfdjbmlwdvlvnfmdzbwsbbhlbszvwcpztlchjrqbmsftltmqpfgdpmdgjvwqqtjsqlfqrwmsnlqgsbqfwsdnfvzthmbplvszfcmlptlcjpnfpjsphsmmjplwjqphgvzbtbjtpttqhlwtgnrjvmvsfsztmsqszzlhqqhfslsvhzgtsssfctzgsqbgdzlpwbsmpcnjqshhhcwqdsdzdhnjfqzqnqdlrpddcgrgldgqbjmdtwgppdczzrjvmcfqjbpjzbtjmgdphlbwnsnpfdqlhwvvmpwzsrztnwvtlbphljmjwsgbphgmwhdmfhpvsmvsjccjhfvqtvfmmlnggncltvtrgmbtfqsvfnlvcmjnjwzcrpjnsgntvhjbtdlptshbhhchqmsprhqzdnfpjqccdfvnzjtlbsmmwvzlwlvmsbrnhqctvtvbfhntdctjnrbcrrlmsnwbbjbcbbgrrhfqwzwwfgvsvgbwnttghtgpspzwzfhffsqjvwwttntnvlwftsfvtttgnprzrzsghvjrdtsfdvzswhmrfcdqsgvrlhzbnvbmjlqrftnnbtwqtvlvwznfbslhdqjbntdgpprfqchjvgvzjssdztjlzwfljjmfvzrbbtczggzqwrnqqgzzcbqjcpfqfrbwtdjrrvbszsjdjcpdfjscsvnltcgwvqsgnhbfgnfnddnpmbzbptrmvqzpvbdpfdvtlmgnnjwflgdbfnmvsdnmlvgcpwflwvdbtbfwtfpsmqsplnzwlwgvbjrhghwrnrswsggbqpdjcjrgbgnsqdvwzzwftvjqgjzzcdvpbbjzpphmbcqmrjvgqwfgrsnqvhwflmhgrlvbpwdcsrlqwfrwppqbrdhwqtvczpclpsbsjcptgblbbsqmbhjjgzwvlcnhnzcttmpjsgchmppgphqlzlcsqcgbbjgtjjvmttdztfdptzgvmpnqrcmpmcdlpnbztllvqbggqbqhlqvdwsrwzsjwfrqvcbvsgfdptmrzpvdfblmhlzrvpmsljlqqzrhlnmwncpfhvqlsbtrjbfcrnfvjvddrhdbbczjdsrdvzlbqrccssdzcpmdsqbprjppfzdwfdswptgzcmjqfhcwsqfqhvrslffqfbcvhdzljzrmtwmfdwzdhhjcmbjtvjhzzwfqhrcslztdbnlwmmhbbbgdscjcdzftnchqfnflnsdqjscfrqpnfbftpzvtmrwncqfqqflschpfnjsjlqcjdjgtwpqhgcnjdmnnvmmpwdspmnrgqrptqwcvbtdwpqlbtwpqgwgfrzlrhtvrvzhmhmwhfdsrhpcczqfltsgtgrfwcvlcvtlhqqwnrqgzpnzbfmzbdwqwbsfvbshrgzqdbgvrhzhzlbqsfzttmsnmrqmwgtzbvdqdrbgcpclzjrhdbjtpcdbbznjgtbwbqrnpvffdmwtrbhhstcmnjcwbbnmpbvmjprtzgcptmtrffwhvfgdljnrbbrblbfbgdwtjrtgqgrpvpgjqrjzczvvlspgdbzftqgqvgdqlglbgvgjdcztznszcwfqhmwbrbjcfstzdcmdsssqfhtzpdgmzjscvbdzgbhhgdqgvfwrzmhdrhlsvlzjjzbzdljcbhncppwrtptjgszlqsrqpzqcsgvdvzmgvwgsncnbffttslphcstqvfwbwzbflmshcbnhpljgqwmmwwzlgpbcqnrtqlwcjcrclfdrnnmvtbfdztdfvtqrsgdptfcfpzpsldhzmrngggfvdqggtlfqqwsldprcffsstnnpmsbbvghdbpprqbssnprdbqclzqtgsrczwcvqwrrfmmfwsndvtvqljwwglrgbphdvvwgctbbmtrbpzqtspgrlhmnhjcdwhwvssgspzjbcfjttjqbdpdmptfzzjcfqljpqddfssmffqprvbptfvdshsdmfmdtmlbnmbmjjjsgmlmwmgcwhbrbgchrstptvdlqgddfzddlzhwjmsvvcjwvqtzjtsctfmzchlbrvlgdzbvdlbfpvhptpltrdmcgjghcpwvwqqnrzdtnmgdncplhdpsgpnbprbgshffwwsdhpgqsbmwdtpnhhltlcqfrjtswcchzvlhdgrmjwhgwppdjqlgmdhwbllqvzrchgclmqdlghjsvmwlflmhhmdzbfjhjnvwphnjbclmdpgflqgtfsmsjslntfcmtbphnrgpdcqtjzjttdtgjmvhzsrfnrjqssvwpcslpfstbpfsrsntmftmdgsqrrsnddqfmchrhtlhmqndvvllnvltdzfphjqnvmcdsgfpcmjftgdpntjzplqljhtthvnbzbzwvfnqsjvnfwhmtbsspjslgfjvdgfjpwrsgqwntntjcqtdgnhnsfwhhqfwbwhdrftj \ No newline at end of file diff --git a/src/main/resources/input07.txt b/src/main/resources/input07.txt new file mode 100644 index 0000000..1c87c00 --- /dev/null +++ b/src/main/resources/input07.txt @@ -0,0 +1,979 @@ +$ cd / +$ ls +dir plws +dir pwlbgbz +dir pwtpltr +dir szn +$ cd plws +$ ls +dir ffpzc +dir frcmjzts +92461 nbvnzg +dir phqcg +21621 vqgsglwq +$ cd ffpzc +$ ls +48459 dzdfc.vqq +143107 jql.jzl +208330 mmnvqn.hqb +290122 svjvhflz +218008 wjlmgq +$ cd .. +$ cd frcmjzts +$ ls +dir bsltmjz +dir jfzgrbm +$ cd bsltmjz +$ ls +34237 dzdfc.vqq +58741 mdgdhqgw +$ cd .. +$ cd jfzgrbm +$ ls +132811 fcmpng +103661 lgt.swt +173031 vqgsglwq +29134 wprjfg.zbr +$ cd .. +$ cd .. +$ cd phqcg +$ ls +955 jgfs.zjw +$ cd .. +$ cd .. +$ cd pwlbgbz +$ ls +dir gbg +dir mjzhcwrd +dir njcscpj +dir sphbzn +dir tbgjpphc +55938 tvrfpczc.djm +4840 twd +$ cd gbg +$ ls +287003 fcsjl.bzm +dir wgq +$ cd wgq +$ ls +22963 fcsjl.fcm +$ cd .. +$ cd .. +$ cd mjzhcwrd +$ ls +228632 clfnpmbq.zmb +28276 dzdfc.vqq +2982 tdbg.wgn +$ cd .. +$ cd njcscpj +$ ls +dir dqzgqgv +275186 ffpzc +192491 gjnflc.plq +$ cd dqzgqgv +$ ls +70309 dzdfc.vqq +56139 fcsjl +142095 sgwz.cdz +dir snjntth +dir sphbzn +284618 wjlmgq +$ cd snjntth +$ ls +51918 ffpzc +dir vrfgfds +$ cd vrfgfds +$ ls +155233 jlscz +$ cd .. +$ cd .. +$ cd sphbzn +$ ls +dir qbzwrrw +dir qwpzn +$ cd qbzwrrw +$ ls +278531 fcsjl.tqj +211591 snjntth.gpd +$ cd .. +$ cd qwpzn +$ ls +174183 vqgsglwq +$ cd .. +$ cd .. +$ cd .. +$ cd .. +$ cd sphbzn +$ ls +185471 bsltmjz.fqz +dir bsvh +dir fvzcs +dir ndw +dir nlml +dir pcbt +286260 zhcmrpvt +$ cd bsvh +$ ls +130814 wjlmgq +$ cd .. +$ cd fvzcs +$ ls +dir cgmv +dir ggzwljr +298241 qvzghdpw.lms +dir snjntth +dir sphbzn +$ cd cgmv +$ ls +46843 dzdfc.vqq +dir lmqcbbm +dir rstcqsmd +215261 snjntth +$ cd lmqcbbm +$ ls +229898 bdmbvgp +25529 ffpzc.stm +16871 lnpjzvg.qlj +$ cd .. +$ cd rstcqsmd +$ ls +289038 zrbbbwng.smf +$ cd .. +$ cd .. +$ cd ggzwljr +$ ls +198200 bcthn +$ cd .. +$ cd snjntth +$ ls +191672 fwp.phf +68229 hzs.zpg +dir pggcwb +222426 qbv.bwj +dir snjntth +155354 vmqcm +$ cd pggcwb +$ ls +154272 fqztwvnv.lvv +dir pdjg +62393 vqgsglwq +dir wjhrtg +$ cd pdjg +$ ls +260644 gvhlrcf +209906 wpls.pbd +$ cd .. +$ cd wjhrtg +$ ls +148640 dljf.zrq +172168 dzdfc.vqq +196203 hjdphcfm +247620 sgwz.cdz +$ cd .. +$ cd .. +$ cd snjntth +$ ls +37467 ndlshlmj.cjq +257404 snjntth.nsf +$ cd .. +$ cd .. +$ cd sphbzn +$ ls +64082 bfdv.lwv +dir bsltmjz +58942 dzdfc.vqq +dir snjntth +$ cd bsltmjz +$ ls +dir bsqqdr +266007 fcsjl.gfm +dir ffpzc +dir frsmrd +72122 nthnhzwf +286705 wjlmgq +$ cd bsqqdr +$ ls +117496 wcqt +$ cd .. +$ cd ffpzc +$ ls +280224 mmnvqn.hqb +105346 vrr +$ cd .. +$ cd frsmrd +$ ls +111509 sphbzn.shz +$ cd .. +$ cd .. +$ cd snjntth +$ ls +177491 mplj +9029 pvbz.jwn +92891 snjntth.zrv +203356 vnnnw.gql +134728 vqgsglwq +$ cd .. +$ cd .. +$ cd .. +$ cd ndw +$ ls +241303 bht.rpj +173068 vqgsglwq +$ cd .. +$ cd nlml +$ ls +228982 hzglfpvq.ftt +114981 sgwz.cdz +$ cd .. +$ cd pcbt +$ ls +dir bsltmjz +dir ffpzc +dir fjsjwfg +dir fwm +dir jvwt +227943 tmr.jdc +dir vwpqzdwh +31258 wjlmgq +$ cd bsltmjz +$ ls +177750 bsltmjz.spj +dir ffpzc +dir flrpwfs +138824 mtmdtcpv.cfj +165770 wzqwczj.qwn +$ cd ffpzc +$ ls +179645 snjntth.dss +$ cd .. +$ cd flrpwfs +$ ls +60566 wvjq.gmm +$ cd .. +$ cd .. +$ cd ffpzc +$ ls +97847 qzhhtmd.bhw +1197 vqgsglwq +$ cd .. +$ cd fjsjwfg +$ ls +152232 dnsdd.jgz +181301 gsb.wsh +dir jqpb +dir jscbg +dir snjntth +227677 snjntth.vvg +dir sphbzn +75358 vqgsglwq +2589 wjlmgq +$ cd jqpb +$ ls +253403 mmnvqn.hqb +108325 rvq.mrc +$ cd .. +$ cd jscbg +$ ls +dir dtm +dir gsdnz +208269 prh +25977 qdzljgh +169262 vmnq.mth +$ cd dtm +$ ls +80072 gzqnb +$ cd .. +$ cd gsdnz +$ ls +dir dsqzjs +297895 sgwz.cdz +129983 vqgsglwq +$ cd dsqzjs +$ ls +2621 jqrlsf.gzs +164844 snjntth +$ cd .. +$ cd .. +$ cd .. +$ cd snjntth +$ ls +118553 cbhql +dir ffpzc +dir snjntth +$ cd ffpzc +$ ls +dir lmn +12104 tvlwn.vhh +$ cd lmn +$ ls +46401 bsltmjz +96888 shrnqhvq +$ cd .. +$ cd .. +$ cd snjntth +$ ls +dir snjntth +dir vlnfhbq +dir wpwl +$ cd snjntth +$ ls +dir ctj +$ cd ctj +$ ls +82485 fcsjl.lfl +$ cd .. +$ cd .. +$ cd vlnfhbq +$ ls +250106 qvf +$ cd .. +$ cd wpwl +$ ls +153950 cmsd.rlg +$ cd .. +$ cd .. +$ cd .. +$ cd sphbzn +$ ls +dir glgq +$ cd glgq +$ ls +285182 wjlmgq +$ cd .. +$ cd .. +$ cd .. +$ cd fwm +$ ls +251865 ffpzc.qgb +279522 zvvpfqtp +$ cd .. +$ cd jvwt +$ ls +48990 bsltmjz.nzp +219604 ffpzc +69573 mvmdfzr.lwb +$ cd .. +$ cd vwpqzdwh +$ ls +267581 pvcch +$ cd .. +$ cd .. +$ cd .. +$ cd tbgjpphc +$ ls +255571 dstpcgr.tfq +dir fdbwbrpp +dir gjzwh +dir hjvrtjt +dir rhzczj +292888 sgwz.cdz +dir wlzhr +149395 wnfzrqgz.dtn +$ cd fdbwbrpp +$ ls +dir ffpzc +dir qbrth +51164 qprp +dir slpt +117026 sphbzn +295685 vqgsglwq +dir znmj +$ cd ffpzc +$ ls +dir jhnzrdvb +$ cd jhnzrdvb +$ ls +217775 ffpzc.sgw +$ cd .. +$ cd .. +$ cd qbrth +$ ls +183969 lpbwgfjv.vcg +47333 wjlmgq +$ cd .. +$ cd slpt +$ ls +32343 tqhtj.jwz +$ cd .. +$ cd znmj +$ ls +55058 mmnvqn.hqb +$ cd .. +$ cd .. +$ cd gjzwh +$ ls +dir dvcbcd +202530 dzdfc.vqq +dir fsgz +dir hfrrqq +54897 jlzn.qsn +16097 ldzqsbb.jzl +225078 pswccrd +dir rqqmldw +292464 rzrdhbp.vld +dir ssqbqqp +dir zsztqrc +$ cd dvcbcd +$ ls +187837 dzdfc.vqq +dir jlwtvf +dir jnjvshs +164053 nrf.fqd +5665 tlp.jmt +13801 wjlmgq +$ cd jlwtvf +$ ls +219985 sphbzn.dvj +$ cd .. +$ cd jnjvshs +$ ls +dir bsltmjz +dir nrpm +$ cd bsltmjz +$ ls +152972 qgdqj +$ cd .. +$ cd nrpm +$ ls +18509 wjlmgq +$ cd .. +$ cd .. +$ cd .. +$ cd fsgz +$ ls +224576 mmnvqn.hqb +$ cd .. +$ cd hfrrqq +$ ls +dir bwgsnfvb +dir fcsjl +294608 ffpzc.gvm +136880 qjcgtw +dir sphbzn +$ cd bwgsnfvb +$ ls +29735 dzdfc.vqq +dir wstmzfml +$ cd wstmzfml +$ ls +158447 bnvhbvvc.nrt +59889 jclclgd +$ cd .. +$ cd .. +$ cd fcsjl +$ ls +138297 ffpzc.szw +$ cd .. +$ cd sphbzn +$ ls +dir wqdths +$ cd wqdths +$ ls +8326 cgvtw.jpz +$ cd .. +$ cd .. +$ cd .. +$ cd rqqmldw +$ ls +226757 dzdfc.vqq +115055 mwb.btc +dir qpts +298524 sgwz.cdz +$ cd qpts +$ ls +60860 bsltmjz.frp +dir fcsjl +94904 sgwz.cdz +dir wnmqqspz +$ cd fcsjl +$ ls +25082 mmnvqn.hqb +$ cd .. +$ cd wnmqqspz +$ ls +165529 sgwz.cdz +$ cd .. +$ cd .. +$ cd .. +$ cd ssqbqqp +$ ls +192477 pvrgm +$ cd .. +$ cd zsztqrc +$ ls +254053 lht.htn +$ cd .. +$ cd .. +$ cd hjvrtjt +$ ls +189942 fwps +$ cd .. +$ cd rhzczj +$ ls +36502 bmtfr +dir ffjz +35148 nctfhmzm.vsz +dir qdgjzcz +208196 rwql +79863 sgwz.cdz +dir snjntth +$ cd ffjz +$ ls +dir grsvhwm +$ cd grsvhwm +$ ls +50231 fwj.rdv +dir snjntth +$ cd snjntth +$ ls +dir dtbgb +$ cd dtbgb +$ ls +150245 vdflm.lmq +$ cd .. +$ cd .. +$ cd .. +$ cd .. +$ cd qdgjzcz +$ ls +222389 dzdfc.vqq +$ cd .. +$ cd snjntth +$ ls +56794 mmnvqn.hqb +$ cd .. +$ cd .. +$ cd wlzhr +$ ls +116628 bsltmjz +60122 jqpbsgnr.fgb +252605 lfss +300065 qwjdl.vhr +$ cd .. +$ cd .. +$ cd .. +$ cd pwtpltr +$ ls +dir dplsvrhl +140951 gwtfzqvd.znb +dir jbvdb +dir jst +dir qhjv +dir snjntth +$ cd dplsvrhl +$ ls +272101 fcsjl +dir ffpzc +58852 mmnvqn.hqb +dir mnhntjz +91899 sgwz.cdz +228077 snjntth.btv +$ cd ffpzc +$ ls +5499 bsltmjz +dir qmfwpjhl +dir rsrb +dir wgt +$ cd qmfwpjhl +$ ls +300362 dzdfc.vqq +$ cd .. +$ cd rsrb +$ ls +252983 dzdfc.vqq +107744 ltssrgqb.zvj +214895 rhglgcwr.wpw +249727 sgwz.cdz +$ cd .. +$ cd wgt +$ ls +141984 dzdfc.vqq +194686 mmnvqn.hqb +258023 pgr +$ cd .. +$ cd .. +$ cd mnhntjz +$ ls +dir bdvght +dir jprwchh +dir snjntth +$ cd bdvght +$ ls +243166 vpsvjdq.wsn +$ cd .. +$ cd jprwchh +$ ls +178943 bmpc.bjb +$ cd .. +$ cd snjntth +$ ls +dir nlbm +dir zjmjntff +$ cd nlbm +$ ls +33050 fcsjl.rcc +dir sphbzn +17446 wjlmgq +$ cd sphbzn +$ ls +214563 prrfhff.pbp +$ cd .. +$ cd .. +$ cd zjmjntff +$ ls +82134 sgwz.cdz +52203 vrtlgdq.crp +$ cd .. +$ cd .. +$ cd .. +$ cd .. +$ cd jbvdb +$ ls +dir wmtjh +$ cd wmtjh +$ ls +dir ggvwn +$ cd ggvwn +$ ls +192285 spqvmf.sdh +$ cd .. +$ cd .. +$ cd .. +$ cd jst +$ ls +dir bsltmjz +212740 dzdfc.vqq +dir gncztvtb +dir jsqjcqnt +286257 jvs +36654 sdcsm.mbg +192040 sgwz.cdz +dir tbqphzb +dir vdcqgts +285843 wjlmgq +$ cd bsltmjz +$ ls +215705 snjntth.gpv +213665 wjlmgq +$ cd .. +$ cd gncztvtb +$ ls +229298 vqgsglwq +$ cd .. +$ cd jsqjcqnt +$ ls +dir bsltmjz +dir fcsjl +dir ffpzc +dir sphbzn +70864 vqgsglwq +$ cd bsltmjz +$ ls +14981 pqzffzjc +$ cd .. +$ cd fcsjl +$ ls +140328 jwhczwbc +$ cd .. +$ cd ffpzc +$ ls +213650 mmnvqn.hqb +$ cd .. +$ cd sphbzn +$ ls +dir psmtphhq +dir sphbzn +$ cd psmtphhq +$ ls +dir ffpzc +123131 tzgwd +$ cd ffpzc +$ ls +49737 cfngvmd +dir gcnrp +172799 gmd.cwl +dir llnztjf +dir nbqs +79661 rrqz +$ cd gcnrp +$ ls +283 vqnrgl.vwp +$ cd .. +$ cd llnztjf +$ ls +63263 tjhm.bwh +$ cd .. +$ cd nbqs +$ ls +dir vssmq +$ cd vssmq +$ ls +88980 dzdfc.vqq +$ cd .. +$ cd .. +$ cd .. +$ cd .. +$ cd sphbzn +$ ls +20140 fcsjl.zrs +260579 snjntth +$ cd .. +$ cd .. +$ cd .. +$ cd tbqphzb +$ ls +93470 sgwz.cdz +$ cd .. +$ cd vdcqgts +$ ls +223564 dzdfc.vqq +dir ffpzc +dir gwhfgwf +dir nbjtqnng +dir snjntth +$ cd ffpzc +$ ls +42813 qwwmw.nmt +$ cd .. +$ cd gwhfgwf +$ ls +59918 jvfv.mpm +dir mjl +211039 pcwl +$ cd mjl +$ ls +13004 pgjb.tpq +195995 tms.fjz +$ cd .. +$ cd .. +$ cd nbjtqnng +$ ls +107058 dzdfc.vqq +dir ldrsd +111631 vqgsglwq +104599 wbzmdljw.tjq +155747 wjlmgq +$ cd ldrsd +$ ls +107439 jvjm +$ cd .. +$ cd .. +$ cd snjntth +$ ls +242680 fgrt.gng +$ cd .. +$ cd .. +$ cd .. +$ cd qhjv +$ ls +dir bmnm +68453 hjjpdgn.hwl +dir sjlbj +dir vqnrj +$ cd bmnm +$ ls +1238 vqgsglwq +$ cd .. +$ cd sjlbj +$ ls +44239 wzzbtmrz.gml +$ cd .. +$ cd vqnrj +$ ls +3286 bsltmjz.qlc +$ cd .. +$ cd .. +$ cd snjntth +$ ls +130833 blm.wmt +dir snjntth +dir tcnmbcgg +218869 wjlmgq +$ cd snjntth +$ ls +dir snmrdfbt +$ cd snmrdfbt +$ ls +281025 bzrsds.lfg +$ cd .. +$ cd .. +$ cd tcnmbcgg +$ ls +194998 fcsjl +dir qdrmpqgn +dir rzqd +dir tcsds +$ cd qdrmpqgn +$ ls +165713 qmzgt.tnc +$ cd .. +$ cd rzqd +$ ls +dir cwhnmlv +57819 fcsjl +246864 pjnzdvd.gjm +$ cd cwhnmlv +$ ls +287539 mmnvqn.hqb +215636 pbnjt.zbn +124638 sqd +$ cd .. +$ cd .. +$ cd tcsds +$ ls +78812 gfmgb.wqj +218987 hnhfvz.dln +209640 mzzhqlq.zqp +102492 nml.ppg +$ cd .. +$ cd .. +$ cd .. +$ cd .. +$ cd szn +$ ls +dir fcsjl +dir snjntth +dir zjbp +$ cd fcsjl +$ ls +158019 jsv.pmz +$ cd .. +$ cd snjntth +$ ls +229510 dfvpvp +191061 fgplbptq.jlt +dir lfb +234911 lfsrwr.wcb +dir lrfcgzl +48031 stbbw +219691 vqgsglwq +dir zshh +$ cd lfb +$ ls +dir btj +99591 dhrjbvvg.gwm +137224 dzdfc.vqq +201972 jtzmqsvj.wnd +9704 mmnvqn.hqb +dir pwg +200308 snjntth.css +dir wcmhcfm +dir zwhvmln +$ cd btj +$ ls +dir rnbzdfgn +51799 wdhsm +dir wvf +$ cd rnbzdfgn +$ ls +117095 bsltmjz.tlv +$ cd .. +$ cd wvf +$ ls +dir ffpzc +dir ncbmgpsc +dir wtwrmjnt +$ cd ffpzc +$ ls +249919 lsth.fmf +$ cd .. +$ cd ncbmgpsc +$ ls +147899 dzdfc.vqq +$ cd .. +$ cd wtwrmjnt +$ ls +252366 pvpdv.jwz +$ cd .. +$ cd .. +$ cd .. +$ cd pwg +$ ls +280845 fcsjl.fjz +44300 sgwz.cdz +dir snjntth +229605 vqgsglwq +$ cd snjntth +$ ls +2053 pflvsnzs +143522 sgwz.cdz +$ cd .. +$ cd .. +$ cd wcmhcfm +$ ls +229329 qsznhwlw.vjg +$ cd .. +$ cd zwhvmln +$ ls +dir ffpzc +dir tjjzbf +dir wzcq +$ cd ffpzc +$ ls +dir ncnj +37497 vqgsglwq +$ cd ncnj +$ ls +40920 htbjhjq +$ cd .. +$ cd .. +$ cd tjjzbf +$ ls +47522 mczn.spd +$ cd .. +$ cd wzcq +$ ls +56662 ffpzc.vwp +dir snjntth +$ cd snjntth +$ ls +117276 wjlmgq +$ cd .. +$ cd .. +$ cd .. +$ cd .. +$ cd lrfcgzl +$ ls +267485 rsjmpph.qqz +$ cd .. +$ cd zshh +$ ls +dir ffpzc +dir gmn +dir snjntth +150048 tgtlh +32020 thfr +72152 vqgsglwq +$ cd ffpzc +$ ls +dir snjntth +$ cd snjntth +$ ls +224945 dpfpz +$ cd .. +$ cd .. +$ cd gmn +$ ls +238996 sgwz.cdz +$ cd .. +$ cd snjntth +$ ls +86775 dzdfc.vqq +19560 vshcmjj +$ cd .. +$ cd .. +$ cd .. +$ cd zjbp +$ ls +dir fcsjl +41522 nlvpb.fpf +dir nmtjtd +$ cd fcsjl +$ ls +276802 fcsjl.psm +197934 sgwz.cdz +$ cd .. +$ cd nmtjtd +$ ls +47477 dvqmqlgw.ths +51081 vqgsglwq diff --git a/src/main/resources/input08.txt b/src/main/resources/input08.txt new file mode 100644 index 0000000..610aa64 --- /dev/null +++ b/src/main/resources/input08.txt @@ -0,0 +1,99 @@ +213301311230020143114320444110403320013225525311631030063110421431345121304222223004301412232100001 +032203111100043323010213335301511304130605406233153314443635022154110215552041255340234040130323222 +211033104233224304235521203100252423434120553365402362266533500152442121543412024410024400242202302 +013233443223404100042450150455321226633161540105245332600255253210530355343333525022032244210410030 +100023412423313250410335224414340304541343205513226532163144253316101245551432014201003142341223120 +232241013411335302431133421201615210501105064501562020244216516152310063135512221455045300342211403 +001211403144420455554423216332215200446124050665565420055553546105000034160513122231050524220140011 +010222034210203122402014343566262222246103065613373733360061263604223104106135234020024543242111403 +133113440330510405504554625242222200403366266153277146434533626152126510506334524322514123130210430 +101113041432001410142511513526503002532162171436233673475525363642630611162522443352502205024124331 +324312213553041030426555020660523457632523764416232512767555566551645346253661665442120340412302333 +222123425201320323442604100535316531114411567157656317576577367225171531643603563142005225003430304 +230404233442530203464653423224331773327325127722375144767252343327447164151244036263205440245102240 +020311403313133205655466214461271263366243355275525631512333123546621214666605403224540121240310404 +223432305440325556610201021457211262246351424434658664512646355413752541213342520233125105551331330 +410041131121534131115352632731175264753542438584525556827443273227227341353644032545140104543024000 +423453033330221431012636112324171513474458778337333686836267386757554467754342542115255232403454502 +141503311314266450662537113455732217424265537246342583573854773454123656425412332165232141011402443 +234300432213662423462523257572767147464533826775238485872738873855313755143164616151012552443215022 +033241031332110563643465311621477762732537565784247833454662525727847541531227547400151244235203533 +240224003236231611317717416272324253823854672343372244362284832853474756317737336366405432515551141 +044253414432535641343531616777683583443747683557473845555627346482283442342143325272142654451141515 +414053450103324521235112631345676573684558268948763749867453426652857573524661772775625535603534203 +452331543214300655576765671548836233443573348365895488958888986552454663627672751663623063544153145 +213123262132446231133475424568643584667349958744556395357354533357757384556355745247423355145351432 +342221165500622631522633663654256837955886839433536678696786657748837377774671514433313266661623225 +130525523663122464775524878454547596977765643878496844435439637547575786557583612611151265003051021 +052340513053426716457138866685633365633897943973977354954887846375952874745888233531473341566254321 +551302462051112655343688535254486759649794957694399376794599363586956664557346654412445441323166111 +423314110434112256221674555238787433834639693845964995577597377494776955386853327646756442555444510 +011552365334113123648585377225387834796343948497694499984846743648856748248673875362436356643131030 +020256210453324157237867264233786435595376465578894967846665837389745665523842772735511735230401305 +414103611044274157467628724497537843895695848765959754656769555753737934946468683576713214360041123 +433526245602544722152833257988587439889445445556677697744745565449795769495384242545477273223656031 +535042251546455362245227649985889898476674985559449558958898867548978656953754247384375772356045111 +323611233267761557486537664663454997974544898976574687679659946846478948476457434665442317312022000 +316230521014145628676243456554785557548446999847699997896955585649999577677524437423612355506115351 +233431152247465456337854474647793964448444896895598667778778977886586858366824426252253276231246145 +404014103521614562682335866979974948446875556785969767656758585669745354988763786574741512533625562 +556325261143135338658723684954548748574497796665868666555699769757857835743973646256523654252240304 +266422162456222134742357585545497865656898785565975797777687675798668987868793755627527272716412640 +455002563563223122565674686979694669768589897756676776589979994889496595734434837783346346143450216 +423623414476221783674588469588594648549897978796997876765586667888788799455377766468736364172434104 +461015352326313587764337768946558646676685575698789678659997955774574676447688826876753362163336656 +454301143535414652353245365369994964967576769566899779689689997774557795374734563262787562775060012 +653222122731245568566556776985848547968556787679686669879569789644864455634454383364432375535243521 +342316353424453765457789959854867655565788786777767789769587758955585444849988572535856114662250155 +250055446366322362645884695995797555897869878978866789879755795875895966677947756776764266155654244 +355444312633526744883699577599657855885557866766789996876599887759779647979599732827875247133603306 +355162377751474644575435897745996464769988698987886888687666856555545976965644336524766776743736625 +254133626515278463466897589667596746698997878997878697797768557598696668363844637544382211555636416 +360253472354274732737486847668779778565699779896887679689978676579598846458534776876223325777613344 +366252652724126345554794996866795676999857566667778779778577866995589777749549487475787272211122413 +431342467147246836362775364375899585598957998976787989869955888769495445683934936635824416757641010 +146634042466136236774369894774864768596766587699767886867877869796986964585967784682527733236415223 +156304456734165226274783349494798495455769775689668799688775958559896465983366587486585214546510053 +605206622655775234243663487486755585458887997787688876799655859888594564838739982853787622517046650 +423630024631261432424833633564887777468876679966768898695978957564669463675476746456267163626043120 +416652052662467458722777939356947478968767765657999676685879795995878796976469668655854466754261205 +220024367637577658627779495636364487645958666565757789856885784694646544987687453532241513327314431 +001205127227723722658235495649657985496688668778766957998998798794864455548548428355817465523414166 +025161664544242365866263435484535744784969979677987979756856584797657359539943238646534427543545433 +244045631473162278554572386595375669975856555597887558858964647474989998785563783734436666571035624 +353335045651153142532442577843953876787689468686959685568475794765699446555738548335432232450554121 +534351561042516364445286348344476866564776585989956875745847495865559949864377745388672675423056350 +540405145026441333666346536966747774764948686678756744954767654888755588373534364785112116636432366 +310352124627123114353328539488485988645766859746585887776555674793469866749353577236524625202164415 +302556262406343647252785226737766869695447799556645996986594999884557567783867558422423434634241154 +211616662653431774753648337273939739669445597598598567499698999634858586533835878556437361125533615 +213322310145376773757677875437498844399795974564596995697555949834733955347632738712147720025645345 +541321441544454414357337667684975575996485879944954889455796373396388797572654885262161174164114144 +210116521136412425163348474242489536463548693688568577695359465578777582266853876663474766131111432 +440444421253572763622188785355529648358638647573673687439788966944953762338575361334246603164356300 +054351113510556462163317846522547487438935688785489478376663949834482363723855432634571000412534200 +415304004006217366116355647365825399757479337377973788354755373575483332857751272645472164332645502 +525435240504040365515335242682485535453593777959944374675953567553247848654865615214462532062624325 +421513461342233446252413525637885564683877795686776666737637754842856378347452214626360461550624343 +445211110022304542377331711668252868465579847656559543637984976636772273847434447777513040455425001 +302124154303411402267242643588322823363568229589888949467266487378624266732545514654524630362511225 +434012041224431221666125342437865823243772555453745443857363576672867874747661743241420321212130504 +100134115561650365223124662615754286283234445334825852647834765375247667746624712416412652603245504 +132253131224342151537452754232162483446373772738888327822756583445567161173342212362212631430242244 +141002023046411154261327625245617625735662275264772823842687844832822441456725161115444254441235253 +200553032020156206063203436454516443664846483233468486433667666766457415762323462062450463344313222 +201010451225251563362461722113361342618764328454374782643642448326624276154240645532300534152314133 +444032143444456452225426623113762543374213652282765487482433537313361316346564006642411354445335302 +020342143213005041512255604774164472633331333366228437463563712421513134547351014225565411402514242 +422332412253335446146523426227763642635272527343272516342561634646544572211313465325345004130011204 +440123035240040516464102063022655255262623463165725261752452217412716246215333530160420454541132140 +143323423014024055541430440445462316717323336261624421453346176657765065655202543223211535243321002 +133332221053010114200220465260340352674371352121611744231126156721603415356035634351251443041000331 +404032402110401515330522443316116601151652142553741456176754127651434134661511225255414401412224430 +300223104202155300140023253011351612643321427612315624461765340336455620510150244014335414004342223 +230303331103324102513523351221602260544055166522131313540411061216126232512021403023242041242141113 +101421341122145002224050506061436405231312566403515452555542525100113200314454334451233442312303301 +303031334122345315210233432302103062261562324500250254554303502015306535302122202415335332113422223 +323333442324333342200411433124165341334121455446602633255250161540440000210002155250512324214002123 +020000401400224230303002512321356354406540161122666225140252401423502424351314403352020313231212111 +000130010133444334124411122525303126205322331530363021562050544410330230535525023331433124342133030