private data class CurrentUnit(var pile: Int = 500, var height: Int = 0) {
    fun diagonalMove(piles: Map<Int, Set<Int>>): Boolean {
        if (piles[pile - 1] == null || !piles[pile - 1]!!.contains(height + 1)) {
            pile--
            height++

            return true
        }

        if (piles[pile + 1] == null || !piles[pile + 1]!!.contains(height + 1)) {
            pile++
            height++

            return true
        }

        return false
    }

    fun reset(): Boolean {
        if (pile == 500 && height == 0) return false

        pile = 500
        height = 0

        return true
    }
}

private fun getPoints(input: List<String>) = input.map { line ->
    line.split(" -> ")
        .map { it.split(',').map(String::toInt) }
        .map { (first, second) -> first to second }
}

private fun getPiles(points: List<List<Pair<Int, Int>>>): MutableMap<Int, MutableSet<Int>> {
    val piles = mutableMapOf<Int, MutableSet<Int>>()

    points.forEach { line ->
        line.zipWithNext().forEach { (start, end) ->
            val (minPoint, maxPoint) = if (start < end) start to end else end to start
            val (x, y) = maxPoint - minPoint

            for (i in 0..x) {
                for (j in 0..y) {
                    piles.computeIfAbsent(minPoint.first + i) { mutableSetOf() }.add(minPoint.second + j)
                }
            }
        }
    }

    return piles
}

private fun Set<Int>.fallUnitOrNull(height: Int) = this.filter { it > height }.minOrNull()

fun main() {
    fun part1(input: List<String>): Int {
        val piles = getPiles(getPoints(input))

        var cnt = 0
        val point = CurrentUnit()
        while (true) {
            val pile = piles[point.pile]
            point.height = pile?.fallUnitOrNull(point.height) ?: return cnt
            point.height--

            if (point.diagonalMove(piles)) continue

            pile.add(point.height)
            cnt++

            point.reset()
        }
    }

    fun part2(input: List<String>): Int {
        val piles = getPiles(getPoints(input))
        val floor = piles.values.maxOf { it.max() } + 2

        var cnt = 0
        val point = CurrentUnit()
        while (true) {
            val pile = piles.computeIfAbsent(point.pile) { mutableSetOf(floor) }

            point.height = pile.fallUnitOrNull(point.height) ?: floor
            point.height--

            if (point.height != floor - 1 && point.diagonalMove(piles)) continue

            pile.add(point.height)
            cnt++

            if (!point.reset()) return cnt
        }
    }

    // test if implementation meets criteria from the description, like:
    val testInput = readInput("Day14_test")
    check(part1(testInput) == 24)
    check(part2(testInput) == 93)

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

Compiled from "Day14.kt"
public final class Day14Kt {
  private static final java.util.List<java.util.List<kotlin.Pair<java.lang.Integer, java.lang.Integer>>> getPoints(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: checkcast     #9                  // class java/lang/Iterable
       4: astore_1
       5: iconst_0
       6: istore_2
       7: aload_1
       8: astore_3
       9: new           #11                 // class java/util/ArrayList
      12: dup
      13: aload_1
      14: bipush        10
      16: invokestatic  #17                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      19: invokespecial #21                 // Method java/util/ArrayList."<init>":(I)V
      22: checkcast     #23                 // class java/util/Collection
      25: astore        4
      27: iconst_0
      28: istore        5
      30: aload_3
      31: invokeinterface #27,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      36: astore        6
      38: aload         6
      40: invokeinterface #33,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      45: ifeq          476
      48: aload         6
      50: invokeinterface #37,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      55: astore        7
      57: aload         4
      59: aload         7
      61: checkcast     #39                 // class java/lang/String
      64: astore        8
      66: astore        30
      68: iconst_0
      69: istore        9
      71: aload         8
      73: checkcast     #41                 // class java/lang/CharSequence
      76: iconst_1
      77: anewarray     #39                 // class java/lang/String
      80: astore        10
      82: aload         10
      84: iconst_0
      85: ldc           #43                 // String  ->
      87: aastore
      88: aload         10
      90: iconst_0
      91: iconst_0
      92: bipush        6
      94: aconst_null
      95: invokestatic  #49                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      98: checkcast     #9                  // class java/lang/Iterable
     101: astore        10
     103: nop
     104: iconst_0
     105: istore        11
     107: aload         10
     109: astore        12
     111: new           #11                 // class java/util/ArrayList
     114: dup
     115: aload         10
     117: bipush        10
     119: invokestatic  #17                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     122: invokespecial #21                 // Method java/util/ArrayList."<init>":(I)V
     125: checkcast     #23                 // class java/util/Collection
     128: astore        13
     130: iconst_0
     131: istore        14
     133: aload         12
     135: invokeinterface #27,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     140: astore        15
     142: aload         15
     144: invokeinterface #33,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     149: ifeq          317
     152: aload         15
     154: invokeinterface #37,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     159: astore        16
     161: aload         13
     163: aload         16
     165: checkcast     #39                 // class java/lang/String
     168: astore        17
     170: astore        18
     172: iconst_0
     173: istore        19
     175: aload         17
     177: checkcast     #41                 // class java/lang/CharSequence
     180: iconst_1
     181: newarray       char
     183: astore        20
     185: aload         20
     187: iconst_0
     188: bipush        44
     190: castore
     191: aload         20
     193: iconst_0
     194: iconst_0
     195: bipush        6
     197: aconst_null
     198: invokestatic  #52                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[CZIILjava/lang/Object;)Ljava/util/List;
     201: checkcast     #9                  // class java/lang/Iterable
     204: astore        20
     206: iconst_0
     207: istore        21
     209: aload         20
     211: astore        22
     213: new           #11                 // class java/util/ArrayList
     216: dup
     217: aload         20
     219: bipush        10
     221: invokestatic  #17                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     224: invokespecial #21                 // Method java/util/ArrayList."<init>":(I)V
     227: checkcast     #23                 // class java/util/Collection
     230: astore        23
     232: iconst_0
     233: istore        24
     235: aload         22
     237: invokeinterface #27,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     242: astore        25
     244: aload         25
     246: invokeinterface #33,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     251: ifeq          298
     254: aload         25
     256: invokeinterface #37,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     261: astore        26
     263: aload         23
     265: aload         26
     267: checkcast     #39                 // class java/lang/String
     270: astore        27
     272: astore        28
     274: iconst_0
     275: istore        29
     277: aload         27
     279: invokestatic  #58                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     282: nop
     283: invokestatic  #62                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     286: aload         28
     288: swap
     289: invokeinterface #66,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     294: pop
     295: goto          244
     298: aload         23
     300: checkcast     #68                 // class java/util/List
     303: nop
     304: nop
     305: aload         18
     307: swap
     308: invokeinterface #66,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     313: pop
     314: goto          142
     317: aload         13
     319: checkcast     #68                 // class java/util/List
     322: nop
     323: checkcast     #9                  // class java/lang/Iterable
     326: astore        10
     328: nop
     329: iconst_0
     330: istore        11
     332: aload         10
     334: astore        12
     336: new           #11                 // class java/util/ArrayList
     339: dup
     340: aload         10
     342: bipush        10
     344: invokestatic  #17                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     347: invokespecial #21                 // Method java/util/ArrayList."<init>":(I)V
     350: checkcast     #23                 // class java/util/Collection
     353: astore        13
     355: iconst_0
     356: istore        14
     358: aload         12
     360: invokeinterface #27,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     365: astore        15
     367: aload         15
     369: invokeinterface #33,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     374: ifeq          457
     377: aload         15
     379: invokeinterface #37,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     384: astore        16
     386: aload         13
     388: aload         16
     390: checkcast     #68                 // class java/util/List
     393: astore        17
     395: astore        18
     397: iconst_0
     398: istore        19
     400: aload         17
     402: iconst_0
     403: invokeinterface #72,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     408: checkcast     #74                 // class java/lang/Number
     411: invokevirtual #78                 // Method java/lang/Number.intValue:()I
     414: istore        20
     416: aload         17
     418: iconst_1
     419: invokeinterface #72,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     424: checkcast     #74                 // class java/lang/Number
     427: invokevirtual #78                 // Method java/lang/Number.intValue:()I
     430: istore        21
     432: iload         20
     434: invokestatic  #62                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     437: iload         21
     439: invokestatic  #62                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     442: invokestatic  #84                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     445: aload         18
     447: swap
     448: invokeinterface #66,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     453: pop
     454: goto          367
     457: aload         13
     459: checkcast     #68                 // class java/util/List
     462: nop
     463: nop
     464: aload         30
     466: swap
     467: invokeinterface #66,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     472: pop
     473: goto          38
     476: aload         4
     478: checkcast     #68                 // class java/util/List
     481: nop
     482: areturn

  private static final java.util.Map<java.lang.Integer, java.util.Set<java.lang.Integer>> getPiles(java.util.List<? extends java.util.List<kotlin.Pair<java.lang.Integer, java.lang.Integer>>>);
    Code:
       0: new           #111                // class java/util/LinkedHashMap
       3: dup
       4: invokespecial #114                // Method java/util/LinkedHashMap."<init>":()V
       7: checkcast     #116                // class java/util/Map
      10: astore_1
      11: aload_0
      12: checkcast     #9                  // class java/lang/Iterable
      15: astore_2
      16: iconst_0
      17: istore_3
      18: aload_2
      19: invokeinterface #27,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      24: astore        4
      26: aload         4
      28: invokeinterface #33,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      33: ifeq          329
      36: aload         4
      38: invokeinterface #37,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      43: astore        5
      45: aload         5
      47: checkcast     #68                 // class java/util/List
      50: astore        6
      52: iconst_0
      53: istore        7
      55: aload         6
      57: checkcast     #9                  // class java/lang/Iterable
      60: invokestatic  #120                // Method kotlin/collections/CollectionsKt.zipWithNext:(Ljava/lang/Iterable;)Ljava/util/List;
      63: checkcast     #9                  // class java/lang/Iterable
      66: astore        8
      68: iconst_0
      69: istore        9
      71: aload         8
      73: invokeinterface #27,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      78: astore        10
      80: aload         10
      82: invokeinterface #33,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      87: ifeq          323
      90: aload         10
      92: invokeinterface #37,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      97: astore        11
      99: aload         11
     101: checkcast     #122                // class kotlin/Pair
     104: astore        12
     106: iconst_0
     107: istore        13
     109: aload         12
     111: invokevirtual #125                // Method kotlin/Pair.component1:()Ljava/lang/Object;
     114: checkcast     #122                // class kotlin/Pair
     117: astore        14
     119: aload         12
     121: invokevirtual #128                // Method kotlin/Pair.component2:()Ljava/lang/Object;
     124: checkcast     #122                // class kotlin/Pair
     127: astore        15
     129: aload         14
     131: aload         15
     133: invokestatic  #134                // Method UtilsKt.compareTo:(Lkotlin/Pair;Lkotlin/Pair;)I
     136: ifge          149
     139: aload         14
     141: aload         15
     143: invokestatic  #84                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     146: goto          156
     149: aload         15
     151: aload         14
     153: invokestatic  #84                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     156: astore        16
     158: aload         16
     160: invokevirtual #125                // Method kotlin/Pair.component1:()Ljava/lang/Object;
     163: checkcast     #122                // class kotlin/Pair
     166: astore        17
     168: aload         16
     170: invokevirtual #128                // Method kotlin/Pair.component2:()Ljava/lang/Object;
     173: checkcast     #122                // class kotlin/Pair
     176: astore        18
     178: aload         18
     180: aload         17
     182: invokestatic  #138                // Method UtilsKt.minus:(Lkotlin/Pair;Lkotlin/Pair;)Lkotlin/Pair;
     185: astore        19
     187: aload         19
     189: invokevirtual #125                // Method kotlin/Pair.component1:()Ljava/lang/Object;
     192: checkcast     #74                 // class java/lang/Number
     195: invokevirtual #78                 // Method java/lang/Number.intValue:()I
     198: istore        20
     200: aload         19
     202: invokevirtual #128                // Method kotlin/Pair.component2:()Ljava/lang/Object;
     205: checkcast     #74                 // class java/lang/Number
     208: invokevirtual #78                 // Method java/lang/Number.intValue:()I
     211: istore        21
     213: iconst_0
     214: istore        22
     216: iload         22
     218: iload         20
     220: if_icmpgt     318
     223: iconst_0
     224: istore        23
     226: iload         23
     228: iload         21
     230: if_icmpgt     305
     233: aload_1
     234: aload         17
     236: invokevirtual #141                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     239: checkcast     #74                 // class java/lang/Number
     242: invokevirtual #78                 // Method java/lang/Number.intValue:()I
     245: iload         22
     247: iadd
     248: invokestatic  #62                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     251: invokedynamic #160,  0            // InvokeDynamic #0:invoke:()Lkotlin/jvm/functions/Function1;
     256: invokedynamic #171,  0            // InvokeDynamic #1:apply:(Lkotlin/jvm/functions/Function1;)Ljava/util/function/Function;
     261: invokeinterface #175,  3          // InterfaceMethod java/util/Map.computeIfAbsent:(Ljava/lang/Object;Ljava/util/function/Function;)Ljava/lang/Object;
     266: checkcast     #177                // class java/util/Set
     269: aload         17
     271: invokevirtual #180                // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
     274: checkcast     #74                 // class java/lang/Number
     277: invokevirtual #78                 // Method java/lang/Number.intValue:()I
     280: iload         23
     282: iadd
     283: invokestatic  #62                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     286: invokeinterface #181,  2          // InterfaceMethod java/util/Set.add:(Ljava/lang/Object;)Z
     291: pop
     292: iload         23
     294: iload         21
     296: if_icmpeq     305
     299: iinc          23, 1
     302: goto          233
     305: iload         22
     307: iload         20
     309: if_icmpeq     318
     312: iinc          22, 1
     315: goto          223
     318: nop
     319: nop
     320: goto          80
     323: nop
     324: nop
     325: nop
     326: goto          26
     329: nop
     330: aload_1
     331: areturn

  private static final java.lang.Integer fallUnitOrNull(java.util.Set<java.lang.Integer>, int);
    Code:
       0: aload_0
       1: checkcast     #9                  // class java/lang/Iterable
       4: astore_2
       5: iconst_0
       6: istore_3
       7: aload_2
       8: astore        4
      10: new           #11                 // class java/util/ArrayList
      13: dup
      14: invokespecial #202                // Method java/util/ArrayList."<init>":()V
      17: checkcast     #23                 // class java/util/Collection
      20: astore        5
      22: iconst_0
      23: istore        6
      25: aload         4
      27: invokeinterface #27,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      32: astore        7
      34: aload         7
      36: invokeinterface #33,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      41: ifeq          93
      44: aload         7
      46: invokeinterface #37,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      51: astore        8
      53: aload         8
      55: checkcast     #74                 // class java/lang/Number
      58: invokevirtual #78                 // Method java/lang/Number.intValue:()I
      61: istore        9
      63: iconst_0
      64: istore        10
      66: iload         9
      68: iload_1
      69: if_icmple     76
      72: iconst_1
      73: goto          77
      76: iconst_0
      77: ifeq          34
      80: aload         5
      82: aload         8
      84: invokeinterface #66,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
      89: pop
      90: goto          34
      93: aload         5
      95: checkcast     #68                 // class java/util/List
      98: nop
      99: checkcast     #9                  // class java/lang/Iterable
     102: invokestatic  #206                // Method kotlin/collections/CollectionsKt.minOrNull:(Ljava/lang/Iterable;)Ljava/lang/Comparable;
     105: checkcast     #54                 // class java/lang/Integer
     108: areturn

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

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

  private static final java.util.Set getPiles$lambda$6$lambda$5$lambda$3(java.lang.Integer);
    Code:
       0: aload_0
       1: ldc_w         #256                // String it
       4: invokestatic  #262                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: new           #264                // class java/util/LinkedHashSet
      10: dup
      11: invokespecial #265                // Method java/util/LinkedHashSet."<init>":()V
      14: checkcast     #177                // class java/util/Set
      17: areturn

  private static final java.util.Set getPiles$lambda$6$lambda$5$lambda$4(kotlin.jvm.functions.Function1, java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: invokeinterface #270,  2          // InterfaceMethod kotlin/jvm/functions/Function1.invoke:(Ljava/lang/Object;)Ljava/lang/Object;
       7: checkcast     #177                // class java/util/Set
      10: areturn

  private static final int main$part1(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: invokestatic  #275                // Method getPoints:(Ljava/util/List;)Ljava/util/List;
       4: invokestatic  #277                // Method getPiles:(Ljava/util/List;)Ljava/util/Map;
       7: astore_1
       8: iconst_0
       9: istore_2
      10: new           #279                // class CurrentUnit
      13: dup
      14: iconst_0
      15: iconst_0
      16: iconst_3
      17: aconst_null
      18: invokespecial #282                // Method CurrentUnit."<init>":(IIILkotlin/jvm/internal/DefaultConstructorMarker;)V
      21: astore_3
      22: nop
      23: aload_1
      24: aload_3
      25: invokevirtual #285                // Method CurrentUnit.getPile:()I
      28: invokestatic  #62                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      31: invokeinterface #287,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
      36: checkcast     #177                // class java/util/Set
      39: astore        4
      41: aload_3
      42: aload         4
      44: dup
      45: ifnull        65
      48: aload_3
      49: invokevirtual #290                // Method CurrentUnit.getHeight:()I
      52: invokestatic  #292                // Method fallUnitOrNull:(Ljava/util/Set;I)Ljava/lang/Integer;
      55: dup
      56: ifnull        65
      59: invokevirtual #293                // Method java/lang/Integer.intValue:()I
      62: goto          68
      65: pop
      66: iload_2
      67: ireturn
      68: invokevirtual #296                // Method CurrentUnit.setHeight:(I)V
      71: aload_3
      72: invokevirtual #290                // Method CurrentUnit.getHeight:()I
      75: istore        5
      77: aload_3
      78: iload         5
      80: iconst_m1
      81: iadd
      82: invokevirtual #296                // Method CurrentUnit.setHeight:(I)V
      85: aload_3
      86: aload_1
      87: invokevirtual #300                // Method CurrentUnit.diagonalMove:(Ljava/util/Map;)Z
      90: ifne          22
      93: aload         4
      95: aload_3
      96: invokevirtual #290                // Method CurrentUnit.getHeight:()I
      99: invokestatic  #62                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     102: invokeinterface #181,  2          // InterfaceMethod java/util/Set.add:(Ljava/lang/Object;)Z
     107: pop
     108: iinc          2, 1
     111: aload_3
     112: invokevirtual #303                // Method CurrentUnit.reset:()Z
     115: pop
     116: goto          22

  private static final java.util.Set main$part2$lambda$9(int, java.lang.Integer);
    Code:
       0: aload_1
       1: ldc_w         #256                // String it
       4: invokestatic  #262                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: iconst_1
       8: anewarray     #54                 // class java/lang/Integer
      11: astore_2
      12: aload_2
      13: iconst_0
      14: iload_0
      15: invokestatic  #62                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      18: aastore
      19: aload_2
      20: invokestatic  #315                // Method kotlin/collections/SetsKt.mutableSetOf:([Ljava/lang/Object;)Ljava/util/Set;
      23: areturn

  private static final java.util.Set main$part2$lambda$10(kotlin.jvm.functions.Function1, java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: invokeinterface #270,  2          // InterfaceMethod kotlin/jvm/functions/Function1.invoke:(Ljava/lang/Object;)Ljava/lang/Object;
       7: checkcast     #177                // class java/util/Set
      10: areturn

  private static final int main$part2(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: invokestatic  #275                // Method getPoints:(Ljava/util/List;)Ljava/util/List;
       4: invokestatic  #277                // Method getPiles:(Ljava/util/List;)Ljava/util/Map;
       7: astore_1
       8: aload_1
       9: invokeinterface #321,  1          // InterfaceMethod java/util/Map.values:()Ljava/util/Collection;
      14: checkcast     #9                  // class java/lang/Iterable
      17: invokeinterface #27,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      22: astore        4
      24: aload         4
      26: invokeinterface #33,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      31: ifne          42
      34: new           #323                // class java/util/NoSuchElementException
      37: dup
      38: invokespecial #324                // Method java/util/NoSuchElementException."<init>":()V
      41: athrow
      42: aload         4
      44: invokeinterface #37,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      49: checkcast     #177                // class java/util/Set
      52: astore        5
      54: iconst_0
      55: istore        6
      57: aload         5
      59: checkcast     #9                  // class java/lang/Iterable
      62: invokestatic  #327                // Method kotlin/collections/CollectionsKt.maxOrThrow:(Ljava/lang/Iterable;)Ljava/lang/Comparable;
      65: checkcast     #74                 // class java/lang/Number
      68: invokevirtual #78                 // Method java/lang/Number.intValue:()I
      71: istore        5
      73: aload         4
      75: invokeinterface #33,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      80: ifeq          128
      83: aload         4
      85: invokeinterface #37,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      90: checkcast     #177                // class java/util/Set
      93: astore        6
      95: iconst_0
      96: istore        7
      98: aload         6
     100: checkcast     #9                  // class java/lang/Iterable
     103: invokestatic  #327                // Method kotlin/collections/CollectionsKt.maxOrThrow:(Ljava/lang/Iterable;)Ljava/lang/Comparable;
     106: checkcast     #74                 // class java/lang/Number
     109: invokevirtual #78                 // Method java/lang/Number.intValue:()I
     112: istore        6
     114: iload         5
     116: iload         6
     118: if_icmpge     73
     121: iload         6
     123: istore        5
     125: goto          73
     128: iload         5
     130: iconst_2
     131: iadd
     132: istore_2
     133: iconst_0
     134: istore_3
     135: new           #279                // class CurrentUnit
     138: dup
     139: iconst_0
     140: iconst_0
     141: iconst_3
     142: aconst_null
     143: invokespecial #282                // Method CurrentUnit."<init>":(IIILkotlin/jvm/internal/DefaultConstructorMarker;)V
     146: astore        4
     148: nop
     149: aload_1
     150: aload         4
     152: invokevirtual #285                // Method CurrentUnit.getPile:()I
     155: invokestatic  #62                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     158: iload_2
     159: invokedynamic #333,  0            // InvokeDynamic #2:invoke:(I)Lkotlin/jvm/functions/Function1;
     164: invokedynamic #337,  0            // InvokeDynamic #3:apply:(Lkotlin/jvm/functions/Function1;)Ljava/util/function/Function;
     169: invokeinterface #175,  3          // InterfaceMethod java/util/Map.computeIfAbsent:(Ljava/lang/Object;Ljava/util/function/Function;)Ljava/lang/Object;
     174: dup
     175: ldc_w         #339                // String computeIfAbsent(...)
     178: invokestatic  #342                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     181: checkcast     #177                // class java/util/Set
     184: astore        5
     186: aload         4
     188: aload         5
     190: aload         4
     192: invokevirtual #290                // Method CurrentUnit.getHeight:()I
     195: invokestatic  #292                // Method fallUnitOrNull:(Ljava/util/Set;I)Ljava/lang/Integer;
     198: dup
     199: ifnull        208
     202: invokevirtual #293                // Method java/lang/Integer.intValue:()I
     205: goto          210
     208: pop
     209: iload_2
     210: invokevirtual #296                // Method CurrentUnit.setHeight:(I)V
     213: aload         4
     215: invokevirtual #290                // Method CurrentUnit.getHeight:()I
     218: istore        6
     220: aload         4
     222: iload         6
     224: iconst_m1
     225: iadd
     226: invokevirtual #296                // Method CurrentUnit.setHeight:(I)V
     229: aload         4
     231: invokevirtual #290                // Method CurrentUnit.getHeight:()I
     234: iload_2
     235: iconst_1
     236: isub
     237: if_icmpeq     249
     240: aload         4
     242: aload_1
     243: invokevirtual #300                // Method CurrentUnit.diagonalMove:(Ljava/util/Map;)Z
     246: ifne          148
     249: aload         5
     251: aload         4
     253: invokevirtual #290                // Method CurrentUnit.getHeight:()I
     256: invokestatic  #62                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     259: invokeinterface #181,  2          // InterfaceMethod java/util/Set.add:(Ljava/lang/Object;)Z
     264: pop
     265: iinc          3, 1
     268: aload         4
     270: invokevirtual #303                // Method CurrentUnit.reset:()Z
     273: ifne          148
     276: iload_3
     277: ireturn
}


private fun rangesPairList(input: List<String>) = input.map { "(\\d+)-(\\d+),(\\d+)-(\\d+)".toRegex().find(it)!!.destructured }
    .map { (l1, l2, r1, r2) -> (l1.toInt() to l2.toInt()) to (r1.toInt() to r2.toInt()) }

fun main() {
    fun part1(input: List<String>) = rangesPairList(input).sumOf { (first, second) -> first.include(second).toInt() }

    fun part2(input: List<String>) = rangesPairList(input).sumOf { (first, second) -> first.intersect(second).toInt() }

    // test if implementation meets criteria from the description, like:
    val testInput = readInput("Day04_test")
    check(part1(testInput) == 2)
    check(part2(testInput) == 4)

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

Compiled from "Day04.kt"
public final class Day04Kt {
  private static final java.util.List<kotlin.Pair<kotlin.Pair<java.lang.Integer, java.lang.Integer>, kotlin.Pair<java.lang.Integer, java.lang.Integer>>> rangesPairList(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: checkcast     #9                  // class java/lang/Iterable
       4: astore_1
       5: iconst_0
       6: istore_2
       7: aload_1
       8: astore_3
       9: new           #11                 // class java/util/ArrayList
      12: dup
      13: aload_1
      14: bipush        10
      16: invokestatic  #17                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      19: invokespecial #21                 // Method java/util/ArrayList."<init>":(I)V
      22: checkcast     #23                 // class java/util/Collection
      25: astore        4
      27: iconst_0
      28: istore        5
      30: aload_3
      31: invokeinterface #27,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      36: astore        6
      38: aload         6
      40: invokeinterface #33,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      45: ifeq          112
      48: aload         6
      50: invokeinterface #37,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      55: astore        7
      57: aload         4
      59: aload         7
      61: checkcast     #39                 // class java/lang/String
      64: astore        8
      66: astore        14
      68: iconst_0
      69: istore        9
      71: new           #41                 // class kotlin/text/Regex
      74: dup
      75: ldc           #43                 // String (\\d+)-(\\d+),(\\d+)-(\\d+)
      77: invokespecial #46                 // Method kotlin/text/Regex."<init>":(Ljava/lang/String;)V
      80: aload         8
      82: checkcast     #48                 // class java/lang/CharSequence
      85: iconst_0
      86: iconst_2
      87: aconst_null
      88: invokestatic  #52                 // Method kotlin/text/Regex.find$default:(Lkotlin/text/Regex;Ljava/lang/CharSequence;IILjava/lang/Object;)Lkotlin/text/MatchResult;
      91: dup
      92: invokestatic  #58                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      95: invokeinterface #64,  1           // InterfaceMethod kotlin/text/MatchResult.getDestructured:()Lkotlin/text/MatchResult$Destructured;
     100: aload         14
     102: swap
     103: invokeinterface #68,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     108: pop
     109: goto          38
     112: aload         4
     114: checkcast     #70                 // class java/util/List
     117: nop
     118: checkcast     #9                  // class java/lang/Iterable
     121: astore_1
     122: nop
     123: iconst_0
     124: istore_2
     125: aload_1
     126: astore_3
     127: new           #11                 // class java/util/ArrayList
     130: dup
     131: aload_1
     132: bipush        10
     134: invokestatic  #17                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     137: invokespecial #21                 // Method java/util/ArrayList."<init>":(I)V
     140: checkcast     #23                 // class java/util/Collection
     143: astore        4
     145: iconst_0
     146: istore        5
     148: aload_3
     149: invokeinterface #27,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     154: astore        6
     156: aload         6
     158: invokeinterface #33,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     163: ifeq          326
     166: aload         6
     168: invokeinterface #37,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     173: astore        7
     175: aload         4
     177: aload         7
     179: checkcast     #72                 // class kotlin/text/MatchResult$Destructured
     182: astore        8
     184: astore        14
     186: iconst_0
     187: istore        9
     189: aload         8
     191: invokevirtual #76                 // Method kotlin/text/MatchResult$Destructured.getMatch:()Lkotlin/text/MatchResult;
     194: invokeinterface #80,  1           // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;
     199: iconst_1
     200: invokeinterface #84,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     205: checkcast     #39                 // class java/lang/String
     208: astore        10
     210: aload         8
     212: invokevirtual #76                 // Method kotlin/text/MatchResult$Destructured.getMatch:()Lkotlin/text/MatchResult;
     215: invokeinterface #80,  1           // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;
     220: iconst_2
     221: invokeinterface #84,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     226: checkcast     #39                 // class java/lang/String
     229: astore        11
     231: aload         8
     233: invokevirtual #76                 // Method kotlin/text/MatchResult$Destructured.getMatch:()Lkotlin/text/MatchResult;
     236: invokeinterface #80,  1           // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;
     241: iconst_3
     242: invokeinterface #84,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     247: checkcast     #39                 // class java/lang/String
     250: astore        12
     252: aload         8
     254: invokevirtual #76                 // Method kotlin/text/MatchResult$Destructured.getMatch:()Lkotlin/text/MatchResult;
     257: invokeinterface #80,  1           // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;
     262: iconst_4
     263: invokeinterface #84,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     268: checkcast     #39                 // class java/lang/String
     271: astore        13
     273: aload         10
     275: invokestatic  #90                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     278: invokestatic  #94                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     281: aload         11
     283: invokestatic  #90                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     286: invokestatic  #94                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     289: invokestatic  #100                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     292: aload         12
     294: invokestatic  #90                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     297: invokestatic  #94                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     300: aload         13
     302: invokestatic  #90                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     305: invokestatic  #94                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     308: invokestatic  #100                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     311: invokestatic  #100                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     314: aload         14
     316: swap
     317: invokeinterface #68,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     322: pop
     323: goto          156
     326: aload         4
     328: checkcast     #70                 // class java/util/List
     331: nop
     332: areturn

  public static final void main();
    Code:
       0: ldc           #124                // String Day04_test
       2: invokestatic  #130                // Method UtilsKt.readInput:(Ljava/lang/String;)Ljava/util/List;
       5: astore_0
       6: aload_0
       7: invokestatic  #134                // Method main$part1:(Ljava/util/List;)I
      10: iconst_2
      11: if_icmpne     18
      14: iconst_1
      15: goto          19
      18: iconst_0
      19: ifne          32
      22: new           #136                // class java/lang/IllegalStateException
      25: dup
      26: ldc           #138                // String Check failed.
      28: invokespecial #139                // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
      31: athrow
      32: aload_0
      33: invokestatic  #142                // Method main$part2:(Ljava/util/List;)I
      36: iconst_4
      37: if_icmpne     44
      40: iconst_1
      41: goto          45
      44: iconst_0
      45: ifne          58
      48: new           #136                // class java/lang/IllegalStateException
      51: dup
      52: ldc           #138                // String Check failed.
      54: invokespecial #139                // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
      57: athrow
      58: ldc           #144                // String Day04
      60: invokestatic  #130                // Method UtilsKt.readInput:(Ljava/lang/String;)Ljava/util/List;
      63: astore_1
      64: aload_1
      65: invokestatic  #134                // Method main$part1:(Ljava/util/List;)I
      68: istore_2
      69: getstatic     #150                // Field java/lang/System.out:Ljava/io/PrintStream;
      72: iload_2
      73: invokevirtual #155                // Method java/io/PrintStream.println:(I)V
      76: aload_1
      77: invokestatic  #142                // Method main$part2:(Ljava/util/List;)I
      80: istore_2
      81: getstatic     #150                // Field java/lang/System.out:Ljava/io/PrintStream;
      84: iload_2
      85: invokevirtual #155                // Method java/io/PrintStream.println:(I)V
      88: return

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

  private static final int main$part1(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: invokestatic  #164                // Method rangesPairList:(Ljava/util/List;)Ljava/util/List;
       4: checkcast     #9                  // class java/lang/Iterable
       7: astore_1
       8: iconst_0
       9: istore_2
      10: aload_1
      11: invokeinterface #27,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      16: astore_3
      17: aload_3
      18: invokeinterface #33,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      23: ifeq          88
      26: aload_3
      27: invokeinterface #37,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      32: astore        4
      34: iload_2
      35: aload         4
      37: checkcast     #166                // class kotlin/Pair
      40: astore        5
      42: istore        9
      44: iconst_0
      45: istore        6
      47: aload         5
      49: invokevirtual #169                // Method kotlin/Pair.component1:()Ljava/lang/Object;
      52: checkcast     #166                // class kotlin/Pair
      55: astore        7
      57: aload         5
      59: invokevirtual #172                // Method kotlin/Pair.component2:()Ljava/lang/Object;
      62: checkcast     #166                // class kotlin/Pair
      65: astore        8
      67: aload         7
      69: aload         8
      71: invokestatic  #176                // Method UtilsKt.include:(Lkotlin/Pair;Lkotlin/Pair;)Z
      74: invokestatic  #180                // Method UtilsKt.toInt:(Z)I
      77: istore        10
      79: iload         9
      81: iload         10
      83: iadd
      84: istore_2
      85: goto          17
      88: iload_2
      89: ireturn

  private static final int main$part2(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: invokestatic  #164                // Method rangesPairList:(Ljava/util/List;)Ljava/util/List;
       4: checkcast     #9                  // class java/lang/Iterable
       7: astore_1
       8: iconst_0
       9: istore_2
      10: aload_1
      11: invokeinterface #27,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      16: astore_3
      17: aload_3
      18: invokeinterface #33,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      23: ifeq          88
      26: aload_3
      27: invokeinterface #37,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      32: astore        4
      34: iload_2
      35: aload         4
      37: checkcast     #166                // class kotlin/Pair
      40: astore        5
      42: istore        9
      44: iconst_0
      45: istore        6
      47: aload         5
      49: invokevirtual #169                // Method kotlin/Pair.component1:()Ljava/lang/Object;
      52: checkcast     #166                // class kotlin/Pair
      55: astore        7
      57: aload         5
      59: invokevirtual #172                // Method kotlin/Pair.component2:()Ljava/lang/Object;
      62: checkcast     #166                // class kotlin/Pair
      65: astore        8
      67: aload         7
      69: aload         8
      71: invokestatic  #187                // Method UtilsKt.intersect:(Lkotlin/Pair;Lkotlin/Pair;)Z
      74: invokestatic  #180                // Method UtilsKt.toInt:(Z)I
      77: istore        10
      79: iload         9
      81: iload         10
      83: iadd
      84: istore_2
      85: goto          17
      88: iload_2
      89: ireturn
}


import java.util.*

private fun stackPeeks(input: List<List<String>>, move: (List<Stack<Char>>, Int, Int, Int) -> Unit): String {
    val (towers, instructions) = input
    val stacksSize = towers.last().split("\\s+".toRegex()).last().toInt()

    val stacks = List(stacksSize) { Stack<Char>() }
    for (i in (0 until towers.size - 1).reversed()) {
        for (j in 1 until towers[i].length step 4) {
            if (towers[i][j] != ' ') {
                stacks[j / 4].push(towers[i][j])
            }
        }
    }

    for (instruction in instructions) {
        val (amount, from, to) = "move (\\d+) from (\\d+) to (\\d+)".toRegex().find(instruction)!!.destructured
        move(stacks, amount.toInt(), from.toInt(), to.toInt())
    }

    return stacks.map { it.peek() }.joinToString("")
}

fun main() {
    fun part1(input: List<List<String>>) =
        stackPeeks(input) { stacks: List<Stack<Char>>, amount: Int, from: Int, to: Int ->
            repeat(amount) { stacks[to - 1].push(stacks[from - 1].pop()) }
        }

    fun part2(input: List<List<String>>) =
        stackPeeks(input) { stacks: List<Stack<Char>>, amount: Int, from: Int, to: Int ->
            stacks[to - 1].addAll(stacks[from - 1].takeLast(amount))
            repeat(amount) { stacks[from - 1].pop() }
        }

    // test if implementation meets criteria from the description, like:
    val testInput = readBlocks("Day05_test")
    check(part1(testInput) == "CMZ")
    check(part2(testInput) == "MCD")

    val input = readBlocks("Day05")
    println(part1(input))
    println(part2(input))
}

Compiled from "Day05.kt"
public final class Day05Kt {
  private static final java.lang.String stackPeeks(java.util.List<? extends java.util.List<java.lang.String>>, kotlin.jvm.functions.Function4<? super java.util.List<? extends java.util.Stack<java.lang.Character>>, ? super java.lang.Integer, ? super java.lang.Integer, ? super java.lang.Integer, kotlin.Unit>);
    Code:
       0: aload_0
       1: iconst_0
       2: invokeinterface #13,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
       7: checkcast     #9                  // class java/util/List
      10: astore_2
      11: aload_0
      12: iconst_1
      13: invokeinterface #13,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      18: checkcast     #9                  // class java/util/List
      21: astore_3
      22: aload_2
      23: invokestatic  #19                 // Method kotlin/collections/CollectionsKt.last:(Ljava/util/List;)Ljava/lang/Object;
      26: checkcast     #21                 // class java/lang/CharSequence
      29: astore        5
      31: new           #23                 // class kotlin/text/Regex
      34: dup
      35: ldc           #25                 // String \\s+
      37: invokespecial #29                 // Method kotlin/text/Regex."<init>":(Ljava/lang/String;)V
      40: astore        6
      42: iconst_0
      43: istore        7
      45: aload         6
      47: aload         5
      49: iload         7
      51: invokevirtual #33                 // Method kotlin/text/Regex.split:(Ljava/lang/CharSequence;I)Ljava/util/List;
      54: invokestatic  #19                 // Method kotlin/collections/CollectionsKt.last:(Ljava/util/List;)Ljava/lang/Object;
      57: checkcast     #35                 // class java/lang/String
      60: invokestatic  #41                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      63: istore        4
      65: new           #43                 // class java/util/ArrayList
      68: dup
      69: iload         4
      71: invokespecial #46                 // Method java/util/ArrayList."<init>":(I)V
      74: astore        6
      76: iconst_0
      77: istore        7
      79: iload         7
      81: iload         4
      83: if_icmpge     121
      86: iload         7
      88: istore        8
      90: aload         6
      92: iload         8
      94: istore        9
      96: astore        15
      98: iconst_0
      99: istore        10
     101: new           #48                 // class java/util/Stack
     104: dup
     105: invokespecial #51                 // Method java/util/Stack."<init>":()V
     108: aload         15
     110: swap
     111: invokevirtual #55                 // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
     114: pop
     115: iinc          7, 1
     118: goto          79
     121: aload         6
     123: checkcast     #9                  // class java/util/List
     126: astore        5
     128: iconst_0
     129: aload_2
     130: invokeinterface #59,  1           // InterfaceMethod java/util/List.size:()I
     135: iconst_1
     136: isub
     137: invokestatic  #65                 // Method kotlin/ranges/RangesKt.until:(II)Lkotlin/ranges/IntRange;
     140: checkcast     #67                 // class kotlin/ranges/IntProgression
     143: invokestatic  #71                 // Method kotlin/ranges/RangesKt.reversed:(Lkotlin/ranges/IntProgression;)Lkotlin/ranges/IntProgression;
     146: astore        6
     148: aload         6
     150: invokevirtual #74                 // Method kotlin/ranges/IntProgression.getFirst:()I
     153: istore        7
     155: aload         6
     157: invokevirtual #77                 // Method kotlin/ranges/IntProgression.getLast:()I
     160: istore        8
     162: aload         6
     164: invokevirtual #80                 // Method kotlin/ranges/IntProgression.getStep:()I
     167: istore        9
     169: iload         9
     171: ifle          181
     174: iload         7
     176: iload         8
     178: if_icmple     193
     181: iload         9
     183: ifge          357
     186: iload         8
     188: iload         7
     190: if_icmpgt     357
     193: iconst_1
     194: aload_2
     195: iload         7
     197: invokeinterface #13,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     202: checkcast     #35                 // class java/lang/String
     205: invokevirtual #83                 // Method java/lang/String.length:()I
     208: invokestatic  #65                 // Method kotlin/ranges/RangesKt.until:(II)Lkotlin/ranges/IntRange;
     211: checkcast     #67                 // class kotlin/ranges/IntProgression
     214: iconst_4
     215: invokestatic  #87                 // Method kotlin/ranges/RangesKt.step:(Lkotlin/ranges/IntProgression;I)Lkotlin/ranges/IntProgression;
     218: astore        10
     220: aload         10
     222: invokevirtual #74                 // Method kotlin/ranges/IntProgression.getFirst:()I
     225: istore        11
     227: aload         10
     229: invokevirtual #77                 // Method kotlin/ranges/IntProgression.getLast:()I
     232: istore        12
     234: aload         10
     236: invokevirtual #80                 // Method kotlin/ranges/IntProgression.getStep:()I
     239: istore        13
     241: iload         13
     243: ifle          253
     246: iload         11
     248: iload         12
     250: if_icmple     265
     253: iload         13
     255: ifge          340
     258: iload         12
     260: iload         11
     262: if_icmpgt     340
     265: aload_2
     266: iload         7
     268: invokeinterface #13,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     273: checkcast     #35                 // class java/lang/String
     276: iload         11
     278: invokevirtual #91                 // Method java/lang/String.charAt:(I)C
     281: bipush        32
     283: if_icmpeq     323
     286: aload         5
     288: iload         11
     290: iconst_4
     291: idiv
     292: invokeinterface #13,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     297: checkcast     #48                 // class java/util/Stack
     300: aload_2
     301: iload         7
     303: invokeinterface #13,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     308: checkcast     #35                 // class java/lang/String
     311: iload         11
     313: invokevirtual #91                 // Method java/lang/String.charAt:(I)C
     316: invokestatic  #97                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     319: invokevirtual #101                // Method java/util/Stack.push:(Ljava/lang/Object;)Ljava/lang/Object;
     322: pop
     323: iload         11
     325: iload         12
     327: if_icmpeq     340
     330: iload         11
     332: iload         13
     334: iadd
     335: istore        11
     337: goto          265
     340: iload         7
     342: iload         8
     344: if_icmpeq     357
     347: iload         7
     349: iload         9
     351: iadd
     352: istore        7
     354: goto          193
     357: aload_3
     358: invokeinterface #105,  1          // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;
     363: astore        6
     365: aload         6
     367: invokeinterface #111,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     372: ifeq          517
     375: aload         6
     377: invokeinterface #115,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     382: checkcast     #35                 // class java/lang/String
     385: astore        7
     387: new           #23                 // class kotlin/text/Regex
     390: dup
     391: ldc           #117                // String move (\\d+) from (\\d+) to (\\d+)
     393: invokespecial #29                 // Method kotlin/text/Regex."<init>":(Ljava/lang/String;)V
     396: aload         7
     398: checkcast     #21                 // class java/lang/CharSequence
     401: iconst_0
     402: iconst_2
     403: aconst_null
     404: invokestatic  #121                // Method kotlin/text/Regex.find$default:(Lkotlin/text/Regex;Ljava/lang/CharSequence;IILjava/lang/Object;)Lkotlin/text/MatchResult;
     407: dup
     408: invokestatic  #127                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     411: invokeinterface #133,  1          // InterfaceMethod kotlin/text/MatchResult.getDestructured:()Lkotlin/text/MatchResult$Destructured;
     416: astore        8
     418: aload         8
     420: invokevirtual #139                // Method kotlin/text/MatchResult$Destructured.getMatch:()Lkotlin/text/MatchResult;
     423: invokeinterface #143,  1          // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;
     428: iconst_1
     429: invokeinterface #13,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     434: checkcast     #35                 // class java/lang/String
     437: astore        9
     439: aload         8
     441: invokevirtual #139                // Method kotlin/text/MatchResult$Destructured.getMatch:()Lkotlin/text/MatchResult;
     444: invokeinterface #143,  1          // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;
     449: iconst_2
     450: invokeinterface #13,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     455: checkcast     #35                 // class java/lang/String
     458: astore        10
     460: aload         8
     462: invokevirtual #139                // Method kotlin/text/MatchResult$Destructured.getMatch:()Lkotlin/text/MatchResult;
     465: invokeinterface #143,  1          // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;
     470: iconst_3
     471: invokeinterface #13,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     476: checkcast     #35                 // class java/lang/String
     479: astore        11
     481: aload_1
     482: aload         5
     484: aload         9
     486: invokestatic  #41                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     489: invokestatic  #146                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     492: aload         10
     494: invokestatic  #41                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     497: invokestatic  #146                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     500: aload         11
     502: invokestatic  #41                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     505: invokestatic  #146                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     508: invokeinterface #152,  5          // InterfaceMethod kotlin/jvm/functions/Function4.invoke:(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     513: pop
     514: goto          365
     517: aload         5
     519: checkcast     #154                // class java/lang/Iterable
     522: astore        6
     524: iconst_0
     525: istore        7
     527: aload         6
     529: astore        8
     531: new           #43                 // class java/util/ArrayList
     534: dup
     535: aload         6
     537: bipush        10
     539: invokestatic  #158                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     542: invokespecial #46                 // Method java/util/ArrayList."<init>":(I)V
     545: checkcast     #160                // class java/util/Collection
     548: astore        9
     550: iconst_0
     551: istore        10
     553: aload         8
     555: invokeinterface #161,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     560: astore        11
     562: aload         11
     564: invokeinterface #111,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     569: ifeq          615
     572: aload         11
     574: invokeinterface #115,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     579: astore        12
     581: aload         9
     583: aload         12
     585: checkcast     #48                 // class java/util/Stack
     588: astore        13
     590: astore        15
     592: iconst_0
     593: istore        14
     595: aload         13
     597: invokevirtual #164                // Method java/util/Stack.peek:()Ljava/lang/Object;
     600: checkcast     #93                 // class java/lang/Character
     603: aload         15
     605: swap
     606: invokeinterface #165,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     611: pop
     612: goto          562
     615: aload         9
     617: checkcast     #9                  // class java/util/List
     620: nop
     621: checkcast     #154                // class java/lang/Iterable
     624: ldc           #167                // String
     626: checkcast     #21                 // class java/lang/CharSequence
     629: aconst_null
     630: aconst_null
     631: iconst_0
     632: aconst_null
     633: aconst_null
     634: bipush        62
     636: aconst_null
     637: invokestatic  #171                // Method kotlin/collections/CollectionsKt.joinToString$default:(Ljava/lang/Iterable;Ljava/lang/CharSequence;Ljava/lang/CharSequence;Ljava/lang/CharSequence;ILjava/lang/CharSequence;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ljava/lang/String;
     640: areturn

  public static final void main();
    Code:
       0: ldc           #203                // String Day05_test
       2: invokestatic  #209                // Method UtilsKt.readBlocks:(Ljava/lang/String;)Ljava/util/List;
       5: astore_0
       6: aload_0
       7: invokestatic  #213                // Method main$part1:(Ljava/util/List;)Ljava/lang/String;
      10: ldc           #215                // String CMZ
      12: invokestatic  #219                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      15: ifne          28
      18: new           #221                // class java/lang/IllegalStateException
      21: dup
      22: ldc           #223                // String Check failed.
      24: invokespecial #224                // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
      27: athrow
      28: aload_0
      29: invokestatic  #227                // Method main$part2:(Ljava/util/List;)Ljava/lang/String;
      32: ldc           #229                // String MCD
      34: invokestatic  #219                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      37: ifne          50
      40: new           #221                // class java/lang/IllegalStateException
      43: dup
      44: ldc           #223                // String Check failed.
      46: invokespecial #224                // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
      49: athrow
      50: ldc           #231                // String Day05
      52: invokestatic  #209                // Method UtilsKt.readBlocks:(Ljava/lang/String;)Ljava/util/List;
      55: astore_1
      56: aload_1
      57: invokestatic  #213                // Method main$part1:(Ljava/util/List;)Ljava/lang/String;
      60: getstatic     #237                // Field java/lang/System.out:Ljava/io/PrintStream;
      63: swap
      64: invokevirtual #242                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      67: aload_1
      68: invokestatic  #227                // Method main$part2:(Ljava/util/List;)Ljava/lang/String;
      71: getstatic     #237                // Field java/lang/System.out:Ljava/io/PrintStream;
      74: swap
      75: invokevirtual #242                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      78: return

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

  private static final kotlin.Unit main$part1$lambda$3(java.util.List, int, int, int);
    Code:
       0: aload_0
       1: ldc           #251                // String stacks
       3: invokestatic  #255                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: iconst_0
       7: istore        4
       9: iload         4
      11: iload_1
      12: if_icmpge     59
      15: iload         4
      17: istore        5
      19: iconst_0
      20: istore        6
      22: aload_0
      23: iload_3
      24: iconst_1
      25: isub
      26: invokeinterface #13,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      31: checkcast     #48                 // class java/util/Stack
      34: aload_0
      35: iload_2
      36: iconst_1
      37: isub
      38: invokeinterface #13,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      43: checkcast     #48                 // class java/util/Stack
      46: invokevirtual #258                // Method java/util/Stack.pop:()Ljava/lang/Object;
      49: invokevirtual #101                // Method java/util/Stack.push:(Ljava/lang/Object;)Ljava/lang/Object;
      52: pop
      53: iinc          4, 1
      56: goto          9
      59: getstatic     #264                // Field kotlin/Unit.INSTANCE:Lkotlin/Unit;
      62: areturn

  private static final java.lang.String main$part1(java.util.List<? extends java.util.List<java.lang.String>>);
    Code:
       0: aload_0
       1: invokedynamic #282,  0            // InvokeDynamic #0:invoke:()Lkotlin/jvm/functions/Function4;
       6: invokestatic  #284                // Method stackPeeks:(Ljava/util/List;Lkotlin/jvm/functions/Function4;)Ljava/lang/String;
       9: areturn

  private static final kotlin.Unit main$part2$lambda$5(java.util.List, int, int, int);
    Code:
       0: aload_0
       1: ldc           #251                // String stacks
       3: invokestatic  #255                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: iload_3
       8: iconst_1
       9: isub
      10: invokeinterface #13,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      15: checkcast     #48                 // class java/util/Stack
      18: aload_0
      19: iload_2
      20: iconst_1
      21: isub
      22: invokeinterface #13,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      27: checkcast     #9                  // class java/util/List
      30: iload_1
      31: invokestatic  #289                // Method kotlin/collections/CollectionsKt.takeLast:(Ljava/util/List;I)Ljava/util/List;
      34: checkcast     #160                // class java/util/Collection
      37: invokevirtual #293                // Method java/util/Stack.addAll:(Ljava/util/Collection;)Z
      40: pop
      41: iconst_0
      42: istore        4
      44: iload         4
      46: iload_1
      47: if_icmpge     79
      50: iload         4
      52: istore        5
      54: iconst_0
      55: istore        6
      57: aload_0
      58: iload_2
      59: iconst_1
      60: isub
      61: invokeinterface #13,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      66: checkcast     #48                 // class java/util/Stack
      69: invokevirtual #258                // Method java/util/Stack.pop:()Ljava/lang/Object;
      72: pop
      73: iinc          4, 1
      76: goto          44
      79: getstatic     #264                // Field kotlin/Unit.INSTANCE:Lkotlin/Unit;
      82: areturn

  private static final java.lang.String main$part2(java.util.List<? extends java.util.List<java.lang.String>>);
    Code:
       0: aload_0
       1: invokedynamic #298,  0            // InvokeDynamic #1:invoke:()Lkotlin/jvm/functions/Function4;
       6: invokestatic  #284                // Method stackPeeks:(Ljava/util/List;Lkotlin/jvm/functions/Function4;)Ljava/lang/String;
       9: areturn
}