import java.util.Stack

fun main() {

    val day = "Day05"

    // Some utility functions for Pair
    fun <A, B, R> Pair<A, B>.mapFirst(operation: (A) -> R) = operation(first) to second
    fun <A, B, R> Pair<A, B>.mapSecond(operation: (B) -> R) = first to operation(second)

    fun <A, B, R> Pair<Iterable<A>, B>.foldFirst(initial: R, operation: (acc: R, A) -> R): Pair<R, B> =
        first.fold(initial, operation) to second

    fun <A, B, R> Pair<A, Iterable<B>>.foldSecond(initial: R, operation: (acc: R, B) -> R): Pair<A, R> =
        first to second.fold(initial, operation)

    fun <E> List<E>.chunkedAsPairs() = chunked(2).map { list -> list[0] to list[1] }

    fun List<String>.parse(): Pair<Array<Stack<Char>>, List<String>> {
        val startingStacksAndRearrangementInstructions = chunked(String::isEmpty).chunkedAsPairs().first()
        return startingStacksAndRearrangementInstructions.mapFirst { startingStacks ->
            val numberOfStacks = startingStacks.last().split(" ").last().toInt()
            val emptyStacks = Array(numberOfStacks) { Stack<Char>() }
            startingStacks.dropLast(1).reversed()
                .fold(emptyStacks) { stacks, crates ->
                    ("$crates ").chunked(4).foldIndexed(stacks) { index, acc, crate ->
                        if (crate.isNotBlank()) {
                            acc[index].push(crate.substring(1..2).first())
                        }
                        acc
                    }
                    stacks
                }
        }
    }

    fun Pair<Array<Stack<Char>>, List<String>>.rearrangeWithMoveStrategy(moveStrategy: (Stack<Char>, Stack<Char>) -> List<Stack<Char>>) =
        foldSecond(first) { stacks, rearrangeInstruction ->
            val (_, numberOf, _, from, _, to) = rearrangeInstruction.split((" "))
            moveStrategy(stacks[from.toInt() - 1], stacks[to.toInt() - 1]).windowed(2)
                .forEach { (from, to) ->
                    repeat(numberOf.toInt()) {
                        to.push(from.pop())
                    }
                }
            stacks
        }.first

    fun Array<Stack<Char>>.collectTopCrates() = map(Stack<Char>::pop).joinToString("")

    fun part1(input: List<String>): String {
        return input.parse()
            .rearrangeWithMoveStrategy { from, to -> listOf(from, to) }
            .collectTopCrates()
    }

    fun part2(input: List<String>): String {
        return input.parse()
            .rearrangeWithMoveStrategy { from, to -> listOf(from, Stack(), to) }
            .collectTopCrates()
    }

    // test if implementation meets criteria from the description, like:
    val testInput = readInput("${day}_test")
    val input = readInput(day)

    check(part1(testInput) == "CMZ")
    val result1 = part1(input)
    println(result1)
    check(result1 == "GFTNRBZPF")

    check(part2(testInput) == "MCD")
    val result2 = part2(input)
    println(result2)
    check(result2 == "VRQWPDSGP")
}

private operator fun <E> List<E>.component6() = this[5]

Compiled from "Day05.kt"
final class Day05Kt$main$parse$startingStacksAndRearrangementInstructions$1 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.lang.String, java.lang.Boolean> {
  public static final Day05Kt$main$parse$startingStacksAndRearrangementInstructions$1 INSTANCE;

  Day05Kt$main$parse$startingStacksAndRearrangementInstructions$1();
    Code:
       0: aload_0
       1: iconst_1
       2: ldc           #11                 // class kotlin/text/StringsKt
       4: ldc           #13                 // String isEmpty
       6: ldc           #15                 // String isEmpty(Ljava/lang/CharSequence;)Z
       8: iconst_1
       9: invokespecial #18                 // Method kotlin/jvm/internal/FunctionReferenceImpl."<init>":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V
      12: return

  public final java.lang.Boolean invoke(java.lang.String);
    Code:
       0: aload_1
       1: ldc           #24                 // String p0
       3: invokestatic  #30                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: checkcast     #32                 // class java/lang/CharSequence
      10: invokeinterface #36,  1           // InterfaceMethod java/lang/CharSequence.length:()I
      15: ifne          22
      18: iconst_1
      19: goto          23
      22: iconst_0
      23: invokestatic  #42                 // Method java/lang/Boolean.valueOf:(Z)Ljava/lang/Boolean;
      26: areturn

  public java.lang.Object invoke(java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: checkcast     #46                 // class java/lang/String
       5: invokevirtual #48                 // Method invoke:(Ljava/lang/String;)Ljava/lang/Boolean;
       8: areturn

  static {};
    Code:
       0: new           #2                  // class Day05Kt$main$parse$startingStacksAndRearrangementInstructions$1
       3: dup
       4: invokespecial #53                 // Method "<init>":()V
       7: putstatic     #56                 // Field INSTANCE:LDay05Kt$main$parse$startingStacksAndRearrangementInstructions$1;
      10: return
}

Compiled from "Day05.kt"
public final class Day05Kt {
  public static final void main();
    Code:
       0: ldc           #8                  // String Day05
       2: astore_0
       3: new           #10                 // class java/lang/StringBuilder
       6: dup
       7: invokespecial #13                 // Method java/lang/StringBuilder."<init>":()V
      10: aload_0
      11: invokevirtual #17                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      14: ldc           #19                 // String _test
      16: invokevirtual #17                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      19: invokevirtual #23                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      22: invokestatic  #29                 // Method UtilsKt.readInput:(Ljava/lang/String;)Ljava/util/List;
      25: astore_1
      26: aload_0
      27: invokestatic  #29                 // Method UtilsKt.readInput:(Ljava/lang/String;)Ljava/util/List;
      30: astore_2
      31: aload_1
      32: invokestatic  #33                 // Method main$part1:(Ljava/util/List;)Ljava/lang/String;
      35: ldc           #35                 // String CMZ
      37: invokestatic  #41                 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      40: ifne          53
      43: new           #43                 // class java/lang/IllegalStateException
      46: dup
      47: ldc           #45                 // String Check failed.
      49: invokespecial #48                 // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
      52: athrow
      53: aload_2
      54: invokestatic  #33                 // Method main$part1:(Ljava/util/List;)Ljava/lang/String;
      57: astore_3
      58: getstatic     #54                 // Field java/lang/System.out:Ljava/io/PrintStream;
      61: aload_3
      62: invokevirtual #60                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      65: aload_3
      66: ldc           #62                 // String GFTNRBZPF
      68: invokestatic  #41                 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      71: ifne          84
      74: new           #43                 // class java/lang/IllegalStateException
      77: dup
      78: ldc           #45                 // String Check failed.
      80: invokespecial #48                 // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
      83: athrow
      84: aload_1
      85: invokestatic  #65                 // Method main$part2:(Ljava/util/List;)Ljava/lang/String;
      88: ldc           #67                 // String MCD
      90: invokestatic  #41                 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      93: ifne          106
      96: new           #43                 // class java/lang/IllegalStateException
      99: dup
     100: ldc           #45                 // String Check failed.
     102: invokespecial #48                 // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
     105: athrow
     106: aload_2
     107: invokestatic  #65                 // Method main$part2:(Ljava/util/List;)Ljava/lang/String;
     110: astore        4
     112: getstatic     #54                 // Field java/lang/System.out:Ljava/io/PrintStream;
     115: aload         4
     117: invokevirtual #60                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     120: aload         4
     122: ldc           #69                 // String VRQWPDSGP
     124: invokestatic  #41                 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
     127: ifne          140
     130: new           #43                 // class java/lang/IllegalStateException
     133: dup
     134: ldc           #45                 // String Check failed.
     136: invokespecial #48                 // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
     139: athrow
     140: return

  private static final <E> E component6(java.util.List<? extends E>);
    Code:
       0: aload_0
       1: ldc           #85                 // String <this>
       3: invokestatic  #89                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: iconst_5
       8: invokeinterface #93,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      13: areturn

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

  private static final <A, B, R> kotlin.Pair<R, B> main$mapFirst(kotlin.Pair<? extends A, ? extends B>, kotlin.jvm.functions.Function1<? super A, ? extends R>);
    Code:
       0: aload_1
       1: aload_0
       2: invokevirtual #108                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
       5: invokeinterface #114,  2          // InterfaceMethod kotlin/jvm/functions/Function1.invoke:(Ljava/lang/Object;)Ljava/lang/Object;
      10: aload_0
      11: invokevirtual #117                // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
      14: invokestatic  #123                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      17: areturn

  private static final <A, B, R> kotlin.Pair<A, R> main$mapSecond(kotlin.Pair<? extends A, ? extends B>, kotlin.jvm.functions.Function1<? super B, ? extends R>);
    Code:
       0: aload_0
       1: invokevirtual #108                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
       4: aload_1
       5: aload_0
       6: invokevirtual #117                // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
       9: invokeinterface #114,  2          // InterfaceMethod kotlin/jvm/functions/Function1.invoke:(Ljava/lang/Object;)Ljava/lang/Object;
      14: invokestatic  #123                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      17: areturn

  private static final <A, B, R> kotlin.Pair<R, B> main$foldFirst(kotlin.Pair<? extends java.lang.Iterable<? extends A>, ? extends B>, R, kotlin.jvm.functions.Function2<? super R, ? super A, ? extends R>);
    Code:
       0: aload_0
       1: invokevirtual #108                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
       4: checkcast     #135                // class java/lang/Iterable
       7: astore_3
       8: iconst_0
       9: istore        4
      11: aload_1
      12: astore        5
      14: aload_3
      15: invokeinterface #139,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      20: astore        6
      22: aload         6
      24: invokeinterface #145,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      29: ifeq          56
      32: aload         6
      34: invokeinterface #148,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      39: astore        7
      41: aload_2
      42: aload         5
      44: aload         7
      46: invokeinterface #153,  3          // InterfaceMethod kotlin/jvm/functions/Function2.invoke:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
      51: astore        5
      53: goto          22
      56: aload         5
      58: aload_0
      59: invokevirtual #117                // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
      62: invokestatic  #123                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      65: areturn

  private static final <A, B, R> kotlin.Pair<A, R> main$foldSecond(kotlin.Pair<? extends A, ? extends java.lang.Iterable<? extends B>>, R, kotlin.jvm.functions.Function2<? super R, ? super B, ? extends R>);
    Code:
       0: aload_0
       1: invokevirtual #108                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
       4: aload_0
       5: invokevirtual #117                // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
       8: checkcast     #135                // class java/lang/Iterable
      11: astore_3
      12: astore        8
      14: iconst_0
      15: istore        4
      17: aload_1
      18: astore        5
      20: aload_3
      21: invokeinterface #139,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      26: astore        6
      28: aload         6
      30: invokeinterface #145,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      35: ifeq          62
      38: aload         6
      40: invokeinterface #148,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      45: astore        7
      47: aload_2
      48: aload         5
      50: aload         7
      52: invokeinterface #153,  3          // InterfaceMethod kotlin/jvm/functions/Function2.invoke:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
      57: astore        5
      59: goto          28
      62: aload         5
      64: aload         8
      66: swap
      67: invokestatic  #123                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      70: areturn

  private static final <E> java.util.List<kotlin.Pair<E, E>> main$chunkedAsPairs(java.util.List<? extends E>);
    Code:
       0: aload_0
       1: checkcast     #135                // class java/lang/Iterable
       4: iconst_2
       5: invokestatic  #175                // Method kotlin/collections/CollectionsKt.chunked:(Ljava/lang/Iterable;I)Ljava/util/List;
       8: checkcast     #135                // class java/lang/Iterable
      11: astore_1
      12: iconst_0
      13: istore_2
      14: aload_1
      15: astore_3
      16: new           #177                // class java/util/ArrayList
      19: dup
      20: aload_1
      21: bipush        10
      23: invokestatic  #181                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      26: invokespecial #184                // Method java/util/ArrayList."<init>":(I)V
      29: checkcast     #186                // class java/util/Collection
      32: astore        4
      34: iconst_0
      35: istore        5
      37: aload_3
      38: invokeinterface #139,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      43: astore        6
      45: aload         6
      47: invokeinterface #145,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      52: ifeq          109
      55: aload         6
      57: invokeinterface #148,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      62: astore        7
      64: aload         4
      66: aload         7
      68: checkcast     #80                 // class java/util/List
      71: astore        8
      73: astore        10
      75: iconst_0
      76: istore        9
      78: aload         8
      80: iconst_0
      81: invokeinterface #93,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      86: aload         8
      88: iconst_1
      89: invokeinterface #93,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      94: invokestatic  #123                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      97: aload         10
      99: swap
     100: invokeinterface #190,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     105: pop
     106: goto          45
     109: aload         4
     111: checkcast     #80                 // class java/util/List
     114: nop
     115: areturn

  private static final java.util.Stack[] main$parse$lambda$3(java.util.List);
    Code:
       0: aload_0
       1: ldc           #204                // String startingStacks
       3: invokestatic  #89                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: invokestatic  #207                // Method kotlin/collections/CollectionsKt.last:(Ljava/util/List;)Ljava/lang/Object;
      10: checkcast     #209                // class java/lang/CharSequence
      13: iconst_1
      14: anewarray     #78                 // class java/lang/String
      17: astore_2
      18: aload_2
      19: iconst_0
      20: ldc           #211                // String
      22: aastore
      23: aload_2
      24: iconst_0
      25: iconst_0
      26: bipush        6
      28: aconst_null
      29: invokestatic  #217                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      32: invokestatic  #207                // Method kotlin/collections/CollectionsKt.last:(Ljava/util/List;)Ljava/lang/Object;
      35: checkcast     #78                 // class java/lang/String
      38: invokestatic  #223                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      41: istore_1
      42: iconst_0
      43: istore_3
      44: iload_1
      45: anewarray     #225                // class java/util/Stack
      48: astore        4
      50: iload_3
      51: iload_1
      52: if_icmpge     76
      55: iload_3
      56: istore        5
      58: aload         4
      60: iload         5
      62: new           #225                // class java/util/Stack
      65: dup
      66: invokespecial #226                // Method java/util/Stack."<init>":()V
      69: aastore
      70: iinc          3, 1
      73: goto          50
      76: aload         4
      78: astore_2
      79: aload_0
      80: iconst_1
      81: invokestatic  #230                // Method kotlin/collections/CollectionsKt.dropLast:(Ljava/util/List;I)Ljava/util/List;
      84: checkcast     #135                // class java/lang/Iterable
      87: invokestatic  #234                // Method kotlin/collections/CollectionsKt.reversed:(Ljava/lang/Iterable;)Ljava/util/List;
      90: checkcast     #135                // class java/lang/Iterable
      93: astore_3
      94: nop
      95: iconst_0
      96: istore        4
      98: aload_2
      99: astore        5
     101: aload_3
     102: invokeinterface #139,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     107: astore        6
     109: aload         6
     111: invokeinterface #145,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     116: ifeq          311
     119: aload         6
     121: invokeinterface #148,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     126: astore        7
     128: aload         5
     130: aload         7
     132: checkcast     #78                 // class java/lang/String
     135: astore        8
     137: astore        9
     139: iconst_0
     140: istore        10
     142: new           #10                 // class java/lang/StringBuilder
     145: dup
     146: invokespecial #13                 // Method java/lang/StringBuilder."<init>":()V
     149: aload         8
     151: invokevirtual #17                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     154: bipush        32
     156: invokevirtual #237                // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
     159: invokevirtual #23                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     162: checkcast     #209                // class java/lang/CharSequence
     165: iconst_4
     166: invokestatic  #240                // Method kotlin/text/StringsKt.chunked:(Ljava/lang/CharSequence;I)Ljava/util/List;
     169: checkcast     #135                // class java/lang/Iterable
     172: astore        11
     174: iconst_0
     175: istore        12
     177: iconst_0
     178: istore        13
     180: aload         9
     182: astore        14
     184: aload         11
     186: invokeinterface #139,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     191: astore        15
     193: aload         15
     195: invokeinterface #145,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     200: ifeq          303
     203: aload         15
     205: invokeinterface #148,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     210: astore        16
     212: iload         13
     214: iinc          13, 1
     217: istore        17
     219: iload         17
     221: ifge          227
     224: invokestatic  #243                // Method kotlin/collections/CollectionsKt.throwIndexOverflow:()V
     227: iload         17
     229: aload         14
     231: aload         16
     233: checkcast     #78                 // class java/lang/String
     236: astore        18
     238: astore        19
     240: istore        20
     242: iconst_0
     243: istore        21
     245: aload         18
     247: checkcast     #209                // class java/lang/CharSequence
     250: invokestatic  #247                // Method kotlin/text/StringsKt.isBlank:(Ljava/lang/CharSequence;)Z
     253: ifne          260
     256: iconst_1
     257: goto          261
     260: iconst_0
     261: ifeq          296
     264: aload         19
     266: iload         20
     268: aaload
     269: aload         18
     271: new           #249                // class kotlin/ranges/IntRange
     274: dup
     275: iconst_1
     276: iconst_2
     277: invokespecial #252                // Method kotlin/ranges/IntRange."<init>":(II)V
     280: invokestatic  #256                // Method kotlin/text/StringsKt.substring:(Ljava/lang/String;Lkotlin/ranges/IntRange;)Ljava/lang/String;
     283: checkcast     #209                // class java/lang/CharSequence
     286: invokestatic  #260                // Method kotlin/text/StringsKt.first:(Ljava/lang/CharSequence;)C
     289: invokestatic  #266                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     292: invokevirtual #269                // Method java/util/Stack.push:(Ljava/lang/Object;)Ljava/lang/Object;
     295: pop
     296: aload         19
     298: astore        14
     300: goto          193
     303: nop
     304: aload         9
     306: astore        5
     308: goto          109
     311: aload         5
     313: areturn

  private static final kotlin.Pair<java.util.Stack<java.lang.Character>[], java.util.List<java.lang.String>> main$parse(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: getstatic     #293                // Field Day05Kt$main$parse$startingStacksAndRearrangementInstructions$1.INSTANCE:LDay05Kt$main$parse$startingStacksAndRearrangementInstructions$1;
       4: checkcast     #110                // class kotlin/jvm/functions/Function1
       7: invokestatic  #296                // Method UtilsKt.chunked:(Ljava/util/List;Lkotlin/jvm/functions/Function1;)Ljava/util/List;
      10: invokestatic  #298                // Method main$chunkedAsPairs:(Ljava/util/List;)Ljava/util/List;
      13: invokestatic  #300                // Method kotlin/collections/CollectionsKt.first:(Ljava/util/List;)Ljava/lang/Object;
      16: checkcast     #104                // class kotlin/Pair
      19: astore_1
      20: aload_1
      21: invokedynamic #315,  0            // InvokeDynamic #0:invoke:()Lkotlin/jvm/functions/Function1;
      26: invokestatic  #317                // Method main$mapFirst:(Lkotlin/Pair;Lkotlin/jvm/functions/Function1;)Lkotlin/Pair;
      29: areturn

  private static final java.util.Stack[] main$rearrangeWithMoveStrategy$lambda$6(kotlin.jvm.functions.Function2, java.util.Stack[], java.lang.String);
    Code:
       0: aload_1
       1: ldc_w         #322                // String stacks
       4: invokestatic  #89                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: aload_2
       8: ldc_w         #324                // String rearrangeInstruction
      11: invokestatic  #89                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      14: aload_2
      15: checkcast     #209                // class java/lang/CharSequence
      18: iconst_1
      19: anewarray     #78                 // class java/lang/String
      22: astore        4
      24: aload         4
      26: iconst_0
      27: ldc           #211                // String
      29: aastore
      30: aload         4
      32: iconst_0
      33: iconst_0
      34: bipush        6
      36: aconst_null
      37: invokestatic  #217                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      40: astore_3
      41: aload_3
      42: iconst_1
      43: invokeinterface #93,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      48: checkcast     #78                 // class java/lang/String
      51: astore        4
      53: aload_3
      54: iconst_3
      55: invokeinterface #93,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      60: checkcast     #78                 // class java/lang/String
      63: astore        5
      65: aload_3
      66: invokestatic  #326                // Method component6:(Ljava/util/List;)Ljava/lang/Object;
      69: checkcast     #78                 // class java/lang/String
      72: astore        6
      74: aload_0
      75: aload_1
      76: aload         5
      78: invokestatic  #223                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      81: iconst_1
      82: isub
      83: aaload
      84: aload_1
      85: aload         6
      87: invokestatic  #223                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      90: iconst_1
      91: isub
      92: aaload
      93: invokeinterface #153,  3          // InterfaceMethod kotlin/jvm/functions/Function2.invoke:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
      98: checkcast     #135                // class java/lang/Iterable
     101: iconst_2
     102: iconst_0
     103: iconst_0
     104: bipush        6
     106: aconst_null
     107: invokestatic  #330                // Method kotlin/collections/CollectionsKt.windowed$default:(Ljava/lang/Iterable;IIZILjava/lang/Object;)Ljava/util/List;
     110: checkcast     #135                // class java/lang/Iterable
     113: astore        7
     115: nop
     116: iconst_0
     117: istore        8
     119: aload         7
     121: invokeinterface #139,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     126: astore        9
     128: aload         9
     130: invokeinterface #145,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     135: ifeq          230
     138: aload         9
     140: invokeinterface #148,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     145: astore        10
     147: aload         10
     149: checkcast     #80                 // class java/util/List
     152: astore        11
     154: iconst_0
     155: istore        12
     157: aload         11
     159: iconst_0
     160: invokeinterface #93,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     165: checkcast     #225                // class java/util/Stack
     168: astore        13
     170: aload         11
     172: iconst_1
     173: invokeinterface #93,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     178: checkcast     #225                // class java/util/Stack
     181: astore        14
     183: aload         4
     185: invokestatic  #223                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     188: istore        15
     190: iconst_0
     191: istore        16
     193: iload         16
     195: iload         15
     197: if_icmpge     225
     200: iload         16
     202: istore        17
     204: iconst_0
     205: istore        18
     207: aload         14
     209: aload         13
     211: invokevirtual #333                // Method java/util/Stack.pop:()Ljava/lang/Object;
     214: invokevirtual #269                // Method java/util/Stack.push:(Ljava/lang/Object;)Ljava/lang/Object;
     217: pop
     218: nop
     219: iinc          16, 1
     222: goto          193
     225: nop
     226: nop
     227: goto          128
     230: nop
     231: aload_1
     232: areturn

  private static final java.util.Stack<java.lang.Character>[] main$rearrangeWithMoveStrategy(kotlin.Pair<java.util.Stack<java.lang.Character>[], ? extends java.util.List<java.lang.String>>, kotlin.jvm.functions.Function2<? super java.util.Stack<java.lang.Character>, ? super java.util.Stack<java.lang.Character>, ? extends java.util.List<? extends java.util.Stack<java.lang.Character>>>);
    Code:
       0: aload_0
       1: aload_0
       2: invokevirtual #108                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
       5: aload_1
       6: invokedynamic #354,  0            // InvokeDynamic #1:invoke:(Lkotlin/jvm/functions/Function2;)Lkotlin/jvm/functions/Function2;
      11: invokestatic  #356                // Method main$foldSecond:(Lkotlin/Pair;Ljava/lang/Object;Lkotlin/jvm/functions/Function2;)Lkotlin/Pair;
      14: invokevirtual #108                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
      17: checkcast     #284                // class "[Ljava/util/Stack;"
      20: areturn

  private static final java.lang.String main$collectTopCrates(java.util.Stack<java.lang.Character>[]);
    Code:
       0: aload_0
       1: astore_1
       2: iconst_0
       3: istore_2
       4: aload_1
       5: astore_3
       6: new           #177                // class java/util/ArrayList
       9: dup
      10: aload_1
      11: arraylength
      12: invokespecial #184                // Method java/util/ArrayList."<init>":(I)V
      15: checkcast     #186                // class java/util/Collection
      18: astore        4
      20: iconst_0
      21: istore        5
      23: iconst_0
      24: istore        6
      26: aload_3
      27: arraylength
      28: istore        7
      30: iload         6
      32: iload         7
      34: if_icmpge     77
      37: aload_3
      38: iload         6
      40: aaload
      41: astore        8
      43: aload         4
      45: aload         8
      47: astore        9
      49: astore        11
      51: iconst_0
      52: istore        10
      54: aload         9
      56: invokevirtual #333                // Method java/util/Stack.pop:()Ljava/lang/Object;
      59: checkcast     #262                // class java/lang/Character
      62: aload         11
      64: swap
      65: invokeinterface #190,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
      70: pop
      71: iinc          6, 1
      74: goto          30
      77: aload         4
      79: checkcast     #80                 // class java/util/List
      82: nop
      83: checkcast     #135                // class java/lang/Iterable
      86: ldc_w         #363                // String
      89: checkcast     #209                // class java/lang/CharSequence
      92: aconst_null
      93: aconst_null
      94: iconst_0
      95: aconst_null
      96: aconst_null
      97: bipush        62
      99: aconst_null
     100: invokestatic  #367                // 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;
     103: areturn

  private static final java.util.List main$part1$lambda$7(java.util.Stack, java.util.Stack);
    Code:
       0: aload_0
       1: ldc_w         #374                // String from
       4: invokestatic  #89                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: aload_1
       8: ldc_w         #375                // String to
      11: invokestatic  #89                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      14: iconst_2
      15: anewarray     #225                // class java/util/Stack
      18: astore_2
      19: aload_2
      20: iconst_0
      21: aload_0
      22: aastore
      23: aload_2
      24: iconst_1
      25: aload_1
      26: aastore
      27: aload_2
      28: invokestatic  #379                // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
      31: areturn

  private static final java.lang.String main$part1(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: invokestatic  #382                // Method main$parse:(Ljava/util/List;)Lkotlin/Pair;
       4: invokedynamic #389,  0            // InvokeDynamic #2:invoke:()Lkotlin/jvm/functions/Function2;
       9: invokestatic  #391                // Method main$rearrangeWithMoveStrategy:(Lkotlin/Pair;Lkotlin/jvm/functions/Function2;)[Ljava/util/Stack;
      12: invokestatic  #393                // Method main$collectTopCrates:([Ljava/util/Stack;)Ljava/lang/String;
      15: areturn

  private static final java.util.List main$part2$lambda$8(java.util.Stack, java.util.Stack);
    Code:
       0: aload_0
       1: ldc_w         #374                // String from
       4: invokestatic  #89                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: aload_1
       8: ldc_w         #375                // String to
      11: invokestatic  #89                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      14: iconst_3
      15: anewarray     #225                // class java/util/Stack
      18: astore_2
      19: aload_2
      20: iconst_0
      21: aload_0
      22: aastore
      23: aload_2
      24: iconst_1
      25: new           #225                // class java/util/Stack
      28: dup
      29: invokespecial #226                // Method java/util/Stack."<init>":()V
      32: aastore
      33: aload_2
      34: iconst_2
      35: aload_1
      36: aastore
      37: aload_2
      38: invokestatic  #379                // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
      41: areturn

  private static final java.lang.String main$part2(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: invokestatic  #382                // Method main$parse:(Ljava/util/List;)Lkotlin/Pair;
       4: invokedynamic #398,  0            // InvokeDynamic #3:invoke:()Lkotlin/jvm/functions/Function2;
       9: invokestatic  #391                // Method main$rearrangeWithMoveStrategy:(Lkotlin/Pair;Lkotlin/jvm/functions/Function2;)[Ljava/util/Stack;
      12: invokestatic  #393                // Method main$collectTopCrates:([Ljava/util/Stack;)Ljava/lang/String;
      15: areturn
}


private data class Item(val worryLevel: Long) {
    fun relieved(): Item {
        return Item(worryLevel / 3L)
    }
}

private data class TestedItem(val item: Item, val action: (Item, Array<Monkey>) -> Unit)

private data class Monkey(
    val items: List<Item>,
    val operation: (Item) -> Item,
    val testValue: Long,
    val ifTrue: (Item, Array<Monkey>) -> Unit,
    val ifFalse: (Item, Array<Monkey>) -> Unit
) {
    fun takeTurn(afterInspection: (Item) -> Item) = items.size to items
        .map(::inspect)
        .map(afterInspection)
        .map(::testItem)
        .map(::throwItem)

    private fun inspect(item: Item): Item {
        return operation(item)
    }

    private fun testItem(item: Item) =
        TestedItem(
            item,
            if (item.worryLevel % testValue == 0L) {
                ifTrue
            } else {
                ifFalse
            }
        )

    private fun throwItem(testedItem: TestedItem): (Array<Monkey>) -> Unit =
        { monkeys: Array<Monkey> -> testedItem.action(testedItem.item, monkeys) }

    fun receive(item: Item) = this.copy(items = items + item)
    fun leaveItem() = this.copy(items= items.drop(1))
}

private fun List<String>.toMonkeys() = chunked(String::isEmpty)
    .mapIndexed{ index, monkeyConfiguration ->
        Monkey(
            items = monkeyConfiguration[1].removePrefix("  Starting items: ").split(", ").map { Item(it.toLong()) },
            operation = monkeyConfiguration[2].removePrefix("  Operation: new = old ").split(" ").let {
                val (operation, valueStr) = it
                val value = if (valueStr != "old") valueStr.toLong() else 0
                when (operation) {
                    "*" -> { item: Item -> Item(item.worryLevel * if (valueStr == "old") item.worryLevel else value) }
                    "+" -> { item: Item -> Item(item.worryLevel + if (valueStr == "old") item.worryLevel else value) }
                    else -> {
                        throw IllegalArgumentException("Unknown operation $operation")
                    }
                }

            },
            testValue = monkeyConfiguration[3].removePrefix("  Test: divisible by ").toLong(),
            ifTrue = monkeyConfiguration[4].removePrefix("    If true: throw to monkey ").toInt().let {
                { item: Item, monkeys: Array<Monkey> -> monkeys[index] = monkeys[index].leaveItem(); monkeys[it] = monkeys[it].receive(item) }
            },
            ifFalse = monkeyConfiguration[5].removePrefix("    If false: throw to monkey ").toInt().let {
                { item: Item, monkeys: Array<Monkey> -> monkeys[index] = monkeys[index].leaveItem(); monkeys[it] = monkeys[it].receive(item) }
            }
        )
    }.toTypedArray()

fun main() {

    val day = "Day11"

    fun IntRange.run(monkeys: Array<Monkey>, afterInspection: (Item) -> Item): Long {
        val afterExecution = fold(List(monkeys.size) { 0L }) { numberOfItemsInspected, _ ->
            val numberOfItemsInspectedInRound = monkeys
                .map { monkey ->
                    val (numberOfItems, throwsToExecute) = monkey.takeTurn(afterInspection)
                    throwsToExecute.forEach { it(monkeys) }
                    numberOfItems
                }

            numberOfItemsInspected.zip(numberOfItemsInspectedInRound)
                .map { (i1, i2) -> i1 + i2 }
        }

        return afterExecution.sortedDescending().take(2).reduce(Long::times)
    }

    fun part1(input: List<String>): Long {
        val monkeys = input.toMonkeys()
        val rounds = 1..20
        return rounds.run(monkeys,Item::relieved)
    }

    fun part2(input: List<String>): Long {
        val monkeys = input.toMonkeys()
        val rounds = 1..10000
        return rounds.run(monkeys) { item: Item -> Item(item.worryLevel % monkeys.map { it.testValue }.reduce(Long::times)) }
    }

    // test if implementation meets criteria from the description, like:
    val testInput = readInput("${day}_test")
    val input = readInput(day)

    check(part1(testInput) == 10605L)
    val result1 = part1(input)
    println(result1)
    check(result1 == 121450L)

    check(part2(testInput) == 2713310158L)
    val result2 = part2(input)
    println(result2)
    check(result2 == 28244037010L)
}

Compiled from "Day11.kt"
final class Day11Kt$main$part1$1 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<Item, Item> {
  public static final Day11Kt$main$part1$1 INSTANCE;

  Day11Kt$main$part1$1();
    Code:
       0: aload_0
       1: iconst_1
       2: ldc           #11                 // class Item
       4: ldc           #13                 // String relieved
       6: ldc           #15                 // String relieved()LItem;
       8: iconst_0
       9: invokespecial #18                 // Method kotlin/jvm/internal/FunctionReferenceImpl."<init>":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V
      12: return

  public final Item invoke(Item);
    Code:
       0: aload_1
       1: ldc           #24                 // String p0
       3: invokestatic  #30                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: invokevirtual #33                 // Method Item.relieved:()LItem;
      10: areturn

  public java.lang.Object invoke(java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: checkcast     #11                 // class Item
       5: invokevirtual #37                 // Method invoke:(LItem;)LItem;
       8: areturn

  static {};
    Code:
       0: new           #2                  // class Day11Kt$main$part1$1
       3: dup
       4: invokespecial #42                 // Method "<init>":()V
       7: putstatic     #45                 // Field INSTANCE:LDay11Kt$main$part1$1;
      10: return
}

Compiled from "Day11.kt"
final class Day11Kt$toMonkeys$1 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.lang.String, java.lang.Boolean> {
  public static final Day11Kt$toMonkeys$1 INSTANCE;

  Day11Kt$toMonkeys$1();
    Code:
       0: aload_0
       1: iconst_1
       2: ldc           #11                 // class kotlin/text/StringsKt
       4: ldc           #13                 // String isEmpty
       6: ldc           #15                 // String isEmpty(Ljava/lang/CharSequence;)Z
       8: iconst_1
       9: invokespecial #18                 // Method kotlin/jvm/internal/FunctionReferenceImpl."<init>":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V
      12: return

  public final java.lang.Boolean invoke(java.lang.String);
    Code:
       0: aload_1
       1: ldc           #24                 // String p0
       3: invokestatic  #30                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: checkcast     #32                 // class java/lang/CharSequence
      10: invokeinterface #36,  1           // InterfaceMethod java/lang/CharSequence.length:()I
      15: ifne          22
      18: iconst_1
      19: goto          23
      22: iconst_0
      23: invokestatic  #42                 // Method java/lang/Boolean.valueOf:(Z)Ljava/lang/Boolean;
      26: areturn

  public java.lang.Object invoke(java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: checkcast     #46                 // class java/lang/String
       5: invokevirtual #48                 // Method invoke:(Ljava/lang/String;)Ljava/lang/Boolean;
       8: areturn

  static {};
    Code:
       0: new           #2                  // class Day11Kt$toMonkeys$1
       3: dup
       4: invokespecial #53                 // Method "<init>":()V
       7: putstatic     #56                 // Field INSTANCE:LDay11Kt$toMonkeys$1;
      10: return
}

Compiled from "Day11.kt"
public final class Day11Kt {
  private static final Monkey[] toMonkeys(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: getstatic     #13                 // Field Day11Kt$toMonkeys$1.INSTANCE:LDay11Kt$toMonkeys$1;
       4: checkcast     #15                 // class kotlin/jvm/functions/Function1
       7: invokestatic  #21                 // Method UtilsKt.chunked:(Ljava/util/List;Lkotlin/jvm/functions/Function1;)Ljava/util/List;
      10: checkcast     #23                 // class java/lang/Iterable
      13: astore_1
      14: nop
      15: iconst_0
      16: istore_2
      17: aload_1
      18: astore_3
      19: new           #25                 // class java/util/ArrayList
      22: dup
      23: aload_1
      24: bipush        10
      26: invokestatic  #31                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      29: invokespecial #35                 // Method java/util/ArrayList."<init>":(I)V
      32: checkcast     #37                 // class java/util/Collection
      35: astore        4
      37: iconst_0
      38: istore        5
      40: iconst_0
      41: istore        6
      43: aload_3
      44: invokeinterface #41,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      49: astore        7
      51: aload         7
      53: invokeinterface #47,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      58: ifeq          604
      61: aload         7
      63: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      68: astore        8
      70: aload         4
      72: iload         6
      74: iinc          6, 1
      77: istore        9
      79: iload         9
      81: ifge          87
      84: invokestatic  #55                 // Method kotlin/collections/CollectionsKt.throwIndexOverflow:()V
      87: iload         9
      89: aload         8
      91: checkcast     #57                 // class java/util/List
      94: astore        10
      96: istore        11
      98: astore        30
     100: iconst_0
     101: istore        12
     103: aload         10
     105: iconst_1
     106: invokeinterface #61,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     111: checkcast     #63                 // class java/lang/String
     114: ldc           #65                 // String   Starting items:
     116: checkcast     #67                 // class java/lang/CharSequence
     119: invokestatic  #73                 // Method kotlin/text/StringsKt.removePrefix:(Ljava/lang/String;Ljava/lang/CharSequence;)Ljava/lang/String;
     122: checkcast     #67                 // class java/lang/CharSequence
     125: iconst_1
     126: anewarray     #63                 // class java/lang/String
     129: astore        13
     131: aload         13
     133: iconst_0
     134: ldc           #75                 // String ,
     136: aastore
     137: aload         13
     139: iconst_0
     140: iconst_0
     141: bipush        6
     143: aconst_null
     144: invokestatic  #79                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     147: checkcast     #23                 // class java/lang/Iterable
     150: astore        13
     152: iconst_0
     153: istore        14
     155: aload         13
     157: astore        15
     159: new           #25                 // class java/util/ArrayList
     162: dup
     163: aload         13
     165: bipush        10
     167: invokestatic  #31                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     170: invokespecial #35                 // Method java/util/ArrayList."<init>":(I)V
     173: checkcast     #37                 // class java/util/Collection
     176: astore        16
     178: iconst_0
     179: istore        17
     181: aload         15
     183: invokeinterface #41,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     188: astore        18
     190: aload         18
     192: invokeinterface #47,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     197: ifeq          247
     200: aload         18
     202: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     207: astore        19
     209: aload         16
     211: aload         19
     213: checkcast     #63                 // class java/lang/String
     216: astore        20
     218: astore        21
     220: iconst_0
     221: istore        22
     223: new           #81                 // class Item
     226: dup
     227: aload         20
     229: invokestatic  #87                 // Method java/lang/Long.parseLong:(Ljava/lang/String;)J
     232: invokespecial #90                 // Method Item."<init>":(J)V
     235: aload         21
     237: swap
     238: invokeinterface #94,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     243: pop
     244: goto          190
     247: aload         16
     249: checkcast     #57                 // class java/util/List
     252: nop
     253: aload         10
     255: iconst_2
     256: invokeinterface #61,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     261: checkcast     #63                 // class java/lang/String
     264: ldc           #96                 // String   Operation: new = old
     266: checkcast     #67                 // class java/lang/CharSequence
     269: invokestatic  #73                 // Method kotlin/text/StringsKt.removePrefix:(Ljava/lang/String;Ljava/lang/CharSequence;)Ljava/lang/String;
     272: checkcast     #67                 // class java/lang/CharSequence
     275: iconst_1
     276: anewarray     #63                 // class java/lang/String
     279: astore        13
     281: aload         13
     283: iconst_0
     284: ldc           #98                 // String
     286: aastore
     287: aload         13
     289: iconst_0
     290: iconst_0
     291: bipush        6
     293: aconst_null
     294: invokestatic  #79                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     297: astore        14
     299: astore        21
     301: iconst_0
     302: istore        15
     304: aload         14
     306: iconst_0
     307: invokeinterface #61,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     312: checkcast     #63                 // class java/lang/String
     315: astore        16
     317: aload         14
     319: iconst_1
     320: invokeinterface #61,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     325: checkcast     #63                 // class java/lang/String
     328: astore        17
     330: aload         17
     332: ldc           #100                // String old
     334: invokestatic  #106                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
     337: ifne          348
     340: aload         17
     342: invokestatic  #87                 // Method java/lang/Long.parseLong:(Ljava/lang/String;)J
     345: goto          349
     348: lconst_0
     349: lstore        23
     351: aload         16
     353: astore        20
     355: aload         20
     357: ldc           #108                // String *
     359: invokestatic  #106                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
     362: ifeq          377
     365: aload         17
     367: lload         23
     369: invokedynamic #128,  0            // InvokeDynamic #0:invoke:(Ljava/lang/String;J)Lkotlin/jvm/functions/Function1;
     374: goto          427
     377: aload         20
     379: ldc           #130                // String +
     381: invokestatic  #106                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
     384: ifeq          399
     387: aload         17
     389: lload         23
     391: invokedynamic #135,  0            // InvokeDynamic #1:invoke:(Ljava/lang/String;J)Lkotlin/jvm/functions/Function1;
     396: goto          427
     399: new           #137                // class java/lang/IllegalArgumentException
     402: dup
     403: new           #139                // class java/lang/StringBuilder
     406: dup
     407: invokespecial #141                // Method java/lang/StringBuilder."<init>":()V
     410: ldc           #143                // String Unknown operation
     412: invokevirtual #147                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     415: aload         16
     417: invokevirtual #147                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     420: invokevirtual #151                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     423: invokespecial #154                // Method java/lang/IllegalArgumentException."<init>":(Ljava/lang/String;)V
     426: athrow
     427: nop
     428: aload         21
     430: swap
     431: nop
     432: aload         10
     434: iconst_3
     435: invokeinterface #61,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     440: checkcast     #63                 // class java/lang/String
     443: ldc           #156                // String   Test: divisible by
     445: checkcast     #67                 // class java/lang/CharSequence
     448: invokestatic  #73                 // Method kotlin/text/StringsKt.removePrefix:(Ljava/lang/String;Ljava/lang/CharSequence;)Ljava/lang/String;
     451: invokestatic  #87                 // Method java/lang/Long.parseLong:(Ljava/lang/String;)J
     454: aload         10
     456: iconst_4
     457: invokeinterface #61,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     462: checkcast     #63                 // class java/lang/String
     465: ldc           #158                // String     If true: throw to monkey
     467: checkcast     #67                 // class java/lang/CharSequence
     470: invokestatic  #73                 // Method kotlin/text/StringsKt.removePrefix:(Ljava/lang/String;Ljava/lang/CharSequence;)Ljava/lang/String;
     473: invokestatic  #164                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     476: istore        14
     478: lstore        26
     480: astore        25
     482: astore        21
     484: iconst_0
     485: istore        15
     487: iload         11
     489: iload         14
     491: invokedynamic #176,  0            // InvokeDynamic #2:invoke:(II)Lkotlin/jvm/functions/Function2;
     496: astore        28
     498: aload         21
     500: aload         25
     502: lload         26
     504: aload         28
     506: nop
     507: aload         10
     509: iconst_5
     510: invokeinterface #61,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     515: checkcast     #63                 // class java/lang/String
     518: ldc           #178                // String     If false: throw to monkey
     520: checkcast     #67                 // class java/lang/CharSequence
     523: invokestatic  #73                 // Method kotlin/text/StringsKt.removePrefix:(Ljava/lang/String;Ljava/lang/CharSequence;)Ljava/lang/String;
     526: invokestatic  #164                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     529: istore        14
     531: astore        28
     533: lstore        26
     535: astore        25
     537: astore        21
     539: iconst_0
     540: istore        15
     542: iload         11
     544: iload         14
     546: invokedynamic #183,  0            // InvokeDynamic #3:invoke:(II)Lkotlin/jvm/functions/Function2;
     551: astore        29
     553: aload         21
     555: aload         25
     557: lload         26
     559: aload         28
     561: aload         29
     563: nop
     564: astore        31
     566: astore        32
     568: lstore        33
     570: astore        35
     572: astore        36
     574: new           #185                // class Monkey
     577: dup
     578: aload         36
     580: aload         35
     582: lload         33
     584: aload         32
     586: aload         31
     588: invokespecial #188                // Method Monkey."<init>":(Ljava/util/List;Lkotlin/jvm/functions/Function1;JLkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;)V
     591: nop
     592: aload         30
     594: swap
     595: invokeinterface #94,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     600: pop
     601: goto          51
     604: aload         4
     606: checkcast     #57                 // class java/util/List
     609: nop
     610: checkcast     #37                 // class java/util/Collection
     613: astore_1
     614: nop
     615: iconst_0
     616: istore_2
     617: aload_1
     618: astore_3
     619: aload_3
     620: iconst_0
     621: anewarray     #185                // class Monkey
     624: invokeinterface #192,  2          // InterfaceMethod java/util/Collection.toArray:([Ljava/lang/Object;)[Ljava/lang/Object;
     629: checkcast     #194                // class "[LMonkey;"
     632: areturn

  public static final void main();
    Code:
       0: ldc           #232                // String Day11
       2: astore_0
       3: new           #139                // class java/lang/StringBuilder
       6: dup
       7: invokespecial #141                // Method java/lang/StringBuilder."<init>":()V
      10: aload_0
      11: invokevirtual #147                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      14: ldc           #234                // String _test
      16: invokevirtual #147                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      19: invokevirtual #151                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      22: invokestatic  #238                // Method UtilsKt.readInput:(Ljava/lang/String;)Ljava/util/List;
      25: astore_1
      26: aload_0
      27: invokestatic  #238                // Method UtilsKt.readInput:(Ljava/lang/String;)Ljava/util/List;
      30: astore_2
      31: aload_1
      32: invokestatic  #242                // Method main$part1:(Ljava/util/List;)J
      35: ldc2_w        #243                // long 10605l
      38: lcmp
      39: ifne          46
      42: iconst_1
      43: goto          47
      46: iconst_0
      47: ifne          60
      50: new           #246                // class java/lang/IllegalStateException
      53: dup
      54: ldc           #248                // String Check failed.
      56: invokespecial #249                // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
      59: athrow
      60: aload_2
      61: invokestatic  #242                // Method main$part1:(Ljava/util/List;)J
      64: lstore_3
      65: getstatic     #255                // Field java/lang/System.out:Ljava/io/PrintStream;
      68: lload_3
      69: invokevirtual #260                // Method java/io/PrintStream.println:(J)V
      72: lload_3
      73: ldc2_w        #261                // long 121450l
      76: lcmp
      77: ifne          84
      80: iconst_1
      81: goto          85
      84: iconst_0
      85: ifne          98
      88: new           #246                // class java/lang/IllegalStateException
      91: dup
      92: ldc           #248                // String Check failed.
      94: invokespecial #249                // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
      97: athrow
      98: aload_1
      99: invokestatic  #265                // Method main$part2:(Ljava/util/List;)J
     102: ldc2_w        #266                // long 2713310158l
     105: lcmp
     106: ifne          113
     109: iconst_1
     110: goto          114
     113: iconst_0
     114: ifne          127
     117: new           #246                // class java/lang/IllegalStateException
     120: dup
     121: ldc           #248                // String Check failed.
     123: invokespecial #249                // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
     126: athrow
     127: aload_2
     128: invokestatic  #265                // Method main$part2:(Ljava/util/List;)J
     131: lstore        5
     133: getstatic     #255                // Field java/lang/System.out:Ljava/io/PrintStream;
     136: lload         5
     138: invokevirtual #260                // Method java/io/PrintStream.println:(J)V
     141: lload         5
     143: ldc2_w        #268                // long 28244037010l
     146: lcmp
     147: ifne          154
     150: iconst_1
     151: goto          155
     154: iconst_0
     155: ifne          168
     158: new           #246                // class java/lang/IllegalStateException
     161: dup
     162: ldc           #248                // String Check failed.
     164: invokespecial #249                // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
     167: athrow
     168: return

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

  private static final Item toMonkeys$lambda$8$lambda$3$lambda$1(java.lang.String, long, Item);
    Code:
       0: aload_3
       1: ldc_w         #280                // String item
       4: invokestatic  #284                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: new           #81                 // class Item
      10: dup
      11: aload_3
      12: invokevirtual #288                // Method Item.getWorryLevel:()J
      15: aload_0
      16: ldc           #100                // String old
      18: invokestatic  #106                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      21: ifeq          31
      24: aload_3
      25: invokevirtual #288                // Method Item.getWorryLevel:()J
      28: goto          32
      31: lload_1
      32: lmul
      33: invokespecial #90                 // Method Item."<init>":(J)V
      36: areturn

  private static final Item toMonkeys$lambda$8$lambda$3$lambda$2(java.lang.String, long, Item);
    Code:
       0: aload_3
       1: ldc_w         #280                // String item
       4: invokestatic  #284                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: new           #81                 // class Item
      10: dup
      11: aload_3
      12: invokevirtual #288                // Method Item.getWorryLevel:()J
      15: aload_0
      16: ldc           #100                // String old
      18: invokestatic  #106                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      21: ifeq          31
      24: aload_3
      25: invokevirtual #288                // Method Item.getWorryLevel:()J
      28: goto          32
      31: lload_1
      32: ladd
      33: invokespecial #90                 // Method Item."<init>":(J)V
      36: areturn

  private static final kotlin.Unit toMonkeys$lambda$8$lambda$5$lambda$4(int, int, Item, Monkey[]);
    Code:
       0: aload_2
       1: ldc_w         #280                // String item
       4: invokestatic  #284                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: aload_3
       8: ldc_w         #293                // String monkeys
      11: invokestatic  #284                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      14: aload_3
      15: iload_0
      16: aload_3
      17: iload_0
      18: aaload
      19: invokevirtual #297                // Method Monkey.leaveItem:()LMonkey;
      22: aastore
      23: aload_3
      24: iload_1
      25: aload_3
      26: iload_1
      27: aaload
      28: aload_2
      29: invokevirtual #301                // Method Monkey.receive:(LItem;)LMonkey;
      32: aastore
      33: getstatic     #306                // Field kotlin/Unit.INSTANCE:Lkotlin/Unit;
      36: areturn

  private static final kotlin.Unit toMonkeys$lambda$8$lambda$7$lambda$6(int, int, Item, Monkey[]);
    Code:
       0: aload_2
       1: ldc_w         #280                // String item
       4: invokestatic  #284                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: aload_3
       8: ldc_w         #293                // String monkeys
      11: invokestatic  #284                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      14: aload_3
      15: iload_0
      16: aload_3
      17: iload_0
      18: aaload
      19: invokevirtual #297                // Method Monkey.leaveItem:()LMonkey;
      22: aastore
      23: aload_3
      24: iload_1
      25: aload_3
      26: iload_1
      27: aaload
      28: aload_2
      29: invokevirtual #301                // Method Monkey.receive:(LItem;)LMonkey;
      32: aastore
      33: getstatic     #306                // Field kotlin/Unit.INSTANCE:Lkotlin/Unit;
      36: areturn

  private static final long main$run(kotlin.ranges.IntRange, Monkey[], kotlin.jvm.functions.Function1<? super Item, Item>);
    Code:
       0: aload_0
       1: checkcast     #23                 // class java/lang/Iterable
       4: astore        4
       6: aload_1
       7: arraylength
       8: istore        5
      10: new           #25                 // class java/util/ArrayList
      13: dup
      14: iload         5
      16: invokespecial #35                 // Method java/util/ArrayList."<init>":(I)V
      19: astore        6
      21: iconst_0
      22: istore        7
      24: iload         7
      26: iload         5
      28: if_icmpge     63
      31: iload         7
      33: istore        8
      35: aload         6
      37: iload         8
      39: istore        9
      41: astore        36
      43: iconst_0
      44: istore        10
      46: lconst_0
      47: invokestatic  #315                // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
      50: aload         36
      52: swap
      53: invokevirtual #316                // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
      56: pop
      57: iinc          7, 1
      60: goto          24
      63: aload         6
      65: checkcast     #57                 // class java/util/List
      68: astore        5
      70: nop
      71: iconst_0
      72: istore        6
      74: aload         5
      76: astore        7
      78: aload         4
      80: invokeinterface #41,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      85: astore        8
      87: aload         8
      89: invokeinterface #47,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      94: ifeq          446
      97: aload         8
      99: checkcast     #318                // class kotlin/collections/IntIterator
     102: invokevirtual #322                // Method kotlin/collections/IntIterator.nextInt:()I
     105: istore        9
     107: aload         7
     109: astore        11
     111: iconst_0
     112: istore        12
     114: aload_1
     115: astore        13
     117: nop
     118: iconst_0
     119: istore        14
     121: aload         13
     123: astore        15
     125: new           #25                 // class java/util/ArrayList
     128: dup
     129: aload         13
     131: arraylength
     132: invokespecial #35                 // Method java/util/ArrayList."<init>":(I)V
     135: checkcast     #37                 // class java/util/Collection
     138: astore        16
     140: iconst_0
     141: istore        17
     143: iconst_0
     144: istore        18
     146: aload         15
     148: arraylength
     149: istore        19
     151: iload         18
     153: iload         19
     155: if_icmpge     289
     158: aload         15
     160: iload         18
     162: aaload
     163: astore        20
     165: aload         16
     167: aload         20
     169: astore        21
     171: astore        22
     173: iconst_0
     174: istore        23
     176: aload         21
     178: aload_2
     179: invokevirtual #326                // Method Monkey.takeTurn:(Lkotlin/jvm/functions/Function1;)Lkotlin/Pair;
     182: astore        24
     184: aload         24
     186: invokevirtual #331                // Method kotlin/Pair.component1:()Ljava/lang/Object;
     189: checkcast     #333                // class java/lang/Number
     192: invokevirtual #336                // Method java/lang/Number.intValue:()I
     195: istore        25
     197: aload         24
     199: invokevirtual #339                // Method kotlin/Pair.component2:()Ljava/lang/Object;
     202: checkcast     #57                 // class java/util/List
     205: astore        26
     207: aload         26
     209: checkcast     #23                 // class java/lang/Iterable
     212: astore        27
     214: iconst_0
     215: istore        28
     217: aload         27
     219: invokeinterface #41,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     224: astore        29
     226: aload         29
     228: invokeinterface #47,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     233: ifeq          268
     236: aload         29
     238: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     243: astore        30
     245: aload         30
     247: checkcast     #15                 // class kotlin/jvm/functions/Function1
     250: astore        31
     252: iconst_0
     253: istore        32
     255: aload         31
     257: aload_1
     258: invokeinterface #341,  2          // InterfaceMethod kotlin/jvm/functions/Function1.invoke:(Ljava/lang/Object;)Ljava/lang/Object;
     263: pop
     264: nop
     265: goto          226
     268: nop
     269: iload         25
     271: invokestatic  #344                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     274: aload         22
     276: swap
     277: invokeinterface #94,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     282: pop
     283: iinc          18, 1
     286: goto          151
     289: aload         16
     291: checkcast     #57                 // class java/util/List
     294: nop
     295: astore        33
     297: aload         11
     299: checkcast     #23                 // class java/lang/Iterable
     302: aload         33
     304: checkcast     #23                 // class java/lang/Iterable
     307: invokestatic  #348                // Method kotlin/collections/CollectionsKt.zip:(Ljava/lang/Iterable;Ljava/lang/Iterable;)Ljava/util/List;
     310: checkcast     #23                 // class java/lang/Iterable
     313: astore        13
     315: nop
     316: iconst_0
     317: istore        14
     319: aload         13
     321: astore        15
     323: new           #25                 // class java/util/ArrayList
     326: dup
     327: aload         13
     329: bipush        10
     331: invokestatic  #31                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     334: invokespecial #35                 // Method java/util/ArrayList."<init>":(I)V
     337: checkcast     #37                 // class java/util/Collection
     340: astore        16
     342: iconst_0
     343: istore        17
     345: aload         15
     347: invokeinterface #41,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     352: astore        18
     354: aload         18
     356: invokeinterface #47,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     361: ifeq          434
     364: aload         18
     366: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     371: astore        19
     373: aload         16
     375: aload         19
     377: checkcast     #328                // class kotlin/Pair
     380: astore        20
     382: astore        22
     384: iconst_0
     385: istore        21
     387: aload         20
     389: invokevirtual #331                // Method kotlin/Pair.component1:()Ljava/lang/Object;
     392: checkcast     #333                // class java/lang/Number
     395: invokevirtual #351                // Method java/lang/Number.longValue:()J
     398: lstore        34
     400: aload         20
     402: invokevirtual #339                // Method kotlin/Pair.component2:()Ljava/lang/Object;
     405: checkcast     #333                // class java/lang/Number
     408: invokevirtual #336                // Method java/lang/Number.intValue:()I
     411: istore        25
     413: lload         34
     415: iload         25
     417: i2l
     418: ladd
     419: invokestatic  #315                // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
     422: aload         22
     424: swap
     425: invokeinterface #94,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     430: pop
     431: goto          354
     434: aload         16
     436: checkcast     #57                 // class java/util/List
     439: nop
     440: nop
     441: astore        7
     443: goto          87
     446: aload         7
     448: astore_3
     449: aload_3
     450: checkcast     #23                 // class java/lang/Iterable
     453: invokestatic  #355                // Method kotlin/collections/CollectionsKt.sortedDescending:(Ljava/lang/Iterable;)Ljava/util/List;
     456: checkcast     #23                 // class java/lang/Iterable
     459: iconst_2
     460: invokestatic  #359                // Method kotlin/collections/CollectionsKt.take:(Ljava/lang/Iterable;I)Ljava/util/List;
     463: checkcast     #23                 // class java/lang/Iterable
     466: astore        4
     468: iconst_0
     469: istore        5
     471: aload         4
     473: invokeinterface #41,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     478: astore        6
     480: aload         6
     482: invokeinterface #47,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     487: ifne          501
     490: new           #361                // class java/lang/UnsupportedOperationException
     493: dup
     494: ldc_w         #363                // String Empty collection can\'t be reduced.
     497: invokespecial #364                // Method java/lang/UnsupportedOperationException."<init>":(Ljava/lang/String;)V
     500: athrow
     501: aload         6
     503: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     508: astore        7
     510: aload         6
     512: invokeinterface #47,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     517: ifeq          561
     520: aload         7
     522: aload         6
     524: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     529: checkcast     #333                // class java/lang/Number
     532: invokevirtual #351                // Method java/lang/Number.longValue:()J
     535: lstore        8
     537: checkcast     #333                // class java/lang/Number
     540: invokevirtual #351                // Method java/lang/Number.longValue:()J
     543: lstore        10
     545: iconst_0
     546: istore        12
     548: lload         10
     550: lload         8
     552: lmul
     553: invokestatic  #315                // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
     556: astore        7
     558: goto          510
     561: aload         7
     563: checkcast     #333                // class java/lang/Number
     566: invokevirtual #351                // Method java/lang/Number.longValue:()J
     569: lreturn

  private static final long main$part1(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: invokestatic  #402                // Method toMonkeys:(Ljava/util/List;)[LMonkey;
       4: astore_1
       5: new           #399                // class kotlin/ranges/IntRange
       8: dup
       9: iconst_1
      10: bipush        20
      12: invokespecial #405                // Method kotlin/ranges/IntRange."<init>":(II)V
      15: astore_2
      16: aload_2
      17: aload_1
      18: getstatic     #410                // Field Day11Kt$main$part1$1.INSTANCE:LDay11Kt$main$part1$1;
      21: checkcast     #15                 // class kotlin/jvm/functions/Function1
      24: invokestatic  #412                // Method main$run:(Lkotlin/ranges/IntRange;[LMonkey;Lkotlin/jvm/functions/Function1;)J
      27: lreturn

  private static final Item main$part2$lambda$16(Monkey[], Item);
    Code:
       0: aload_1
       1: ldc_w         #280                // String item
       4: invokestatic  #284                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: aload_1
       8: invokevirtual #288                // Method Item.getWorryLevel:()J
      11: aload_0
      12: astore_2
      13: lstore        12
      15: iconst_0
      16: istore_3
      17: aload_2
      18: astore        4
      20: new           #25                 // class java/util/ArrayList
      23: dup
      24: aload_2
      25: arraylength
      26: invokespecial #35                 // Method java/util/ArrayList."<init>":(I)V
      29: checkcast     #37                 // class java/util/Collection
      32: astore        5
      34: iconst_0
      35: istore        6
      37: iconst_0
      38: istore        7
      40: aload         4
      42: arraylength
      43: istore        8
      45: iload         7
      47: iload         8
      49: if_icmpge     93
      52: aload         4
      54: iload         7
      56: aaload
      57: astore        9
      59: aload         5
      61: aload         9
      63: astore        10
      65: astore        14
      67: iconst_0
      68: istore        11
      70: aload         10
      72: invokevirtual #418                // Method Monkey.getTestValue:()J
      75: invokestatic  #315                // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
      78: aload         14
      80: swap
      81: invokeinterface #94,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
      86: pop
      87: iinc          7, 1
      90: goto          45
      93: aload         5
      95: checkcast     #57                 // class java/util/List
      98: nop
      99: astore        14
     101: lload         12
     103: aload         14
     105: checkcast     #23                 // class java/lang/Iterable
     108: astore_2
     109: lstore        12
     111: iconst_0
     112: istore_3
     113: aload_2
     114: invokeinterface #41,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     119: astore        4
     121: aload         4
     123: invokeinterface #47,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     128: ifne          142
     131: new           #361                // class java/lang/UnsupportedOperationException
     134: dup
     135: ldc_w         #363                // String Empty collection can\'t be reduced.
     138: invokespecial #364                // Method java/lang/UnsupportedOperationException."<init>":(Ljava/lang/String;)V
     141: athrow
     142: aload         4
     144: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     149: astore        5
     151: aload         4
     153: invokeinterface #47,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     158: ifeq          202
     161: aload         5
     163: aload         4
     165: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     170: checkcast     #333                // class java/lang/Number
     173: invokevirtual #351                // Method java/lang/Number.longValue:()J
     176: lstore        6
     178: checkcast     #333                // class java/lang/Number
     181: invokevirtual #351                // Method java/lang/Number.longValue:()J
     184: lstore        8
     186: iconst_0
     187: istore        10
     189: lload         8
     191: lload         6
     193: lmul
     194: invokestatic  #315                // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
     197: astore        5
     199: goto          151
     202: aload         5
     204: astore        14
     206: lload         12
     208: aload         14
     210: checkcast     #333                // class java/lang/Number
     213: invokevirtual #351                // Method java/lang/Number.longValue:()J
     216: lrem
     217: lstore        15
     219: new           #81                 // class Item
     222: dup
     223: lload         15
     225: invokespecial #90                 // Method Item."<init>":(J)V
     228: areturn

  private static final long main$part2(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: invokestatic  #402                // Method toMonkeys:(Ljava/util/List;)[LMonkey;
       4: astore_1
       5: new           #399                // class kotlin/ranges/IntRange
       8: dup
       9: iconst_1
      10: sipush        10000
      13: invokespecial #405                // Method kotlin/ranges/IntRange."<init>":(II)V
      16: astore_2
      17: aload_2
      18: aload_1
      19: aload_1
      20: invokedynamic #427,  0            // InvokeDynamic #4:invoke:([LMonkey;)Lkotlin/jvm/functions/Function1;
      25: invokestatic  #412                // Method main$run:(Lkotlin/ranges/IntRange;[LMonkey;Lkotlin/jvm/functions/Function1;)J
      28: lreturn
}