const val SCORE_ROCK = 1
const val SCORE_PAPER = 2
const val SCORE_SCISSORS = 3

const val DRAW = 'Y'
const val LOSE = 'X'
const val WIN = 'Z'

const val EXPECTED_PART1_CHECK_ANSWER = 15
const val EXPECTED_PART2_CHECK_ANSWER = 12

const val POS_THEIR_CHOICE = 0
const val POS_OUR_CHOICE = 2

const val SCORE_WIN = 6
const val SCORE_DRAW = 3
const val SCORE_LOSE = 0

enum class Shape(val shapeScore: Int) {
    Rock(SCORE_ROCK),
    Paper(SCORE_PAPER),
    Scissors(SCORE_SCISSORS);

    companion object {
        fun from(char: Char): Shape =
            when (char) {
                'A', 'X' -> Rock
                'B', 'Y' -> Paper
                'C', 'Z' -> Scissors
                else -> error("Unknown value $char")
            }
    }
}

val BEATS = mapOf(
    Shape.Rock to Shape.Scissors,
    Shape.Paper to Shape.Rock,
    Shape.Scissors to Shape.Paper,
)

val BEATEN_BY = mapOf(
    Shape.Scissors to Shape.Rock,
    Shape.Rock to Shape.Paper,
    Shape.Paper to Shape.Scissors,
)

fun main() {

    fun getScore(theirs: Shape, ours: Shape) = when {
        ours == theirs -> ours.shapeScore + SCORE_DRAW
        BEATS[ours] == theirs -> ours.shapeScore + SCORE_WIN
        else -> ours.shapeScore + SCORE_LOSE
    }

    fun part1(input: List<String>): Int {
        return input.sumOf {
            val theirs = Shape.from(it[POS_THEIR_CHOICE])
            val ours = Shape.from(it[POS_OUR_CHOICE])
            getScore(theirs, ours)
        }
    }

    fun part2(input: List<String>): Int {
        return input.sumOf {
            val theirs = Shape.from(it[POS_THEIR_CHOICE])
            val ours = when (it[POS_OUR_CHOICE]) {
                DRAW -> theirs
                LOSE -> BEATS[theirs]!!
                WIN -> BEATEN_BY[theirs]!!
                else -> error("Wrong input")
            }
            getScore(theirs, ours)
        }
    }

    // test if implementation meets criteria from the description, like:
    val testInput = readInput("Day02_test")
    check(part1(testInput) == EXPECTED_PART1_CHECK_ANSWER)
    check(part2(testInput) == EXPECTED_PART2_CHECK_ANSWER)

    val input = readInput("Day02")
    println(part1(input))
    println(part2(input))
}

Compiled from "Day02.kt"
public final class Day02Kt {
  public static final int SCORE_ROCK;

  public static final int SCORE_PAPER;

  public static final int SCORE_SCISSORS;

  public static final char DRAW;

  public static final char LOSE;

  public static final char WIN;

  public static final int EXPECTED_PART1_CHECK_ANSWER;

  public static final int EXPECTED_PART2_CHECK_ANSWER;

  public static final int POS_THEIR_CHOICE;

  public static final int POS_OUR_CHOICE;

  public static final int SCORE_WIN;

  public static final int SCORE_DRAW;

  public static final int SCORE_LOSE;

  private static final java.util.Map<Shape, Shape> BEATS;

  private static final java.util.Map<Shape, Shape> BEATEN_BY;

  public static final java.util.Map<Shape, Shape> getBEATS();
    Code:
       0: getstatic     #12                 // Field BEATS:Ljava/util/Map;
       3: areturn

  public static final java.util.Map<Shape, Shape> getBEATEN_BY();
    Code:
       0: getstatic     #16                 // Field BEATEN_BY:Ljava/util/Map;
       3: areturn

  public static final void main();
    Code:
       0: ldc           #20                 // String Day02_test
       2: invokestatic  #26                 // Method UtilsKt.readInput:(Ljava/lang/String;)Ljava/util/List;
       5: astore_0
       6: aload_0
       7: invokestatic  #30                 // Method main$part1:(Ljava/util/List;)I
      10: bipush        15
      12: if_icmpne     19
      15: iconst_1
      16: goto          20
      19: iconst_0
      20: ifne          33
      23: new           #32                 // class java/lang/IllegalStateException
      26: dup
      27: ldc           #34                 // String Check failed.
      29: invokespecial #38                 // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
      32: athrow
      33: aload_0
      34: invokestatic  #41                 // Method main$part2:(Ljava/util/List;)I
      37: bipush        12
      39: if_icmpne     46
      42: iconst_1
      43: goto          47
      46: iconst_0
      47: ifne          60
      50: new           #32                 // class java/lang/IllegalStateException
      53: dup
      54: ldc           #34                 // String Check failed.
      56: invokespecial #38                 // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
      59: athrow
      60: ldc           #43                 // String Day02
      62: invokestatic  #26                 // Method UtilsKt.readInput:(Ljava/lang/String;)Ljava/util/List;
      65: astore_1
      66: aload_1
      67: invokestatic  #30                 // Method main$part1:(Ljava/util/List;)I
      70: istore_2
      71: getstatic     #49                 // Field java/lang/System.out:Ljava/io/PrintStream;
      74: iload_2
      75: invokevirtual #55                 // Method java/io/PrintStream.println:(I)V
      78: aload_1
      79: invokestatic  #41                 // Method main$part2:(Ljava/util/List;)I
      82: istore_2
      83: getstatic     #49                 // Field java/lang/System.out:Ljava/io/PrintStream;
      86: iload_2
      87: invokevirtual #55                 // Method java/io/PrintStream.println:(I)V
      90: return

  public static void main(java.lang.String[]);
    Code:
       0: invokestatic  #63                 // Method main:()V
       3: return

  private static final int main$getScore(Shape, Shape);
    Code:
       0: nop
       1: aload_1
       2: aload_0
       3: if_acmpne     15
       6: aload_1
       7: invokevirtual #73                 // Method Shape.getShapeScore:()I
      10: iconst_3
      11: iadd
      12: goto          44
      15: getstatic     #12                 // Field BEATS:Ljava/util/Map;
      18: aload_1
      19: invokeinterface #79,  2           // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
      24: aload_0
      25: if_acmpne     38
      28: aload_1
      29: invokevirtual #73                 // Method Shape.getShapeScore:()I
      32: bipush        6
      34: iadd
      35: goto          44
      38: aload_1
      39: invokevirtual #73                 // Method Shape.getShapeScore:()I
      42: iconst_0
      43: iadd
      44: ireturn

  private static final int main$part1(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: checkcast     #85                 // class java/lang/Iterable
       4: astore_1
       5: iconst_0
       6: istore_2
       7: aload_1
       8: invokeinterface #89,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      13: astore_3
      14: aload_3
      15: invokeinterface #95,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      20: ifeq          90
      23: aload_3
      24: invokeinterface #99,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      29: astore        4
      31: iload_2
      32: aload         4
      34: checkcast     #101                // class java/lang/String
      37: astore        5
      39: istore        9
      41: iconst_0
      42: istore        6
      44: getstatic     #105                // Field Shape.Companion:LShape$Companion;
      47: aload         5
      49: iconst_0
      50: invokevirtual #109                // Method java/lang/String.charAt:(I)C
      53: invokevirtual #115                // Method Shape$Companion.from:(C)LShape;
      56: astore        7
      58: getstatic     #105                // Field Shape.Companion:LShape$Companion;
      61: aload         5
      63: iconst_2
      64: invokevirtual #109                // Method java/lang/String.charAt:(I)C
      67: invokevirtual #115                // Method Shape$Companion.from:(C)LShape;
      70: astore        8
      72: aload         7
      74: aload         8
      76: invokestatic  #117                // Method main$getScore:(LShape;LShape;)I
      79: istore        10
      81: iload         9
      83: iload         10
      85: iadd
      86: istore_2
      87: goto          14
      90: iload_2
      91: ireturn

  private static final int main$part2(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: checkcast     #85                 // class java/lang/Iterable
       4: astore_1
       5: iconst_0
       6: istore_2
       7: aload_1
       8: invokeinterface #89,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      13: astore_3
      14: aload_3
      15: invokeinterface #95,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      20: ifeq          170
      23: aload_3
      24: invokeinterface #99,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      29: astore        4
      31: iload_2
      32: aload         4
      34: checkcast     #101                // class java/lang/String
      37: astore        5
      39: istore        9
      41: iconst_0
      42: istore        6
      44: getstatic     #105                // Field Shape.Companion:LShape$Companion;
      47: aload         5
      49: iconst_0
      50: invokevirtual #109                // Method java/lang/String.charAt:(I)C
      53: invokevirtual #115                // Method Shape$Companion.from:(C)LShape;
      56: astore        7
      58: aload         5
      60: iconst_2
      61: invokevirtual #109                // Method java/lang/String.charAt:(I)C
      64: tableswitch   { // 88 to 90
                    88: 97
                    89: 92
                    90: 117
               default: 137
          }
      92: aload         7
      94: goto          150
      97: getstatic     #12                 // Field BEATS:Ljava/util/Map;
     100: aload         7
     102: invokeinterface #79,  2           // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     107: dup
     108: invokestatic  #127                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     111: checkcast     #69                 // class Shape
     114: goto          150
     117: getstatic     #16                 // Field BEATEN_BY:Ljava/util/Map;
     120: aload         7
     122: invokeinterface #79,  2           // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     127: dup
     128: invokestatic  #127                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     131: checkcast     #69                 // class Shape
     134: goto          150
     137: new           #32                 // class java/lang/IllegalStateException
     140: dup
     141: ldc           #129                // String Wrong input
     143: invokevirtual #133                // Method java/lang/Object.toString:()Ljava/lang/String;
     146: invokespecial #38                 // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
     149: athrow
     150: astore        8
     152: aload         7
     154: aload         8
     156: invokestatic  #117                // Method main$getScore:(LShape;LShape;)I
     159: istore        10
     161: iload         9
     163: iload         10
     165: iadd
     166: istore_2
     167: goto          14
     170: iload_2
     171: ireturn

  static {};
    Code:
       0: iconst_3
       1: anewarray     #137                // class kotlin/Pair
       4: astore_0
       5: aload_0
       6: iconst_0
       7: getstatic     #140                // Field Shape.Rock:LShape;
      10: getstatic     #143                // Field Shape.Scissors:LShape;
      13: invokestatic  #149                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      16: aastore
      17: aload_0
      18: iconst_1
      19: getstatic     #152                // Field Shape.Paper:LShape;
      22: getstatic     #140                // Field Shape.Rock:LShape;
      25: invokestatic  #149                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      28: aastore
      29: aload_0
      30: iconst_2
      31: getstatic     #143                // Field Shape.Scissors:LShape;
      34: getstatic     #152                // Field Shape.Paper:LShape;
      37: invokestatic  #149                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      40: aastore
      41: aload_0
      42: invokestatic  #158                // Method kotlin/collections/MapsKt.mapOf:([Lkotlin/Pair;)Ljava/util/Map;
      45: putstatic     #12                 // Field BEATS:Ljava/util/Map;
      48: iconst_3
      49: anewarray     #137                // class kotlin/Pair
      52: astore_0
      53: aload_0
      54: iconst_0
      55: getstatic     #143                // Field Shape.Scissors:LShape;
      58: getstatic     #140                // Field Shape.Rock:LShape;
      61: invokestatic  #149                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      64: aastore
      65: aload_0
      66: iconst_1
      67: getstatic     #140                // Field Shape.Rock:LShape;
      70: getstatic     #152                // Field Shape.Paper:LShape;
      73: invokestatic  #149                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      76: aastore
      77: aload_0
      78: iconst_2
      79: getstatic     #152                // Field Shape.Paper:LShape;
      82: getstatic     #143                // Field Shape.Scissors:LShape;
      85: invokestatic  #149                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      88: aastore
      89: aload_0
      90: invokestatic  #158                // Method kotlin/collections/MapsKt.mapOf:([Lkotlin/Pair;)Ljava/util/Map;
      93: putstatic     #16                 // Field BEATEN_BY:Ljava/util/Map;
      96: return
}


object Day18 {
    const val EXPECTED_PART1_CHECK_ANSWER = 64
    const val EXPECTED_PART2_CHECK_ANSWER = 58
}

fun main() {
    val air = mutableMapOf<Point3D, Boolean>()

    fun List<String>.parsePoints() =
        map { line ->
            val xyz = line.split(',')
            Point3D(xyz[0].toInt(), xyz[1].toInt(), xyz[2].toInt())
        }

    fun Point3D.sides() =
        listOf(
            Triple(-1, 0, 0),
            Triple(0, 1, 0),
            Triple(1, 0, 0),
            Triple(0, -1, 0),
            Triple(0, 0, 1),
            Triple(0, 0, -1),
        ).map { (xMove, yMove, zMove) ->
            Point3D(x + xMove, y +yMove, z + zMove)
        }

    fun addToCache(points: Iterable<Point3D>, isAir: Boolean): Boolean {
        points.forEach { air[it] = isAir }
        return isAir
    }

    fun Point3D.outsideRange(pMin: Point3D, pMax: Point3D) = x < pMin.x || x > pMax.x || y < pMin.y || y > pMax.y || z < pMin.z || z > pMax.z

    fun Point3D.isAir(points: List<Point3D>, pMin: Point3D, pMax: Point3D): Boolean {
        air[this]?.let { return it }
        val frontier = ArrayDeque(listOf(this))
        val visited = mutableSetOf<Point3D>()
        while (!frontier.isEmpty()) {
            val current = frontier.removeFirst()
            when {
                !visited.add(current) -> continue
                current in air -> return addToCache(visited, air.getValue(current))
                current.outsideRange(pMin, pMax) -> return addToCache(visited, false)
                else -> frontier.addAll(current.sides().filter { it !in points })
            }
        }
        return addToCache(visited, true)
    }

    fun part1(input: List<String>): Int {
        val points = input.parsePoints()
        return points.sumOf { point ->
            point.sides().count { it !in points }
        }
    }

    fun part2(input: List<String>): Int {
        val points = input.parsePoints()
        val pMin = Point3D(points.minOf { it.x }, points.minOf { it.y }, points.minOf { it.z })
        val pMax = Point3D(points.maxOf { it.x }, points.maxOf { it.y }, points.maxOf { it.z })

        val result = points.sumOf { point ->
            point.sides().filter { it !in points }.count { !it.isAir(points, pMin, pMax) }
        }
        return result
    }

    // test if implementation meets criteria from the description, like:
    val testInput = readInput("Day18_test")
    check(part1(testInput) == Day18.EXPECTED_PART1_CHECK_ANSWER) { "Part 1 failed" }
    check(part2(testInput) == Day18.EXPECTED_PART2_CHECK_ANSWER) { "Part 2 failed" }

    val input = readInput("Day18")
    println(part1(input))
    println(part2(input))
}

Compiled from "Day18.kt"
public final class Day18 {
  public static final Day18 INSTANCE;

  public static final int EXPECTED_PART1_CHECK_ANSWER;

  public static final int EXPECTED_PART2_CHECK_ANSWER;

  private Day18();
    Code:
       0: aload_0
       1: invokespecial #8                  // Method java/lang/Object."<init>":()V
       4: return

  static {};
    Code:
       0: new           #2                  // class Day18
       3: dup
       4: invokespecial #12                 // Method "<init>":()V
       7: putstatic     #15                 // Field INSTANCE:LDay18;
      10: return
}

Compiled from "Day18.kt"
public final class Day18Kt {
  public static final void main();
    Code:
       0: new           #8                  // class java/util/LinkedHashMap
       3: dup
       4: invokespecial #11                 // Method java/util/LinkedHashMap."<init>":()V
       7: checkcast     #13                 // class java/util/Map
      10: astore_0
      11: ldc           #15                 // String Day18_test
      13: invokestatic  #21                 // Method UtilsKt.readInput:(Ljava/lang/String;)Ljava/util/List;
      16: astore_1
      17: aload_1
      18: invokestatic  #25                 // Method main$part1:(Ljava/util/List;)I
      21: bipush        64
      23: if_icmpne     30
      26: iconst_1
      27: goto          31
      30: iconst_0
      31: ifne          51
      34: iconst_0
      35: istore_3
      36: ldc           #27                 // String Part 1 failed
      38: astore_3
      39: new           #29                 // class java/lang/IllegalStateException
      42: dup
      43: aload_3
      44: invokevirtual #33                 // Method java/lang/Object.toString:()Ljava/lang/String;
      47: invokespecial #36                 // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
      50: athrow
      51: aload_0
      52: aload_1
      53: invokestatic  #40                 // Method main$part2:(Ljava/util/Map;Ljava/util/List;)I
      56: bipush        58
      58: if_icmpne     65
      61: iconst_1
      62: goto          66
      65: iconst_0
      66: ifne          86
      69: iconst_0
      70: istore_3
      71: ldc           #42                 // String Part 2 failed
      73: astore_3
      74: new           #29                 // class java/lang/IllegalStateException
      77: dup
      78: aload_3
      79: invokevirtual #33                 // Method java/lang/Object.toString:()Ljava/lang/String;
      82: invokespecial #36                 // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
      85: athrow
      86: ldc           #44                 // String Day18
      88: invokestatic  #21                 // Method UtilsKt.readInput:(Ljava/lang/String;)Ljava/util/List;
      91: astore_2
      92: aload_2
      93: invokestatic  #25                 // Method main$part1:(Ljava/util/List;)I
      96: istore_3
      97: getstatic     #50                 // Field java/lang/System.out:Ljava/io/PrintStream;
     100: iload_3
     101: invokevirtual #56                 // Method java/io/PrintStream.println:(I)V
     104: aload_0
     105: aload_2
     106: invokestatic  #40                 // Method main$part2:(Ljava/util/Map;Ljava/util/List;)I
     109: istore_3
     110: getstatic     #50                 // Field java/lang/System.out:Ljava/io/PrintStream;
     113: iload_3
     114: invokevirtual #56                 // Method java/io/PrintStream.println:(I)V
     117: return

  public static void main(java.lang.String[]);
    Code:
       0: invokestatic  #69                 // Method main:()V
       3: return

  private static final java.util.List<Point3D> main$parsePoints(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: checkcast     #76                 // class java/lang/Iterable
       4: astore_1
       5: iconst_0
       6: istore_2
       7: aload_1
       8: astore_3
       9: new           #78                 // class java/util/ArrayList
      12: dup
      13: aload_1
      14: bipush        10
      16: invokestatic  #84                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      19: invokespecial #86                 // Method java/util/ArrayList."<init>":(I)V
      22: checkcast     #88                 // class java/util/Collection
      25: astore        4
      27: iconst_0
      28: istore        5
      30: aload_3
      31: invokeinterface #92,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      36: astore        6
      38: aload         6
      40: invokeinterface #98,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      45: ifeq          160
      48: aload         6
      50: invokeinterface #102,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      55: astore        7
      57: aload         4
      59: aload         7
      61: checkcast     #104                // class java/lang/String
      64: astore        8
      66: astore        12
      68: iconst_0
      69: istore        9
      71: aload         8
      73: checkcast     #106                // class java/lang/CharSequence
      76: iconst_1
      77: newarray       char
      79: astore        10
      81: aload         10
      83: iconst_0
      84: bipush        44
      86: castore
      87: aload         10
      89: iconst_0
      90: iconst_0
      91: bipush        6
      93: aconst_null
      94: invokestatic  #112                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[CZIILjava/lang/Object;)Ljava/util/List;
      97: astore        11
      99: new           #114                // class Point3D
     102: dup
     103: aload         11
     105: iconst_0
     106: invokeinterface #118,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     111: checkcast     #104                // class java/lang/String
     114: invokestatic  #124                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     117: aload         11
     119: iconst_1
     120: invokeinterface #118,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     125: checkcast     #104                // class java/lang/String
     128: invokestatic  #124                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     131: aload         11
     133: iconst_2
     134: invokeinterface #118,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     139: checkcast     #104                // class java/lang/String
     142: invokestatic  #124                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     145: invokespecial #127                // Method Point3D."<init>":(III)V
     148: aload         12
     150: swap
     151: invokeinterface #131,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     156: pop
     157: goto          38
     160: aload         4
     162: checkcast     #66                 // class java/util/List
     165: nop
     166: areturn

  private static final java.util.List<Point3D> main$sides(Point3D);
    Code:
       0: bipush        6
       2: anewarray     #150                // class kotlin/Triple
       5: astore_1
       6: aload_1
       7: iconst_0
       8: new           #150                // class kotlin/Triple
      11: dup
      12: iconst_m1
      13: invokestatic  #154                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      16: iconst_0
      17: invokestatic  #154                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      20: iconst_0
      21: invokestatic  #154                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      24: invokespecial #157                // Method kotlin/Triple."<init>":(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V
      27: aastore
      28: aload_1
      29: iconst_1
      30: new           #150                // class kotlin/Triple
      33: dup
      34: iconst_0
      35: invokestatic  #154                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      38: iconst_1
      39: invokestatic  #154                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      42: iconst_0
      43: invokestatic  #154                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      46: invokespecial #157                // Method kotlin/Triple."<init>":(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V
      49: aastore
      50: aload_1
      51: iconst_2
      52: new           #150                // class kotlin/Triple
      55: dup
      56: iconst_1
      57: invokestatic  #154                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      60: iconst_0
      61: invokestatic  #154                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      64: iconst_0
      65: invokestatic  #154                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      68: invokespecial #157                // Method kotlin/Triple."<init>":(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V
      71: aastore
      72: aload_1
      73: iconst_3
      74: new           #150                // class kotlin/Triple
      77: dup
      78: iconst_0
      79: invokestatic  #154                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      82: iconst_m1
      83: invokestatic  #154                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      86: iconst_0
      87: invokestatic  #154                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      90: invokespecial #157                // Method kotlin/Triple."<init>":(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V
      93: aastore
      94: aload_1
      95: iconst_4
      96: new           #150                // class kotlin/Triple
      99: dup
     100: iconst_0
     101: invokestatic  #154                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     104: iconst_0
     105: invokestatic  #154                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     108: iconst_1
     109: invokestatic  #154                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     112: invokespecial #157                // Method kotlin/Triple."<init>":(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V
     115: aastore
     116: aload_1
     117: iconst_5
     118: new           #150                // class kotlin/Triple
     121: dup
     122: iconst_0
     123: invokestatic  #154                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     126: iconst_0
     127: invokestatic  #154                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     130: iconst_m1
     131: invokestatic  #154                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     134: invokespecial #157                // Method kotlin/Triple."<init>":(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V
     137: aastore
     138: aload_1
     139: invokestatic  #161                // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
     142: checkcast     #76                 // class java/lang/Iterable
     145: astore_1
     146: nop
     147: iconst_0
     148: istore_2
     149: aload_1
     150: astore_3
     151: new           #78                 // class java/util/ArrayList
     154: dup
     155: aload_1
     156: bipush        10
     158: invokestatic  #84                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     161: invokespecial #86                 // Method java/util/ArrayList."<init>":(I)V
     164: checkcast     #88                 // class java/util/Collection
     167: astore        4
     169: iconst_0
     170: istore        5
     172: aload_3
     173: invokeinterface #92,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     178: astore        6
     180: aload         6
     182: invokeinterface #98,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     187: ifeq          292
     190: aload         6
     192: invokeinterface #102,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     197: astore        7
     199: aload         4
     201: aload         7
     203: checkcast     #150                // class kotlin/Triple
     206: astore        8
     208: astore        13
     210: iconst_0
     211: istore        9
     213: aload         8
     215: invokevirtual #164                // Method kotlin/Triple.component1:()Ljava/lang/Object;
     218: checkcast     #166                // class java/lang/Number
     221: invokevirtual #170                // Method java/lang/Number.intValue:()I
     224: istore        10
     226: aload         8
     228: invokevirtual #173                // Method kotlin/Triple.component2:()Ljava/lang/Object;
     231: checkcast     #166                // class java/lang/Number
     234: invokevirtual #170                // Method java/lang/Number.intValue:()I
     237: istore        11
     239: aload         8
     241: invokevirtual #176                // Method kotlin/Triple.component3:()Ljava/lang/Object;
     244: checkcast     #166                // class java/lang/Number
     247: invokevirtual #170                // Method java/lang/Number.intValue:()I
     250: istore        12
     252: new           #114                // class Point3D
     255: dup
     256: aload_0
     257: invokevirtual #179                // Method Point3D.getX:()I
     260: iload         10
     262: iadd
     263: aload_0
     264: invokevirtual #182                // Method Point3D.getY:()I
     267: iload         11
     269: iadd
     270: aload_0
     271: invokevirtual #185                // Method Point3D.getZ:()I
     274: iload         12
     276: iadd
     277: invokespecial #127                // Method Point3D."<init>":(III)V
     280: aload         13
     282: swap
     283: invokeinterface #131,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     288: pop
     289: goto          180
     292: aload         4
     294: checkcast     #66                 // class java/util/List
     297: nop
     298: areturn

  private static final boolean main$addToCache(java.util.Map<Point3D, java.lang.Boolean>, java.lang.Iterable<Point3D>, boolean);
    Code:
       0: aload_1
       1: astore_3
       2: iconst_0
       3: istore        4
       5: aload_3
       6: invokeinterface #92,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      11: astore        5
      13: aload         5
      15: invokeinterface #98,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      20: ifeq          64
      23: aload         5
      25: invokeinterface #102,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      30: astore        6
      32: aload         6
      34: checkcast     #114                // class Point3D
      37: astore        7
      39: iconst_0
      40: istore        8
      42: iload_2
      43: invokestatic  #199                // Method java/lang/Boolean.valueOf:(Z)Ljava/lang/Boolean;
      46: astore        9
      48: aload_0
      49: aload         7
      51: aload         9
      53: invokeinterface #203,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
      58: pop
      59: nop
      60: nop
      61: goto          13
      64: nop
      65: iload_2
      66: ireturn

  private static final boolean main$outsideRange(Point3D, Point3D, Point3D);
    Code:
       0: aload_0
       1: invokevirtual #179                // Method Point3D.getX:()I
       4: aload_1
       5: invokevirtual #179                // Method Point3D.getX:()I
       8: if_icmplt     66
      11: aload_0
      12: invokevirtual #179                // Method Point3D.getX:()I
      15: aload_2
      16: invokevirtual #179                // Method Point3D.getX:()I
      19: if_icmpgt     66
      22: aload_0
      23: invokevirtual #182                // Method Point3D.getY:()I
      26: aload_1
      27: invokevirtual #182                // Method Point3D.getY:()I
      30: if_icmplt     66
      33: aload_0
      34: invokevirtual #182                // Method Point3D.getY:()I
      37: aload_2
      38: invokevirtual #182                // Method Point3D.getY:()I
      41: if_icmpgt     66
      44: aload_0
      45: invokevirtual #185                // Method Point3D.getZ:()I
      48: aload_1
      49: invokevirtual #185                // Method Point3D.getZ:()I
      52: if_icmplt     66
      55: aload_0
      56: invokevirtual #185                // Method Point3D.getZ:()I
      59: aload_2
      60: invokevirtual #185                // Method Point3D.getZ:()I
      63: if_icmple     70
      66: iconst_1
      67: goto          71
      70: iconst_0
      71: ireturn

  private static final boolean main$isAir(Point3D, java.util.Map<Point3D, java.lang.Boolean>, java.util.List<Point3D>, Point3D, Point3D);
    Code:
       0: aload_1
       1: aload_0
       2: invokeinterface #222,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
       7: checkcast     #196                // class java/lang/Boolean
      10: astore        5
      12: aload         5
      14: ifnull        30
      17: aload         5
      19: invokevirtual #225                // Method java/lang/Boolean.booleanValue:()Z
      22: istore        7
      24: iconst_0
      25: istore        8
      27: iload         7
      29: ireturn
      30: new           #227                // class kotlin/collections/ArrayDeque
      33: dup
      34: aload_0
      35: invokestatic  #230                // Method kotlin/collections/CollectionsKt.listOf:(Ljava/lang/Object;)Ljava/util/List;
      38: checkcast     #88                 // class java/util/Collection
      41: invokespecial #233                // Method kotlin/collections/ArrayDeque."<init>":(Ljava/util/Collection;)V
      44: astore        5
      46: new           #235                // class java/util/LinkedHashSet
      49: dup
      50: invokespecial #236                // Method java/util/LinkedHashSet."<init>":()V
      53: checkcast     #238                // class java/util/Set
      56: astore        6
      58: aload         5
      60: invokevirtual #241                // Method kotlin/collections/ArrayDeque.isEmpty:()Z
      63: ifne          269
      66: aload         5
      68: invokevirtual #244                // Method kotlin/collections/ArrayDeque.removeFirst:()Ljava/lang/Object;
      71: checkcast     #114                // class Point3D
      74: astore        7
      76: nop
      77: aload         6
      79: aload         7
      81: invokeinterface #245,  2          // InterfaceMethod java/util/Set.add:(Ljava/lang/Object;)Z
      86: ifeq          58
      89: aload_1
      90: aload         7
      92: invokeinterface #248,  2          // InterfaceMethod java/util/Map.containsKey:(Ljava/lang/Object;)Z
      97: ifeq          122
     100: aload_1
     101: aload         6
     103: checkcast     #76                 // class java/lang/Iterable
     106: aload_1
     107: aload         7
     109: invokestatic  #254                // Method kotlin/collections/MapsKt.getValue:(Ljava/util/Map;Ljava/lang/Object;)Ljava/lang/Object;
     112: checkcast     #196                // class java/lang/Boolean
     115: invokevirtual #225                // Method java/lang/Boolean.booleanValue:()Z
     118: invokestatic  #256                // Method main$addToCache:(Ljava/util/Map;Ljava/lang/Iterable;Z)Z
     121: ireturn
     122: aload         7
     124: aload_3
     125: aload         4
     127: invokestatic  #258                // Method main$outsideRange:(LPoint3D;LPoint3D;LPoint3D;)Z
     130: ifeq          144
     133: aload_1
     134: aload         6
     136: checkcast     #76                 // class java/lang/Iterable
     139: iconst_0
     140: invokestatic  #256                // Method main$addToCache:(Ljava/util/Map;Ljava/lang/Iterable;Z)Z
     143: ireturn
     144: aload         5
     146: aload         7
     148: invokestatic  #260                // Method main$sides:(LPoint3D;)Ljava/util/List;
     151: checkcast     #76                 // class java/lang/Iterable
     154: astore        8
     156: astore        17
     158: iconst_0
     159: istore        9
     161: aload         8
     163: astore        10
     165: new           #78                 // class java/util/ArrayList
     168: dup
     169: invokespecial #261                // Method java/util/ArrayList."<init>":()V
     172: checkcast     #88                 // class java/util/Collection
     175: astore        11
     177: iconst_0
     178: istore        12
     180: aload         10
     182: invokeinterface #92,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     187: astore        13
     189: aload         13
     191: invokeinterface #98,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     196: ifeq          250
     199: aload         13
     201: invokeinterface #102,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     206: astore        14
     208: aload         14
     210: checkcast     #114                // class Point3D
     213: astore        15
     215: iconst_0
     216: istore        16
     218: aload_2
     219: aload         15
     221: invokeinterface #264,  2          // InterfaceMethod java/util/List.contains:(Ljava/lang/Object;)Z
     226: ifne          233
     229: iconst_1
     230: goto          234
     233: iconst_0
     234: ifeq          189
     237: aload         11
     239: aload         14
     241: invokeinterface #131,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     246: pop
     247: goto          189
     250: aload         11
     252: checkcast     #66                 // class java/util/List
     255: nop
     256: aload         17
     258: swap
     259: checkcast     #88                 // class java/util/Collection
     262: invokevirtual #268                // Method kotlin/collections/ArrayDeque.addAll:(Ljava/util/Collection;)Z
     265: pop
     266: goto          58
     269: aload_1
     270: aload         6
     272: checkcast     #76                 // class java/lang/Iterable
     275: iconst_1
     276: invokestatic  #256                // Method main$addToCache:(Ljava/util/Map;Ljava/lang/Iterable;Z)Z
     279: ireturn

  private static final int main$part1(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: invokestatic  #284                // Method main$parsePoints:(Ljava/util/List;)Ljava/util/List;
       4: astore_1
       5: aload_1
       6: checkcast     #76                 // class java/lang/Iterable
       9: astore_2
      10: iconst_0
      11: istore_3
      12: aload_2
      13: invokeinterface #92,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      18: astore        4
      20: aload         4
      22: invokeinterface #98,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      27: ifeq          178
      30: aload         4
      32: invokeinterface #102,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      37: astore        5
      39: iload_3
      40: aload         5
      42: checkcast     #114                // class Point3D
      45: astore        6
      47: istore        15
      49: iconst_0
      50: istore        7
      52: aload         6
      54: invokestatic  #260                // Method main$sides:(LPoint3D;)Ljava/util/List;
      57: checkcast     #76                 // class java/lang/Iterable
      60: astore        8
      62: iconst_0
      63: istore        9
      65: aload         8
      67: instanceof    #88                 // class java/util/Collection
      70: ifeq          90
      73: aload         8
      75: checkcast     #88                 // class java/util/Collection
      78: invokeinterface #285,  1          // InterfaceMethod java/util/Collection.isEmpty:()Z
      83: ifeq          90
      86: iconst_0
      87: goto          166
      90: iconst_0
      91: istore        10
      93: aload         8
      95: invokeinterface #92,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     100: astore        11
     102: aload         11
     104: invokeinterface #98,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     109: ifeq          164
     112: aload         11
     114: invokeinterface #102,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     119: astore        12
     121: aload         12
     123: checkcast     #114                // class Point3D
     126: astore        13
     128: iconst_0
     129: istore        14
     131: aload_1
     132: aload         13
     134: invokeinterface #264,  2          // InterfaceMethod java/util/List.contains:(Ljava/lang/Object;)Z
     139: ifne          146
     142: iconst_1
     143: goto          147
     146: iconst_0
     147: ifeq          102
     150: iinc          10, 1
     153: iload         10
     155: ifge          102
     158: invokestatic  #288                // Method kotlin/collections/CollectionsKt.throwCountOverflow:()V
     161: goto          102
     164: iload         10
     166: nop
     167: istore        16
     169: iload         15
     171: iload         16
     173: iadd
     174: istore_3
     175: goto          20
     178: iload_3
     179: ireturn

  private static final int main$part2(java.util.Map<Point3D, java.lang.Boolean>, java.util.List<java.lang.String>);
    Code:
       0: aload_1
       1: invokestatic  #284                // Method main$parsePoints:(Ljava/util/List;)Ljava/util/List;
       4: astore_2
       5: aload_2
       6: checkcast     #76                 // class java/lang/Iterable
       9: invokeinterface #92,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      14: astore        5
      16: aload         5
      18: invokeinterface #98,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      23: ifne          34
      26: new           #297                // class java/util/NoSuchElementException
      29: dup
      30: invokespecial #298                // Method java/util/NoSuchElementException."<init>":()V
      33: athrow
      34: aload         5
      36: invokeinterface #102,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      41: checkcast     #114                // class Point3D
      44: astore        6
      46: iconst_0
      47: istore        7
      49: aload         6
      51: invokevirtual #179                // Method Point3D.getX:()I
      54: istore        6
      56: aload         5
      58: invokeinterface #98,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      63: ifeq          102
      66: aload         5
      68: invokeinterface #102,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      73: checkcast     #114                // class Point3D
      76: astore        7
      78: iconst_0
      79: istore        8
      81: aload         7
      83: invokevirtual #179                // Method Point3D.getX:()I
      86: istore        7
      88: iload         6
      90: iload         7
      92: if_icmple     56
      95: iload         7
      97: istore        6
      99: goto          56
     102: iload         6
     104: aload_2
     105: checkcast     #76                 // class java/lang/Iterable
     108: astore        4
     110: istore        23
     112: aload         4
     114: invokeinterface #92,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     119: astore        5
     121: aload         5
     123: invokeinterface #98,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     128: ifne          139
     131: new           #297                // class java/util/NoSuchElementException
     134: dup
     135: invokespecial #298                // Method java/util/NoSuchElementException."<init>":()V
     138: athrow
     139: aload         5
     141: invokeinterface #102,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     146: checkcast     #114                // class Point3D
     149: astore        6
     151: iconst_0
     152: istore        7
     154: aload         6
     156: invokevirtual #182                // Method Point3D.getY:()I
     159: istore        6
     161: aload         5
     163: invokeinterface #98,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     168: ifeq          207
     171: aload         5
     173: invokeinterface #102,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     178: checkcast     #114                // class Point3D
     181: astore        7
     183: iconst_0
     184: istore        8
     186: aload         7
     188: invokevirtual #182                // Method Point3D.getY:()I
     191: istore        7
     193: iload         6
     195: iload         7
     197: if_icmple     161
     200: iload         7
     202: istore        6
     204: goto          161
     207: iload         6
     209: istore        24
     211: iload         23
     213: iload         24
     215: aload_2
     216: checkcast     #76                 // class java/lang/Iterable
     219: astore        4
     221: istore        24
     223: istore        23
     225: aload         4
     227: invokeinterface #92,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     232: astore        5
     234: aload         5
     236: invokeinterface #98,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     241: ifne          252
     244: new           #297                // class java/util/NoSuchElementException
     247: dup
     248: invokespecial #298                // Method java/util/NoSuchElementException."<init>":()V
     251: athrow
     252: aload         5
     254: invokeinterface #102,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     259: checkcast     #114                // class Point3D
     262: astore        6
     264: iconst_0
     265: istore        7
     267: aload         6
     269: invokevirtual #185                // Method Point3D.getZ:()I
     272: istore        6
     274: aload         5
     276: invokeinterface #98,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     281: ifeq          320
     284: aload         5
     286: invokeinterface #102,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     291: checkcast     #114                // class Point3D
     294: astore        7
     296: iconst_0
     297: istore        8
     299: aload         7
     301: invokevirtual #185                // Method Point3D.getZ:()I
     304: istore        7
     306: iload         6
     308: iload         7
     310: if_icmple     274
     313: iload         7
     315: istore        6
     317: goto          274
     320: iload         6
     322: istore        25
     324: iload         23
     326: iload         24
     328: iload         25
     330: istore        26
     332: istore        27
     334: istore        28
     336: new           #114                // class Point3D
     339: dup
     340: iload         28
     342: iload         27
     344: iload         26
     346: invokespecial #127                // Method Point3D."<init>":(III)V
     349: astore_3
     350: aload_2
     351: checkcast     #76                 // class java/lang/Iterable
     354: invokeinterface #92,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     359: astore        6
     361: aload         6
     363: invokeinterface #98,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     368: ifne          379
     371: new           #297                // class java/util/NoSuchElementException
     374: dup
     375: invokespecial #298                // Method java/util/NoSuchElementException."<init>":()V
     378: athrow
     379: aload         6
     381: invokeinterface #102,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     386: checkcast     #114                // class Point3D
     389: astore        7
     391: iconst_0
     392: istore        8
     394: aload         7
     396: invokevirtual #179                // Method Point3D.getX:()I
     399: istore        7
     401: aload         6
     403: invokeinterface #98,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     408: ifeq          447
     411: aload         6
     413: invokeinterface #102,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     418: checkcast     #114                // class Point3D
     421: astore        8
     423: iconst_0
     424: istore        9
     426: aload         8
     428: invokevirtual #179                // Method Point3D.getX:()I
     431: istore        8
     433: iload         7
     435: iload         8
     437: if_icmpge     401
     440: iload         8
     442: istore        7
     444: goto          401
     447: iload         7
     449: aload_2
     450: checkcast     #76                 // class java/lang/Iterable
     453: astore        5
     455: istore        23
     457: aload         5
     459: invokeinterface #92,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     464: astore        6
     466: aload         6
     468: invokeinterface #98,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     473: ifne          484
     476: new           #297                // class java/util/NoSuchElementException
     479: dup
     480: invokespecial #298                // Method java/util/NoSuchElementException."<init>":()V
     483: athrow
     484: aload         6
     486: invokeinterface #102,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     491: checkcast     #114                // class Point3D
     494: astore        7
     496: iconst_0
     497: istore        8
     499: aload         7
     501: invokevirtual #182                // Method Point3D.getY:()I
     504: istore        7
     506: aload         6
     508: invokeinterface #98,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     513: ifeq          552
     516: aload         6
     518: invokeinterface #102,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     523: checkcast     #114                // class Point3D
     526: astore        8
     528: iconst_0
     529: istore        9
     531: aload         8
     533: invokevirtual #182                // Method Point3D.getY:()I
     536: istore        8
     538: iload         7
     540: iload         8
     542: if_icmpge     506
     545: iload         8
     547: istore        7
     549: goto          506
     552: iload         7
     554: istore        24
     556: iload         23
     558: iload         24
     560: aload_2
     561: checkcast     #76                 // class java/lang/Iterable
     564: astore        5
     566: istore        24
     568: istore        23
     570: aload         5
     572: invokeinterface #92,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     577: astore        6
     579: aload         6
     581: invokeinterface #98,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     586: ifne          597
     589: new           #297                // class java/util/NoSuchElementException
     592: dup
     593: invokespecial #298                // Method java/util/NoSuchElementException."<init>":()V
     596: athrow
     597: aload         6
     599: invokeinterface #102,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     604: checkcast     #114                // class Point3D
     607: astore        7
     609: iconst_0
     610: istore        8
     612: aload         7
     614: invokevirtual #185                // Method Point3D.getZ:()I
     617: istore        7
     619: aload         6
     621: invokeinterface #98,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     626: ifeq          665
     629: aload         6
     631: invokeinterface #102,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     636: checkcast     #114                // class Point3D
     639: astore        8
     641: iconst_0
     642: istore        9
     644: aload         8
     646: invokevirtual #185                // Method Point3D.getZ:()I
     649: istore        8
     651: iload         7
     653: iload         8
     655: if_icmpge     619
     658: iload         8
     660: istore        7
     662: goto          619
     665: iload         7
     667: istore        25
     669: iload         23
     671: iload         24
     673: iload         25
     675: istore        29
     677: istore        30
     679: istore        31
     681: new           #114                // class Point3D
     684: dup
     685: iload         31
     687: iload         30
     689: iload         29
     691: invokespecial #127                // Method Point3D."<init>":(III)V
     694: astore        4
     696: aload_2
     697: checkcast     #76                 // class java/lang/Iterable
     700: astore        6
     702: iconst_0
     703: istore        7
     705: aload         6
     707: invokeinterface #92,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     712: astore        8
     714: aload         8
     716: invokeinterface #98,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     721: ifeq          980
     724: aload         8
     726: invokeinterface #102,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     731: astore        9
     733: iload         7
     735: aload         9
     737: checkcast     #114                // class Point3D
     740: astore        10
     742: istore        21
     744: iconst_0
     745: istore        11
     747: aload         10
     749: invokestatic  #260                // Method main$sides:(LPoint3D;)Ljava/util/List;
     752: checkcast     #76                 // class java/lang/Iterable
     755: astore        12
     757: iconst_0
     758: istore        13
     760: aload         12
     762: astore        14
     764: new           #78                 // class java/util/ArrayList
     767: dup
     768: invokespecial #261                // Method java/util/ArrayList."<init>":()V
     771: checkcast     #88                 // class java/util/Collection
     774: astore        15
     776: iconst_0
     777: istore        16
     779: aload         14
     781: invokeinterface #92,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     786: astore        17
     788: aload         17
     790: invokeinterface #98,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     795: ifeq          849
     798: aload         17
     800: invokeinterface #102,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     805: astore        18
     807: aload         18
     809: checkcast     #114                // class Point3D
     812: astore        19
     814: iconst_0
     815: istore        20
     817: aload_2
     818: aload         19
     820: invokeinterface #264,  2          // InterfaceMethod java/util/List.contains:(Ljava/lang/Object;)Z
     825: ifne          832
     828: iconst_1
     829: goto          833
     832: iconst_0
     833: ifeq          788
     836: aload         15
     838: aload         18
     840: invokeinterface #131,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     845: pop
     846: goto          788
     849: aload         15
     851: checkcast     #66                 // class java/util/List
     854: nop
     855: checkcast     #76                 // class java/lang/Iterable
     858: astore        12
     860: nop
     861: iconst_0
     862: istore        13
     864: aload         12
     866: instanceof    #88                 // class java/util/Collection
     869: ifeq          889
     872: aload         12
     874: checkcast     #88                 // class java/util/Collection
     877: invokeinterface #285,  1          // InterfaceMethod java/util/Collection.isEmpty:()Z
     882: ifeq          889
     885: iconst_0
     886: goto          967
     889: iconst_0
     890: istore        14
     892: aload         12
     894: invokeinterface #92,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     899: astore        15
     901: aload         15
     903: invokeinterface #98,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     908: ifeq          965
     911: aload         15
     913: invokeinterface #102,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     918: astore        16
     920: aload         16
     922: checkcast     #114                // class Point3D
     925: astore        17
     927: iconst_0
     928: istore        18
     930: aload         17
     932: aload_0
     933: aload_2
     934: aload_3
     935: aload         4
     937: invokestatic  #300                // Method main$isAir:(LPoint3D;Ljava/util/Map;Ljava/util/List;LPoint3D;LPoint3D;)Z
     940: ifne          947
     943: iconst_1
     944: goto          948
     947: iconst_0
     948: ifeq          901
     951: iinc          14, 1
     954: iload         14
     956: ifge          901
     959: invokestatic  #288                // Method kotlin/collections/CollectionsKt.throwCountOverflow:()V
     962: goto          901
     965: iload         14
     967: nop
     968: istore        22
     970: iload         21
     972: iload         22
     974: iadd
     975: istore        7
     977: goto          714
     980: iload         7
     982: istore        5
     984: iload         5
     986: ireturn
}


const val PART1_EXPECTED_HIGHEST_CALORIES = 24000
const val PART2_EXPECTED_HIGHEST_3_CALORIES_SUM = 45000
const val PART2_TOP_ELF_COUNT = 3

fun main() {

    fun elfTotals(input: List<String>, idx: Int = 0, elfAmount: Int = 0, totals: List<Int> = emptyList()): List<Int> {
        if (idx >= input.size) return totals + elfAmount
        return elfTotals(
            input,
            idx + 1,
            if (input[idx].isBlank()) 0 else elfAmount + input[idx].toInt(),
            if (input[idx].isBlank()) totals + elfAmount else totals
        )
    }

    fun part1(input: List<String>): Int {
        return elfTotals(input).maxOf { it }
    }

    fun part2(input: List<String>): Int {
        val elfTotals = elfTotals(input)
        return elfTotals.sortedDescending().take(PART2_TOP_ELF_COUNT).sum()
    }

    // test if implementation meets criteria from the description, like:
    val testInput = readInput("Day01_test")
    check(part1(testInput) == PART1_EXPECTED_HIGHEST_CALORIES)
    check(part2(testInput) == PART2_EXPECTED_HIGHEST_3_CALORIES_SUM)

    val input = readInput("Day01")
    println(part1(input))
    println(part2(input))

//    fun part1(input: List<String>): Int {
//        var currentMax = 0
//        var elfTotal = 0
//        input.forEach {
//            if (it.isBlank()) {
//                if (elfTotal > currentMax) {
//                    currentMax = elfTotal
//                }
//                elfTotal = 0
//            } else {
//                elfTotal += it.toInt()
//            }
//        }
//        return currentMax
//    }
//
}

Compiled from "Day01.kt"
public final class Day01Kt {
  public static final int PART1_EXPECTED_HIGHEST_CALORIES;

  public static final int PART2_EXPECTED_HIGHEST_3_CALORIES_SUM;

  public static final int PART2_TOP_ELF_COUNT;

  public static final void main();
    Code:
       0: ldc           #8                  // String Day01_test
       2: invokestatic  #14                 // Method UtilsKt.readInput:(Ljava/lang/String;)Ljava/util/List;
       5: astore_0
       6: aload_0
       7: invokestatic  #18                 // Method main$part1:(Ljava/util/List;)I
      10: sipush        24000
      13: if_icmpne     20
      16: iconst_1
      17: goto          21
      20: iconst_0
      21: ifne          34
      24: new           #20                 // class java/lang/IllegalStateException
      27: dup
      28: ldc           #22                 // String Check failed.
      30: invokespecial #26                 // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
      33: athrow
      34: aload_0
      35: invokestatic  #29                 // Method main$part2:(Ljava/util/List;)I
      38: ldc           #30                 // int 45000
      40: if_icmpne     47
      43: iconst_1
      44: goto          48
      47: iconst_0
      48: ifne          61
      51: new           #20                 // class java/lang/IllegalStateException
      54: dup
      55: ldc           #22                 // String Check failed.
      57: invokespecial #26                 // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
      60: athrow
      61: ldc           #32                 // String Day01
      63: invokestatic  #14                 // Method UtilsKt.readInput:(Ljava/lang/String;)Ljava/util/List;
      66: astore_1
      67: aload_1
      68: invokestatic  #18                 // Method main$part1:(Ljava/util/List;)I
      71: istore_2
      72: getstatic     #38                 // Field java/lang/System.out:Ljava/io/PrintStream;
      75: iload_2
      76: invokevirtual #44                 // Method java/io/PrintStream.println:(I)V
      79: aload_1
      80: invokestatic  #29                 // Method main$part2:(Ljava/util/List;)I
      83: istore_2
      84: getstatic     #38                 // Field java/lang/System.out:Ljava/io/PrintStream;
      87: iload_2
      88: invokevirtual #44                 // Method java/io/PrintStream.println:(I)V
      91: return

  public static void main(java.lang.String[]);
    Code:
       0: invokestatic  #52                 // Method main:()V
       3: return

  private static final java.util.List<java.lang.Integer> main$elfTotals(java.util.List<java.lang.String>, int, int, java.util.List<java.lang.Integer>);
    Code:
       0: iload_1
       1: aload_0
       2: invokeinterface #61,  1           // InterfaceMethod java/util/List.size:()I
       7: if_icmplt     22
      10: aload_3
      11: checkcast     #63                 // class java/util/Collection
      14: iload_2
      15: invokestatic  #69                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      18: invokestatic  #75                 // Method kotlin/collections/CollectionsKt.plus:(Ljava/util/Collection;Ljava/lang/Object;)Ljava/util/List;
      21: areturn
      22: aload_0
      23: iload_1
      24: iconst_1
      25: iadd
      26: aload_0
      27: iload_1
      28: invokeinterface #79,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      33: checkcast     #81                 // class java/lang/CharSequence
      36: invokestatic  #87                 // Method kotlin/text/StringsKt.isBlank:(Ljava/lang/CharSequence;)Z
      39: ifeq          46
      42: iconst_0
      43: goto          61
      46: iload_2
      47: aload_0
      48: iload_1
      49: invokeinterface #79,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      54: checkcast     #89                 // class java/lang/String
      57: invokestatic  #93                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      60: iadd
      61: aload_0
      62: iload_1
      63: invokeinterface #79,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      68: checkcast     #81                 // class java/lang/CharSequence
      71: invokestatic  #87                 // Method kotlin/text/StringsKt.isBlank:(Ljava/lang/CharSequence;)Z
      74: ifeq          91
      77: aload_3
      78: checkcast     #63                 // class java/util/Collection
      81: iload_2
      82: invokestatic  #69                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      85: invokestatic  #75                 // Method kotlin/collections/CollectionsKt.plus:(Ljava/util/Collection;Ljava/lang/Object;)Ljava/util/List;
      88: goto          92
      91: aload_3
      92: invokestatic  #95                 // Method main$elfTotals:(Ljava/util/List;IILjava/util/List;)Ljava/util/List;
      95: areturn

  static java.util.List main$elfTotals$default(java.util.List, int, int, java.util.List, int, java.lang.Object);
    Code:
       0: iload         4
       2: iconst_2
       3: iand
       4: ifeq          9
       7: iconst_0
       8: istore_1
       9: iload         4
      11: iconst_4
      12: iand
      13: ifeq          18
      16: iconst_0
      17: istore_2
      18: iload         4
      20: bipush        8
      22: iand
      23: ifeq          30
      26: invokestatic  #105                // Method kotlin/collections/CollectionsKt.emptyList:()Ljava/util/List;
      29: astore_3
      30: aload_0
      31: iload_1
      32: iload_2
      33: aload_3
      34: invokestatic  #95                 // Method main$elfTotals:(Ljava/util/List;IILjava/util/List;)Ljava/util/List;
      37: areturn

  private static final int main$part1(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: iconst_0
       2: iconst_0
       3: aconst_null
       4: bipush        14
       6: aconst_null
       7: invokestatic  #108                // Method main$elfTotals$default:(Ljava/util/List;IILjava/util/List;ILjava/lang/Object;)Ljava/util/List;
      10: checkcast     #110                // class java/lang/Iterable
      13: invokeinterface #114,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      18: astore_1
      19: aload_1
      20: invokeinterface #120,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      25: ifne          36
      28: new           #122                // class java/util/NoSuchElementException
      31: dup
      32: invokespecial #124                // Method java/util/NoSuchElementException."<init>":()V
      35: athrow
      36: aload_1
      37: invokeinterface #128,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      42: checkcast     #130                // class java/lang/Number
      45: invokevirtual #133                // Method java/lang/Number.intValue:()I
      48: istore_2
      49: iconst_0
      50: istore_3
      51: iload_2
      52: istore_2
      53: aload_1
      54: invokeinterface #120,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      59: ifeq          90
      62: aload_1
      63: invokeinterface #128,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      68: checkcast     #130                // class java/lang/Number
      71: invokevirtual #133                // Method java/lang/Number.intValue:()I
      74: istore_3
      75: iconst_0
      76: istore        4
      78: iload_3
      79: istore_3
      80: iload_2
      81: iload_3
      82: if_icmpge     53
      85: iload_3
      86: istore_2
      87: goto          53
      90: iload_2
      91: ireturn

  private static final int main$part2(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: iconst_0
       2: iconst_0
       3: aconst_null
       4: bipush        14
       6: aconst_null
       7: invokestatic  #108                // Method main$elfTotals$default:(Ljava/util/List;IILjava/util/List;ILjava/lang/Object;)Ljava/util/List;
      10: astore_1
      11: aload_1
      12: checkcast     #110                // class java/lang/Iterable
      15: invokestatic  #139                // Method kotlin/collections/CollectionsKt.sortedDescending:(Ljava/lang/Iterable;)Ljava/util/List;
      18: checkcast     #110                // class java/lang/Iterable
      21: iconst_3
      22: invokestatic  #143                // Method kotlin/collections/CollectionsKt.take:(Ljava/lang/Iterable;I)Ljava/util/List;
      25: checkcast     #110                // class java/lang/Iterable
      28: invokestatic  #147                // Method kotlin/collections/CollectionsKt.sumOfInt:(Ljava/lang/Iterable;)I
      31: ireturn
}